Skip to content

Add geometry-loop + Move advisories to validation#52

Open
YLZha wants to merge 1 commit into
mainfrom
validate-loop-and-move-advisories
Open

Add geometry-loop + Move advisories to validation#52
YLZha wants to merge 1 commit into
mainfrom
validate-loop-and-move-advisories

Conversation

@YLZha

@YLZha YLZha commented May 31, 2026

Copy link
Copy Markdown
Collaborator

Two advisory-only validation checks (never affect pass/fail), from lessons building the Moravian workbench.

1. Geometry-loop advisory — helpers/sp/deps.py

AST-scans the tracked build script for for/while loops that create geometry (sketches.add, extrudes, combine, cyl_/box_ helpers) and nudges toward a Rectangular Pattern or Mirror feature.

Why: validate_design's existing replication advisory groups congruent bodies — so a loop of identical cuts (dog-hole / mortise / hole arrays, which remove voids rather than add bodies) is invisible to it. That's exactly why the workbench's dog holes were first built one-by-one in a loop with nothing flagging it. The AST sees both body-loops and cut-loops. A loop that builds a list then patterns/mirrors it is not flagged. Script path is now resolved up-front so the lint runs even when an explicit metadata_path is passed.

2. Move advisory — addin/tools/validate_design.py

Flags Move/rotate features that likely orient a part to an angled reference. A Move bakes a non-parametric transform and can hide sizing bugs until the part is in place (it masked an oversized vise collar in the workbench build). Prefer building in place; for compound splay use a two-section loft. Opt out a legitimate roll / measured-alignment Move with a _norep substring in its name.

3. Docs — docs/angled-construction.md

Documents the parametric two-section Loft as the Move-free way to do compound splay (and why a Loft, not an off-axis extrude — Fusion extrudes only normal to the profile plane), plus the "run check_interference after a Move" reflex.

4. Test — tests/test_deps_loops.py

Offline unit test for the detector (cut-loop, sketch-loop, helper-loop flagged; pattern-loop / no-geometry-loop / bad-source not flagged). Existing test_deps_anchoring.py still 12/12.

Both advisories are non-failing and opt-out-able, consistent with the existing replication advisory — a working build is never forced into a redo.

🤖 Generated with Claude Code

Two advisory-only validation checks (never affect pass/fail), closing gaps
surfaced building the Moravian workbench:

- Geometry-loop advisory (helpers/sp/deps.py): AST-scans the tracked build
  script for for/while loops that create geometry (sketches/extrudes/combines/
  cyl_/box_) and nudges toward a Rectangular Pattern or Mirror. This is the
  source-level complement to validate_design's body-congruence replication
  advisory, which can't see a loop of identical CUTs (e.g. dog-hole arrays
  remove voids, not add bodies). Resolves the script path up-front so it runs
  even when an explicit metadata_path is passed.

- Move advisory (addin/tools/validate_design.py): flags Move/rotate features
  that likely orient a part to an angled reference; prefer building in place
  (or a two-section loft for compound splay). Opt out a legit roll / measured
  alignment with a `_norep` substring in the feature name.

- docs/angled-construction.md: documents the parametric two-section Loft as the
  Move-free way to do compound splay (and why a Loft, not an off-axis extrude),
  plus the "check_interference after a Move" reflex.

- tests/test_deps_loops.py: offline unit test for the loop detector.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant