Skip to content
This repository was archived by the owner on Nov 4, 2026. It is now read-only.

fix(test-infra): judge a subpath of a swept package in check-vi-mock-inherit - #8391

Merged
baozhoutao merged 1 commit into
mainfrom
claude/issue-8141-covered-subpath-scope
Sep 7, 2026
Merged

baozhoutao merged 1 commit into
mainfrom
claude/issue-8141-covered-subpath-scope

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

Fixes #8141

The defect

scripts/check-vi-mock-inherit.mjs resolved scope by exact string equality against COVERED_SPECIFIERS. A subpath of an already-swept package therefore fell through to the @object-ui/ branch and landed in the "other workspace" bucket: counted, never judged — while the verdict line printed above it named the package as covered.

That is the class this card is admitted under: a gate that runs and reports a verdict broader than what it checked hides the absence behind a green. The neighbouring card #8286 was closed as out-of-class precisely because no gate ran there at all — nothing was claimed, so nothing was over-claimed. #8286 is not addressed here.

⭐ This was not an exemption and not a recogniser bug — the resolver did exactly what it said. It was a scope boundary drawn when the covered set had ONE member and no call site named a subpath. The failure mechanism the gate exists to catch (a module-scope read of an export the frozen stand-in never listed, killing the file during COLLECTION with zero failed assertions) does not care whether the frozen stand-in stood in for a package root or for one of its subpaths: a subpath's export surface grows exactly the way the root's does.

The route: option 1 (prefix match), and its precondition, taken first

A member now covers member and member/.... The separator is part of the prefix, so a sibling package whose NAME merely starts with a member's (@object-ui/react-native) is a different package and stays out. The constant still names package ROOTS only — what widened is the reach of one membership, not the test for membership, so "a member joins only by sweep" is unchanged.

Widening the resolver newly JUDGES sites nobody swept, so the population was re-measured first, on today's tree, with the gate's own exported scan() — never from the card's table, which was taken on 214d5d5a6 when the constant held eleven members:

node -e "import('./scripts/check-vi-mock-inherit.mjs').then(m => { const r = m.scan(process.cwd());
  console.log(r.sites.filter(s => s.scope === 'workspace' && m.COVERED_SPECIFIERS.some(c => s.specifier.startsWith(c + '/')))); })"

Measured on b38014e82 against today's eighteen members:

before (exact match) after (prefix match)
judged call sites 623 625
other workspace 37 35
frozen 0 0
unreadable / vacuous 0 / 0 0 / 0

The two newly-judged sites are both @object-ui/components/ui/sonner, both in packages/plugin-form:

packages/plugin-form/src/MasterDetailForm.outcomeToastSupersede.test.tsx:99
packages/plugin-form/src/WizardForm.outcomeToastSupersede.test.tsx:96

Both were already inheriting (async (importOriginal) => ({ ...actual, toast: fakeToast })), so no sweep was owed and this lands as a RATCHET — the same "the tree is at zero, so the gate starts as a ratchet" argument that scoped #6849. Every other row is byte-identical between the two runs and no site moved the other way. Had the re-measure turned up a frozen subpath factory it would have been SWEPT in this PR — never floored, never given a per-site allowance.

What changed

  • The resolver — coveredSet.has(spec) becomes spec === member || spec.startsWith(member + '/').
  • The verdict line — now reads ... call site(s) on A, B, ... and their subpaths judged, so the line is true of what the run checked. The over-claim is the defect; a verdict that named only the members would be the same over-claim in the other direction.
  • The header prose — a new section, "A member covers its SUBPATHS", records the boundary, why the separator is part of the prefix, the re-measured numbers above, and that a future re-measure turning up a frozen subpath factory sweeps it rather than flooring it.
  • The pins (scripts/__tests__/check-vi-mock-inherit.test.ts) — six cases: a subpath is judged (frozen and inheriting shapes), vi.importActual of the subpath inherits it, the regression pin (a frozen subpath factory makes the gate RED rather than silently green), a sibling package sharing a name prefix is NOT swallowed, and COVERED_SPECIFIERS still holds package roots only.

Verification

node scripts/check-vi-mock-inherit.mjs
  OK (4455 tracked source file(s), 2721 test-named; 615 carry a mock;
      625 call site(s) on ... and their subpaths judged (625 inherit, 0 auto-mocked);
      35 other workspace, 242 external, 879 local, 0 non-static, 3 embedded ...)
node scripts/check-vi-mock-specifiers.mjs   OK  (same population: 4455 / 615)
node scripts/check-control-bytes.mjs        OK  (6650 text files)
pnpm exec vitest run scripts/__tests__/     Test Files 120 passed | Tests 3598 passed
pnpm exec vitest run packages/plugin-form/src/{MasterDetailForm,WizardForm}.outcomeToastSupersede.test.tsx
                                            Test Files 2 passed | Tests 5 passed
pnpm exec eslint (both changed files)       exit 0
pnpm run type-check:scripts                 exit 0   (both files confirmed in the program via --listFiles)

Ablation — the resolver reverted to exact equality on a committed tree, the mutation proved on disk (marker counts 1 to 0, blob 7d02f51c to 478fadc7), then restored with git checkout HEAD -- path and proved byte-identical (blob back to 7d02f51c, git diff HEAD empty):

  • the pins go RED: Tests 5 failed | 69 passed (74) — the subpath is workspace/unjudged again, the regression pin's frozen list empties, and the on-disk pin finds no judged subpath site;
  • the gate itself still exits 0 and prints 37 other workspace. That is the card in one line: nothing is red, the verdict just quietly stops being true of the package it names.

Scope

Deliberately untouched: holdsObtainedModule() (#8183, serialized behind this card on the same file and rebasing onto this resolver change), #8117's pin-versus-prose issue in the same file, and @object-ui/app-shell (being measured under #8173) — it is not added to COVERED_SPECIFIERS here. No changeset is owed: node scripts/check-changeset-presence.mjs reports 0 published source files and 0 published contracts in this range.


Generated by Claude Code

…inherit

The gate resolved scope by exact string equality against COVERED_SPECIFIERS,
so a subpath of an already-swept package fell into the "other workspace"
bucket -- counted, never judged -- while the verdict line above it named the
package as covered. A gate that reports a verdict broader than what it checked
hides the absence behind a green.

A member now covers `member` and `member/...`. The separator is part of the
prefix, so a sibling package whose name merely starts with a member's is not
swallowed. The constant still names package roots only: what widened is the
reach of one membership, not the test for membership.

Re-measured on b38014e with the gate's own scan() against today's eighteen
members: 2 subpath sites, both `@object-ui/components/ui/sonner` in
packages/plugin-form, both already inheriting. Census 623 -> 625 judged and
37 -> 35 other workspace, zero frozen before and after, no site moving the
other way -- so this lands as a ratchet and no sweep was owed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
@claude

claude Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

ACCEPT — domain:devx @ objectui execution seat, PM session session_01FhBNJcLRZLe8M87VcUgpKr, R46, reviewed 2026-09-07T16:20Z against GitHub and the tree, ⛔ never against the report's narrative.

What was verified independently

The diff is what the report says it is. +151/-7 across exactly two files, draft, head d7bd19901. The resolver change is one added helper plus one call-site swap:

const coveredPrefixes = [...coveredSet].map((member) => `${member}/`);
const isCovered = (spec) => coveredSet.has(spec) || coveredPrefixes.some((prefix) => spec.startsWith(prefix));

holdsObtainedModule() is absent from the diff (⇒ #8183's chain head is clean and #8183 rebases onto this), COVERED_SPECIFIERS gains no member (⇒ @object-ui/app-shell is not smuggled in ahead of #8173), and #8117 is not folded in. All three fences held.

The load-bearing number was re-derived here, not taken from the report. A git grep over origin/main for every vi.mock('@object-ui/…') specifier returns 22 distinct specifiers, of which exactly one is a subpath — @object-ui/components/ui/sonner, at 2 call sites, and @object-ui/components is a member of the 18-name constant. That is the report's population reproduced by a different instrument than the one it used (scan()), which is why it is being accepted rather than re-run.

⭐ The separator fence is not hypothetical — it has a live occupant, and this is the finding of the review

The PR and its pin justify including the / in the prefix with @object-ui/react-native, which does not exist. A package that does exist is @object-ui/react-runtime — enumerated from all 39 @object-ui/* workspace manifests on origin/main and checked against every member:

bare string-prefix collisions (member is a prefix of another package name): 1
  @object-ui/react  is a prefix of  @object-ui/react-runtime   swallowed by `member + '/'`? False

So a naive spec.startsWith(member) would have silently pulled a real, never-swept package into covered and judged it as though it had been — an over-claim in the same direction as the defect this card fixes, introduced by the fix. The implementation includes the separator, so it does not happen; the pin covers the shape (${COVERED}-native, ${COVERED}ive). ⚠️ Recorded because the pin's example is invented while the hazard is real: if that pin is ever edited, @object-ui/react-runtime is the case that must keep passing.

No stale consumer of the verdict string is left behind

The line changed from … judged to … and their subpaths judged. Searching origin/main for call site(s) on outside the gate returns one hit — scripts/__tests__/check-vi-mock-inherit.test.ts:677 — and this PR updates it, in both the summarise() assertion and the real-spawn toContain. Control: the string does occur once in the gate itself, so the search was live rather than empty.

The pins earn the claim

The regression pin builds a fixture with a frozen subpath factory and asserts frozen === [subpath], census.covered === 1, census.workspace === 0 — reverting the resolver reds it. The on-disk pin carries its own existence control (${file} moved — this control tests nothing), so it cannot pass vacuously if the two plugin-form files are renamed. And the structural pin — every member .split('/') has length 2 — is what keeps option 2 from being reintroduced by accident: it makes "the constant names package ROOTS only" a mechanically enforced sentence rather than a header claim.

⭐ The ablation the dev ran is the report's strongest line and it reproduces the card's thesis exactly: with the resolver reverted, the pins go red while the gate itself still exits 0 printing 37 other workspace. That is the card in one sentence — the gate cannot detect its own over-claim, so the pin is the only thing standing between this and a green that asserts more than it checked.

Answering the dev's open question, because it has a measured answer

The dispatch's "⛔ no model identifiers in any pushed artifact" and this session's mandated Co-Authored-By: trailer do conflict on the letter. Option A, as the dev chose — and the conflict is moot at the merge boundary: this shift has measured three landings (f20e57d62, dc75260a2, 59cca05b0) where the squash path normalises the trailer to a plain Co-authored-by: Claude <noreply@anthropic.com> with no model identifier. Nothing carrying a model name reaches main. ⛔ Do not push a follow-up commit to rewrite it; that would add a commit to fix something the merge already fixes.

Out-of-scope finding

#8392 (the vi-mock-specifiers.yml step comment now under-claiming) is correctly out of this PR's fenced surface and correctly filed rather than fixed. Verified on origin/main: .github/workflows/vi-mock-specifiers.yml:113 does say what the card says it says. ⭐ The seat added the finding label the card was filed without — an observation card with no label is invisible to the grading sweep. ⛔ No domain:* and no grade were added: that is the triage seat's alone.

No changeset owed (scripts/** only; check-changeset-presence agrees).

Next: CI convergence → flip ready → post-flip guard → auto-merge SQUASH → queue confirmation → landing probe (isCovered and the member + '/' prefix present on re-fetched origin/main, the verdict line carrying and their subpaths judged; control: @object-ui/react-runtime still a package and still NOT a member) → LANDED here and on #8141, which closes via Fixes. #8183 is dispatched only after this lands.


Generated by Claude Code

@baozhoutao
baozhoutao marked this pull request as ready for review September 7, 2026 16:23
@baozhoutao
baozhoutao added this pull request to the merge queue Sep 7, 2026
@claude

claude Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Armed: PR #8391 flipped ready at 2026-09-07T16:23:32Z on head d7bd19901 after CI converged all green (28 checks, Live E2E excluded, read 16:23:25Z); post-flip Governed Surface Queue Guard completed/success at 16:23:48Z; auto-merge SQUASH enabled; queued (added_to_merge_queue at 16:23:55Z, read 16:23:59Z).

Landing probe on merge, on re-fetched origin/main: isCovered present with the ${member}/ prefix (the separator is the load-bearing character), and the verdict line reading and their subpaths judged. Control: @object-ui/react-runtime is still a workspace package and still NOT a COVERED_SPECIFIERS member — it is the one real bare string-prefix extension of a member (@object-ui/react) in the tree, so if it ever reads as covered, the separator has been lost. Then LANDED here and on #8141, which closes via Fixes.

⇒ #8183 becomes dispatchable the moment this lands and rebases onto this resolver change rather than racing it. — domain:devx @ objectui seat, PM session session_01FhBNJcLRZLe8M87VcUgpKr.


Generated by Claude Code

@claude

claude Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

LANDED — merged into main at 2026-09-07T16:40:49Z as 47053c9f6 (squash), read 16:41:01Z. #8141 closed completed via Fixes.

Content probe on re-fetched origin/main (tip 47053c9f6, read 2026-09-07T16:42Z) — the two claims from the Armed note, plus the control:

  1. The resolver. scripts/check-vi-mock-inherit.mjs:1293-1294 carries coveredPrefixes built as `${member}/` and isCovered = (spec) => coveredSet.has(spec) || coveredPrefixes.some(...), wired in at :1311. The separator is present, which is the whole safety of the change.
  2. The verdict line. :1426 reads … and their subpaths judged, so the sentence is now true of what the run checked.
  3. Control — and it is the one that matters, so it was re-run against the merged tree rather than assumed to still hold. @object-ui/react-runtime is still a real workspace package (packages/react-runtime/package.json) and still NOT a COVERED_SPECIFIERS member (0 matches; the constant holds 18, unchanged by this PR). It is the single live bare string-prefix extension of a member (@object-ui/react) in the tree, so it is the case a lost separator would silently swallow. It is not swallowed.

⭐ Restating why that control is the right one: this PR's own hazard was introducing the defect it removes, one level up — a naive startsWith(member) would have pulled a never-swept package into covered and reported it as judged. The constant's count staying at 18 while the reach of each member widened is exactly the shape the header claims ("what widened is the reach of one membership, not the test for membership"), and both halves are now verifiable on main.

⇒ #8183 is unblocked — the chain head has landed, so it may be dispatched and will rebase onto this resolver rather than race it. #6892's @object-ui/app-shell slice is queued behind it on the same file.


Generated by Claude Code

baozhoutao pushed a commit that referenced this pull request Sep 9, 2026
…omment

The step comment above `node scripts/check-vi-mock-inherit.mjs` claimed that
"only the covered workspace specifiers in `COVERED_SPECIFIERS` are judged".
That has been false since objectui#8141 (PR #8391) widened the resolver to
judge a member AND any subpath of one, so `@object-ui/components/ui/sonner`
is judged today although it is not a `COVERED_SPECIFIERS` member. The gate's
own header and its verdict line were updated by that PR; this second prose
site was not.

Removed rather than reworded. The gate header is where the last three
boundary changes were recorded, and the workflow copy was left behind all
three times: this is a duplicate statement that goes stale periodically, not
a one-off miss, so rewording it would fix this instance and not the next.
The step's `run:` already names the script, and its header carries the
boundary in full -- including the whole-module-replacement carve-out this
paragraph restated (scripts/check-vi-mock-inherit.mjs, "Three things are
therefore out of scope by construction, not by exemption").

Comment-only: the four deleted lines are whole-line YAML comments, and both
wiring suites that pin this workflow read it through a `yamlOf()` that strips
whole-line comments before asserting.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr
akarma-synetal pushed a commit to akarma-synetal/objectui that referenced this pull request Sep 17, 2026
…omment (objectstack-ai#8843)

The step comment above `node scripts/check-vi-mock-inherit.mjs` claimed that
"only the covered workspace specifiers in `COVERED_SPECIFIERS` are judged".
That has been false since objectui#8141 (PR objectstack-ai#8391) widened the resolver to
judge a member AND any subpath of one, so `@object-ui/components/ui/sonner`
is judged today although it is not a `COVERED_SPECIFIERS` member. The gate's
own header and its verdict line were updated by that PR; this second prose
site was not.

Removed rather than reworded. The gate header is where the last three
boundary changes were recorded, and the workflow copy was left behind all
three times: this is a duplicate statement that goes stale periodically, not
a one-off miss, so rewording it would fix this instance and not the next.
The step's `run:` already names the script, and its header carries the
boundary in full -- including the whole-module-replacement carve-out this
paragraph restated (scripts/check-vi-mock-inherit.mjs, "Three things are
therefore out of scope by construction, not by exemption").

Comment-only: the four deleted lines are whole-line YAML comments, and both
wiring suites that pin this workflow read it through a `yamlOf()` that strips
whole-line comments before asserting.


Claude-Session: https://claude.ai/code/session_01FhBNJcLRZLe8M87VcUgpKr

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

finding(test-infra): check-vi-mock-inherit's covered set is exact-match, so a SUBPATH of a swept package is never judged

2 participants