50%

Section 04: route_walk forward-coherence boundary pass (all cascade sites)

Goal

Run the forward-coherence check at the section-close -> next-section-open boundary in route_walk, so a registered constraint halt-gates the next section before it is served. Honor the PURE-helper/roadmap-wrapper two-layer split at every cascade site.

Implementation Sketch

Two-layer split: PURE *_route_or_none in route_walk (no mutation, exception-safe), roadmap wrapper emits dispatch + loop-guard. The cascade is duplicated across ~5 sites — the route must thread into all of them or it fires on one path only.

Spec References

scripts/plan_orchestrator/route_walk.py (mission_reground_route_or_none:1630, _v7_payload_to_section_info:1008); scripts/plan_orchestrator/roadmap.py (cascade 864/975/1801/2252/2357/9707, _grind_mission_reground_or_none:1383); scripts/plan_orchestrator/mission_reground_loop_guard.py.

Work Items

  • TDD-first: pin that dossier_constraint_violation_or_none returns a {route, …} dict ONLY on a real constraint hit and is exception-safe; pin that the roadmap wrapper emits the dispatch at EVERY cascade site; failing tests in scripts/plan_orchestrator/tests/.
  • Author the PURE dossier_constraint_violation_or_none(plan_dir, prev_section_id, next_section_id) in route_walk.py (mirror mission_reground_route_or_none:1630; zero mutation; except Exception -> warn + None) + the roadmap.py emit wrapper (mirror _grind_mission_reground_or_none:1383) with a run-scoped loop-guard.
  • Thread the new terminal route into ALL ~5 cascade sites (roadmap.py ~864/975, and the route_no_completion_progress fallthroughs ~1801/2252/2357/9707), each loop-guarded; tests assert it fires on every path, not just one.

Items

  • TDD-first: add a FAILING test in scripts/plan_orchestrator/tests/ asserting the roadmap wrapper (_grind_dossier_constraint_or_none) emits the /review-section dispatch at EVERY section-serve cascade path, not just the single §00 site. The helper-purity / exception-safe / declaring-section-never-gated / inert-when-no-constraints pins ALREADY exist (§00 test_forward_coherence_00.py + test_forward_coherence_acceptance.py) — do NOT duplicate them. The new pin parametrizes over the section-serve paths (the _grind_mission_reground_or_none callsites) and fails until the dossier gate is threaded into all of them.
  • VERIFY (do NOT re-author — both already exist, delivered by §00): dossier_constraint_violation_or_none (route_walk.py PURE helper: zero-mutation, exception-safe except Exception -> warn + None, deterministic) and its roadmap emit wrapper _grind_dossier_constraint_or_none (roadmap.py, mirrors _grind_mission_reground_or_none). Confirm they satisfy the PURE-helper / exception-safe / two-layer-split contract and are reusable AS-IS for all-site threading; fix only a real contract gap if one is found. The run-scoped B-side re-thrash / anti-thrash bound is explicitly §06-owned (per the wrapper docstring) — out of scope here.
  • Thread the existing _grind_dossier_constraint_or_none emit into EVERY section-serve cascade path so the binding constraint halt-gates the next section on all paths, not just one. Locate the sites by grepping _grind_mission_reground_or_none( callsites in roadmap.py (the sibling forward-coherence route already generalized across them); current actual sites are 996 / 1930 / 2381 / 2478 / 9828 (the dossier gate already fires at 726 — do NOT trust the section body’s drifted frozen line numbers). Honor the PURE-helper / roadmap-wrapper two-layer split at each site; tests assert the gate fires on every serve path, not just one.

Fresh intel (regenerated)

{ “schema_version”: 1, “target”: { “kind”: “plan-section”, “ref”: “plan-forward-coherence/s-ed730d4b” }, “generated_at”: “2026-06-26T01:24:09.358594+00:00”, “graph_state”: { “head_sha”: “8f006d26”, “last_code_import_at”: “2026-06-26T01:23:56.419Z”, “embedding_stale”: false, “insights_stale”: false, “cpg_stale”: false }, “surfaces”: {}, “summary”: “intel-package[plan-section:plan-forward-coherence/s-ed730d4b] agent-authored dossier”, “degraded”: false, “dossier”: { “objective_symbols”: [], “tiers”: {}, “agent_authored”: true, “constrained_symbols”: [], “difficulty”: { “class”: “routine”, “research_online”: false, “research_mode”: “auto”, “signals”: [], “plan_dir”: “/home/eric/projects/ori_lang/plans/plan-forward-coherence” } } }

(full dossier: route-forward-coherence-boundary—s-ed730d4b.intel.json)