Repository navigation
chore(ci): census the call sites that set the vouched-reference mark - #31086
Conversation
The only production code that may set the vouched-reference mark (`vouchForReference`, @objectstack/core) is the file-attachments writer, at its two call sites (attachFileAs and attachUploadAs). The new census gate holds that: a file outside ALLOWED_CALLERS that sets the mark, a listed file with more or fewer call sites than its row, a renamed import, or the mark's key spelled by hand is red, naming the file. The bare run judges every source extension and runs in the lint step beside the single authz resolver guard. The @objectstack/core repo pin runs it with --ts-only, so what the pin judges equals the `.ts` radius that re-runs it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
📓 Docs Drift Check
What this run could not see
Coarse fallback — 39 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc Contract reviewServed-tier: Reviewed at 2026-11-07T05:11Z. Face: rules, read off the PR's file list by ① Derived judgmentsWhat the change holds, read against the code it cites. Accept-set changes — what goes red. Under What stays green. Test files ( Can the scan miss a real call site? Yes, in two ways the gate's own rule says it should not.
Other extensions and the The Is the self-test genuinely wired? Yes. The root alias is Does the workflow edit add or change a required context? No. The hunk edits the Checks on the head at the time of reading. ② Semver levelNo published package moves. The only file under a package is ③ Boundary flags
④ Design judgmentThis is the sibling gates' shape, in the parts that matter: an allowlist whose rows carry a Where it departs from the house shape, the departures are the two findings in ①: a hand-written comment rule where the tree has one shared mask and a gate that exists to stop new private ones, and a hiding-spelling rule applied to one of the gate's two names. Both are cheap to close and both close in the fail-safe direction. The simplest remedy for finding 1 is one rule instead of several: on a scanned line, any occurrence of Two smaller notes, neither a finding. The pin test asserts the literal Must-fix
Should-fix
Implemented-by: VERDICT: FAIL |
…ery other spelling Outside the defining module, every mention of vouchForReference, VOUCHED_REFERENCES or the key's Symbol.for description is a counted direct call, an unrenamed import/export-from specifier, or a finding naming the file and line. Renames of either name, namespace and bracket access, value aliases, .call/.apply, require destructuring, the key as a computed property or a defineProperty/Reflect.set argument, and the description in any literal are all findings. A Symbol.for whose argument is not a plain literal or a same-file const bound to one is a finding too. Comments are told from code by maskComments (js-comment-mask.mjs) rather than a private line rule, so a // inside a string or a /* ... */ span on the same line no longer hides a call. The bare run now reads examples/ and apps/ as well as packages/; --ts-only keeps the core pin's packages/**/*.ts radius. The stale-row message names both remedies. The self-test grows to 37 batteries. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
…or the dispatch derivation The census walks packages/, examples/ and apps/ whole, and the dispatch derivation refuses a bare root word as too generic, so SCAN_ROOTS alone left the gate in no dispatch brief. ROOT_DIR_WATCH_HINTS spells the same three roots as subtrees, as check-org-identifier.mjs does over the same roots, and two self-test batteries hold it equal to SCAN_ROOTS. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
check-watch-hint-literal reads the declaration as a literal array of strings; an Object.freeze wrapper is a computed spelling to it. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
|
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc Contract reviewServed-tier: Reviewed at 2026-11-07T06:32Z, round 2. Face: rules, read off the PR's file list by ① Derived judgmentsRound-1 must-fix 1 — every mention that is not a counted call in an allow-listed file is a finding. Closed in code. Trying to miss a call site again. Read, not run; every line is a trace through the regexes above.
Round-1 must-fix 2 — the shared mask. Closed. Round-1 should-fix 3 — the bare run reads Round-1 should-fix 4 — the stale-row message names both remedies. Closed. "Remove the stale row in the same change, or restore the call it pins if its removal was not meant"; the battery asserts the second clause by text. The
Accept-set changes — what goes red. On a tracked or untracked, non-ignored, non-test file of extension What stays green. Test files by name ( Is the self-test genuinely wired, and does its floor hold? Yes on both. The root alias is The pin's radius, one input short. The Does the workflow edit add or change a required context? No. The hunk edits the Checks on the head. Every check-run on ② Semver levelNo published package moves. The only file under a package is ③ Boundary flags
④ Design judgmentThis is the sibling gates' shape, and closer to it than round 1's head: an allowlist whose rows carry a The one-rule redesign ("a mention the census cannot count is a finding") is the direction round 1 asked for and the one the sibling headers prefer: a false red over a quiet green. Its false reds are enumerable and cheap — a destructured dynamic import or What remains is boundary prose and one declared input, not machinery: the header should say in one sentence what no text census sees (an assembled or escaped name; a symbol read off an already-marked context), the way the sibling pin states what it declined to chase; the mask belongs in the pin's declared inputs by the table's own precedent; and the Must-fix
Should-fix
Implemented-by: VERDICT: PASS |
|
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc 席位核对ACCEPT · 2026-11-07T06:33Z · head
Generated by Claude Code |
security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc
Clause-②: no
Metadata-protocol: none
维护者速读
check:vouch-for-reference-callers:在packages/、examples/、apps/下,只有 file-attachments 写入方(file-attachment-service.ts,恰 2 处直接调用)可以设置 vouched-reference 标记;对vouchForReference、VOUCHED_REFERENCES或其 Symbol 描述的任何其它写法(改名、命名空间、别名、.call、方括号、defineProperty、看不懂的Symbol.for参数)都转红并点名文件与行。scripts/check-vouch-for-reference-callers.mjs的censusOf与ALLOWED_CALLERS;②.github/workflows/lint.yml的 Single authz resolver guard 步骤;③scripts/cross-package-test-inputs.mjs的 core 条目注释(packages/**.ts边界)。pnpm check:vouch-for-reference-callers,预期两行 ✓:self-test 39 cases pass,以及file-attachment-service.ts (2)。.github/workflows/**(Tier H),需要维护者合并或授权批准。What changes
The only production code that may set the vouched-reference mark (
vouchForReference,@objectstack/core) ispackages/services/service-storage/src/file-attachment-service.ts, at exactly two call sites (attachFileAsandattachUploadAs). This PR adds a call-site census gate that holds that rule.scripts/check-vouch-for-reference-callers.mjs. Outside the defining module, every mention ofvouchForReference,VOUCHED_REFERENCESor the key'sSymbol.fordescription, in code or in a string literal, is exactly one of three things:import/export … fromspecifier, which sets nothing..call/.apply,requiredestructuring, the key as a computed property or as an argument toObject.defineProperty/Reflect.set, and the description in any literal.A
Symbol.for(…)whose argument is not a plain literal, an unsubstituted template, or a same-fileconstbound to a plain literal is a finding too. Counted calls are held equal toALLOWED_CALLERS. A new caller, a count that moves either way, or a stale row is red. The stale-row message names both remedies: remove the row, or restore the call. Code is told from comments bymaskComments(scripts/js-comment-mask.mjs), andSymbol.forarguments are read offmaskCommentsAndLiterals. Test files are outside the census, and an empty scan is refused. The--self-testcarries a 39-battery roster with a floor and the verdict handshake.Surfaces. The bare run reads
packages/,examples/andapps/over every source extension. It runs in the lint step on every PR, uncached, and it is the authority.--ts-onlyreadspackages/**.tsalone. That is the radius of the@objectstack/corepin (its declaration-table entry andtest:repoturbo inputs, which also name the script), so what the pin judges equals what re-runs it.ROOT_DIR_WATCH_HINTSspells the three roots as subtrees for the dispatch derivation, ascheck-org-identifier.mjsdoes over the same roots. The self-test holds it equal toSCAN_ROOTS.Root alias
check:vouch-for-reference-callers(self-test, then scan), wired into the existingSingle authz resolver guardstep oflint.yml. No new check context and no new required-status entry.packages/core/src/security/vouched-reference-callers.pin.test.ts, listed invitest.repo-tests.json, runs--self-testand--ts-onlywhereTest Coreruns them.The allowlist was re-read against
main(37371559b): the file holds exactly twovouchForReference(calls, and nothing else under the three roots mentions the mark outside a comment. The tree has 57Symbol.forcode sites, and all of them are readable.Tests
repoproject: 7 files / 96 tests pass onef6658f2d1. The pin is compiled bytsconfig.test.jsonwith no new test-typecheck debt.scripts/ablation-replace.mjs, with the restore proven by blob equal to HEAD and an emptygit diff HEAD. Each injection reds the bare run, naming the file:packages/rest/src/query-allowlist.ts(also red under--ts-only, and the pin goes red);attachFileAscall (row pins 2, file holds 1);import { VOUCHED_REFERENCES as MARK }(line 2);Symbol.for(PREFIX + …)with an imported constant (line 3);vouchForReference(line 3);'https://…'on the same line;examples/app-crm/src/actions/convert-lead.action.ts, which is green under--ts-onlyby design;.mjsfile underpackages/, which is green under--ts-onlyby design.Symbol.forargument rule off: 2;maskCommentsswapped for a//-to-end-of-line strip: 2;examples/appsdropped fromSCAN_ROOTS: 1;ROOT_DIR_WATCH_HINTS: 2 and 1.lint.ymlredscheck-self-test-wired(alias-self-test-not-run).Acceptance notes
.github/workflows/lint.yml.check-governed-merges --prnames exactly that path, landing tier H, 588 changed lines, under the 3,000-line threshold.*.test.tsin@objectstack/core, which shipsdistonly. Check Changeset route 2 applies, through theskip-changesetlabel.bash -e, so a redcheck:authz-resolverstops the census from running in that same step. The step is red either way.Verification
Gate run
Derived gate families
dispatch-gates --commandsderives 94 commands on the final headef6658f2d1; all 94 exit 0 and--ranreconciles 94 run, 0 unrun.dispatch-gates --self-test --fast(1954 cases),bare-root-worklist --self-test,check-watch-hint-literal --self-test,check-self-test-wiredandcheck-comment-mask-adoptionare green, and every check-run onef6658f2d1concluded success or skipped.Generated by Claude Code