Repository navigation
Description
Part of the code-health epic. Evidence pinned to main @ 71b8c94.
Problem
Nine ._dw_* attribute names are bolted onto build123d-drafting-helpers objects through setattr/getattr/hasattr string lookups. There are 34 such sites; _dw_measurement_span alone has 13. Dynamic attribute access in general is heavy: getattr/setattr/hasattr appear 143 times in drawing.py, 103 in from_model.py and 92 in _common.py. This state has no types, mypy cannot see it, and it depends on objects we do not own tolerating extra attributes.
Proposal
Keep this metadata in a typed side table instead. The options are an entry on the registry keyed by annotation identity, or a field on the compiled-plan item. Then remove the _dw_* attributes.
Acceptance
grep -rn '_dw_' srcreturns nothing.- A test fails if a
_dw_*string reappears.
2026-09-30 remaining family audit
On the reviewed local follow-up aggregate at 9c574776, _dw_spec is the only remaining _dw_* field: 38 source matches across 13 files; tests have 158 matches across 35 files. The registry now snapshots named dimension construction evidence, but the live annotation still carries _dw_spec for precommit ink/interior placement and for repair, lint, evaluation, and raw PDF fallback. The acceptance search for zero _dw_ has not passed.
A final removal needs a coordinated boundary change: carry a typed transient spec through placement, commit named evidence to the registry, then make finished-drawing consumers read that registry record. Preserve raw helper fallback and late Draft PDF styling. This is a planning estimate of 150–300 source lines and 150–250 test lines from the reference map, not a verified patch size. Require registration/rollback, repair, lint/evaluation, PDF/export, and successful drawing/trace parity gates; avoid another persistent cache. No ADR wording change is proposed.
2026-09-30 reviewed local completion candidate
An isolated typed-owner slice at b290233f (integrated locally after the next unpublished aggregate as 0460f23c) makes rg '_dw_' src return no matches and adds a load-bearing guard against reintroduction. Engine-created dimensions now carry a typed transient placement spec on an owned Dimension subclass; the registry snapshots committed named evidence, and lint/repair/evaluation/PDF consumers read registry evidence for named annotations. A fresh reviewer found and reproduced two unnamed place_dim regressions, which were fixed with transient fallback for unnamed dimensions while named missing specs remain fail-closed. The reviewer re-ran both repros and reported no remaining P0–P2 finding. Static, unit, smoke, 451 focused tests, 17 CAD plus three STEP exact parity, and SVG/DXF/PDF/PNG byte parity passed on the isolated slice or its corrected head; the final integrated full fast tier, measured no-regression gate, PR CI, and merge are outstanding. The owned subtype preserves isinstance(helpers.Dimension) and the visible Dimension type name, but exact Python class identity changes; this P3 compatibility risk is disclosed for review. Do not close this issue until the final gates and merge.
2026-09-30 final local verification (unpublished)
The integrated candidate 0f9534c9 retains zero _dw_ source matches and the load-bearing reintroduction guard. Fresh independent integrated and final-delta reviews found no blocking issue. scripts/pr-check --static exited 0; the exact-head fast tier passed 9,938 tests (9 skipped, 15 xfailed), with 96.03% total and 98% changed-line coverage (205/208). The final 14 CAD + three STEP drawing/lint/decision/trace corpus is byte-identical to the #2104 baseline, and five quiet paired workloads showed no reproducible timing regression. Two construction-count guards were moved to the owned Dimension constructor with positive-count preconditions after the first full run exposed their stale _core.Dimension patch site. The source acceptance is met locally, but this issue remains open until a PR passes current-head CI and merges. GitHub branch/PR writes are rejected by automatic approval policy never; no new PR or CI has started.
Activity
Move section cut identity into registry (#1931) (#1957)
pzfreo commentedon Sep 28, 2026
First typed-state slice merged in #1957: section cutting-plane cut/view identity now lives in immutable
SectionMarkrecords owned byAnnotationRegistry, with replacement, clear, snapshot, rollback, and deferred replay tests. The remaining_dw_*metadata is still open under this issue. Fresh review cleared; CI green; full local failures matched untouched main exactly.pzfreo commentedon Sep 29, 2026
Next typed-state slice: #2099 is open against the reviewed #2084 stack tip. Solved candidate-region provenance now lives in
AnnotationRegistryrather than_dw_candidate_regionattributes on helper objects; placement, layout comparison, and structural lint read the typed registry state, and replacement/snapshot/reapply follow registry identity. Exact 14 CAD + 3 STEP drawing/lint/decision/trace parity, 234 focused tests, static checks, and a load-bearing mutation passed; a fresh independent review found no actionable findings and reran 215 focused tests. Required GitHub CI is pending. Other_dw_*metadata families remain open.pzfreo commentedon Sep 30, 2026
Completed in #2105 (merged as f4aa321). On merged main, rg -n "dw" src/draftwright --glob "*.py" returns no matches; the reintroduction guard, independent reviews, and current-head CI (17 successful checks, two expected skips) passed. No ADR text changed.