Skip to content

test(core): give the vouched-reference census pin a scan budget and declare its census imports as inputs - #31105

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/sec-hardening-r22
Nov 7, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/sec-hardening-r22

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:vouched-reference 调用点普查的 core pin 两个测试各带显式时限 SCAN_TIMEOUT_MS = 60_000(与同目录 operation-private-keys 扫描 pin 同值);普查脚本 import 的 scripts/js-comment-mask.mjs 与 scripts/invoked-as.mjs 登记为 @objectstack/core 的跨包测试输入(声明表 + turbo.json 的 core#test:repo),并在声明表里以该 pin 作 heldBy 见证。
  • 为什么改:--ts-only 扫描读 packages/ 下全部 .ts,闲机约 1 秒;繁忙 runner 上会越过 vitest 默认 5 秒,测试在任何断言前超时,把无关 PR 和合并队列批次一起拖红。另外普查导入的两个模块一改,pin 的判定就会变,但此前改它们不会重跑这个 pin,也不会让 turbo 缓存失效。
  • 风险与回滚:只改测试与仓根配置,不发布任何包、不改运行时;回滚即还原这 3 个文件。
  • 先看:① packages/core/src/security/vouched-reference-callers.pin.test.ts 的 SCAN_TIMEOUT_MS 及两处 it 末参;② scripts/cross-package-test-inputs.mjs 的 @objectstack/core 条目(globs 与新增 heldBy);③ turbo.json 的 @objectstack/core#test:repo inputs。
  • 两分钟验证:pnpm check:cross-package-test-inputs,预期末行 OK: 32 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob。
  • 需要你做的:无,席位落地。

What changes

  • Scan budget. Both tests in vouched-reference-callers.pin.test.ts spawn the census (--self-test, then --ts-only) and ran under vitest's default 5000 ms test timeout. The --ts-only scan reads every .ts file under packages/. On a runner that is building the monorepo at the same time, it can overrun that timeout, and the test then fails with Test timed out in 5000ms before any assertion runs. Each it now passes SCAN_TIMEOUT_MS (60 s), and a one-paragraph docblock gives the reason. This is the same constant name, value and shape as the sibling scan pin operation-private-keys.pin.test.ts. No repo gate registers or spells per-test timeouts. The file-level // test-budget: header grammar in scripts/measure-test-shard-timings.mjs is for files over the 10 s wall line, and this file runs in about 1.2 s, so it does not apply.

  • Census imports declared as inputs. The census imports ./js-comment-mask.mjs, which decides what counts as prose, and ./invoked-as.mjs, which decides whether its dispatch runs. js-comment-mask.mjs also imports invoked-as.mjs. An edit to either file moves the pin's verdict, so both are now:

    • globs of the @objectstack/core entry in scripts/cross-package-test-inputs.mjs, next to the census script itself;
    • inputs of @objectstack/core#test:repo in turbo.json.

    The review asked for js-comment-mask.mjs. invoked-as.mjs belongs to the same import closure, so it is included as the same omission.

  • heldBy witness. check:cross-package-test-inputs cannot see from the pin's quoted paths that it reads these two files, because only the spawned child loads them. On the first commit it flagged both globs as "held by nothing". The entry now names the pin as their heldBy witness, which is that gate's second disposition: the read is real, and the scan cannot name it.

Tests

  • Core repo project on ce6158a02f: 7 files and 96 tests pass. The two pin tests take 91 ms (--self-test) and 1091 ms (--ts-only) on a 4-core container while other gates run.
  • The census run alone on the same tree: --self-test takes 0.09 s and passes 39 cases. --ts-only takes 1.07 s to 1.15 s over 3 runs and stays green at file-attachment-service.ts (2). The scan is not restructured in this PR.
  • pnpm --filter @objectstack/core typecheck: exit 0. The test layer holds at its pinned 4 signatures.

Acceptance notes

  • Changeset: none. The diff is one *.test.ts in @objectstack/core, which ships only dist, plus root config (turbo.json, scripts/). Nothing published moves, so skip-changeset applies, the same as for the census PR. The label is not applied here; the seat applies it.
  • No ablation was run. The diff changes a test timeout and input declarations, not tested behaviour.
  • check:dual-build-cjs-loads is NOT MEASURED locally. It needs every package's dist (PREREQUISITE NOT MET, exit 3) and is left to CI's Lint & Repo Gates.

Verification

Derived gates on ce6158a: 69 derived, 68 exit 0, 1 NOT MEASURED

node scripts/pm/dispatch-gates.mjs --commands (change set vs merge base 465c2bea3, 3 files) derived 69 commands. Every one was run on ce6158a02f, and the exit code was captured before any pipe. 68 exited 0. pnpm check:dual-build-cjs-loads exited 3 (PREREQUISITE NOT MET). Reconciliation:

dispatch-gates --ran: 69 derived famil(ies) accounted for — 68 run, 1 NOT-MEASURED (1 DERIVED from a recorded exit 3).

pnpm check:cross-package-test-inputs, which was red on the first commit and is green after the heldBy witness:

All 261 self-test cases passed.
OK: 32 package(s) read outside themselves, all declared, and turbo.json hashes every declared glob (6 of them on a split "test:repo" task)

Generated by Claude Code

…eclare the census's imports

Both tests of vouched-reference-callers.pin.test.ts spawn the census under
vitest's default 5 s timeout; the --ts-only scan reads every .ts file under
packages/ and can overrun that on a busy runner, failing before any assertion
runs. Each test now takes SCAN_TIMEOUT_MS (60 s), the budget of the sibling
operation-private-keys scan pin.

The census imports scripts/js-comment-mask.mjs and scripts/invoked-as.mjs, so
an edit to either moves the pin's verdict; both are now @objectstack/core
inputs in cross-package-test-inputs.mjs and core#test:repo in turbo.json.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
… imports

check:cross-package-test-inputs cannot see the census's own relative imports
from the pin, which quotes only the census path, so it read the two new globs
as unheld. The pin is the test that loads them (through the spawned child);
record it as their heldBy witness.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L9qibvynRbCtMndW8EHNGc
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

Nothing in this diff resolved to a documentable surface (no symbol, route or SDK anchor derived from 0 changed package(s)), so this run has no opinion about the docs.

What this run could not see

Coarse fallback — 0 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json a61f61a46ea4cf33ed2edce9af0989a668e75f10 → packageMentionDocs.

@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 7, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

Contract review

Served-tier: TIER_DEFAULT
Head-sha: ce6158a02ff101f92a0d2cb1efdb531138490e77
Local-runs: none

Reviewed 2026-11-07T09:44Z. Face: declaration, read off the PR's three paths with record-recognisers --template --paths: no published schema, no path the governed register names, and the body's Clause-②: no carries no (narrowing) arm, so the review owed is the declaration face and its one exact tier is TIER_DEFAULT. The seat's order named CONTRACT_REVIEW_TIER; the recogniser holds the tier to the face the committed tree decides and accepts no floor, so this record stands at the face's tier and is written at full-review depth anyway. Read-only: the body, the file list, the three-dot diff against main (merge base 465c2bea3), the head's check-runs, the cited code on main at a61f61a46e, and the CI log of the shard the body cites. Nothing was built, run or re-run on the PR's tree.

① Derived judgments

The budget is the sibling's shape, and 60 s is the right value. operation-private-keys.pin.test.ts on main declares const SCAN_TIMEOUT_MS = 60_000; under a docblock and passes it as each it's last argument; this PR does the same thing by the same name, value and position in the sibling file, one directory over, with a docblock that gives its own reason. No vitest config in the chain sets testTimeout (vitest.preset.mts, packages/core/vitest.config.ts), so the pin ran at the 5000 ms default. The timeout the body cites is real and is not the dev's account: the first attempt of Test Core (2/8) on the sibling PR's head c97eb416db, started 2026-11-07T08:36Z, ends with Test timed out in 5000ms at vouched-reference-callers.pin.test.ts:39:3, the --ts-only case, with the file at 6255 ms; the re-run of the same job passed. 60 s is about ten times the loaded reading and the same headroom the sibling chose for the same kind of runner. It hides no slowness: the file-level wall gate (measure-test-shard-timings, the 10 s line and the // test-budget: header) grades the file's duration independently and report-only, so a scan that really grows still surfaces there; what the budget removes is a red that says nothing about the mark, raised before any assertion runs. The self-test case gets the same budget on a stated reason (same process start, same runner), which is how the sibling applies its constant too. Clocked windows measure behaviour here, not loading: the test spawns the census and clocks the scan, so check:test-source-alias's convention is untouched.

The inputs are complete and nothing extra is declared. The census's import closure on main is ./invoked-as.mjs and ./js-comment-mask.mjs, and js-comment-mask.mjs itself imports ./invoked-as.mjs; beyond that only node builtins. Its file set comes from git ls-files under the scan roots, which with --ts-only is the .ts surface of packages/ already declared as packages/**/*.ts. js-comment-mask.d.mts is not loaded by an .mjs importer and is rightly left out. Both helpers are added to the @objectstack/core globs in scripts/cross-package-test-inputs.mjs and to @objectstack/core#test:repo inputs in turbo.json, spelled exactly as the build and *#build tasks on main already spell them. Layer C holds without an edit: ci.yml's core filter lists both files by name and crosspkg carries scripts/**, and the head's filter check-run is green.

The heldBy witness is honest under the gate's dispositions. globHolderVerdict holds a glob mechanically when a path an escaping test quotes lands in it, or by declaration when heldBy names a test that is still one of the package's escaping tests. The pin quotes only the census path, so no quoted path lands in either helper; the read is real because the spawned child loads both and their bytes move the pin's verdict. That is the gate's second disposition (a read the scan cannot name), and the entry's comment says plainly that the child, not the pin, loads them. The witness is checked in the failing direction: the pin is an escaping test only through its resolve(HERE, '../../../../scripts/...') seed, so if it stopped escaping the glob would fail by name rather than sit declared and unheld. The table already carries a precedent for declaring an import rather than a file read (the cli entry's js-comment-mask.mjs).

skip-changeset is right. The diff is one *.test.ts in @objectstack/core, which publishes dist only, plus root turbo.json and scripts/, neither of which is published. Nothing a consumer installs moves. Clause-②: no and Metadata-protocol: none are the correct declarations, and the Check Changeset run on the head is green.

No required context and no test behaviour changes. The two assertions are byte-identical to main; only the budget argument is added. No workflow, no .claude/**, no skills/**, no ADR, no spec. The head repo is the base repo, so this is a delivery, not a fork proposal. The Governed Surface Queue Guard on the head is green.

② Semver level

None. No released package's published surface moves; the PR correctly ships no changeset and carries skip-changeset.

③ Boundary flags

  • Governed surfaces: none touched (register read through reviewFace; the guard check-run agrees).
  • Spec / ADR / North Star: untouched.
  • Tooling and test only: packages/core test layer, the cross-package input table, turbo.json.
  • Size: 33 additions, 5 deletions, 3 files, size/s.
  • Check-runs at the time of this record: Governed Surface Queue Guard, Check Changeset, Check PR Size, filter, PR-body guards, Plan Test Core shards, Dogfood Regression Gate are green; Test Core (1/8) to (8/8), Build Core, every Lint · and Type Check · job, Build UI Deps and Live E2E UI are still in progress. This PASS is conditional on those pending required contexts finishing green; a red among them re-opens the verdict.
  • Should-fix, not blocking: the detector cannot follow a spawned root script's import closure, which is why a witness was needed at all. The dispatch-gates derivation already follows a gate's first-party imports one level; a card to teach check-cross-package-test-inputs the same hop would let these two globs be held mechanically and retire the witness. File it; do not widen this PR for it.

Implemented-by: claude/sec-hardening-r22
Reviewed-by: session_01L9qibvynRbCtMndW8EHNGc

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#1 · os-tesla · session_01L9qibvynRbCtMndW8EHNGc

席位核对

ACCEPT · 2026-11-07T09:59Z · head ce6158a02ff101f92a0d2cb1efdb531138490e77

  • Contract review: PASS at this head on the declaration face, at that face's exact tier TIER_DEFAULT, record 6705210877. The recogniser's face holds over the seat's order. It was conditional on CI, and every check-run is now green. There is no must-fix. Its one should-fix goes into this seat's follow-up list: teach the cross-package input probe to follow a spawned root script's import closure, so this entry's declared holder can retire.
  • What lands: the vouched-reference census pin from chore(ci): census the call sites that set the vouched-reference mark #31086 gets an explicit scan budget, SCAN_TIMEOUT_MS = 60_000, in the same shape as the sibling operation-private-keys pin. Its assertions are unchanged. Under the default 5 s budget, a busy runner timed out before any assertion ran: fix(rest, runtime)!: the /meta action doors and MCP list_actions serve an action entry as the object door projects it (ADR-0106) #31104's Test Core (2/8), and that PR's merge-queue build. The census's two imported helpers become declared inputs of the core pin, both in the cross-package table, with a declared holder, and in the turbo inputs.
  • Checks: all 63 check-runs are green (53 success, 10 skipped), and Check Changeset is skipped under skip-changeset. git merge-tree against current main is clean.
  • Gates (dev, at this head): dispatch-gates --commands derived 69 and ran 68 green. The one left to CI is check:dual-build-cjs-loads, because it needs every package's dist. The core repo project passes 7 files and 96 tests. The census scan takes about 1.1 s on an idle machine.
  • Shape: base main, no closing keyword, test and tooling only. Clause-②: no, Metadata-protocol: none, skip-changeset.
  • Governed: check-governed-merges.mjs --pr 31105 says not governed, with 38 changed lines, so Tier S.
  • Landing authority: the maintainer's standing approval for this seat's security PRs at Tier S, given 2026-11-06 in the seat's thread. This fixes a test budget that the seat's own chore(ci): census the call sites that set the vouched-reference mark #31086 introduced.
  • Next: relay pr_ready + automerge_enable, then re-queue fix(rest, runtime)!: the /meta action doors and MCP list_actions serve an action entry as the object door projects it (ADR-0106) #31104 once this is on main.

Generated by Claude Code

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 7, 2026 10:00
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 7, 2026 10:00
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 7, 2026
Merged via the queue into main with commit 0ba68b6 Nov 7, 2026
69 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/sec-hardening-r22 branch November 7, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant