bench: matrix v7 adds takeoff_roundtrip and understand_foreign; five understanding checks; the live smoke and the field-test script
The evidence for track H, in the shape tracks A, E, B + G and F used.
- benchmarks/tasks_v7.py: 21 tasks, DEFAULT_MATRIX = "v7"; v6 to v2 stay
addressable. Both new tasks read the synthetic plant pair and nothing
else. takeoff_roundtrip: the P&ID called schematic, every routable run's
layout length equal to the rectilinear MST of its tags, sizes and services
as drawn (a return drawn on the supply layer included), the cable metres
rounded up after the allowance, an unstated power left empty.
understand_foreign: inches over millimetres flagged, the stray entity found
by handle, two plan copies separated, five layers classified. A test breaks
each input and watches its gate fail by name.
- Five correctness checks, every number worked out by hand in its docstring;
the published A/B report is re-run over 48 checks: 26 / 48 -> 48 / 48,
zero regressed.
- scripts/smoke_understand_com.py reads the pair through the live engine -
snapshots, the DWG route, both takeoffs and a diff - and closes every
document it opens; the CHANGELOG records what it returned.
scripts/field_test_takeoff.py runs the takeoffs on a user's own files,
refuses to write inside the repository and prints no quantity by default.
- The README token table is remeasured; check_doc_numbers derives the task
count from the v7 matrix; CLAUDE.md, both READMEs, the CHANGELOG and the
spec status line say what shipped.
One reader defect found on the way: describe.tag_occurrences read a wiring
callout ("Wiring to CP-2") as a place its panel is written, so the scale
check called CP-2 ambiguous and read "Wiring to CP1" as a phantom tag CP1 -
10 tags and 45 pairs (13.3 % within 10 %) where the generator placed 11 and
55 (21.8 %). A callout is no longer a tag occurrence, the rule
network.tag_occurrences already kept; two tests failed before the fix.
The smoke works only in documents it opened from its own temporary folder,
known by full path; it attaches with GetActiveObject only (the backend's
Dispatch fallback would launch AutoCAD), checks in the same COM-thread call
that the active document is its own before each snapshot, the DWG save and
the move, closes its documents with Close(False) and re-activates the
document that was active when it started. No new ActiveX member: Documents,
Item, FullName, ActiveDocument, Activate and Close are the ones the backend
already calls. Measured on AutoCAD 2026 (25.1s): exit 0, model-space types
equal file / live / DWG, export 0.104 s, no document of the run left open.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
835bc4b65e
commit
ba41428c88
@@ -190,3 +190,30 @@ def test_the_synthetic_pid_is_schematic_against_its_layout(tmp_path):
|
||||
assert len(result["matched"]) >= 3
|
||||
# The layout's two plan copies: the check must pick one of them.
|
||||
assert result["scope"]["cluster_b"] is not None
|
||||
|
||||
|
||||
def test_a_wiring_callout_is_not_a_second_place_for_its_panel():
|
||||
"""``Wiring to CP-2`` names the panel it points at; it is not written at the
|
||||
panel. Read as a tag it would make every panel with a callout ambiguous
|
||||
(and ``Wiring to CP1`` a phantom tag ``CP1``), so the callout takes no part
|
||||
- the same rule the line-network reader (`network.tag_occurrences`) keeps."""
|
||||
plan = {**PLAN, "CP-2": (3000.0, 15000.0)}
|
||||
callouts = [
|
||||
text("W1", "Wiring to CP-2", 12000.0, 0.0),
|
||||
text("W2", "Wiring to CP1", 0.0, 9000.0),
|
||||
]
|
||||
result = scale_check(snapshot(tags(plan, "A")), snapshot(tags(plan, "B") + callouts))
|
||||
assert result["ambiguous"] == []
|
||||
assert "CP-2" in {row["tag"] for row in result["matched"]}
|
||||
assert result["only_b"] == []
|
||||
assert result["pair_count"] == math.comb(len(plan), 2)
|
||||
|
||||
|
||||
def test_the_synthetic_pair_reproduces_the_generators_own_statistics(tmp_path):
|
||||
"""The generator computes its truth from the positions it placed: 11 shared
|
||||
tags, 55 pairs, 21.8 % within +/-10 % of the median. The check must see the
|
||||
same tags - a wiring callout counted as a panel would drop to 45."""
|
||||
truth = build_plant_pair(tmp_path)
|
||||
result = scale_check(read_snapshot(truth["pid"]), read_snapshot(truth["layout"]))
|
||||
assert result["pair_count"] == truth["scale"]["overall"]["pairs"] == 55
|
||||
assert result["within_10pct"] == pytest.approx(truth["scale"]["overall"]["within_10pct"])
|
||||
|
||||
Reference in New Issue
Block a user