Skip to content

refactor(core): resolve the descriptor once in check_dataflow - #3083

Open
phil-opp wants to merge 1 commit into
mainfrom
claude/dreamy-bardeen-v852wi-validate-resolve-once
Open

refactor(core): resolve the descriptor once in check_dataflow#3083
phil-opp wants to merge 1 commit into
mainfrom
claude/dreamy-bardeen-v852wi-validate-resolve-once

Conversation

@phil-opp

@phil-opp phil-opp commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Issue

check_dataflow (libraries/core/src/descriptor/validate.rs) resolved the descriptor three times on every call:

  1. check_dataflow_staticdataflow.resolve_aliases_and_set_defaults()
  2. check_dataflow_staticcheck_wiring(dataflow) → resolves again
  3. check_dataflow → resolves a third time for the path/runtime existence checks

resolve_aliases_and_set_defaults clones the entire node topology and rebuilds a BTreeMap<NodeId, ResolvedNode>. The three resolutions are deterministic and identical, so two of them are pure wasted work — O(nodes) on every dora check / dora run / dora start validation.

Fix

Resolve once and thread the resolved node map through the checks:

  • check_wiring_resolved(&nodes) holds the wiring loop; check_wiring keeps its public signature by resolving then delegating.
  • check_dataflow_static_resolved(dataflow, &nodes) holds the resolution-dependent static checks; check_dataflow_static keeps its public signature the same way.
  • ROS2-config validation is extracted into validate_ros2_configs, still run on the unresolved descriptor before resolution — preserving the original error precedence (a ROS2 misconfig is reported ahead of an alias-resolution error).

check_dataflow now resolves exactly once and reuses the result. Public API signatures, behavior, and error ordering are all unchanged.

Validation

  • cargo test -p dora-core --lib descriptor:: — 156 passed (includes the full validate::tests and wiring_* suites).
  • cargo fmt --all -- --check and cargo clippy -p dora-core -- -D warnings clean.

🤖 This is a machine-generated pull request opened by Claude Code as part of an automated code-review pass. Please review carefully before merging.

🤖 Generated with Claude Code


Generated by Claude Code

`check_dataflow` resolved the descriptor three times per call:
`check_dataflow_static` resolved it once (validate.rs), then called
`check_wiring`, which resolved it a second time, and `check_dataflow`
resolved it a third time for the path/runtime existence checks.
`resolve_aliases_and_set_defaults` clones the entire node topology and
rebuilds a `BTreeMap<NodeId, ResolvedNode>`, so this was O(nodes) wasted
work on every `dora check` / `dora run` / `dora start` validation.

Resolve once and thread the resolved node map through the checks:
- `check_wiring_resolved(&nodes)` holds the wiring loop; `check_wiring`
  keeps its public signature by resolving then delegating.
- `check_dataflow_static_resolved(dataflow, &nodes)` holds the
  resolution-dependent static checks; `check_dataflow_static` keeps its
  public signature the same way.
- ROS2-config validation is extracted to `validate_ros2_configs` so it
  still runs on the unresolved descriptor *before* resolution, preserving
  the original error precedence (a ROS2 misconfig is reported ahead of an
  alias-resolution error).

`check_dataflow` now resolves exactly once and reuses the result.
Behavior and error ordering are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SD4dBVimzepwKSh2b9F8aG
@trunk-io

trunk-io Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

⏳ Waiting to start tests on this pull request - details.

phil-opp commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

🤖 Automated review by Claude — this is a fully automated review with no human in the loop.

I reviewed this diff and found no issues. The refactor resolves the descriptor once and threads the resolved node map through check_wiring_resolved and check_dataflow_static_resolved, while check_wiring / check_dataflow_static keep their public signatures by resolving then delegating. ROS2-config validation is extracted to validate_ros2_configs and still runs on the unresolved descriptor before resolution, so the original error precedence (ROS2 misconfig reported ahead of alias-resolution errors) is preserved. Behavior and error ordering are unchanged.


Generated by Claude Code

@phil-opp
phil-opp marked this pull request as ready for review August 9, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants