Summary
Backward-direction bus contexts in BusContext.from_tree were building rectangle source coordinates from canonical bus source indices rather than direction-resolved lane endpoints. This caused valid backward movers to be excluded from pos_to_loc, so rectangle construction failed and moves were split into singleton steps even when a parallel rectangle was legal.
Impact
- Valid parallel backward moves can be incorrectly split.
- The planner can emit less parallel move programs than the hardware supports.
- Tuning scoring weights (e.g. very large
w_d) does not fix the behavior because candidate construction is wrong before scoring/ranking can help.
Reproduction
- Run
uv run python debug/steane_physical_impl.py --gif.
- Inspect the move sequence around backward word-bus moves (
bus_id=9, Direction.BACKWARD).
- Observe rows that are lane-group compatible and collision-free getting emitted as separate move statements.
Root Cause
BusContext.from_tree computed candidate source locations from static bus index sets.
- For backward direction, executable source coordinates differ from forward-side canonical indices.
pos_to_loc therefore missed real movers and is_valid_rect(...) returned false on otherwise valid rectangles.
Proposed Fix
- Build source locations from actual
LaneAddress -> get_endpoints(...) resolution, which is direction aware.
- Track
src_to_lane mapping and use it when converting rectangles back to lane sets.
- Keep collision checks source-based using the resolved lane endpoint mapping.
Validation
- Add regression test:
test_from_tree_backward_word_bus_uses_backward_sources.
- Confirm search generator tests pass.
- Confirm the Steane debug program merges the two backward rows into one move layer at logical stage.
Acceptance Criteria
Summary
Backward-direction bus contexts in
BusContext.from_treewere building rectangle source coordinates from canonical bus source indices rather than direction-resolved lane endpoints. This caused valid backward movers to be excluded frompos_to_loc, so rectangle construction failed and moves were split into singleton steps even when a parallel rectangle was legal.Impact
w_d) does not fix the behavior because candidate construction is wrong before scoring/ranking can help.Reproduction
uv run python debug/steane_physical_impl.py --gif.bus_id=9,Direction.BACKWARD).Root Cause
BusContext.from_treecomputed candidate source locations from static bus index sets.pos_to_loctherefore missed real movers andis_valid_rect(...)returned false on otherwise valid rectangles.Proposed Fix
LaneAddress -> get_endpoints(...)resolution, which is direction aware.src_to_lanemapping and use it when converting rectangles back to lane sets.Validation
test_from_tree_backward_word_bus_uses_backward_sources.Acceptance Criteria
pos_to_loc.