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

test(gates): share attachedDocs and pin the lazy-views ledger to its own prose - #7982

Merged
baozhoutao merged 1 commit into
mainfrom
claude/issue-7289-attached-docs-shared-helper-lazy-views-pin
Sep 6, 2026
Merged

baozhoutao merged 1 commit into
mainfrom
claude/issue-7289-attached-docs-shared-helper-lazy-views-pin

Conversation

@baozhoutao

Copy link
Copy Markdown
Contributor

Fixes #7289

Lifts attachedDocs — the structural locator for the documentation attached to
an exported constant, written for objectui#7046 — into a shared test helper, and
applies its value half to scripts/vite-declared-lazy-views.ts.

Where the helper went, and why there

scripts/__tests__/helpers/attached-docs.ts.

That directory is the repo's existing shared test-plumbing location, not a new
convention: helpers/turbo-inputs.ts, helpers/tsc-program.ts,
helpers/build-program.ts, helpers/config-program.ts,
helpers/eslint-config-program.ts and helpers/vitest-config-program.ts
already live there and are imported as ./helpers/NAME by six sibling suites.

Measured, because a helper collected as a suite would be an empty test file: the
unit project in vitest.config.mts includes only names ending in .test.ts
under scripts/, so this module is importable and never collected. The whole
scripts/ surface runs 107 files after the change, the same 107 as before.

The body is token-identical to the one it replaces (verified by comparing
the whitespace-normalised token streams of the HEAD block and the new file). Two
things differ and nothing else: the signature is reflowed onto three lines by
the added export, and the not-found throw said in the checker and now says
in the source, because it has two customers. No test asserts that string.

The commit half does not transfer — re-measured on this branch

  • scripts/vite-declared-lazy-views.ts carries five 9-hex citations in
    prose, at lines 100, 227, 282, 340 and 547. They are two distinct commits
    (b98352a15 four times, fab4802e3 once) — the card said "five commits",
    and the precise reading is five citations of two.
  • Its three exported constants are APP_CONTENT_PATH, EAGER_WALK_CONTROL and
    DECLARED_LAZY_VIEWS_STILL_EAGER. All three carry path strings. No exported
    constant carries a commit string as data.

So there is nothing live for a commit pin to check those citations against, and
copying objectui#7046's commit pin here would ship a vacuously green test — the
same wall objectui#7046 hit on PER_CHUNK_BASELINE. It is deliberately not
shipped, and the reasoning is written beside the pin rather than left in a card.
The blanket negative pin ("no OTHER hash in this block") is not shipped either,
for the reason objectui#7046 already measured: it is red on honest history.

The value pin, and the finding it produced

Every path a constant carries must appear in the prose attached to that same
constant. attachedDocs strips the code, so the declaration cannot satisfy the
pin by restating itself.

All three constants FAILED the pin as written. Not one of the three
paragraphs named the path its constant carries: the ledger's bullet said
RecordDetailView, and the two control constants' blocks named no path at all.
Three sentences now do — one per constant — and that is the only edit this
PR makes to scripts/vite-declared-lazy-views.ts. scripts/check-eager-closure-budget.mjs
is untouched.

A companion case records what each constant carries as data, so the pin cannot
go vacuous in silence if the ledger empties. Emptying the ledger is a win
here, not a regression — the file's own header calls deleting a line a
MEASUREMENT — so that number moving down is where the win gets recorded.

Probes

Every mutation was proven on disk before its run was read, and every restore is
proven by blob hash equal to the HEAD blob plus an empty git diff HEAD. Each
script carries an EXIT INT TERM trap restoring through absolute paths.

# Mutation, proven on disk Result
A0 budget test restored to its pre-lift blob 5a772eaa (local function present, import absent) 101 passed — identical to the 101 passed the lifted version produces
A one commit hash inside the checker's gzipBytes prose retyped (injected count 0 to 1; the carried hash still 4 elsewhere), run twice — once against the pre-lift test file, once against the lifted one identical both ways: pins every commit BASELINE carries into its own attached prose, expected [ '3d257c85a' ] to deeply equal [], 1 failed / 100 passed
B1 APP_CONTENT_PATH's value taken out of its paragraph (anchor 1 to 0, replacement 0 to 1) pins every path APP_CONTENT_PATH carries into its own attached prose — 1 failed / 30 passed
B2 EAGER_WALK_CONTROL's value taken out of its paragraph pins every path EAGER_WALK_CONTROL carries into its own attached prose — 1 failed / 30 passed
B3 the ledger bullet reverted to its pre-fix wording pins every path DECLARED_LAZY_VIEWS_STILL_EAGER carries into its own attached prose — 1 failed / 30 passed
C a second ledger entry with no prose — ObjectDataPage.tsx, a real file AppContent really declares lazy, so the sorted / exists / declared-lazy cases stay green and only the new pin speaks 2 failed / 29 passed: the prose pin, and the vacuity record

⚠️ Probe C's first attempt was a no-op and is reported as one rather than
quietly re-run: a \Q...\E-quoted \n in the perl expression matched nothing,
the file's blob hash did not move and the injected-text count went 0 to 0. The
on-disk check caught it; the reading above is from the re-run with a working
anchor.

Gates

Run at 5ae65749b, exit code captured before any pipe, each gate's own verdict
line quoted:

  • pnpm exec vitest run scripts/ — Test Files 107 passed (107), Tests 3239 passed (3239)
  • scripts/__tests__/check-eager-closure-budget.test.ts — Tests 101 passed (101) (unchanged count)
  • scripts/__tests__/vite-declared-lazy-views.test.ts — Tests 31 passed (31) (26 before, plus the five new cases)
  • pnpm type-check:scripts — exit 0, no diagnostics
  • pnpm lint:root — 32 problems (0 errors, 32 warnings), none of them on the four changed files
  • pnpm check:control-bytes — check-control-bytes: OK (scanned 6422 tracked text file(s); skipped 85 binary).
  • pnpm check:unreferenced-sources — OK Every shipped source file in every covered package is reachable.
  • node scripts/check-changeset-presence.mjs — No source or published contract of a released package changed in this range, so no changeset is owed. (scripts/ is not released source; no changeset, and no label)
  • node scripts/check-governed-queue-guard.mjs --test on all four paths — NOT GOVERNED — 4 path(s) checked against 5 governed surface(s); none matched.
  • pnpm exec turbo ls --affected against the branch point — 0 no packages; the diff is entirely under scripts/, which no workspace package owns, and the one code reader of scripts/vite-declared-lazy-views.ts outside scripts/ (apps/console/vite.config.ts) sees a comment-only change.

Overlap with draft PR #7685

Draft PR #7685 (objectui#7122, spec seat) also touches
scripts/__tests__/check-eager-closure-budget.test.ts — two hunks, whose headers
read @@ -611,10 +611,11 @@ and @@ -795,7 +796,7 @@ — and rewrites
scripts/check-eager-closure-budget.mjs. This PR's edits to that test file are
an import near the top and a deletion at old lines 1400 to 1477; the regions are
disjoint. Whichever of the two lands second should merge main first. This PR
does not touch scripts/check-eager-closure-budget.mjs at all, so PR #7685's
rewrite of it lands against the pins rather than through them — which is what
the pins are for.

Out of scope and untouched here: objectui#6785 and objectui#6631. Whether the
file's five prose citations should get any guard at all is the separate question
objectui#7289 recorded, and this PR does not answer it.


Generated by Claude Code

…own prose

`attachedDocs` — the structural locator for the documentation attached to an
exported constant — was written inside
`scripts/__tests__/check-eager-closure-budget.test.ts` and has nothing in it
that is specific to that checker. It moves to
`scripts/__tests__/helpers/attached-docs.ts`, the directory's existing shared
test-plumbing location, which the `unit` project's `*.test.ts` include never
collects as a suite. Its body is token-identical to the lifted one; the only
textual change is the "not found" throw, which said "in the checker" and now
says "in the source" because it has two customers.

Its second customer is `scripts/__tests__/vite-declared-lazy-views.test.ts`,
which now pins the VALUE half only: every path
`DECLARED_LAZY_VIEWS_STILL_EAGER` carries, plus `APP_CONTENT_PATH` and
`EAGER_WALK_CONTROL`, must appear in the prose attached to that same constant.
All three failed that pin as written, so three sentences in
`scripts/vite-declared-lazy-views.ts` now name the path their constant carries;
that is the only edit to the checker's own source.

The commit half of the pin is deliberately absent: the file cites five commits
in prose and exports no constant carrying a commit as data, so there is nothing
live to check them against and copying the pin over would ship a vacuously
green test.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013uAaxiwgYDybsTNV9xwa1M
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

2 participants