Skip to content

chore(tooling): fast local hooks; CI runs the suites - #9126

Merged
patmmccann merged 1 commit into
mainfrom
chore/fast-local-hooks
Nov 20, 2026
Merged

patmmccann merged 1 commit into
mainfrom
chore/fast-local-hooks

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Why

The commit hooks re-run whole test suites that CI already runs as the gate, on a shared 48-core dev host at load 70–230:

  • Pre-commit ran the root unit suite (81 files). For any change under server/src, docs/, static/schemas/source or package.json, it also ran the full server unit suite, about 1,070 files. That suite's budget had already grown from 240 s to 600 s to 1500 s, and it still timed out or failed on unrelated load-sensitive tests (stripe-client, exact-inference, the compliance gate suites, creative33-buyer, hosted-compliance-echoed-release). Each of those passed when run alone.
  • Pre-push ran the storyboard matrix whenever training-agent code changed. Its own message calls it advisory with CI authoritative. It takes about 3 minutes on an idle host and hours under load; two pushes in one session were killed at a 2-hour cap.

The result: commits took 20–30+ minutes, pushes took hours, and agents asked for --no-verify on most commits.

Running only the related tests doesn't fix it: a one-file training-agent change still selects 97 of 1,070 server test files through vitest's import graph, and a typical change 247.

What

Hook Before After
pre-commit image quality, root unit suite, three guards, staged-scoped or full server unit suite, typecheck image quality, the dynamic-import, format-identity and callApi state-change guards, typecheck: about 15 s (this commit took 16 s)
pre-push version sync, changeset policy, docs checks, storyboard matrix the same, with the matrix opt-in via ADCP_RUN_STORYBOARD_MATRIX=1
  • npm run verify:local (new). Runs the root and server tests affected by your changes since origin/main, using vitest --changed, then typecheck. --since <ref> changes the base. --full runs the full suites.
  • scripts/precommit-server-unit.cjs gains --full, so verify:local --full runs the whole sharded server suite, with its serial re-run of load-sensitive failures, whatever is staged.
  • The playbook's Local Hooks section now describes this split.

CI is unchanged. It still runs the canonical and server unit shards, the type check and the storyboard matrix on every PR, and stays the gate.

Verification

  • npm run precommit: 16 s, passes.
  • tests/precommit-server-unit.test.ts: 17/17.
  • verify:local runs the affected tests. An unknown argument exits 2 with a message.
  • sh -n .husky/pre-push: clean.
  • This PR's own commit and push went through the new hooks.

No changeset: tooling only.

🤖 Generated with Claude Code

On a shared 48-core host at load 70-230, the commit hooks re-ran whole
suites that CI already runs as the gate. Pre-commit ran the root unit
suite and, for any change under server/src, docs or schemas, the full
server unit suite (~1,070 files; its budget had grown 240s -> 600s ->
1500s), and timed out or failed on unrelated load-sensitive tests. Pre-push
ran the storyboard matrix, ~3 minutes idle and hours under load. Agents
were asking for --no-verify on most commits.

- pre-commit: image quality, the dynamic-import, format-identity and
  callApi state-change guards, and typecheck (~15s).
- pre-push: version sync, changeset policy and docs checks as before; the
  storyboard matrix runs only with ADCP_RUN_STORYBOARD_MATRIX=1.
- npm run verify:local runs the root and server tests affected since
  origin/main (vitest --changed) plus typecheck; --full runs the full
  suites, with precommit-server-unit.cjs gaining a --full switch.
- The playbook's Local Hooks section describes the split.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Escalate to human review

Escalate — gated path requires human/CODEOWNERS review.

This is a tooling-only PR (local git hooks sped up, full suites deferred to CI) across 5 files. The reviewer found no Critical/High/Medium findings, correctly confirmed no changeset is required (no protocol/schema/wire change), and verified the pre-push opt-in inversion, package.json precommit trim, --full argv handling, and the new verify-local.cjs logic.

However, .agents/playbook.md matches the gated path glob .agents/**, so gated_paths: true, and review_decision is REVIEW_REQUIRED (not APPROVED). Per decision table row 2, the hard approval gate is not satisfied and the outcome must be escalate regardless of the clean diff.

Escalation reasons

  • .agents/playbook.md is under a hard approval gate (.agents/**) and review_decision is REVIEW_REQUIRED. Human/CODEOWNERS approval is required before merge.

No blocking findings exist; the escalation is purely due to the unsatisfied gated-path approval requirement.

Why human review

  • .agents/playbook.md is under the hard approval gate (.agents/**) and review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required.
  • 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.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Nov 20, 2026
@patmmccann
patmmccann enabled auto-merge (squash) November 20, 2026 15:46
@patmmccann
patmmccann merged commit 7b34cda into main Nov 20, 2026
62 checks passed
@patmmccann
patmmccann deleted the chore/fast-local-hooks branch November 20, 2026 19:34
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 21, 2026
Brings in 23 commits from main, among them the 3.2.12 hosted registration,
the @adcp/sdk 17.0.0-beta.31 bump (adcontextprotocol#9132), the inventory-tenant creative
library (adcontextprotocol#9116, adcontextprotocol#9143), the macOS runner tools for the release tests (adcontextprotocol#9138)
and the hook split in adcontextprotocol#9126.

The hooks stay as this branch has them: pre-commit runs the root suite, the
staged-file-scoped server suite, the checks and the node:test files as one
vitest run under a 120 s budget, and pre-push runs the storyboard queue under
180 s. With the shared workers, caches and queue, both fit in about 200 s on
an M4 Pro, so this branch keeps the suites in the hooks. adcontextprotocol#9126's additive
pieces stay: npm run verify:local and precommit-server-unit.cjs --full.

Resolution ledger:
- mechanical: package-lock.json -> main's (identical to main after the merge).
- semantic:
  - package.json -> this branch's precommit script, plus main's verify:local.
  - .husky/pre-push (auto-merged) -> this branch's storyboard block; the
    matrix runs when its sources change, ADCP_SKIP_STORYBOARD_MATRIX=1 skips it.
  - .agents/playbook.md -> this branch's Local Hooks text, plus a
    verify:local paragraph; main's auto-merged hook description removed.
  - scripts/precommit-server-unit.cjs -> union: main's --full switch runs
    this branch's single-run full plan.
  - scripts/verify-local.cjs -> main's, with its header no longer saying the
    hooks run only fast checks.
  - server/tests/unit/training-agent-inventory-tenants.test.ts -> union:
    main's new cases with this branch's static import and state resets.
  - tests/cdn-artifacts, changesets-fence, maintenance-release-publication,
    release-publication-ordering -> union: this branch's git-env isolation,
    main's runnerPath() as the one GNU-tools mechanism; this branch's
    tests/helpers/gnu-tools.cjs and its shims are removed as unused.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants