Skip to content

test(gen): pin res_array hidden-param contract for internal geometry knobs - #6881

Merged
loom-fleet-dispatch[bot] merged 1 commit into
mainfrom
feature/issue-6872
Nov 20, 2026
Merged

loom-fleet-dispatch[bot] merged 1 commit into
mainfrom
feature/issue-6872

Conversation

@loom-fleet-dispatch

@loom-fleet-dispatch loom-fleet-dispatch Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

res_array's internal geometry knobs (res_contact_space_um, res_head_len_um, res_poly_heads_only) were not covered by the hidden-parameter regression tests, so a dropped hidden=True — exactly what happened to res_head_len_um in PR #6356's merge — would not fail any test. This PR pins the contract per name and fixes the stale helper cross-reference #6356's module split left behind.

Changes

Acceptance Criteria Verification

  • list_generators() omits each name; request raises GenError with unknown params and the name — verified: test_hidden_declaration_omitted_from_gen_list[res_array-res_contact_space_um|res_head_len_um|res_poly_heads_only] and test_hidden_declaration_rejected_as_unknown_param[...] (match regex now requires \b{name}\b) all pass: uv run pytest -q tests/test_gen_hidden_params.py → 14 passed.
  • Comment points to the landed location of _res_flavor_mask_box_um — verified: it now reads gen_res_head._res_flavor_mask_box_um; grep -rn "gen\._res_flavor_mask_box_um" src/ tests/ docs/ finds nothing.

Test Plan

  • uv run pytest -q tests/test_gen_hidden_params.py → 14 passed (7 cases × 2 paths).
  • Negative check per the issue's test plan: temporarily removed hidden=True from the res_head_len_um declaration and re-ran — exactly the two res_head_len_um tests failed (listing advertised the name; request validation no longer rejected it); restored the flag and all 14 pass again.
  • uv run ruff format --check + uv run ruff check on both changed files — clean.
  • TDD: regression-pinning test: written first, confirmed green against the intact declarations, then confirmed red for the right reason by deleting hidden=True from res_head_len_um (both the listing and the unknown-param checks fail), then restored to green.

Closes #6872

loom dashboard

…knobs

Extend tests/test_gen_hidden_params.py's shared case table with
res_array's internal geometry knobs (res_contact_space_um, res_head_len_um,
res_poly_heads_only) and add a list_generators() test over the same table,
so a declaration that loses hidden=True fails both the listing and the
unknown-param checks on first run instead of relying on manual review (the
PR #6356 res_head_len_um leak). Also point the res_flavor_{i}_head_enclosure_um
comment at gen_res_head, where #6356 moved _res_flavor_mask_box_um.

Closes #6872
@loom-fleet-dispatch loom-fleet-dispatch Bot added the loom:review-requested PR ready for Judge to review. Applied by: Builder when opening PR. label Nov 20, 2026
@loom-fleet-dispatch

loom-fleet-dispatch Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

PR #6881's loom:reviewing claim is held by the judge of sweep step-judge-6881-1795170549 on host host-7ec0fa4c. This comment is a PR lease record (#9401): its liveness signal is its own forge-assigned updated_at, renewed while the judge works and released when it is done. Another judge that finds this lease live stands down before touching a worktree. See defaults/docs/lease-record.md § "PR-phase leases".

@loom-fleet-dispatch loom-fleet-dispatch Bot added the loom:reviewing Judge is reviewing this PR. Applied by: Judge only. Stale after LOOM_STALE_REVIEWING_MINUTES (45m). label Nov 20, 2026
@loom-fleet-dispatch

Copy link
Copy Markdown
Contributor Author

✅ Approved!

A two-file, 36-line change that pins a contract which was previously held only by manual review. Reviewed at head fa39654e05fa771bfc9862e6eee9d87d5eac0e33 in .loom/worktrees/pr-6881 (clean, HEAD matches PR head).

Spec reconciliation

spec=afdf5729bc58c058 comments=7032081504@2026-11-20T06:19:18Z,7032101525@2026-11-20T06:17:06Z,7032116105@2026-11-20T06:17:58Z,7032208755@2026-11-20T06:24:41Z,7032220167@2026-11-20T06:24:23Z,7034019055@2026-11-20T08:08:22Z,7035677036@2026-11-20T09:23:48Z,7035714427@2026-11-20T09:27:21Z,7035768866@2026-11-20T09:26:52Z,7035798659@2026-11-20T09:28:49Z,7035822270@2026-11-20T09:28:44Z,7035834393@2026-11-20T09:29:59Z,7035880939@2026-11-20T09:30:45Z,7035888908@2026-11-20T09:31:01Z,7035903691@2026-11-20T09:31:31Z,7036697148@2026-11-20T10:07:59Z,7036810882@2026-11-20T10:08:23Z
baseline: none - no earlier spec baseline available; reviewed against current requirements

Reviewed against #6872's current body and trusted comments, not the PR's account of them. No material differences: scope (two files), both acceptance criteria, Affected Files and Out of Scope are unchanged since the Champion promotion at 09:28. Every comment on #6872 is a bot lifecycle record (leases, blocker-cleared, curator/champion notes) — no human rescoped anything. The issue's own ## Verified corrections block (post-#6356) matches what I measured in the tree. The out-of-scope item (an enumerating all-generators schema inventory) is correctly not attempted here.

Acceptance criteria — independently verified

AC1 — list_generators() omits each name; a request supplying it raises GenError with unknown params and the name.

uv run pytest -q tests/test_gen_hidden_params.py → 14 passed (7 cases × 2 paths). Matches the PR's claim.

But a green pinning test proves only that the contract holds today — it does not prove the test would notice if it stopped holding. That is the whole point of this PR, so I falsified it myself rather than taking the PR's word for it. Deleting hidden=True from the res_head_len_um declaration (res_array.py:322) in the review worktree:

FAILED test_hidden_declaration_rejected_as_unknown_param[res_array-res_head_len_um]
  E  Failed: DID NOT RAISE GenError
FAILED test_hidden_declaration_omitted_from_gen_list[res_array-res_head_len_um]
  E  AssertionError: assert 'res_head_len_um' not in {'dummy', 'flavor', 'length_um',
     'metal_level', 'num', 'res_head_len_um', ...}

Exactly two failures, both for the mutated name, each for the correct and distinct reason — the validator stops rejecting it, and --list starts advertising it. The two paths really are independent, as the table comment claims.

I also mutated a second declaration, because the three new names do not all go through the same code: res_contact_space_um and res_head_len_um are _declare_double_param(...) helpers, but res_poly_heads_only is a raw self.param(..., self.TypeBoolean, ..., hidden=True). Deleting its flag (res_array.py:331) likewise failed exactly its own two cases, so the pin covers both declaration mechanisms, not just the helper. Tree restored to the PR head after each mutation (git status clean).

AC2 — the comment points to the landed location of _res_flavor_mask_box_um.

Measured, not assumed: _res_flavor_mask_box_um is defined at src/klayout_tools/gen_res_head.py:109, and res_array.py:72 imports it from klayout_tools.gen_res_head — so gen_res_head._res_flavor_mask_box_um is the correct prefix. grep -rn "gen\._res_flavor_mask_box_um" src/ tests/ docs/ → no matches; the stale reference is fully gone, not just at line 226.

TDD claim

The PR's TDD: line describes a regression-pinning test, not a failing-test-first fix. The merge-base run in the Judge TDD table is inapplicable by construction here: #6872 states plainly that "the contract holds today — the gap is that nothing pins it", so a test that failed at the merge base would mean main was already broken. The builder substituted the correct falsification (mutate the declaration, confirm red for the right reason), and I re-ran that mutation independently on both declaration mechanisms above rather than accepting the claim. Recorded as verified by mutation, not verified at merge base.

Test plan execution

  1. uv run pytest -q tests/test_gen_hidden_params.py — ✅ Executed: 14 passed.
  2. Negative check (remove hidden=True, confirm red, restore) — ✅ Executed independently, twice (_declare_double_param and self.param paths); output above.
  3. uv run ruff format --check + uv run ruff check on both changed files — ✅ Executed: "2 files already formatted", "All checks passed!". The lengthened comment at res_array.py:226 is 83 chars, under the 88 limit.
  4. scripts/check_file_size_baseline.py --comparison-rev <merge-base> — ✅ Executed: OK, 1773 governed files, all within policy. (Not in the PR's plan; run because this repo's ratchet fails CI on growth in a baselined test file, and this one grew 57→78 lines.)

Review notes

  • Nothing lost in the refactor. The extracted _HIDDEN_PARAM_CASES retains all four original rows and adds three; the new listing test runs over the whole table, so mos_array/cap_array gain listing coverage they did not have before. That is a free widening beyond the issue's ask, and a welcome one.
  • The module docstring is now honest. It always claimed both guarantees ("klt gen --list does not advertise them, and the request validator rejects them"); only the second was tested. The first is now actually asserted.
  • Nit, non-blocking: next(g for g in report["generators"] if g["name"] == generator) (line 76) raises StopIteration rather than failing cleanly if a generator is ever renamed. It still surfaces as a visible test error, never a silent pass, so it is not worth a round-trip — noting it only so the next person touching this table knows.

Gates

  • CI: LOOM-CHECKS-GREEN at fa39654e05fa771bfc9862e6eee9d87d5eac0e33 (all 24 check-runs, waited to settle in-turn).
  • Merge state: CLEAN.
  • check-review-feedback.sh: REVIEW_FEEDBACK_STATE=CLEAR (0 reviews, 0 unresolved inline threads).
  • Issue linking: Closes #6872, one closing keyword, correct issue, not an epic.
  • No new secrets or repo variables; no build-pipeline or N-bound work added; no browser/scraper/DOM code and no silent-omission failure shape in res_array's hidden PCell params have no per-name regression test (a real leak slipped through in PR #6356) #6872, so the live-verification requirement does not apply.

loom dashboard

@loom-fleet-dispatch loom-fleet-dispatch Bot added loom:pr PR approved by Judge, ready for Champion auto-merge. Applied by: Judge. and removed loom:review-requested PR ready for Judge to review. Applied by: Builder when opening PR. loom:reviewing Judge is reviewing this PR. Applied by: Judge only. Stale after LOOM_STALE_REVIEWING_MINUTES (45m). labels Nov 20, 2026
@loom-fleet-dispatch

loom-fleet-dispatch Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor Author

PR #6881's (no label: the lease is the claim) claim is held by the champion of sweep step-champion_merge-6881-1795171620 on host host-a6032f0c. This comment is a PR lease record (#9401): its liveness signal is its own forge-assigned updated_at, renewed while the champion works and released when it is done. Another champion that finds this lease live stands down before touching a worktree. See defaults/docs/lease-record.md § "PR-phase leases".

@loom-fleet-dispatch

Copy link
Copy Markdown
Contributor Author

Champion: merging. Judge-approved at current head fa39654e05fa771bfc9862e6eee9d87d5eac0e33; test + comment-only change (2 files, no critical files); CI green; mergeable clean.


Automated by Champion role

loom dashboard

@loom-fleet-dispatch
loom-fleet-dispatch Bot merged commit 03675a5 into main Nov 20, 2026
25 checks passed
@loom-fleet-dispatch
loom-fleet-dispatch Bot deleted the feature/issue-6872 branch November 20, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

loom:pr PR approved by Judge, ready for Champion auto-merge. Applied by: Judge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

res_array's hidden PCell params have no per-name regression test (a real leak slipped through in PR #6356)

0 participants