Repository navigation
Description
Part of the code-health epic. Evidence pinned to main @ 71b8c94.
Problem
annotations/from_model.py is 10,245 lines. It has about 26 feature render_*/place_* passes (:403 through :9830), 124 top-level definitions, 29 functions with 8 or more parameters, and 273 issue-number references. It is the largest module in the package and the second most-churned (71 commits in 30 days). Its biggest functions are render_step_lengths (766 lines, :6399) and render_slots (534, :403), and 27 of its functions are over 100 lines.
Proposal
The passes already share one contract, render_X(dwg, plan, a, *, ctx, only=None), and orchestrator._PASS_SEQUENCE owns their order. That makes it possible to split the file by feature family into sibling modules under annotations/ without changing behaviour. The families are:
- slots
- pockets/pads
- steps/turned
- chamfers/fillets
- threads
- patterns
Shared helpers go into one annotations/_passes_common.py, or into the existing _common.py where they belong.
Acceptance
- No module under
annotations/exceeds about 2.5k lines. _PASS_SEQUENCEorder and the golden corpus are unchanged._LAYERSranks the new modules, and the import-boundary test passes.- Do this after or alongside the placement-candidate refactor sub-issue, because the two touch the same closures.
Progress
- Repair measured machined leader contract after view planning #2029/Extract feature-family annotation producers from from_model #2024/Extract compiled-plan diameter annotation producer from from_model #2033/Extract hole and seat location annotation producers from from_model #2034/Extract declared GD&T annotation corridor producer #2038 merged as stack #2035 at
21e5cdc5: repaired stale machined analytics coverage, then extracted pocket/pad, thin-profile, diameter, location, and GD&T families.from_model.pyfell from 8,807 to 5,987 lines; golden drawings and required CI passed on each layer. Remaining extraction and the issue’s 2.5k-per-module criterion are open. - Extract turned step-length annotation rendering #2002 merged at
c36c0901: turned step-length rendering moved toannotations/_step_lengths.py;from_model.pyfell from 9,554 to 8,807 lines andrender_step_lengthsfrom 765 to 26. Fourteen live golden signatures, independent review, and required CI passed. - Extract slot rendering into focused annotation owner #1995 merged at
0c4fb20d: slot rendering moved toannotations/_slots.py;from_model.pyfell from 10,160 to 9,554 lines andrender_slotsfell from 485 to 19 lines. The render order, golden signatures, and required CI gates passed.
Activity
Extract pocket and pad leader job producers (#1929)
Extract chamfer and rounded-edge leader job producers (#1929)
Extract plate and channel corridor producers (#1929)
Select physical end-on diameter contracts for PR coverage (#1929)
Extract pocket and pad leader job producers (#1929)
Extract chamfer and rounded-edge leader job producers (#1929)
Extract plate and channel corridor producers (#1929)
Extract step and boss diameter producers (#1929)
Preserve live strip solver seam for diameter fallback (#1929)
Retarget diameter reroute provenance audit exemption (#1929)
Select physical end-on diameter contracts for PR coverage (#1929)
Extract feature-family annotation producers from from_model (#2024)
Extract compiled-plan diameter annotation producer from from_model (#…
pzfreo commentedon Sep 29, 2026
Reopened because the issue's own acceptance is not met yet. On merged
mainat502bbc46, four annotation modules exceed about 2.5k lines:_common.py2,972,holes.py2,953,from_model.py2,926, andleaders.py2,873 (rg --files ... | xargs wc -l). The reviewed aggregate branch awaiting its single PR gate moves the polygonal family; a separate local envelope extraction bringsfrom_model.pyto 2,576, but neither is merged and other annotation modules remain above the issue limit. I will update the count and close this issue only when the acceptance is verified onmain.Refactor annotation owners and share build-local evidence (#1939) (#2104