Skip to content

Extract owner-typed corridor records and the typed footprint relation graph #1748

Description

@pinin4fjords

Parent: #1745

Predecessor: #1747 and its stacked draft PR.

Prototype evidence: draft PR #1743 and checkpoint 3f11f175, especially corridor_cohort_integration.py types near CorridorScalarRequest, CorridorScalarGrant, _FootprintTerm, _FootprintOrder, _FootprintContact, and build_corridor_footprint_witnesses.

Retrieving the prototype: git fetch origin refs/pull/1743/head:pr-1743-checkpoint, then read files with git show 3f11f1758f16341ace6b1409eff53a36a36ec715:<path>. Never check that branch out into your worktree.

The four witness tests to re-establish live in the checkpoint's tests/test_corridor_cohorts.py, not its integration module: test_footprint_witnesses_publish_typed_scalar_ownership_deterministically (line 1430), test_semantic_ledger_claims_store_no_observed_geometry (1729), test_opposite_running_peer_is_not_a_fixed_equality (1994), test_coordinate_proximity_without_a_shared_network_is_not_a_fixed_equality (2024). Re-establish them in tests/test_corridor_cohort_integration.py, since #1747 keeps tests/test_corridor_cohorts.py free of integration imports.

Outcome

Define coordinate-free owner identities and extract the typed footprint/relation graph (witnesses, orders, contacts), without closing components (that is #1749) and without changing production route geometry.

Estimate: 4-6 focused hours, hard maximum one working day. Use a fresh worktree based on the predecessor PR.

Starting reproduction

python -c "from nf_metro.layout.routing.corridor_cohort_integration import build_corridor_footprint_witnesses"  # ModuleNotFoundError

Scope

  • Add owner-typed scalar request/grant records with deterministic identity and ordering: CorridorScalarVariable, CorridorScalarRequest, CorridorScalarGrant, CorridorFootprintWitness, _FootprintTerm, _FootprintOrder, _FootprintContact, build_corridor_footprint_witnesses, and the coordinate-free portions of _bind_ledger.
  • Port the coordinate-free container types every later child depends on and which no other child names: CorridorCohortLedger, CorridorCohortTarget, CorridorCohortAllocation, CorridorCohortComponentPlan, CorridorCohortLanding, CorridorCohortSegmentKey, and the RoutePlan.corridor_cohort_ledger field. Port their coordinate-free fields only; do not port finalized_owned_segments.
  • Extract typed carrier, adjacent lead, landing, connector, endpoint frame, network, direction, region, and per-segment owner witnesses from one route-plan snapshot.
  • Represent explicit legal contact and ordered-footprint evidence as a typed relation graph. Do not lower it into solver constraints, and do not compute components over it; Close corridor components over typed footprint relations #1749 owns closure and Complete the member footprint lowering and patch publication slice #1750 owns lowering.
  • Prefer one new focused module plus route_reservations.py (whose checkpoint additions claim_is_destination_boundary_carrier, _plan_owned_clearances, canvas_content_band, and _simultaneous_stack_width are reusable starting points); tests live in tests/test_corridor_cohort_integration.py.

Reuse guidance

Reuse the coordinate-free identity, endpoint-rank, exact connector provenance, and direction-qualified owner tests. Do not port the checkpoint's 316-line _member_footprint_model intact: extract the witness/relation-production pieces this issue needs and leave lowering to #1750. Do not port finalized_owned_segments or any proximity-based ownership. Two names used in earlier drafts of this programme, _landing_domains and the landing-obstacle| alias prefix, exist neither on main nor at 3f11f175; ignore them and do not go looking for them.

Non-goals

Code expected to become obsolete

None. This issue deletes no production code.

Acceptance

  • Identity collision, serialization/equality, and reversed-input tests pass.
  • Proper crossings, endpoint touches, exact continuation contacts, and unrelated same-target/network routes classify deterministically.
  • A missing or ambiguous claimed target fails closed.
  • Direction and terminal identity are required for legal continuation; same line text or coordinate proximity is insufficient.
  • Opposite-running witnesses remain distinct; no relation record gives opposite-running peers equality or rigid bundling.
  • Input permutations yield identical witness and relation identities and ordering.
  • Ambiguous ownership, duplicate variables, or incomplete witnesses fail closed.

Verification

pytest -q -n 0 tests/test_corridor_cohort_integration.py
ruff check src/nf_metro/layout/routing/corridor_cohort_integration.py src/nf_metro/layout/route_reservations.py src/nf_metro/layout/route_plan.py tests/test_corridor_cohort_integration.py
ruff format --check src/nf_metro/layout/routing/corridor_cohort_integration.py src/nf_metro/layout/route_reservations.py src/nf_metro/layout/route_plan.py tests/test_corridor_cohort_integration.py
mypy

Run the module whole; a -k filter that matches nothing exits 5, which reads like success.

CI and render expectations

This issue must not change a single rendered SVG. Open the PR as a draft based on the predecessor's branch and never merge it to main alone. Mark work-in-progress commits [skip ci]; push the final commit without a skip marker so CI runs, and confirm the render diff reports zero changed renders.

#1653 guardrail and stop condition

This issue describes semantic evidence only. If extraction needs to choose a lane, move a point, inspect a fixture ID, or infer ownership by distance, stop and revise the identity model before continuing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions