fix(type_router): validate declared outputs#3575
Conversation
Require node factories to declare a minimum output count through their wiring contract and run that validation during static startup checks. This makes --validate-and-exit reject type routers that would fail during pipeline construction.
Pull request dashboard statusStatus last refreshed: 2026-07-26 03:48:23 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. If you believe this pull request is incorrectly routed as waiting on the author, comment |
lquerel
left a comment
There was a problem hiding this comment.
Thanks for working on this, i.e. the goal of keeping --validate-and-exit consistent with runtime startup is definitely right.
After reproducing #3569 against the parent commit, we found that the original analysis attributing the failure to missing type-router outputs was incorrect. We’re sorry for the confusion.
The type router recognizes three well-known named routes: logs, metrics, and traces. Under the existing configuration model, the outputs list is an optional declaration/allowlist; the actual ports can be established directly by connections such as router["logs"], router["metrics"], and router["traces"]. I verified that this configuration, without an outputs list, validates, starts ready, and processes all three signal types on the parent commit.
The exact configuration from #3569 actually fails because all traffic-generator signal weights default to zero: at least one of metric_weight, trace_weight, or log_weight must be > 0
Runtime calls TrafficConfig::validate(), but static validation only deserializes Config, so --validate-and-exit misses this semantic constraint.
Suggested fix:
- Remove the minimum-declared-output requirement from type_router.
- Reuse a single traffic-generator parse-and-validate helper from both from_config() and the factory’s validate_config.
- Ensure static validation calls config.get_traffic_config().validate().
- Replace the regression test with the original traffic-generator configuration and assert that validation reports the zero-weight error.
- Add a positive test showing that one non-zero signal weight passes.
- Preserve a positive test demonstrating that omitted outputs with explicit type-router connections remains valid.
This fixes the actual validation/runtime mismatch without rejecting previously valid router configurations. Thanks again, I’d be happy to review the revision.
Add @AaronRM for visibility
Fixes #3569
Summary
processor:type_routerto declare at least one output and cover the invalid fully connected topology with a regression testTesting
cargo test --offline --bin df_engine --no-default-features --features crypto-ring validate_type_router_requires_declared_outputs -- --nocapturecargo check -p otap-df-engine -p otap-df-controller -p otap-df-core-nodes -p otap-df-validationcargo clippy -p otap-df-engine -p otap-df-controller -p otap-df-core-nodes -p otap-df-validation --all-targets -- -D warningscargo fmt --all -- --checkchloggen validate --config rust/otap-dataflow/.chloggen/config.yamlAI assistance
Codex assisted with repository navigation, implementation drafting, and local test orchestration. I reviewed the changes and verified the behavior with the checks above.