Skip to content

chore: fix local pre-commit/pre-push failures and share the duration-unit enum - #7480

Merged
bokelley merged 2 commits into
mainfrom
chore/local-hook-cleanup-7478
Sep 14, 2026
Merged

bokelley merged 2 commits into
mainfrom
chore/local-hook-cleanup-7478

Conversation

@bokelley

@bokelley bokelley commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Closes #7478.

Summary

Cleans up the pre-existing local hook failures and stale artifacts collected in #7478 so a clean checkout of main can pass its own hooks. Nothing here touches the frequency-cap work on mesa-verde (#7438) or frequency-cap-media-buy-scope (#7449).

  1. precommit:server-unit failures were environment-shaped, not bugs. Conductor's .env.local exports DEV_USER_EMAIL/DEV_USER_ID (and ADMIN_API_KEY/ADMIN_EMAILS) into the shell; server/src/middleware/auth.ts reads them at module load, so DEV_MODE_ENABLED flipped on and the WorkOS-session path the auth boundary tests exercise was bypassed (authorization-epoch-session, billing-admin-tenant-boundary). The shared vitest setup now scrubs those five variables before every file; tests that exercise the boundaries already set them explicitly in vi.hoisted(). The addie-router live-LLM section ran whenever ANTHROPIC_API_KEY happened to be set and asserted current model behaviour; it is now opt-in (ADDIE_ROUTER_LIVE_TESTS=1). Its one fixture-backed test spied on liveRouter['client'].messages, a field removed when the router moved to the provider seam; it now runs deterministically through fakeRouterProvider.
  2. get_products.mdx snippets. Quick Start imported GetProductsResponseSchema, which @adcp/sdk does not export; it now consumes result.data directly (the SDK's real schema validator is not public, and validateAdCPResponse is a pre-3.x heuristic that would print bogus errors). The authentication comparison, SDK status handling, and continuation-resume blocks are pseudo-code (undefined agent/helper stubs, TypeScript-only !, top-level return, and a no-auth path the hosted test agent no longer serves); they carry test=false with a sentence above each saying why.
  3. scripts/oneof-discriminators.baseline.json regenerated (update-rights-response note picked up generation_credentials/rights_constraint).
  4. Duration units (item 4) moved to its own PR. The shared enums/duration-unit.json change is in draft PR fix(schema): define the duration unit vocabulary once in enums/duration-unit.json #7481. It failed this PR's "Generate Python SDK" bundle check: adcp-client-python hand-maintains Unit as DurationUnit imported from generated_poc.core.duration (src/adcp/types/aliases.py), and the shared enum generates that type as enums/duration_unit instead, so the SDK alias has to move first. Splitting keeps this PR mergeable now.
  5. Pre-push storyboard matrix is advisory. The hook now skips it when tracked files have uncommitted changes (it grades the working tree, not the pushed ref) or when ADCP_SKIP_STORYBOARD_MATRIX=1, and says CI is authoritative. run-storyboards-matrix.sh snapshots the freshly built dist/schemas/latest into a mktemp directory (cleaned on exit) and uses that as ADCP_SCHEMA_ROOT, so a concurrent npm run build:schemas can no longer trip the SDK's assertSchemaRootMatchesVersion mid-run.
  6. Playbook documents the two direct per-file doc checks, when test=false is acceptable, and the local-hook behaviour above.

Acceptance (exact commands from the issue)

Check Command Result
Pre-commit on clean main bash scripts/with-timeout.sh 600 npm run precommit:server-unit (three previously failing files) 3 passed, 109 passed / 28 skipped (live router scenarios skip with the opt-in named in the describe title)
Full server unit suite alone npm run test:server-unit 612 files, 9363 passed / 31 skipped in 1018s on an idle sandbox. That is above the hook's 600s with-timeout budget, so a docs/schema/.agents commit timed out even with every test green; precommit now allows 1500s (the same move #6644 made from 240s to 600s). Judgment call, easy to revert.
Snippets node tests/snippet-validation.test.cjs --file docs/media-buy/task-reference/get_products.mdx Passed: 21, Failed: 1, Skipped: 36. The one failure is Quick Start (line 31): the hosted test agent returns MCP error -32603: PostgresTaskStore.getTask: database operation failed for every get_products call right now (see below). The four failures named in the issue are gone.
oneOf baseline node scripts/audit-oneof.mjs --update then git status --porcelain scripts/oneof-discriminators.baseline.json no diff
One schema source for duration units #7481 split out (blocked on an adcp-client-python alias change)
Pre-push runs against HEAD or is advisory dry-run of the hook with CHANGED forced to a storyboard path: dirty tree → skip message; ADCP_SKIP_STORYBOARD_MATRIX=1 → skip message; SDK registerExternalSchemaRoot('3.2.0-rc.1', <snapshot>) accepts the copied root pass
Playbook documents per-file checks .agents/playbook.md → Schema Compliance and Local Hooks done

Also run: the other precommit components (check-image-quality.sh, test:unit 70 files / 1059 tests, test:test-dynamic-imports, test:format-identity-boundaries, test:callapi-state-change) all pass; npm run typecheck, npm run lint:schema-links, node tests/docs-nav-validation.test.cjs, node scripts/check-testable-snippets.cjs, node scripts/check-changeset-protocol-scope.cjs origin/main, npx @changesets/cli status --since=origin/main (patch, adcontextprotocol, for the storyboard matrix script, which the scope check classifies as release tooling).

Not fixed here (please read)

  • The hosted test agent is down for get_products. test-agent.adcontextprotocol.org returns PostgresTaskStore.createTask/getTask: database operation failed for every brief, with or without idempotency_key, and testAgentNoAuth gets AUTHENTICATION_REQUIRED. This is the real cause of the line-1644 failure the issue attributed to the snippet, and it is why Quick Start still fails. The other 21 snippets on the page only pass because they use if (result.success && result.data) and print nothing on failure. This needs an operator look at the training-agent deployment; nothing in this repo's tests can make it green.
  • Sales-shard flakes (notification_config_event_scope did not emit a complete result envelope, inconsistent capability selection) were not reproduced; a full matrix run is ~40 minutes on a loaded sandbox. The schema-root snapshot removes one concurrent-rebuild path that can change a shard's capability selection mid-run; the envelope timeout (--timeout-ms 180000) is unchanged.
  • Live router assertions should respond to dashboard link requests and should route agent testing requests to agent_quality returned ignore from the current model when I ran them live. They are now opt-in evals rather than a pre-commit gate; the routing prompt may need a look separately.

🤖 Generated with Claude Code

…unit enum

Closes #7478.

- server unit setup scrubs DEV_USER_*/ADMIN_* so the auth boundary tests
  behave the same in Conductor shells as in CI; live router scenarios are
  opt-in via ADDIE_ROUTER_LIVE_TESTS=1 and the fixture-backed opinion-poll
  case runs through the provider seam instead of a removed client field;
  the precommit server-unit budget follows the suite (612 files, ~1020s
  on an idle sandbox): 600s -> 1500s
- get_products.mdx: Quick Start drops the unexported Zod schema import;
  three illustrative blocks are marked test=false with prose saying why
- regenerate scripts/oneof-discriminators.baseline.json
- enums/duration-unit.json is the single source for duration units;
  core/duration.json and get_adcp_capabilities supported_window_units
  reference it (lint allowlist for the intentional evidence-age narrowing;
  mcp-schema-analysis pinned counts re-pinned)
- pre-push storyboard matrix is advisory: skipped on a dirty tree or with
  ADCP_SKIP_STORYBOARD_MATRIX=1; the matrix snapshots dist/schemas/latest
  so a concurrent build:schemas cannot abort a tenant mid-run
- playbook documents the direct per-file doc checks and the local hooks

Co-Authored-By: Claude Fable 5.1 <[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 paths touched without required review approval.

This PR modifies files under a hard, non-overridable approval gate: .agents/playbook.md and multiple static/schemas/source/** files (core/duration.json, enums/duration-unit.json, index.json, protocol/get-adcp-capabilities-response.json). Per decision-table row 2, gated_paths: true while review_decision: REVIEW_REQUIRED (not APPROVED), so the gate is not satisfied and the outcome must be escalate.

The reviewer surfaced no Critical/High/Medium findings — the shared duration-unit enum extraction is clean (enum values unchanged, registered in index.json, matching mcp-schema-analysis count updates), the supported_window_units narrowing codifies an existing MUST so the patch changeset is correct, and the test-infra hardening is sound. The diff itself looks mergeable, but human/CODEOWNERS review is required to satisfy the schema-source and .agents/** approval gate before it can proceed.

Escalation reasons

  • Touches gated paths (static/schemas/source/**, .agents/playbook.md) with review_decision: REVIEW_REQUIRED — human/CODEOWNERS approval required to lift the gate.

Why human review

  • Gated paths touched (static/schemas/source/core/duration.json, static/schemas/source/enums/duration-unit.json, static/schemas/source/index.json, static/schemas/source/protocol/get-adcp-capabilities-response.json, .agents/playbook.md) with review_decision REVIEW_REQUIRED — human/CODEOWNERS approval required.
  • This PR touches a path under a hard, non-overridable approval gate (.agents/playbook.md (modified) matches .agents/**; static/schemas/source/core/duration.json (modified) matches static/schemas/source/**; static/schemas/source/enums/duration-unit.json (added) matches static/schemas/source/**; static/schemas/source/index.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-adcp-capabilities-response.json (modified) matches static/schemas/source/**) 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 Sep 13, 2026
The Python SDK hand-maintains `Unit as DurationUnit` from
generated_poc.core.duration, so moving the enum into enums/duration-unit.json
fails the "Generate Python SDK" bundle check until adcp-client-python
updates its alias. Item 4 of #7478 moves to chore/duration-unit-enum-7478.

The changeset stays: scripts/run-storyboards-matrix.sh is release tooling.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
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.

chore: clean up local pre-commit/pre-push failures and stale test artifacts found while landing frequency-cap PRs

1 participant