Skip to content

test(spec): the gate-spawning beforeAll in check-liveness.test.ts runs under the case budget (#21421) - #21433

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-21421-liveness-hook-budget
Oct 2, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-21421-liveness-hook-budget

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Fixes #21421

Clause-②: no

The one hook in packages/spec/scripts/liveness/check-liveness.test.ts that spawns the whole liveness gate (the beforeAll of the tombstone describe, #19062) now runs under the budget its sibling cases already run the same gate under, instead of vitest's 10 s default hookTimeout. Test-only: no runtime, spec, config or published file changes.

Changes

One file, +105 / -1 (1673 to 1777 lines).

  • const GATE_BUDGET_MS = 60_000; beside runGate, with the reason it is a literal and not an import: vitest.config.ts exports no constant and cannot be imported from a test (its top level runs the filter preflights against process.argv).
  • The hook passes it: the closing }); becomes }, GATE_BUDGET_MS);.
  • A new block at the end of the file reads the file's own source with the TypeScript parser and holds three facts:
    1. the scan can see runGate as reaching spawnSync and finds lifecycle hooks (it cannot pass by scanning nothing);
    2. every beforeAll / beforeEach / afterAll / afterEach whose callback reaches spawnSync, directly or through another function in the file, passes GATE_BUDGET_MS as its timeout argument;
    3. GATE_BUDGET_MS is not below any testTimeout that vitest.config.ts declares (the three declarations all read 60000 today).

Not done, per the ruling: no skip, retry or quarantine, no change to vitest's hookTimeout, no edit to vitest.config.ts.

Hook census (A1)

22 lifecycle hooks in the file: 11 beforeAll and 11 afterAll, no beforeEach / afterEach. Exactly one reaches the gate, the beforeAll of the #19062 describe (runGate(undefined, ['--json'])). The other ten beforeAlls only mkdtempSync or cpSync the ledgers; every afterAll is rmSync. The dispatch listed ten beforeAlls; the file has eleven (the one in the #21127 block, which only creates a temp directory, was not in the list). It does not change the answer.

Evidence

  • Red before the fix. With the pin in place and the hook still unfixed: Tests 1 failed | 2 passed | 68 skipped (71), the failing case being the hook one, with beforeAll at line 1412: timeout argument absent (vitest hookTimeout default, 10 s). Line 1412 is the old line 1401 plus the 11 lines added above it.
  • Green after. The whole file at 1ea92df0fb: Test Files 1 passed (1), Tests 71 passed (71), run with vitest run --project local under the shared verify lock (322.8 s on a shared box).
  • The pin bites in both of its directions (one-off ablations, mutation proven on disk by scripts/ablation-replace.mjs, restored with blob equal to HEAD and git diff HEAD empty):
    • GATE_BUDGET_MS lowered to 9_999: the config case turns red (expected 9999 to be greater than or equal to 60000), the other two stay green.
    • the hook given an explicit but wrong 10_000: the hook case turns red (beforeAll at line 1414: timeout argument 10_000), the other two stay green.
  • Typecheck. pnpm --filter @objectstack/spec typecheck exit 0 (tsc --noEmit, check:scripts-typecheck, check:test-typecheck OK with its debt ledger unchanged). tsc --noEmit -p tsconfig.scripts.json --listFiles lists the test file once, so the scripts program does compile it.

Gates

dispatch-gates --commands derived 59 commands for this diff. Reconciled with --ran: 59 accounted for, 55 run (exit 0), 4 NOT MEASURED, 0 unrun. The four are check:dts-closure, check:dual-build-cjs-loads, check:lean-entry-closure and check:sourcemap-no-sources-content: each exited 3 (prerequisite not met, no built dist) and measured nothing. They read the published build, which this diff cannot reach: npm pack --dry-run on packages/spec lists 322 files and none under scripts/ (positive control: 83 files under liveness/). check:query-options-erasure and check:type-check-debt hit my 250 s cap on the first pass and were re-run with a larger cap: both exit 0. check:nul-bytes exit 0; control-character scan of the file clean.

Changeset

Not published: scripts/ is outside the package's files[] (pack listing above). skip-changeset is applied.

Acceptance notes

  • The third pin case (config drift) goes one step beyond the ruling's pin, to keep the one literal from drifting from vitest.config.ts. It is self-contained; deleting it leaves the other two intact.
  • This file runs in the local vitest project (vitest.repo-tests.json does not list it), not repo; both projects declare the same testTimeout.
  • Base is 39a912ea73, not merged forward. The commits that reached main since do not touch this file, vitest.config.ts or the spec package.json.

Generated by Claude Code

…s under the case budget

The beforeAll of the tombstone describe spawns the whole liveness gate but,
unlike the cases, ran under vitest's default 10 s hookTimeout: a 5 to 9 s run
had 1 to 5 s of margin and a loaded shard spent it. It now passes
GATE_BUDGET_MS (60_000, the cases' testTimeout) as its timeout.

A new block at the end of the file parses the file's own source and fails when
any lifecycle hook whose callback reaches spawnSync (directly or through
runGate) does not pass GATE_BUDGET_MS, and when GATE_BUDGET_MS falls below the
testTimeout declared in vitest.config.ts.

Claude-Session: https://claude.ai/code/session_01YDt3PzwfrkuFzUBF89WPmM
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the size/m label Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 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 8b123c0aec1128fa6c5bdc8a7a605d1deffabfa5 → packageMentionDocs.

@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Oct 2, 2026
@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review October 2, 2026 16:25
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge October 2, 2026 16:25
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Oct 2, 2026
Merged via the queue into main with commit c2c21f3 Oct 2, 2026
41 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-21421-liveness-hook-budget branch October 2, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

2 participants