From f06b2f039884fa4a8b69bdc1ef41db6a75009f25 Mon Sep 17 00:00:00 2001 From: Paul Fremantle Date: Tue, 6 Oct 2026 16:02:36 +0000 Subject: [PATCH 1/3] Retire optional section reservation before imported PMI solve --- src/draftwright/annotations/orchestrator.py | 13 +++++++++++++ tests/test_feature_edit_replay.py | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/src/draftwright/annotations/orchestrator.py b/src/draftwright/annotations/orchestrator.py index fcb6e00be..77bd89b96 100644 --- a/src/draftwright/annotations/orchestrator.py +++ b/src/draftwright/annotations/orchestrator.py @@ -110,6 +110,7 @@ from draftwright.annotations.leaders import drain_feature_leaders from draftwright.annotations.sections import ( _add_section_view, + _clear_section_reservation, _request_prismatic_detail, _reserve_section_row, _resolve_details, @@ -914,6 +915,18 @@ def _s_drain(): # Now every corridor feeder pass has registered; solve each shared strip once # (ADR 2 (was 0009)) with label reconciliation, before the # section/detail views so they see the placed ladder as an obstacle. + # The cutting-plane reservation has already protected early hole callouts. + # Imported source-owned PMI has no alternative semantic representation; + # optional future section ink must not consume its dimension corridor. + # Keep the reservation in ordinary builds so their established section + # and callout layout remains stable. + if any( + candidate.name.startswith("pmi_") + for batch in ctx.corridor_batch.values() + for candidate in batch["cands"] + ): + for section in _sections: + _clear_section_reservation(dwg, section) drain_and_reconcile(ctx, dwg) def _s_grooves(): diff --git a/tests/test_feature_edit_replay.py b/tests/test_feature_edit_replay.py index 3961e1036..9eb004683 100644 --- a/tests/test_feature_edit_replay.py +++ b/tests/test_feature_edit_replay.py @@ -5,6 +5,27 @@ from draftwright import build_drawing +def test_imported_pmi_retires_optional_section_reservation_before_drain(monkeypatch): + """An authored dimension outranks provisional section ink at the shared solve.""" + from types import SimpleNamespace + + from draftwright.annotations import orchestrator + + part = Box(60, 40, 20) - Cylinder(4, 30) - Pos(0, 0, 2) * Cylinder(7, 20) + seen = [] + + def queue_pmi(_drawing, _model, _analysis, *, ctx): + ctx.corridor_batch["test-pmi"] = {"cands": [SimpleNamespace(name="pmi_y_test")]} + + def inspect_drain(_ctx, drawing): + seen.append(any(name.endswith("_reservation") for name in drawing.annotations())) + + monkeypatch.setattr(orchestrator, "render_pmi", queue_pmi) + monkeypatch.setattr(orchestrator, "drain_and_reconcile", inspect_drain) + build_drawing(part, pmi="annotate") + assert seen == [False] + + class TestFeatureEditReplay: """Replay through the production annotation passes.""" From 501e4e2d4a045054921486a075a37147367968ad Mon Sep 17 00:00:00 2001 From: Paul Fremantle Date: Tue, 6 Oct 2026 16:07:06 +0000 Subject: [PATCH 2/3] Keep orchestration complexity budget unchanged --- src/draftwright/annotations/orchestrator.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/draftwright/annotations/orchestrator.py b/src/draftwright/annotations/orchestrator.py index 77bd89b96..ebac8176a 100644 --- a/src/draftwright/annotations/orchestrator.py +++ b/src/draftwright/annotations/orchestrator.py @@ -443,6 +443,17 @@ def drain_and_reconcile(ctx, dwg: DrawingPort) -> None: reconcile_witness_labels(dwg) +def _retire_optional_section_reservations_for_pmi(ctx, dwg, sections) -> None: + """Let source-owned PMI dimensions outrank provisional section ink.""" + if any( + candidate.name.startswith("pmi_") + for batch in ctx.corridor_batch.values() + for candidate in batch["cands"] + ): + for section in sections: + _clear_section_reservation(dwg, section) + + def _concentric_bore_diams(a: Analysis) -> list: """Distinct bore diameters on the rotation axis, in z_diams order (#10). @@ -920,13 +931,7 @@ def _s_drain(): # optional future section ink must not consume its dimension corridor. # Keep the reservation in ordinary builds so their established section # and callout layout remains stable. - if any( - candidate.name.startswith("pmi_") - for batch in ctx.corridor_batch.values() - for candidate in batch["cands"] - ): - for section in _sections: - _clear_section_reservation(dwg, section) + _retire_optional_section_reservations_for_pmi(ctx, dwg, _sections) drain_and_reconcile(ctx, dwg) def _s_grooves(): From a4a3d56117731eaa6eb2509aa762667a59099bfa Mon Sep 17 00:00:00 2001 From: Paul Fremantle Date: Tue, 6 Oct 2026 16:07:53 +0000 Subject: [PATCH 3/3] Prove section reservation exists before PMI drain --- tests/test_feature_edit_replay.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/test_feature_edit_replay.py b/tests/test_feature_edit_replay.py index 9eb004683..999f24cb0 100644 --- a/tests/test_feature_edit_replay.py +++ b/tests/test_feature_edit_replay.py @@ -12,9 +12,13 @@ def test_imported_pmi_retires_optional_section_reservation_before_drain(monkeypa from draftwright.annotations import orchestrator part = Box(60, 40, 20) - Cylinder(4, 30) - Pos(0, 0, 2) * Cylinder(7, 20) + reserved_before_pmi = [] seen = [] - def queue_pmi(_drawing, _model, _analysis, *, ctx): + def queue_pmi(drawing, _model, _analysis, *, ctx): + reserved_before_pmi.append( + any(name.endswith("_reservation") for name in drawing.annotations()) + ) ctx.corridor_batch["test-pmi"] = {"cands": [SimpleNamespace(name="pmi_y_test")]} def inspect_drain(_ctx, drawing): @@ -23,6 +27,7 @@ def inspect_drain(_ctx, drawing): monkeypatch.setattr(orchestrator, "render_pmi", queue_pmi) monkeypatch.setattr(orchestrator, "drain_and_reconcile", inspect_drain) build_drawing(part, pmi="annotate") + assert reserved_before_pmi == [True] assert seen == [False]