Skip to content

refactor: split LeafExecutionPath into prefix/leaf types for type-level guarantees#168

Closed
branchseer wants to merge 1 commit intomainfrom
refactor/execution-path-types
Closed

refactor: split LeafExecutionPath into prefix/leaf types for type-level guarantees#168
branchseer wants to merge 1 commit intomainfrom
refactor/execution-path-types

Conversation

@branchseer
Copy link
Copy Markdown
Member

@branchseer branchseer commented Feb 23, 2026

Summary

  • Introduce ExecutionPathPrefix for incremental path building during graph traversal, and restructure LeafExecutionPath with separate ancestors/leaf fields — making empty paths unrepresentable at the type level.
  • ExecutionPathPrefix precomputes all_containing_graphs_single_node incrementally during construction, eliminating the need for a full graph re-traversal at query time.
  • Remove unused Index<&LeafExecutionPath> for ExecutionGraph impl.

Reduces unreachable! assertions from 3 to 1 (the sole remaining one guards the ancestor-is-Expanded invariant in resolve_leaf_graph).

Note

Stack: this PR is the base for #169.

…el guarantees

Introduce ExecutionPathPrefix for incremental path building during graph
traversal and restructure LeafExecutionPath with separate ancestors/leaf
fields, making empty paths unrepresentable.

Key changes:
- ExecutionPathPrefix: new type for building paths, tracks
  all_containing_graphs_single_node incrementally during construction
- LeafExecutionPath: now struct with ancestors + leaf fields (always
  non-empty by construction), precomputed single-node-chain check
- execute_expanded_graph: takes &ExecutionPathPrefix, uses type-appropriate
  to_leaf_path/extended methods instead of clone+push
- Remove Index<&LeafExecutionPath> impl (unused in production)

Reduces unreachable! assertions from 3 to 1 (the sole remaining one
guards the ancestor-is-Expanded invariant in resolve_leaf_graph).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant