Skip to content

Commit 4a00b2b

Browse files
test(verify): warm the first boot at module scope and declare budgets on the files still over 10 s (#23181 slice 18) (#27548)
<!-- claude-projects-attribution: {"github_login":"os-sales"} --> _Requested by **Sales** · [project thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuGToctYbgzCLJHD15UdEDwi)_ Part of #23181 (slice 18). The card is a series and stays open. Clause-②: no Metadata-protocol: none Test-only diff: `skip-changeset`. Six files under `packages/verify/src/`, all `*.test.ts`; `@objectstack/verify`'s `files[]` ships `dist` only, and no `files[]` changes in any package. ## 维护者速读 - 改了什么:verify 包 4 个测试文件在模块顶层先做一次 `warmUpBoot`(冷启动不再算进第一个用例的计时);仍超 10 s 的 5 个文件在第 2 行加 `// test-budget:` 声明。只动测试文件。 - 为什么改:卡 #23181 要求单个测试文件不超过 10 s;这 4 个文件的第一次启动是冷的,多付 2–4 s。剩下的耗时是每个夹具各启动一次真实栈,按裁决 6181973363 B 声明实测预算。 - 风险与回滚:不改断言、超时与分层;预热只启动一个不带对象的临时应用并停掉。回滚即 revert 本 PR。 - 先看:`packages/verify/src/harness.required-providers.test.ts`(预热带 `requires: ['approvals']`)、`packages/verify/src/dashboard-window.test.ts` 第 2 行(预算最大,100 s)。 - 两分钟验证:`pnpm --filter @objectstack/verify exec vitest run --maxWorkers=2 src/dashboard-window.test.ts src/harness.required-providers.test.ts`,预期 2 个文件全绿,dashboard-window 比 main 上快约 3–4 s。 - 需要你做的:无,席位落地。 ## What changes **Warm-up (the PM hypothesis, measured and holding).** `dashboard-window`, `unique-scope`, `parent-write-reach` and `harness.required-providers` booted cold inside their first hook or case. Each now calls `await warmUpBoot(...)` at module scope, on a line of its own, as `harness.one-composition` already does (`boot-warm-up.testkit.ts`). `required-providers` warms with `requires: ['approvals']`, the requires of its first boot. None of the four asserts on the state the warm-up moves (the harness data key, `NODE_ENV` before the first boot, a once-per-process notice, or an environment variable read once): checked by reading each file, no `process.env` or `NODE_ENV` in any of them. **Budget header (ruling record 6181973363, letter B).** Five files are still over 10 s locally after the warm-up, and each boots the real stack once per single-cause fixture. Each carries one line at line 2: `// test-budget: N — spawns the real producer once per single-cause fixture: REASON`, N = the slowest CI reading x 1.25, rounded up to the next 10 s. The class is the one the in-process boot files already use (`packages/cli/src/commands/migrate/audit-key-material.archive.integration.test.ts` declares it for served-shape boots). | file | change | slowest CI reading (s) | budget | |:--|:--|--:|--:| | `src/dashboard-window.test.ts` | warm-up + header | 73.29 | 100 | | `src/parent-write-reach.test.ts` | warm-up + header | 63.34 | 80 | | `src/unique-scope.test.ts` | warm-up + header | 61.38 | 80 | | `src/held-session-vendor-admin-doors.pin.test.ts` | header | 32.65 | 50 | | `src/harness.one-composition.test.ts` | header (warm-up already there) | 17.89 | 30 | | `src/harness.required-providers.test.ts` | warm-up | (not in the window's list) | under 10 s locally, no header | Card rows this closes: `src/harness.required-providers.test.ts` (under 10 s locally after the warm-up; the next refresh PR's list is the pin), and `src/dashboard-window.test.ts`, `src/parent-write-reach.test.ts`, `src/unique-scope.test.ts`, `src/held-session-vendor-admin-doors.pin.test.ts`, `src/harness.one-composition.test.ts` by declared budget. ## Why **The readings.** The CI numbers are refresh PR #25960's window (hourly runs 40200279306 to 40272142430), the newest shard-timings refresh on `main`; every reading above is from run 40200279306, and each file has 2 executed readings in the window. The scheduled `ci.yml` runs since then replayed `@objectstack/verify` from cache (run 40839660599's aggregator lists it among the cache-replayed packages), so they carry no fresh reading, and the shard logs the API serves are cut to their last 5000 lines, which do not reach this package. The readings were taken before the warm-up, so the budgets are conservative for the three warmed files. **Why the header and not more.** After the warm-up, each file's wall is distinct boots plus one proof run per boot: dashboard-window boots 4 apps (the fixture app, the drop and zero negative controls, the day-turn app), parent-write-reach 3, unique-scope 8 over 6 fixtures (two controls plant then re-open one database file), one-composition boots each case's subject, and held-session-vendor-admin-doors boots once with SCIM and SSO on, then signs in per door per held state. No (boot, options, fixture) triple repeats inside a file, so there is nothing to share in one `beforeAll`. **held-session-vendor-admin-doors takes no warm-up.** Its `beforeAll` sets `OS_SCIM_ENABLED` and `OS_SSO_ENABLED` before its boot, and the testkit forbids a warm-up for a file that changes, after the warm-up, an input a module may read once. Its slow part is a boot inside `beforeAll`; slice 17's note called it a module-level boot, which it is not. ## Tests Full `@objectstack/verify` suite, three runs before (on `origin/main` `57c51aab4`) and three after (on `ee4e8659`, before the main merge), each `cd packages/verify && pnpm exec vitest run --maxWorkers=2 --reporter=default` in its own `os-verify-lock` hold on a shared 4-vCPU container. Every run: `Test Files 46 passed (46)`, VERDICT command-exit 0. <details><summary>Per-file wall (s), vitest module line, runs 1/2/3</summary> | file | before | after | |:--|:--|:--| | `src/dashboard-window.test.ts` | 22.60 / 19.82 / 22.80 | 17.88 / 17.27 / 18.77 | | `src/parent-write-reach.test.ts` | 20.56 / 17.90 / 19.32 | 15.31 / 14.92 / 15.56 | | `src/unique-scope.test.ts` | 15.71 / 15.03 / 17.74 | 14.65 / 13.91 / 15.84 | | `src/harness.one-composition.test.ts` | 10.54 / 10.34 / 11.72 | 10.60 / 10.36 / 11.54 | | `src/harness.required-providers.test.ts` | 8.03 / 8.82 / 10.37 | 7.12 / 6.96 / 8.25 | | `src/held-session-vendor-admin-doors.pin.test.ts` | 8.63 / 8.87 / 10.20 | 9.07 / 8.93 / 10.54 | Every other file in the package read under 10 s in all six runs. </details> One more full-suite run on `89120bc9` (the first `main` merge, after the gates): `Test Files 46 passed (46)`, VERDICT command-exit 0; dashboard-window 20.58, parent-write-reach 16.29, unique-scope 15.64, one-composition 10.74, held-session-vendor-admin-doors 9.44 s, each under its budget. The head `4e0c26a9` adds only a second `main` merge (no file in this diff changes); `Test Core` on this PR is its reading. <details><summary>Header parse</summary> All five lines parse through `readTestBudget` (`scripts/measure-test-shard-timings.mjs`): each returns its budget (100/80/80/50/30) at line 2, class `spawns the real producer once per single-cause fixture`. </details> `pnpm --filter @objectstack/verify typecheck`: VERDICT command-exit 0 (`check:test-typecheck: OK`). `pnpm exec eslint --no-inline-config` on the six files: exit 0. No ablation: no tested behaviour changed. ## Acceptance notes - Five more `@objectstack/verify` files are over 10 s in the same CI window but under 10 s in all six local runs, so this slice leaves them for the next refresh to re-read: `src/harness.key-custody.test.ts` 22.41 s (takes no warm-up by the testkit's own rule), `src/harness.app-default-profile.test.ts` 18.90, `src/handle.test.ts` 17.30, `src/harness.org-context.test.ts` 16.60 (all three already warm up), `src/held-session-impersonation-target.pin.test.ts` 16.43. CI wall in this package runs about 3 to 4 times the local wall (dashboard-window 73.29 s on CI against 22.80 s here). - Branch `claude/project-thread-qpz9u8` is the card thread's harness-assigned branch; claim 6495182333 names it. ## Verification Local, on `89120bc9`: `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` derived 48 families; each run with its exit captured by redirect before any pipe. 46 exit 0 on the first pass; `check-plugin-teardown-shape.mjs --self-test` exit 3 (shallow clone) then 0 after fetching its pinned fixture commit; `pnpm check:dual-build-cjs-loads` exit 3 (packages outside the verify closure had no dist) then 0 after building them. `--ran`: `48 derived famil(ies) accounted for — 48 run, 0 NOT-MEASURED`, exit 0, and the same on `4e0c26a9`. Repo-wide `pnpm lint` is CI's. --- _Generated by [Claude Code](https://claude.ai/code/session_01L6bhgTaB4SPm2t72GW1X9n)_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01L6bhgTaB4SPm2t72GW1X9n --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 72c0152 commit 4a00b2b

6 files changed

Lines changed: 29 additions & 0 deletions

‎packages/verify/src/dashboard-window.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
// test-budget: 100 — spawns the real producer once per single-cause fixture: four in-process boots of the real stack (the fixture app, the drop and zero negative-control apps, the day-turn app), each running the family's proofs once on a frozen clock; slowest CI reading 73.29 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up; read before this file paid its first boot at module scope
23
//
34
// The dashboard date-window family — what it reads from the metadata, what it
45
// proves on a real stack, and the controls that keep its green honest:
@@ -32,13 +33,19 @@ import { defineStack } from '@objectstack/spec';
3233
import { DATE_RANGE_PRESETS } from '@objectstack/spec/data';
3334

3435
import { bootStack, type VerifyStack } from './harness.js';
36+
import { warmUpBoot } from './boot-warm-up.testkit.js';
3537
import {
3638
deriveDashboardWindowCases,
3739
runDashboardWindowProofs,
3840
formatDashboardWindowReport,
3941
type DashboardWindowReport,
4042
} from './dashboard-window.js';
4143

44+
// The boot's first load, paid during collection rather than in the first
45+
// case's clock (see `boot-warm-up.testkit.ts`). The first boot below uses the
46+
// default options.
47+
await warmUpBoot();
48+
4249
// Booting the full in-process stack runs well past vitest's 5s default.
4350
const BOOT_TIMEOUT = 120_000;
4451
const RUN_TIMEOUT = 240_000;

‎packages/verify/src/harness.one-composition.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
// test-budget: 30 — spawns the real producer once per single-cause fixture: each case boots the real stack as its own subject (the instance rule, a re-boot, a refused boot), the first load paid at module scope; slowest CI reading 17.89 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up
23

34
/**
45
* #22301 item 1, ruling A — ONE composition rule: for one configuration,

‎packages/verify/src/harness.required-providers.test.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ import { afterEach, describe, expect, it } from 'vitest';
2929
import { CAPABILITY_PROVIDERS } from '@objectstack/core';
3030
import { composeStacks, defineStack } from '@objectstack/spec';
3131
import { bootStack, type VerifyStack } from './harness.js';
32+
import { warmUpBoot } from './boot-warm-up.testkit.js';
33+
34+
// The boot's first load, paid during collection rather than in the first
35+
// case's clock (see `boot-warm-up.testkit.ts`). The first boot below requires
36+
// `approvals`, so its provider is loaded here too.
37+
await warmUpBoot({}, { requires: ['approvals'] });
3238

3339
const APPROVALS = 'com.objectstack.service.approvals';
3440
const REALTIME = 'com.objectstack.service.realtime';

‎packages/verify/src/held-session-vendor-admin-doors.pin.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
// test-budget: 50 — spawns the real producer once per single-cause fixture: one in-process boot of the real stack with SCIM and SSO on, then sign-ins per door under each held state armed in turn; slowest CI reading 32.65 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up
23

34
/**
45
* ADR-0069 D3 at the platform-admin doors better-auth serves itself, on a real

‎packages/verify/src/parent-write-reach.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
// test-budget: 80 — spawns the real producer once per single-cause fixture: three in-process boots of the real stack (the fixture app and the negative and attribution controls under parentWriteReachSecurity, and one without it), each running the family's proofs once; slowest CI reading 63.34 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up; read before this file paid its first boot at module scope
23
//
34
// The parent-derived write reach family — what it reads from the metadata,
45
// what it proves on a real stack, and the controls that keep its green honest:
@@ -21,6 +22,7 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest';
2122
import { defineStack } from '@objectstack/spec';
2223

2324
import { bootStack, type VerifyStack } from './harness.js';
25+
import { warmUpBoot } from './boot-warm-up.testkit.js';
2426
import {
2527
deriveParentWriteReachCases,
2628
runParentWriteReachProofs,
@@ -29,6 +31,11 @@ import {
2931
type ParentWriteReachReport,
3032
} from './parent-write-reach.js';
3133

34+
// The boot's first load, paid during collection rather than in the first
35+
// case's clock (see `boot-warm-up.testkit.ts`). The boots below differ only in
36+
// their app and its security source, which the warm-up does not share.
37+
await warmUpBoot();
38+
3239
// Booting the full in-process stack runs well past vitest's 5s default.
3340
const BOOT_TIMEOUT = 120_000;
3441
const RUN_TIMEOUT = 180_000;

‎packages/verify/src/unique-scope.test.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
// test-budget: 80 — spawns the real producer once per single-cause fixture: eight in-process boots of the real stack over six fixtures (single-posture, walled, the within control and the indexes[] attribution control that each plant then re-open one database file, the across control, the attribution control), each running the family's proofs once; slowest CI reading 61.38 s (run 40200279306, refresh PR #25960's window (hourly runs 40200279306 to 40272142430)) x 1.25, rounded up; read before this file paid its first boot at module scope
23
//
34
// The unique-scope family — what it reads from the metadata, what it proves on
45
// a real stack, and the controls that keep its green honest:
@@ -31,13 +32,19 @@ import { join } from 'node:path';
3132
import { defineStack } from '@objectstack/spec';
3233

3334
import { bootStack, type VerifyStack } from './harness.js';
35+
import { warmUpBoot } from './boot-warm-up.testkit.js';
3436
import {
3537
deriveUniqueScopeCases,
3638
runUniqueScopeProofs,
3739
formatUniqueScopeReport,
3840
type UniqueScopeReport,
3941
} from './unique-scope.js';
4042

43+
// The boot's first load, paid during collection rather than in the first
44+
// case's clock (see `boot-warm-up.testkit.ts`). The first boot below uses the
45+
// default options.
46+
await warmUpBoot();
47+
4148
// Booting the full in-process stack runs well past vitest's 5s default.
4249
const BOOT_TIMEOUT = 120_000;
4350
const RUN_TIMEOUT = 180_000;

0 commit comments

Comments
 (0)