Repository navigation
perf(tests): fast local hooks: one vitest run for pre-commit, one budget per hook, shared workers and caches - #9102
Conversation
…ductor The server unit setup file runs before every test file and imported Supertest into all 842 of them for a patch that applies only when CONDUCTOR_IS_LOCAL=1. Move the patch to tests/setup/conductor-supertest-loopback.ts and import it on demand. Supertest now loads in the 116 files that use it. Measured with the rest of this series (a dedicated timing host, two alternating A/B pairs, 12 workers): summed per-file vitest setup time 44 s -> 6 s. supertest-conductor-loopback.test.ts imports the patch from its new module; its assertions are unchanged.
Forty server, test and script modules imported the @adcp/sdk main barrel only for names that a narrower subpath exports as the same binding (canonicalize from /utils, AuthenticationRequiredError from /errors, LIBRARY_VERSION from /version, and so on). Loading the barrel costs about 0.4 s per test file. Import each name from its subpath; type-only names stay on the barrel, where they are erased. Every moved name was checked to be the identical object (===) on the subpath, so callers, instanceof checks and test mocks see the same values. Modules that need a barrel-only name (normalizeGovernanceVerdict, PropertyCrawler, closeMCPConnections, AdCPClient) keep the barrel. Server unit files that load the barrel: 244 -> 98 (summed import self time 96 s -> 41.5 s), measured with the rest of this series.
…st use
isomorphic-dompurify builds a jsdom window when it loads, so the 136
server unit files that reach any sanitizer paid about 0.3 s each before
running a test; linkedom, pdf-parse, mammoth and @google-cloud/kms added
about 31 s more over files that never call them.
- utils/deferred-modules.ts adds getDOMPurify() and getLinkedom(). They
load the package's ES module build synchronously on first call
(require of the path import.meta.resolve returns), the same instance a
static import gives under plain Node. The eight DOMPurify callers and
three linkedom callers use them.
- pdf-parse, mammoth and the KMS client load with await import() inside
the async functions that use them.
- index.ts awaits preloadDeferredModules() before it starts the server,
so production still loads every package at boot: a missing package
still fails the boot, and memory and first-request latency are as
before.
- vast-document-validation loads linkedom before its try block, so a
load failure is not reported as invalid XML.
Guards:
- tests/lint-narrow-imports.test.cjs (npm run test:narrow-imports, in
precommit and npm test) bans the three patterns this series removed:
barrel imports whose names all have a narrower home, static imports of
the five deferred packages under server/src, and a static Supertest
import in the setup file. Three barrel imports whose names unit tests
mock through vi.mock('@adcp/sdk') stay on a shrink-only allowlist.
- tests/unit/deferred-imports.test.ts imports each affected module in a
fresh Node process and asserts what it loads at import, on first use
and after the boot preload.
- parsePdfContent (via the indexer's _testing export) and importBrandBook
now have success tests on a valid PDF, so a broken pdf-parse load
cannot hide behind their error handling.
Measured for the series (a dedicated timing host, alternating A/B pairs, 12
workers, server unit suite): wall 133.1 / 125.6 s -> 118.3 / 116.9 s,
CPU 1432 / 1408 s -> 1244 / 1230 s. Full pre-commit hook 150.8 s
(shared baseline 179 s). Server unit tests: 14478 -> 14494 passed
(16 new), 0 failed.
Each deferred-imports probe ran in `node --import tsx`. The full tsx loader also installs a CommonJS hook that recompiles, with esbuild, every ES module package reached through require(esm), which the deferred getters do for isomorphic-dompurify and linkedom (2.1 of 6.2 CPU-s in the preload probe's profile). Production runs the compiled server with plain node, so that work was test-only. The probes now use --import tsx/esm: tsx compiles the TypeScript sources and require() is Node's own. The probes also spawn asynchronously, so the vitest timeout bounds them, and afterEach stops a probe that a timed-out test leaves. The 90 s per-test and 60 s spawnSync timeouts go; the file runs under the server config's 30 s testTimeout, unchanged since main. On a 40-vCPU Linux VM, alone: preloadDeferredModules 6.1 s -> 2.7 s, renderLegalMarkdown 2.8 s -> 1.6 s, validateInlineVastDocument 2.4 s -> 0.6 s; the file 19.1 s -> 11.6 s.
…ion-authority test The test that adcontextprotocol#9080 added imports canonicalize from the @adcp/sdk barrel, which the narrow-imports check rejects: @adcp/sdk/utils exports it.
The matched-v4 and fixed-trace evaluations rebuilt, cloned, froze, compiled and hashed the same frozen tool catalog on every simulated dispatch. Compute each result once per input that cannot change, and keep the uncached path for every other input. - Add isDeepFrozenJsonData (model-providers/capabilities.ts). It proves a value is frozen, proxy-free, accessor-free plain JSON data without running a getter or a trap, and memoizes the proof per object. Every new cache is keyed by a value this predicate accepts, or by a string. - OpenAI request projection: drop the redundant per-tool schema clone, share one frozen projection per proven-frozen tool (and per tool list), and clone only the rest of the request. Wire bytes unchanged. - Matched-v4 custody: commit each proven-frozen request once and send the committed OpenAI projection (commit-then-send), so a continuation is no longer projected and hashed twice. Hash the unchanged preimage through jsonSha256 (model-providers/json-sha256.ts), which feeds the same JSON bytes to SHA-256 and reuses the encoded bytes of recurring frozen subtrees. Every ledger requestSha256 of the 61 tests (18,058 intents) is identical before and after. - Fixed-trace: compile identity-free tool schemas once per process through model-providers/tool-schema-validator.ts (schemas with $id, anchors or external $ref keep a fresh Ajv per registration), memoize the suite and tool-schema fingerprints of proven-frozen inputs, the identity-leakage predicates by string, and the fixed-trace pricing profiles. Tests: fixed-trace-runner.test.ts "preflights fixture schemas once per complete identity" now resets the validator cache and asserts exactly 1 compile and 2 cache lookups per run (+2 lookups, +0 compiles on a repeat run, +1 compile for a changed nested schema). That is stronger than the previous exact 2: a per-dispatch preflight still raises the lookup count. New guards cover mutated nested schemas, getters, proxies, duplicate $id, non-JSON schemas, the request-hash preimage, jsonSha256 byte equality and mutation, and a structural guard against new per-call Ajv construction or tool-schema clones in addie/eval and addie/model-providers. Measured on a dedicated timing host, serial per-file runs, two alternating A/B pairs against the base (seconds): matched-v4-evaluation 73.5 / 70.8 -> 12.6 / 12.4 fixed-trace-architecture-diagnostic-execution 13.8 / 13.6 -> 3.9 / 3.8 fixed-trace-suite 13.2 / 12.8 -> 6.6 / 6.7 fixed-trace-architecture-diagnostic-runner 12.7 / 8.7 -> 2.8 / 2.7 fixed-trace-direct-full-suite 10.3 / 10.1 -> 5.4 / 5.3 fixed-trace-runner 6.0 / 4.5 -> 2.2 / 2.2
Five pre-commit test files spent most of their time starting cold tsx,
npx and tsc child processes, and two failed under load on short wall
timeouts. Each test keeps the boundary its claim needs and drops the rest.
- exact-inference: run the poison, hostile-constructor and worker probes
in fresh Worker realms of the test process (new realm-probe.mjs) instead
of ~45 tsx children. Emit the engine closure with ts.transpileModule and
the server tsconfig options instead of a full-project tsc, and run every
emitted-JS probe in one plain-node child. Pure termination probes get a
20 s bound; the two 1.5 s preflight windows now open at the worker's
ready message. The expected loader hang is proven by a flag set inside
the poisoned loop, not by a slow start. Trace events are read after the
authorization port closes, which removes the order race behind the
matrix failures. Two tests share one identical n=25 computation.
- fixed-trace-direct-full-suite-eval: export main(argv, io) behind a
direct-invocation guard. Four cells run in-process with stdout, stderr
and console spies; one cell and the ceiling rejection stay as child
processes and run concurrently.
- provider-router-diagnostic-cli: use the checkout's tsx, not npx, and run
both children concurrently. storyboard-candidate-schema-root: start both
fresh-process controls together.
- ipr-check-and-record: run git under fixtureEnv({ identity: false }), so
caller global config and hooks no longer run on every git call.
- Add lint-test-spawn-tooling: tests must not launch npx tsx/tsc or a tsc
binary.
Every existing assertion still runs; guards count real child launches.
On a dedicated timing host, A/B, warm pair: the four server files 65.2 s -> 39.2 s,
ipr-check-and-record 5.2 s -> 1.5 s. Under 12 busy loops the changed
files passed 20 of 20 runs; exact-inference failed 1 of 10 before.
The fixed-trace eval reads Addie's tool catalogs, and its validate-only entry point loaded 2871 modules (466 under server/). The catalogs live in the handler modules (admin-tools.ts has 12093 lines, member-tools.ts 8593), so every reader also loaded the handlers' services and SDKs: Stripe, WorkOS, Google Calendar, C2PA, sharp, pg and the storyboard test kits. side-effect-claims.ts loaded the training agent's whole idempotency store, with the SDK server build and the database client, for isMutatingTool(). - The 14 *_TOOLS literals move verbatim into mcp/*-tool-definitions.ts. Each imports only the AddieTool type; ADMIN_TOOLS keeps its three constant imports. Each handler module imports and re-exports its literal, so other importers are unchanged. - The catalog readers (router.ts, direct-tool-universe.ts, fixed-trace-tools.ts, fixed-trace-corpus-contracts.ts) import the definition modules. - MUTATING_TOOLS and isMutatingTool move to training-agent/ mutating-tools.ts; idempotency.ts re-exports them. The published tool definitions are byte for byte the same. validate-only now loads 846 modules (104 under server/). On a 40-vCPU Linux VM, alone: the CLI child test 11.0 s -> 3.4 s, the first in-process test 11.6 s -> 3.2 s, the file 24.7 s -> 8.2 s. The in-process tests drop their 20 s timeouts and run under the server config's 30 s; the two child tests keep main's 20 s.
… timeouts Moving the probes into Worker realms made them cheaper (0.4-4.2 s on a 40-vCPU Linux VM alone, 0.7-7.4 s in the overloaded full suite), so the raised values had no cost behind them.
…ip unchanged schema and compliance builds A storyboard process loaded both the ESM and the CommonJS build of @adcp/sdk, and every pre-push and test entry point rebuilt dist/schemas/latest and dist/compliance/latest from scratch. - The storyboard runner and the training agent import @adcp/sdk through the ESM build only; tests/run-storyboards-sdk-single-build.test.cjs traces a real discovery child and a training-agent route child and fails on any CommonJS edge into the SDK, including the creative33 and preview paths. - scripts/built-schemas.cjs records a digest of each build's inputs (sources, scripts, package.json, the installed lockfile) and skips a build whose inputs are unchanged, under a cross-process lock; build scripts and tests call `ensure` instead of building. - .husky/pre-push shares Node's compile cache (node_modules/.cache/node-compile-cache) across its processes. - The narrow-imports lint parses each file once; its script returns to the 30 s per-test timeout. The schema-root tests stop waiting on controls that already finished. tests/build-cache.test.cjs covers the digest, the lock and the CLI; its script carries a 20-minute timeout until the CLI runs asynchronously later in this PR.
…idator cache across storyboard processes Installs a local build of @adcp/sdk from vendor/: 17.0.0-beta.29 plus the adcp-client changes in perf/repeated-validation-work and perf/cross-process-caches (single-read schema-root checks, a char-code scan of generated validator code, lazy draft identity schemas, servers built without the error-arm scan, each compliance bundle parsed once per scope, the opt-in cross-process validator cache, parsed storyboard YAML and tools/list compile records in that cache). The tarball's sha256 is 0f8783daf3a12e2e6c6c5708715c7809422a102d88f6ae7f25c8d78f3576188c. package.json pins the exact version and the lock resolves it to the vendored file, so tests that read the SDK version from package.json see a version. A version bump replaces this once an @adcp/sdk release contains those changes. The storyboard matrix sets ADCP_VALIDATOR_CACHE_DIR to node_modules/.cache/adcp-sdk-validators unless it is already set (an empty value turns it off), so only the first storyboard process compiles each validator.
…in workers of 12 - .husky/pre-push runs scripts/run-storyboards-prepush.sh: the current-source and 3.0 compatibility matrices share one pool of ADCP_STORYBOARD_JOBS processes (scripts/run-storyboards-queue.mjs), sized at 1.35 physical cores and 3 GiB per process. - Isolated /sales and /creative-builder storyboards run 12 to a worker (STORYBOARD_STORYBOARDS_PER_PROCESS; 1 gives CI's model). Each storyboard keeps its own timeout, RSS, output and envelope checks; a failure ends the worker and the batch continues in a fresh one. - Every tenant log is kept under test-results/storyboards/<floor set>/ (ADCP_STORYBOARD_LOG_DIR). - runChild runs every orchestrator, matrix and wrapper asynchronously in its own process group, so the runner's 30 s --test-timeout bounds the orchestration tests; test:build-cache returns to --test-timeout=30000. The SDK build guard's two children get the caches their production counterparts get and run under the default timeout. On a 40-core VM at 14 jobs the storyboard phase drops from 547 s and 10,339 CPU-s to 151 s and 1,919 CPU-s, with every storyboard row equal. CI's storyboard jobs are unchanged.
…ompliance builds - build-schemas shares one source cache across its six MCP projections, resolves $refs from one parsed-document map per bundling run, and bundles in a worker thread beside the projection. - build-compliance runs its 20 storyboard lints in its own process, parses each YAML text once, lists the 3.x releases once in the symbol linker, and starts the link check beside the lints. - tests/build-cache.test.cjs gains three work-count guards on the traced build, and its real-build cases run under the runner's 30 s timeout. Outputs are byte-identical over 5,110 files with SOURCE_DATE_EPOCH pinned. On a 40-core VM build-schemas drops from 17.5 to 6.7 s and build-compliance from 27.9 to 7.5 s.
One patch changeset for the local pre-push storyboard work in this PR: the queue and workers of 12, kept tenant logs, one SDK build per process, the shared validator and compile caches, and the faster builds. CI is unchanged.
…e64 decoder The WorkOS SDK picks its base64 decoder when it loads: Uint8Array.fromBase64 when the runtime has the TC39 base64 API, atob otherwise. For a seal part that is not base64url, atob throws a DOMException named InvalidCharacterError and Uint8Array.fromBase64 throws a SyntaxError. isInvalidSealedBearerError recognized only the first, so under the second decoder requireAuth and optionalAuth answered a malformed sealed bearer with 503, silently. The API is built into Node 25 and later, and pdf-parse's bundled core-js installs it on import, so a process that imports pdf-parse before it first loads the WorkOS SDK gets the second decoder. In a test run that reuses workers, a file that parsed a PDF before the worker first loaded the real SDK switched the decoder for every later file: api-key-validation-timeout.test.ts failed in about 1 of 8 shuffled runs. - isInvalidSealedBearerError also accepts SyntaxError; the comment states why no other bare SyntaxError reaches those catch blocks. - The two bearer branches that answer 503 log the error at warn. - sealed-bearer-base64-decoder.test.ts loads a fresh copy of the SDK's CommonJS build with the TC39 API present and checks both middlewares answer 401; it leaves no global or require-cache state behind.
… the isolation and leak fixes that needs The server unit suite ran each of its ~850 files in a fresh process, and the pre-commit step ran it as four static shards. It now runs as one vitest run whose workers are reused across files. - scripts/precommit-server-unit.cjs runs one parallel vitest process instead of shards and keeps no serial rerun of failed files. ADCP_PRECOMMIT_SERVER_UNIT_PLAN=full|skip|auto forces the plan, and ADCP_PRECOMMIT_REPORT_DIR keeps the JSON report and per-file timings for a profiler. - server/vitest.config.ts: unit-shared (isolate: false), unit-fresh (files that mock modules, each from a fresh module graph), unit-isolated and unit-alone projects; workers are capped by memory as well as CPUs (scripts/server-unit-workers.cjs). - scripts/vitest-leak-inventory.json records each leak and its fix: env writes through vi.stubEnv, per-test fetch stubs, order-independent files, rate-limit timers stopped, CachedPostgresStore.shutdown(). It also records the sealed-bearer decoder cause, whose fix is the sealed-bearer commit in this PR. - Fixture git no longer inherits a hook's GIT_DIR and GIT_INDEX_FILE (tests/git-env-isolation.test.cjs reruns every real-git test file under a linked-worktree hook environment); training-agent tool schemas are read from leaf modules; the eval-cycle lint builds its module graph once. - New lints in precommit and npm test: test:test-git-env and test:module-eval-cycles. Laptop: 255-257 s and 1,015-1,018 CPU-s for four isolated shards against 122 s and 706 CPU-s. Profiled VM pre-commit: whole-run CPU 11,168 to 4,980 CPU-s.
server/vitest.config.ts and vitest.config.ts default ADCP_VALIDATOR_CACHE_DIR to node_modules/.cache/adcp-sdk-validators through test.env (scripts/sdk-validator-cache.cjs), with the storyboard matrix's rule: unset gets the default, an empty value turns it off, any other value wins. They set no default when CI is set to anything other than '', 'false' or '0'. The pre-commit planner runs the full server suite when the helper changes. tests/sdk-validator-cache-env.test.ts loads both real vitest configs in a child process under each variable and CI case and fails when a new vitest config appears. Server unit suite, concurrent pair at 38 workers: 3,998 to 3,617 CPU-s on an empty cache, 3,808 to 3,417 on a filled one.
…workers on the shared compile cache - createTrainingAgentRouter builds the router without the reporting stack; brand data and the product-discovery schemas are built on first use; the tenant registries are built on first use unless the server boot prewarms them (server/src/http.ts and the storyboard runner do, so production boot and the matrix are unchanged). - Server-suite workers start with Node's compile cache (scripts/node-compile-cache.cjs, NODE_COMPILE_CACHE in test.env), as the pre-push hook's processes do. - Two credential tests share their workers; the reporting-stack checks await their async import probe. deferred-imports.test.ts checks in a fresh process that building three routers starts 0 tenant-registry inits (12 before) and that the prewarm option starts one per registry; node-compile-cache-worker.test.ts checks that a worker's compile cache lies under the configured directory.
…ad and cold caches - listenOnLoopback() (server/src/testing/loopback-server.ts) turns off Node's idle-connection reaper for in-process test servers, so a stalled event loop no longer drops a written request; 36 test files use it. - Three test files pass in any test order. - The matched-pair inference engine takes MatchedPairNiWallClockLimits; tests that expect a determinate result pass both limits as null, so they depend only on the work budget. - server/tests/setup/warm-caches.ts, a globalSetup, registers the training agent's schema roots once in a child and transforms its module graph before workers start, when ADCP_VALIDATOR_CACHE_DIR is set. - Training-agent unit tests import the training agent statically. No test, hook or step timeout changes. Shuffle gate, 5 seeds in a fresh container: exact-inference passed in all 5, and 0 of 97 training-agent and hosted files failed.
…work bounds instead of wall clocks - searchHeadings reads a doc_id map built once per docsIndex array; fixed-trace snapshots are deep-frozen and reused, canonical text is memoized, and coverage counts pair overlap. - Five tests in four files assert the bound their time budget stood for; elapsed-time-assertion-guard and search-repeated-work-guard keep both patterns out. - stripe-client.test.ts imports the module once; ipr-check-and-record builds its git fixture once per suite. Alone on a quiet VM, the slowest docs-indexer case drops from 12.1-13.1 s to 0.8 s and fixed-trace-suite from 8.6-8.8 s to 2.9 s. Production results are unchanged.
…e before the root suite's workers - The build lock records its owner (host and pid) and keeps its mtime fresh from a heartbeat thread; a waiter takes it over at once when the owner's pid is gone on this host, else after 30 s (was 10 minutes). - tests/setup/built-schemas.ts, the root config's globalSetup, builds dist/schemas/latest once before any worker starts, only for runs that include a file that reads it. compliance-authored-tool-gates no longer builds inside its beforeAll, and its 180 s timeout goes with that build. - scripts/lint-test-builds.cjs (test:test-builds, in precommit and test) fails a vitest test file that starts a build. The tool-gates hook drops from 13.2 s cold to 0.85 s; with an orphaned lock in a fresh container, test:unit passes in 40.6 s where it was killed at its 300 s step budget.
… the root unit suite on forks - scripts/with-timeout.sh, without coreutils timeout (macOS by default), signalled its direct child only, so a timed-out npm run precommit left the rest of the tree, including forks-pool workers whose vitest main process died. It now starts the command in its own process group and signals the group; tests/with-timeout.test.ts runs it under the bash on PATH and /bin/bash 3.2. - vitest.config.ts sets pool: 'forks' and test:unit drops --pool=threads, which adcontextprotocol#2542 chose because forks workers outlived their main process. tests/git-env-isolation.test.cjs follows the config. On Linux the root suite takes 25 s instead of 35 s, with 26% less CPU and 2.1 GB less peak memory.
…odule-eval-cycles lint tests - The narrow-import tree checks list each scope once, read each file once per process, and skip the parse when a file's escape-decoded text can't hold the check's target: 95 files are parsed instead of 2,826, and every file still goes through every check. - The module-eval-cycles lint hands TypeScript's transformers only the import and export declarations (1,030 of 1,030 modules give the same surviving specifiers) and stores each module's record in node_modules/.cache/adcp-lint/module-eval-cycles.json. A record is reused only when the source hash matches and every relative specifier resolves to the same target; the file's version covers the lint's own source, ts.version and the typescript entry files. ADCP_LINT_CACHE_DIR overrides the directory, '' turns it off, and CI runs uncached (isCi is exported by scripts/sdk-validator-cache.cjs). New tests cover the work counts, cache reuse and every miss (an edited module, a resolution change, a version change), and negative controls on the real tree. VM: narrow-import tree pass 11.0-11.2 s to 4.0-4.1 s; module-eval-cycles tree test 16.3-17.1 s to 0.46 s warm and 9.4-10.2 s uncached.
…guard test under the default timeout - The guard gives each rerun file one test, registered when its run ends: exit 0 with no signal, the unchanged caller repository, no caller hook. It reads its bound from its own --test-timeout (30 s), preloads tests/helpers/test-progress-hooks.cjs into node:test children and uses tests/helpers/vitest-progress-reporter.mjs for vitest children, and kills a child's process group after the bound with no progress line. FILE_TIMEOUT_MS (15 min) and the per-file timeouts are gone. - tests/git-env-isolation-guard.test.cjs runs the guard on fixtures that each fail for exactly one reason. - cdn-artifacts runs one publication per test; the release-tool tests run on macOS through GNU stat and timeout shims and shell git stubs; tests that read the enclosing checkout drop GIT_*; test-coverage-registration strips the vitest project prefix. VM, idle: the guard drops from 6:31 to 4:45 and 1,391 to 995 CPU-s, 27/27. Release scripts, the per-write fence and the workflows are unchanged.
…files scripts/profile-precommit.mjs runs the pre-commit plan's leaf commands one at a time or as the hook does, under /usr/bin/time, with a process-tree sampler, optional CPU and heap profiles for every Node process and forked vitest worker, and synthetic load. It writes report.json, summary.html and per-command logs under .hook-runs/, and `summarize`, `compare` and `costs` rank the results, including inclusive CPU cost items across many CPU profiles. It runs on macOS and Linux and ignores wrapper shells when it lists competing processes. ADCP_PRECOMMIT_PROFILE=1 makes the hook run under it.
.husky/pre-commit runs `node scripts/profile-precommit.mjs hook`: plan.mjs expands `npm run precommit` into the same leaf commands, runner.mjs runs them in phases (the light checks together, then the server unit suite), and results.mjs writes the reports. A failed phase skips the later ones and the exit status is the first failing leaf's; ADCP_PRECOMMIT_KEEP_GOING=1 runs every phase. npm run precommit stays the sequential equivalent, and the auction-only compliance files run in parallel. tests/precommit-hook-runner.test.ts checks, with npm as the oracle, that the runner runs exactly the leaves npm runs. It caches npm's expansion of package.json, and on a miss replays the recorded npm calls with npm's own Npm class in one process instead of about 15 npm processes. The tests run under the default timeout. Hook with the server suite skipped: 31 s to 17.6 s.
…st results With --test-force-exit a node:test file's process exits as soon as its reporter hands the last event to stdout, a non-blocking socket, so events the runner has not read are lost and the runner reports fewer tests while exiting 0 (nodejs/node#64833). profile-precommit run now preloads scripts/profile-precommit/node-test-blocking-stdout.cjs into every node-test command whose results it collects, and takes --root as hook does. tests/profile-precommit-node-test-report.test.ts drives a fixture that stops its runner and fills the pipe, through async child processes bounded by the test's default timeout: without the preload the runner reports 5 of 12, with it 12.
…nd profile forks-pool workers runner.mjs stopped a leaf's process group only when it stopped the leaf itself (budget expiry or a forwarded signal), so a vitest main process that crashed or was killed left its forks workers running, and a leftover worker holding the step's output pipe kept the hook from returning. It now kills the leaf's group after every exit. profile-precommit passes CPU and heap profiling to forks-pool workers through --execArgv.
…0 s pre-push Each hook runs under one supervisor budget (scripts/profile-precommit/ budget.mjs) instead of per-step budgets and with-timeout wrappers: 120 s for pre-commit and 180 s for pre-push by default, overridable with --budget-s, ADCP_PRECOMMIT_BUDGET_S, ADCP_PREPUSH_BUDGET_S or ADCP_HOOK_BUDGET_S. On expiry the supervisor kills the hook's process groups, names the running step with its elapsed time and exits 124. The plan rejects a with-timeout.sh clause. Logs go to .hook-runs/<stamp>-<hook>/.
…it:* projects `npm run precommit` is one leaf, `vitest run --project 'precommit:*'`: precommit:root (the root suite), precommit:server-* (the server unit suite as server/vitest.projects.ts defines it, limited to the staged-file plan), precommit:checks (typecheck, the JWS vectors, the advisory image check) and precommit:node-tests (the hook's node:test files, the storyboard compliance tests and the lint tests). sequence.groupOrder keeps the hook's phases, and scripts/vitest-hook-reporter.mjs cancels the run when a later group is queued after a failure. npm scripts keep their names, so CI is unchanged. The leaf runs under the hook budget; tests/vitest-hook-projects.test.ts guards the one-leaf plan.
main bumped the SDK to 17.0.0-beta.32 with the same files as this branch's bump (0f8cb25): package.json and the lockfile, the three docs pages, the conformance README and known-findings.json all match byte for byte. The one conflict is the changeset both sides added at the same path. Resolution ledger: - mechanical: none - semantic: .changeset/sdk-17-beta-32-docs.md -> main's; it states what this branch's did and also names the bundled AdCP releases The merge result differs from this branch's previous head only in that changeset's text.
|
Thanks @bokelley. I merged main instead of rebasing: 1ce5db1 brings in #9156, and the PR is mergeable again. The branch already had the same beta.32 bump, so the only conflict was the changeset at the same path, and I kept yours. On beta.32 the hooks are back under budget on a loaded laptop: pre-commit 78 s and pre-push 171 s, against 149–226 s and up to 496 s on beta.31. Merging keeps pushes fast-forward and keeps the measurements in each commit message; a squash merge gives main the same result. If you'd rather have linear history, say so and I'll rebase. |
…extprotocol#9159) No conflicts. server/src/http.ts changed on both sides in separate hunks: this branch's first-use DOMPurify loader and training-agent prewarm, and main's two Stripe product lookups. git's merge keeps both. Resolution ledger: - mechanical: none - semantic: none; the auto-merged file was read, and main adds no SDK barrel imports or eager loads of the first-use modules Check: typecheck passes, and the full server unit suite passes (867 files, 14,707 tests, 31 skipped; main adds no server tests).
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — hard approval gate on a gated path not yet satisfied by human/CODEOWNERS review.
This PR modifies .agents/playbook.md, which matches the deterministic hard approval gate glob .agents/** (gated_paths: true). The current GitHub review decision is REVIEW_REQUIRED, not APPROVED, so decision table row 2 fires: the gate is NOT satisfied and the PR cannot auto-approve regardless of how clean the diff is.
The reviewer reported a clean pass — all 15 delta files reviewed, no Critical/High/Medium findings. Every removed guard was shown to be provably redundant, crawler.ts is pure reindentation, agents.html adds https-only hardening, committees.html fixes button-restore on error, and outreach-scenarios now exercises the real shouldContact(). Absent the gate, this would be an approve.
The prior decision was also escalate for the same gated-path reason, with no findings then or now. The escalation persists solely because the hard gate remains unsatisfied — a human/CODEOWNERS approval on .agents/playbook.md is required before merge.
Escalation reasons
- Modifies
.agents/playbook.mdunder hard approval gate.agents/**;review_decisionisREVIEW_REQUIRED, notAPPROVED— human/CODEOWNERS review required before merge.
Why human review
- Modifies .agents/playbook.md under hard approval gate
.agents/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - This PR touches a path under a hard, non-overridable approval gate (.agents/playbook.md (modified) matches
.agents/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
…otocol#9146) Brings in adcontextprotocol#9146: CI storyboard rows for /inventory-adserver and /inventory-content, and selection that reports a multi-agent storyboard not applicable on every tenant but its default_agent, and signed_requests not applicable on the inventory tenants. Resolution ledger: - mechanical: none. - semantic: none. git merged server/tests/manual/run-storyboards.ts, tests/run-storyboards-sharding.test.cjs and tests/release-publication-freshness.test.cjs with no conflicts. The selection change reads TENANT_PATH, which the storyboard queue sets per tenant process (scripts/run-storyboards-queue.mjs), so it applies the same way under the local queue as in CI. - The local pre-push matrix keeps its tenants: adcontextprotocol#9146 adds the inventory rows to CI only, and no floor of an existing row changes. Checks on the merge result: - npm run typecheck: pass. - node --test tests/run-storyboards-sharding.test.cjs tests/release-publication-freshness.test.cjs: 65 pass, 0 fail. - node scripts/precommit-server-unit.cjs --full: 867 files, 14,708 passed, 31 skipped. Before the merge: 14,707; adcontextprotocol#9146 adds one test.
… snapshots Brings in adcontextprotocol#9150 (comply_test_controller seeds on the inventory tenants, two isolated orchestrators per inventory tenant in CI), adcontextprotocol#9049 (reporting subscriptions name geography systems and carry geo codes), and the v3.1.34 and v3.2.12 doc snapshots (adcontextprotocol#9131, adcontextprotocol#9139). Resolution ledger: - mechanical: none. - semantic: none. git merged the five files both sides changed with no conflicts: - server/src/addie/mcp/schema-tools.ts: main bumps the 3.1 and 3.2 docs releases; this branch's changes are elsewhere in the file. - server/tests/unit/training-agent-inventory-tenants.test.ts: main adds seed tests beside this branch's changes. - tests/release-publication-freshness.test.cjs, tests/release-workflow-immutability.test.cjs and tests/run-storyboards-sharding.test.cjs: main adds the inventory orchestrator jobs and the --shard-group option. - The local pre-push matrix keeps its tenants: the inventory jobs and --shard-group are CI only, and the local queue runs isolated tenants through run-storyboards-isolated.mjs, not the shard script. Checks on the merge result: - npm run typecheck: pass. - node --test on the three release and sharding test files: 69 pass, 0 fail. - node scripts/precommit-server-unit.cjs --full: 867 files, 14,714 passed, 31 skipped. Before the merge: 14,708; adcontextprotocol#9150 adds six tests.
…tocol#9163, adcontextprotocol#9164) Brings in adcontextprotocol#9163 (a second cancel through inventory update_media_buy answers NOT_CANCELLABLE) and adcontextprotocol#9164 (a seeded inventory product reports its fixture's reporting_capabilities). Resolution ledger: - mechanical: none. - semantic: none. git merged server/tests/unit/training-agent-inventory-tenants.test.ts, which both sides changed, with no conflicts: main adds two tests beside this branch's changes. server/src/training-agent/inventory-sim/platform.ts changed only on main. Checks on the merge result: - npm run typecheck: pass. - server/tests/unit/training-agent-inventory-tenants.test.ts: 35 passed. - node scripts/precommit-server-unit.cjs --full: 867 files, 14,716 passed, 31 skipped. Before the merge: 14,714; main adds two tests.
…contextprotocol#9123) Brings in adcontextprotocol#9123: the scalar branch of 17 scalar-or-list unions is deprecated, and build-schemas fails the build on any bundle failure, unresolvable $ref, unparsable extension or storyboard, keeps call-site keys beside a $ref to a hoisted schema, and takes --root. The storyboard matrix stops when a build fails. Resolution ledger: - package.json (one hunk, the test script): union. This branch's added lints and test:build-cache stay; main's test:build-schemas-exit-status is added after test:build-schemas-vendor-metric-uniqueness. - scripts/run-storyboards-matrix.sh (two hunks): union. - The 3.0 bundle copy keeps this branch's temporary directory under the queue state directory and adds main's extraction error exit. - The current-source builds keep this branch's built-schemas.cjs ensure calls, which skip a build whose inputs are unchanged, and print main's "schema build failed" and "compliance build failed" errors when a build fails. - tests/run-storyboards-sharding.test.cjs (one hunk): union. Both sides' tests stay. Main's build-failure test also copies scripts/built-schemas.cjs into its temporary root, because the matrix builds through the build cache; the cache finds no stamp there and runs the stubbed builds, so both failure cases are still exercised. - scripts/build-schemas.cjs (seven hunks): union. - The parse-once source reads (the documents map, the source cache) stay. They're assigned to main's outer refContent, so an unresolvable $ref still fails with main's error. - Main's failures list, its error lines and the early return for a manifest without tools come in. - Bundling stays in a worker thread. The worker now returns main's failures list instead of an error count, and main() adds every bundled directory's failures to bundleFailures before assertNoBundleFailures runs. That includes the release-mode latest/ bundle, whose result this branch had not used. - The worker gets its source and output directories passed in, so a --root build bundles the --root tree. Checks on the merge result: - npm run typecheck: pass. - SOURCE_DATE_EPOCH=1700000000 node scripts/build-schemas.cjs, in this tree and in a checkout of origin/main: the two dist/schemas/latest trees are identical over 1,771 files. - node --test on tests/build-schemas-*.test.cjs, tests/run-storyboards-sharding.test.cjs, tests/build-cache.test.cjs and tests/v4-compatibility-registry.test.cjs: 146 pass, 0 fail. - node scripts/precommit-server-unit.cjs --full: 867 files, 14,716 passed, 31 skipped, the same as before the merge; adcontextprotocol#9123 adds no server tests.
…dcontextprotocol#9169, adcontextprotocol#9171) Brings in adcontextprotocol#9169 (inventory get_products filters by required_metrics; the inventory storyboard floors rise) and adcontextprotocol#9171 (accept_proposal and create_media_buy refuse a mismatched terms digest with PROPOSAL_TERMS_CHANGED; compact_product_lifecycle gains its 11th step). Resolution ledger: - mechanical: none. - semantic: none. git merged the four files both sides changed with no conflicts, and the hunks are disjoint: - scripts/run-storyboards-matrix.sh: main raises the compact_product_lifecycle exact count to 11 steps; this branch's changes are the queue and the build cache. - server/src/training-agent/task-handlers.ts: main changes the terms-digest checks and exports reportingMetricIsAvailable; this branch's changes are the imports and the lazy product-discovery input schemas. - server/src/training-agent/tenants/tenant-smoke.test.ts and server/tests/unit/training-agent-inventory-tenants.test.ts: main adds tests beside this branch's loopback-server and reset changes. - The CI-only inventory floors in training-agent-storyboards.yml come in unchanged; the local pre-push queue has no inventory floors. Checks on the merge result: - npm run typecheck: pass. - node --test tests/compact-product-lifecycle-storyboards.test.cjs tests/run-storyboards-sharding.test.cjs: pass. - node scripts/precommit-server-unit.cjs --full: 867 files, 14,718 tests, 31 skipped. Before the merge: 14,716; adcontextprotocol#9169 adds two tests. One test failed at load 112: the cold-worker exact-inference test, whose child hit that test's 25 s kill. Neither merged PR touches it, and main has the same 25 s kill.
beta.33 adds the AdCP 3.3 refine_proposals additions (extend_hold, include_collections, expected_confirmation_at), stops createAdcpServer negotiating a prerelease it doesn't package, honours selector.dimension_systems in reporting-subscription offering selection, and validates the storyboard strict response check against the served release's schema (adcp-client#3751). It comes after beta.32, so it keeps adcp-client#3750. - package.json and package-lock.json pin 17.0.0-beta.33. - Choose your SDK, Versions, the creative33 sandbox note and the conformance baseline name the new pin; a patch changeset records it. - proposal-negotiation-profiles.ts: ExtendHoldProposalRefinement joins the ProposalRefinement union, so the evaluator narrows it out before reading revise-only fields. extend_hold never reaches the evaluator: the holds service answers it first, and the SDK handler, built without hold_extension and called as 3.2, refuses it before evaluation. Checks: - The bundled compliance and schema trees of beta.32 and beta.33 are identical (3.3.0-rc.0, 3.2.8, 3.1.31, 3.0.25). - The TypeScript conformance capture (scripts/sdk-response-conformance) against 3.2.1, run on beta.32 and beta.33 with the same plan: the 125 observations, the advertised tools and the transport are identical. - npm run typecheck, npm run test:sdk-response-conformance and npm run test:doc-compliance-drift: pass. - node scripts/precommit-server-unit.cjs --full at load 150-190: 14,668 passed. Two failures were 30 s timeouts under that load (docs-indexer's beforeAll, the exact-inference n=25 fixture), in files that don't use the proposal refinement code; the hold-vector, schema-parity, refinement and docs-indexer files then pass alone.
@adcp/sdk 17.0.0-beta.33 sends refine_proposals action extend_hold (adcontextprotocol/adcp-client#3601), so media_buy_seller/hold_extension now passes all 32 steps on /sales, where beta.32 passed 22 and skipped 10. The required-exact count changed, and CI failed on it. - The /sales required-exact count for media_buy_seller/hold_extension is 32:0, in .github/workflows/training-agent-storyboards.yml and scripts/run-storyboards-matrix.sh. - server/tests/manual/run-storyboards.ts drops the three extend_hold known-failing steps; their removal condition, adcp-client#3601, is closed. Checks: - CI on the bump (Storyboards, current /sales): hold_extension ✓ 32P / 0S; every other required-exact count matched. - node --test tests/run-storyboards-sharding.test.cjs tests/release-workflow-immutability.test.cjs: 23 pass. - npm run typecheck: pass.
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — hard approval gate on gated paths not yet satisfied.
This PR modifies files under hard, non-overridable approval gates:
.agents/playbook.md(matches.agents/**).github/workflows/training-agent-storyboards.yml(matches.github/workflows/**)
gated_paths: true and review_decision: REVIEW_REQUIRED (not APPROVED). Per decision rule row 2, this requires human/CODEOWNERS approval before merge — Ladon cannot auto-approve regardless of diff cleanliness.
Blocking findings: none.
Reviewer status: Clean pass. The delta since the prior run (50a7591) is a new append-only dist/docs/3.1.34/** snapshot (generated, immutability holds) plus main merges (#9049, #9123, #9168/#9171, #9146/#9150/#9169). Mandatory coverage confirmed: storyboard CI jobs fail closed correctly; platform seeded-product path coherent; schema source changes are experimental 3.3 additions + deprecated single-value branches, disjoint-by-type with correct changesets. No new Critical/High/Medium findings, no prior blockers to re-surface.
Escalation reasons:
.agents/playbook.md(modified) is under hard approval gate.agents/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge..github/workflows/training-agent-storyboards.yml(modified) is under hard approval gate.github/workflows/**; same gate applies.
This is a clean, well-reviewed large infra PR; it requires only a recorded human/CODEOWNERS approval to clear the gate.
Why human review
- Modifies .agents/playbook.md under hard approval gate
.agents/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - Modifies .github/workflows/training-agent-storyboards.yml under hard approval gate
.github/workflows/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - This PR touches a path under a hard, non-overridable approval gate (.agents/playbook.md (modified) matches
.agents/**; .github/workflows/training-agent-storyboards.yml (modified) matches.github/workflows/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
A profiling run (ADCP_PRECOMMIT_PROFILE=1, or profile-precommit run --cpu-prof/--heap-prof) lost the CPU and heap profiles of vitest's fork workers on a loaded machine, and tests/profile-precommit-vitest-profiles failed in the hook at load 77. Cause: vitest stops a fork with SIGTERM as soon as the fork answers its stop request, and with SIGKILL 500 ms later (a fixed delay in vitest). Node writes a --cpu-prof or --heap-prof profile at exit, and under load that write takes longer than 500 ms. - scripts/profile-precommit/vitest-worker-profiler.mjs: loaded into each fork worker with --execArgv=--import. It runs the CPU and heap samplers through node:inspector, with Node's default intervals, and writes both profiles under Node's file names when the stop request arrives, before vitest answers it. The worker then stays up until vitest's SIGTERM, so the samplers it inherits from NODE_OPTIONS never write a second copy. - scripts/profile-precommit/vitest-worker-profiler-url.cjs: builds the --import URL, with the profile directories in one base64url query parameter, so the URL passes through sh -c and npm unchanged. - profile-precommit.mjs and precommit-server-unit.cjs pass that URL in place of --execArgv=--cpu-prof/--heap-prof. NODE_OPTIONS still profiles every other process and worker thread, including the fork's own threads (the exact-inference engine runs its probes in them). - The test's fixture worker now has an exit listener that sleeps 1.5 s without CPU use, longer than vitest's SIGKILL delay, so the case fails the old way on an idle machine too. Checks: - The new test fails on the old profiler: the worker's CPU profile is missing, and only the main vitest process wrote one. - With the fix, tests/profile-precommit-vitest-profiles.test.ts and tests/precommit-hook-guards.test.ts pass 3 of 3 runs (7 tests each). - In a hand-built fixture run, the worker writes exactly one CPU and one heap profile, and the main process writes its own.
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — gated-path approval gate not satisfied.
This PR modifies files under hard, non-overridable approval gates while the GitHub review decision is REVIEW_REQUIRED (not APPROVED). Per decision-table row 2, this cannot auto-approve regardless of how clean the diff is.
Escalation reasons
.agents/playbook.md(modified) matches gated glob.agents/**— requires human/CODEOWNERS approval..github/workflows/training-agent-storyboards.yml(modified) matches gated glob.github/workflows/**— requires human/CODEOWNERS approval.
Review quality note: the reviewer's subsequent pass found no Critical/High/Medium findings. The delta (pre-commit profiler tooling under scripts/profile-precommit/, plus callers/test) is non-load-bearing, gated behind ADCP_PRECOMMIT_PROFILE=1, with idempotent profile writes and bounded keep-alive. The diff itself is clean — but the gated-path requirement is a mechanical, deterministic gate that only lifts when review_decision becomes APPROVED. A human/CODEOWNERS approval is required before merge.
Why human review
- Modifies .agents/playbook.md under hard approval gate
.agents/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - Modifies .github/workflows/training-agent-storyboards.yml under hard approval gate
.github/workflows/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - This PR touches a path under a hard, non-overridable approval gate (.agents/playbook.md (modified) matches
.agents/**; .github/workflows/training-agent-storyboards.yml (modified) matches.github/workflows/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
… 3.3.0-rc.3 cut (adcontextprotocol#9141) No conflicts. The only files both sides changed are package.json and package-lock.json. Resolution ledger: - mechanical: package-lock.json -> textual merge checked: version 3.3.0-rc.3 (main), @adcp/sdk 17.0.0-beta.33 (this branch) in the root entry and in node_modules/@adcp/sdk. - semantic: package.json -> union: main's version bump and its tests/oneof-overlap-resolution.test.cjs in test:schemas; this branch's scripts and SDK version stay. - auto-merged, main only: adcontextprotocol#9170's source schema changes and test, the rc.3 release files (dist/, CHANGELOG.md, .changeset/pre/, static/compliance/published-versions.json). None touch the hooks, the schema and compliance builds, or the server. Checks: - npm run typecheck: pass. - tests/oneof-overlap-resolution.test.cjs: 38 pass. - npm run test:build-schemas-exit-status: 2 pass. - npm run test:build-cache: 43 pass.
) No conflicts. The one file both sides changed is server/src/addie/mcp/schema-tools.ts. Resolution ledger: - semantic: server/src/addie/mcp/schema-tools.ts -> union: this branch moved Addie's tool catalogs out of the file; main moves the 3.3-rc docs release in DOCS_SCHEMA_RELEASES from 3.3.0-rc.0 to 3.3.0-rc.3, which stays in this file on both sides. - auto-merged, main only: dist/docs/3.3.0-rc.3/, docs.json and .dockerignore. The remaining 3.3.0-rc.0 references (the training agent's hosted preview bundle and its tests) are the same on main. Checks: - npm run typecheck: pass. - npm run test:docs-nav: pass. - npm run test:release-docs-nav: 41 pass, 1 skipped.
…and 3.3 release docs (adcontextprotocol#9185, adcontextprotocol#9186, adcontextprotocol#9187) adcontextprotocol#9185, adcontextprotocol#9186 and adcontextprotocol#9187 change only docs and changesets; their docs edits fall inside the conflict regions below, which take main's side. adcontextprotocol#9178 does the work of this branch's beta.33 bump (the SDK version in the docs and the conformance record, the extend_hold narrowing in the proposal evaluator, hold_extension at 32:0 and the removed extend_hold known-failing steps) for beta.35, and moves the training agent's preview to 3.3-rc.3. beta.35 is the newer release, so main's text subsumes this branch's in every conflict. Resolution ledger: - mechanical: package-lock.json -> main's (this branch's lockfile differed from main's only in the @adcp/sdk entry). - semantic, main subsumes (same edit for a newer SDK): .github/workflows/training-agent-storyboards.yml, scripts/run-storyboards-matrix.sh (hold_extension comment), docs/building/by-layer/L4/choose-your-sdk.mdx, docs/contributing/creative33-sandbox.md, docs/reference/versions.mdx, scripts/sdk-response-conformance/README.md and known-findings.json, server/src/training-agent/proposal-negotiation-profiles.ts, and the @adcp/sdk line in package.json. Each conflict region takes main's side; this branch's other changes in package.json and run-storyboards-matrix.sh stay. - removed: .changeset/sdk-17-beta-33-docs.md. The docs it describes now name beta.35, and main's .changeset/rc3-sdk-and-test-agent-preview.md covers the bump. - auto-merged: server/tests/manual/run-storyboards.ts (both sides removed the extend_hold known-failing steps), tenant-smoke.test.ts and training-agent-preview-version.test.ts (main's rc.3 pins beside this branch's static imports and loopback helper). Checks (after npm ci on the merged lockfile): - npm run typecheck: pass. - training-agent-preview-version, tenant-smoke and hosted-compliance-version tests: 95 pass. - tests/run-storyboards-sharding.test.cjs and tests/release-workflow-immutability.test.cjs: 23 pass.
…contextprotocol#9189, adcontextprotocol#9190), mutation_outcome docs (adcontextprotocol#9191) No conflicts. Two files changed on both sides, in separate places. Resolution ledger: - semantic: server/src/training-agent/task-handlers.ts -> union: this branch's narrow imports and first-read input schemas; main's market filters, which leave out uncovered products instead of refusing (adcontextprotocol#9189), and the wholesale feed version over the built-in catalogue (adcontextprotocol#9190). - semantic: server/tests/unit/training-agent.test.ts -> union: this branch's @adcp/sdk subpath imports; main's feed and pricing version assertions. - auto-merged, main only: creators.ts, product-factory.ts, publishers.ts, types.ts, the two new training-agent test files, and adcontextprotocol#9191's docs, decision record and test. Checks: - npm run typecheck: pass. - training-agent-product-coverage, training-agent-wholesale-feed-version and training-agent tests: 859 pass. - test:narrow-imports, test:test-spawn-tooling, test:test-builds, test:test-git-env, test:test-dynamic-imports, test:module-eval-cycles: pass. - tests/mutation-outcome.test.cjs: 6 pass.
… test The "fails independently when an isolated script manifest drops the parent invocation" case ran `tsc --project server/tsconfig.json --noEmit` itself to show that the production compiler command alone passes. The hook's typecheck step already runs that command through `npm run typecheck`, so the case compiled the whole server a second time in every pre-commit run: 43 s on a 40-core VM under the full run, with a raised 60 s limit. The manifest assertion it exists for needs no compiler. The case now checks only the manifest, and the 60 s limit is gone. Measured alone: 2 tests, 5 ms (was 35-46 s for the one case).
…working tree The tree checks list files with `git ls-files`, which keeps listing a tracked file after it is deleted from the working tree until the deletion is staged. readRepoFile returns undefined for it, and decodedText threw "Cannot read properties of undefined", so committing any change while another tracked file was deleted failed three tree tests in the hook. A deleted file holds no import: its text is now empty.
…ndex indexSchemaFiles read every JSON file under each indexed release's schemas, including bundled/ (each request and response with its references inlined) and mcp/<date>/ (the same copies as MCP tool schemas): 1,991 files, 491 of 516 MB and 188M of 203M indexed characters. These are the aggregate schemas SCHEMA_FILES_TO_EXCLUDE already keeps out because they duplicate the component schemas, which are indexed, and overwhelm keyword ranking. An entry ending in "/" now excludes a whole tree, and both trees are listed; excluded files are never read. The index drops from 8,531 to 6,558 documents; headings are unchanged (29,591). Search results change where a bundled copy ranked: the 3.1 top 5 for targeting_overlay was the targeting doc plus four bundled copies and is now the targeting, create_media_buy and update_media_buy docs, package-update and signal-targeting-rules; get_products and sync_creatives now return the component request schemas in place of their bundled copies. Tests: a startup read count (no read under bundled/ or mcp/, at most one per component file) and the three rankings above; both fail with the exclusion removed. The 30 s and 90 s beforeAll limits are gone. docs-indexer.test.ts 13.8-17.5 -> 7.0 CPU-s (slowest test 761 -> 92 ms); cross-publisher-frequency-docs.test.ts 6.0-9.0 -> 2.4 CPU-s (3,859 -> 58 ms).
…ps the default limit billing-tools.test.ts reset the module cache and re-imported billing-tools.js and stripe-client.js in every test: 43 dynamic imports and 27 evaluations of the module graph. The first test paid for the whole graph (10 s under load, over the 10 s limit), and the mock it queued then failed the next test. The file now imports statically, sets up its stripe mocks in vi.hoisted and resets them in beforeEach, and no longer opts out of scripts/lint-test-dynamic-imports.cjs. A new test expects one OrganizationDatabase construction (one evaluation of the module); with the per-test reset back it fails with 2. 28/28 pass, also shuffled. 1.78 -> 0.96-1.35 CPU-s; slowest test 160 -> 10 ms. member-tools.test.ts drops its raised 90 s limit. Its first case's extra time (1.2-2.5 s) is first-use validator work inside @adcp/sdk, not the test.
exact-inference.test.ts used 50 CPU-s alone and failed its 30 s limit on a 40-core VM. Its profile: the gcd in rational.ts, under intervalMultiply and intervalAdd in the E-step's interval evaluation, took 70% of each n=25 worker's 6.3 s (883k calls, 56M Euclid steps on product-sized numbers), and the file ran that computation 8 times. add, subtract, multiply and divide now build each result's gcd from gcds of the normalized operands' parts (Henrici; Knuth, TAOCP vol. 2, 4.5.1): for a sum, g * gcd(n / g, g) with g = gcd(b1, b2); for a product, gcd(n1, d2) * gcd(n2, d1). The results are the same lowest-terms rationals with the same 8,192-bit ceiling errors: 160,800 random operations and 8 full engine requests gave byte-identical output. A worker's compute fell from 6.0 to 1.05 s. The cold-worker case starts one child instead of three, with the same assertions: with both clocks off the outcome is deterministic, so repeats added nothing. Its 80 s limit and the 90 s limit on the TypeScript worker-realm poison case are gone; the event-based probes are unchanged. Guards: gcdRemainderStepCount() counts Euclid steps; the E+M fixture takes 6,878 against a bound of 10,000, and 72,110 with the old gcd. The cold case asserts one child launch (3 with the old loop). 50 -> 16 CPU-s alone; slowest test 14.5 -> 1.2 s; 40/40 pass. The file is still the longest server file of a full run, so it keeps starting first; its note in server/vitest.projects.ts says why now.
For every one of about 18,650 model responses, the evaluation fixture serialized the 192 KB frozen tool catalog and rescanned the 98 KB choice contract: about 6 of the worker's 25 CPU-s. It now reads each frozen catalog and contract once, with the same results, and the file's 60 s limit is gone. Guard: after a screening, catalog scans must not exceed the number of distinct catalogs (5); without the cache the count is 187. 16.7-17.7 -> 13.2-13.3 CPU-s alone; 62/62 pass. What remains is production work: hashing the request commitments the ledger records.
…ycles The lint ran ts.transpileModule on each of the 1,034 server/src modules to learn its runtime imports, although only 45 sit in an import cycle and only those can use a binding of a module still evaluating. Its tree test took 54 s on a 40-core VM under the full run and failed its 30 s limit. scan() now reads only import declarations (cached), finds the cycles, checks each one on its own, and fully evaluates only the entries that reach a cycle with a violation; JSDoc parsing is off (it changed elision in none of the 1,034 modules). The analyser throws if a runtime dependency is missing from the parsed imports. On the real tree with a seeded cycle the old and new output are identical: the same violations and the same entries that trigger each. Guards: a scan with no violating cycle analyses exactly 2 modules (5 when every entry is evaluated); a cycle with a violation is still reported with its exact entries. Uncached file 5.2-6.0 -> 2.9-3.1 CPU-s; the tree test 4.2 -> 1.8 s in-process. deferred-imports.test.ts: the 8 leaf-import probes share one process and the 4 reporting probes another (19 -> 11 processes, 6 -> 3 imports of the training-agent graph); the first-use probes keep their own processes. 15.2 -> 11.0 CPU-s; a test fails if each leaf gets its own process. warm-caches.test.ts runs on a 4-module fixture plus one transform of the real entry, not the whole 204-module graph: 4.6-4.9 -> 3.9-4.4 CPU-s.
…nces storyboard-candidate-schema-root.test.ts copied all 1,757 files of dist/schemas/3.3.0-beta.2 in beforeAll and rewrote every one (1,068 ms), and both control processes then loaded that whole root. The root is now only what decline_proposals references through $ref, plus index.json: 1,020 files, each written once. A new test checks that the written root holds only referenced files and misses none; with the full copy back it fails (1,757 against 1,020). The 60 s and 90 s limits are gone. Paired runs against the parent, 3 each: 12.4 -> 11.1 CPU-s, slowest test 3.1-3.8 -> 2.0-2.7 s, beforeAll 1,068 -> 303 ms. What remains is two fresh processes each loading the training agent (about 1.1 s) and first-use schema work in @adcp/sdk (about 1.2 s). sdk-safe-fetch.test.ts and compliance-sdk-rc-transport.test.ts drop their raised 30 s limits; their tests take 65 ms and 150-260 ms.
…-process vitest loaded vitest.config.ts 9 times per run: every inline project set test.root, so each got a Vite server of its own and loaded the config again, scanning about 880 server files and running `git diff --cached` each time. The root is now set once at the top level and the server projects take nothing from this file (extends: false). Resolved configs and `vitest list --project 'precommit:*'` are unchanged (987 files, the same project for each). A one-file run 1.35 -> 0.65 CPU-s; `vitest list` 0.95 -> 0.30. The hook-tooling tests started a node + tsx child to load the config per case, or whole vitest and npm processes: - sdk-validator-cache-env, node-compile-cache and built-schemas-setup load the config in-process (tests/helpers/vitest-config-env.ts replaces the .cjs helper): 9.9 -> 1.2, 3.7 -> 0.9, 2.2 -> 1.0 CPU-s. - vitest-hook-projects drives vitest's Node API in its worker instead of 6 `vitest list` and 4 `vitest run` processes: 6.5 -> 2.4 CPU-s. - storyboard-version-negotiation reads each schema file once instead of copying the tree twice and rewriting it: 5.8 -> 4.2 CPU-s; its 60 s and 30 s limits are gone. - hook-budget waits on a pipe instead of fs.watch, whose readiness events arrived 0.3-3 s late on macOS (one case hit its 10 s limit), and runs `git init` once per file: slowest case 10.0 -> 1.7 s. - precommit-hook-runner runs `git init` once per file and caches the npm reference replay under a full key: 3.8 -> 2.5 CPU-s. Guards count spawns, git calls and fs calls (tests/helpers/spawn-counter.cjs); each goes red with its fix reverted. No guard reads a clock. The profilers lost most fork-worker profiles: they passed the worker profiler as a command-line --execArgv, which vitest applies to a flat config but not to a config's inline projects, and the hook has been one projects run since the single vitest run. Of 319 profiles from a full profiled run, 26 came from fork workers, covering 452 of 3,961 CPU-s. The module now also travels in ADCP_VITEST_WORKER_IMPORT, which every project of both configs reads (workerImportOptions). A new case in vitest-hook-projects checks that every precommit: project, server projects included, gets the import, and none without the variable; with the server projects' import removed it fails on precommit:server-shared.
…, certification retry (adcontextprotocol#9196), release-audit changesets (adcontextprotocol#8879), reporting subscriber suspend and resume (adcontextprotocol#9199), inventory goal forecast refusal (adcontextprotocol#9206), enum hoisting annotations (adcontextprotocol#9167), format_option_ref (adcontextprotocol#8876), claim-priority indexes (adcontextprotocol#9219) Two conflicts. Resolution ledger: - semantic: package.json `test` -> union: this branch's chain (the suites it added and the build-cache and git-env steps) plus main's test:build-schemas-hoist-enum-annotations and test:build-schemas-hoist-inside-definitions, after test:build-schemas-exit-status. Every script main's chain runs is in the merged chain. Dependencies auto-merged to main's versions. - semantic: server/src/training-agent/gcs-reporting.ts imports -> union: this branch's narrow `@adcp/sdk/utils` import of canonicalize; main's randomUUID import and its added `@adcp/sdk/server` names. The rest of the file auto-merged. - mechanical: package-lock.json -> main's (auto-merged; this branch does not change it). Checks: npm ci on main's lockfile (SDK 17.0.0-beta.40), npm run typecheck, and the pre-commit hook's full run.
There was a problem hiding this comment.
Ladon verdict: Escalate to human review
Escalate — hard approval gate unsatisfied.
This PR modifies .agents/playbook.md, which matches the hard, path-based approval gate .agents/** (gated_paths: true). The current GitHub review decision is REVIEW_REQUIRED, not APPROVED. Per decision-table row 2, Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
Escalation reasons
- Modifies
.agents/playbook.mdunder hard approval gate.agents/**;review_decisionisREVIEW_REQUIRED, notAPPROVED— human/CODEOWNERS review required before merge.
Findings: The reviewer reported a clean pass with no Critical/High/Medium findings. The merge-brought 3.3.0-rc.3 compliance artifacts are all additions (no immutability violation), the 19 deletions are consumed changesets/test helpers (none inside a released semver artifact), the 11 source-schema edits add not disjointness discriminators (tightening, changeset-covered, no oneOf regression), and the branch-authored code (rational.ts gcd, docs-indexer exclusion, migrations 637/638) checks out as production-safe.
No blocking findings exist, but the gate holds the merge until a human approval is recorded. This matches the prior escalate outcome, which remains correct for the same gated-path reason.
Why human review
- Modifies .agents/playbook.md under hard approval gate
.agents/**; review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge. - This PR touches a path under a hard, non-overridable approval gate (.agents/playbook.md (modified) matches
.agents/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.
With the SDK changes in adcontextprotocol/adcp-client#3750, a local commit plus push takes about 200 s on an M4 Pro: 70 s for pre-commit with the full server unit suite, and 132 s for pre-push with every conditional step forced on. That's the same tests and the same storyboard results, with no raised timeouts, retries or skipped steps. For comparison, on a 40-core Linux VM,
main's pre-commit took 1,390 s and its forced pre-push storyboard matrix 6,845 s. CI is unchanged.The speed comes from removing repeated work: test workers reused across files, one SDK build and one validator compile shared across processes, builds skipped when their inputs haven't changed, and dependencies loaded on first use. Along the way the work found one production bug, a 503 for a malformed sealed bearer, which this PR fixes.
Why the suites stay in the hooks after #9126
#9126 made the hooks fast by taking the suites out: pre-commit dropped the root and server unit suites, and the storyboard matrix became opt-in, because they took 20–30 minutes and hours under load. This PR makes the suites themselves fast, so it keeps them in the hooks: about 70 s for pre-commit with the full server suite and about 130 s for pre-push on an M4 Pro, against 40–60 minutes before. Each hook has a hard budget (120 s and 180 s): on a loaded machine it stops at the budget and names what was still running, instead of running for hours. A broken test then fails on the developer's machine, not in CI.
#9126's additions stay:
npm run verify:localandprecommit-server-unit.cjs --full. If you'd rather keep the suites out of the hooks, maintainer edits are on: restoring #9126'sprecommitscript and the pre-push opt-in is a two-file change.What changes for a developer
Pre-commit is one vitest run.
npm run precommitisvitest run --project 'precommit:*'. The projects are:precommit:root: the root suite;precommit:server-*: the server unit suite, limited to the staged-file plan;precommit:checks: typecheck, the JWS vectors and the advisory image check;precommit:node-tests: the hook's node:test files.sequence.groupOrderkeeps the hook's phases, and a failed group cancels the later ones. The npm scripts keep their names, so CI andnpm testrun the same files as before.Each hook has one wall-clock budget, replacing the per-step
with-timeout.shbudgets (pre-commit's was 1,500 s):ADCP_HOOK_BUDGET_S,ADCP_PRECOMMIT_BUDGET_S,ADCP_PREPUSH_BUDGET_Sor--budget-s;Every hook run writes logs and a
report.jsonto.hook-runs/<stamp>-<hook>/, which keeps the newest 20 runs.ADCP_PRECOMMIT_PROFILE=1adds CPU and heap profiles, andscripts/profile-precommit.mjsranks the costs.Pre-push runs both storyboard matrices from one queue, sized to the machine's cores and memory (
ADCP_STORYBOARD_JOBS). Isolated/salesand/creative-builderstoryboards run 12 to a worker;STORYBOARD_STORYBOARDS_PER_PROCESS=1gives one per process, as CI runs them. Every tenant log is kept undertest-results/storyboards/<floor set>/.Where it's documented: the "Local Hooks" section of
.agents/playbook.mdcovers:Changes, by area
Uint8Array.fromBase64when the runtime has it (Node 25+, or after pdf-parse's core-js installs it), and that decoder throwsSyntaxError, notInvalidCharacterError.isInvalidSealedBearerErrornow accepts both, so a malformed sealed bearer gets 401 instead of a silent 503. The 503 branches now log at warn.test:narrow-importsandtest:test-spawn-tooling.scripts/vitest-leak-inventory.json.with-timeout.shstops a timed-out command's whole process group.exact-inference.test.tsdecides its probes by events (a work counter, a flag each poison raises) instead of wall-clock windows. It no longer runs alone after the server suite: a one-file project starts it first in the shared pool.--test-force-exit(test_runner: --test-force-exit with concurrency silently loses test verdicts (parent reports fewer tests than ran, exit 0) nodejs/node#64833), the per-hook budget and the single vitest run.test:module-eval-cyclesevaluates only the 45 modules in import cycles, not all 1,034 server modules.bundled/andmcp/, under the index's existing rule for duplicates. Searches return the component schemas instead of those copies, so some results change; commit 5889a0d has three before-and-after samples.test:narrow-importspasses a tracked file that is deleted in the working tree.Measured
build-schemas/build-compliancematched-v4-evaluation)exact-inference.test.tsjoins the shared pool (laptop, load 25–55 vs 23–31)The 201.7 s commit plus push was measured before
exact-inference.test.tsjoined the shared pool. Of the 14 tests still over 10 s, 10 are the first training-agent or storyboard test in a process, which pays the SDK's first-use validator compiles; that work is in progress in the SDK.mainstill passes, with 12 exceptions:Dependencies and CI
main's@adcp/sdk, now 17.0.0-beta.40 (fix(training-agent): pin reporting-storage 0.3.0-beta.9 and log expected notification retries at warn #9188). The first release with perf: cut the SDK's repeated schema and compliance work in tests, cold starts and short-lived processes adcp-client#3750 was beta.32 (chore(deps): bump @adcp/sdk to 17.0.0-beta.32 #9156). fix(schema): make account.supported_billing conditional on media_buy protocol #3750 adds the on-disk validator cache, parsed storyboard YAML, tools/list compile records and the in-process schema and compliance work done once. The local storyboard runs and unit suites setADCP_VALIDATOR_CACHE_DIR; CI doesn't. beta.32's bundled schemas are byte-identical to beta.31's, and the TypeScript conformance capture matches its baseline apart from the SDK version. On beta.32, on a laptop at load 55–90, pre-commit took 78 s and pre-push 171 s, against 149–226 s and up to 496 s on beta.31.CIis set.js/user-controlled-bypassatserver/src/services/supply-path-verifier.ts:377. That alert has been open onmainat the same line since 2026-11-20; this PR changes only the file's SDK import, to@adcp/sdk/discovery..changeset/local-prepush-storyboards.md(patch), because the PR touches the storyboard scripts and the schema and compliance builds.npm run test:build-cache,npm run test:run-storyboards-schema-rootandscripts/run-storyboards-prepush.sh.The first 44 commits each pass the pre-commit hook, and each commit message carries its own measurements. Review them in order: the sealed-bearer fix and the module-loading commits come first, then the storyboards, then the server suite, the guard and the hook tooling. The later commits fix the Addie tool-reference build, keep env and global stubs for a whole file in the serial integration project, unset the public test token in one integration test, return to the released SDK, resolve the CodeQL alerts, decide the exact-inference, hook-budget and profiler tests by events, and bump the SDK to beta.32. A merge of
mainresolves the conflict with the dependency update (#9110): two files keep both the first-use linkedom loader andmain's new document type. A second merge brings in the 3.3.0-rc.2 cut (#9091), with no conflicts. A third merge brings in #9126 and the SDK bump: the hooks stay as above,verify:localand--fullstay, and the release tests usemain's runner-tools helper (#9138) in place of this branch's own. Later merges bring in the inventory fixes (#9147, #9148, #9149, #9153, #9155), with no conflicts.mainthen made the same beta.32 bump (#9156); its merge keepsmain's changeset, and the bump files match byte for byte. The code-quality fixes (#9157, #9159) merge with no conflicts. So do the inventory-tenant storyboard rows (#9146): they're CI only, so the local pre-push matrix keeps its tenants. The inventory seeds and sharded CI (#9150), geo reporting (#9049) and the doc snapshots (#9131, #9139) also merge with no conflicts, as do the inventory cancel and reporting fixes (#9163, #9164). The scalar-or-list deprecation (#9123) conflicts in four files, and its merge keeps both sides:main's errors when a build fails;build-schemaskeeps the parse-once reads and the bundling worker, and the worker returnsmain's failures list, so any bundle failure fails the build;build-schemaswrites the same 1,771 files asmain's.The
required_metricsfilter (#9169) and thePROPOSAL_TERMS_CHANGEDrefusal (#9171) merge with no conflicts, as do the oneOf overlap fix (#9170), the 3.3.0-rc.3 cut (#9141) and its docs snapshot (#9176).Two later commits bumped the SDK to 17.0.0-beta.33.
mainthen bumped it to beta.35 with the same changes (#9178): theextend_holdguard in the training agent's refinement evaluator,media_buy_seller/hold_extensionat 32:0, and the three known-failingextend_holdsteps removed. Its merge takesmain's side in all ten conflicting files and drops this branch's beta.33 changeset, so the PR no longer changes the SDK version. The 3.3 release docs (#9185, #9186, #9187) merge in the same commit. The training-agent market-filter and feed-version fixes (#9189, #9190) and themutation_outcomedocs (#9191) merge with no conflicts.The final commit fixes the profiler, which lost the profiles of vitest's fork workers on a loaded machine. vitest sends a worker SIGTERM when it answers the stop request, then SIGKILL 500 ms later, and under load Node's exit-time profile write takes longer than that. Each worker now loads
scripts/profile-precommit/vitest-worker-profiler.mjs, which writes its CPU and heap profiles throughnode:inspectorwhen the stop request arrives.NODE_OPTIONSstill profiles every other process and thread. The profiler test's fixture worker now exits more slowly than the SIGKILL delay, so the test fails on the old profiler even on an idle machine.Nine commits then fix the slow tests (item 7), one cause per commit. The last merge brings in
main's SDK 17.0.0-beta.40 and reporting-storage 0.3.0-beta.9 (#9188), with #9196, #8879, #9199, #9206, #9167, #8876 and #9219. It has two conflicts, both resolved as unions: thetestscript keeps this branch's chain and addsmain's two new build-schemas tests, andgcs-reporting.tskeeps the narrow@adcp/sdk/utilsimport besidemain's new imports.