Repository navigation
fix(compliance): cache compliance storyboard lookups and stop test-stage hangs - #8507
Merged
Merged
Conversation
…age hangs - server/src/compliance/storyboard-cache.ts: the SDK's getComplianceStoryboardById parses every storyboard YAML in a bundle on each call (~1.3s CPU) to return one. Bundles are immutable per version/directory, so each is parsed once per process and looked up by ID; callers get clones. Used by hosted grading (deriveStoryboardStatuses / classifyRunStep), skip details, v4 readiness, Addie member tools, the storyboards service, and five registry API routes, which each paid the full parse per request. This is what pushed compliance-validate-input-gates past its 10s timeout under load. - Shard runner: a 15-minute per-stage watchdog (TEST_STAGE_TIMEOUT_MS) fails a hung stage by name with its logs, instead of the 25-minute job timeout cancelling the shard and discarding them; stage timings are printed. - --test-force-exit on the four node --test scripts that lacked it, so a lingering handle cannot hang a canonical shard. - member-tools collection round-trip: the first case pays the SDK's one-time JSON Schema compilation (~9s alone, >30s under full-suite load); budget 90s, documented. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
Performance/CI PR: adds a process-wide cache over the SDK's getComplianceStoryboardById and a per-stage CI watchdog plus --test-force-exit. No protocol surface touched.
Checks performed:
- No Critical/High/Medium findings from the reviewer.
- Cache is fail-closed and correct: keyed on exactly the fields
hostedComplianceOptionssets (version/complianceDir/schemaRoot/hostedStableLineAlias), load errors are not cached, lookups returnstructuredClone, andcomplianceDirresolves to immutabledist/compliance/<version>, so no invalidation is needed. - All server call sites swapped with matching mock updates.
- No
static/schemas/source/**,docs/reference/**, ordist/**edits — no schema↔docs coherence, oneOf discriminator, or artifact-immutability concern. No changeset is correct here (app/CI-only change).
Decision-table trace:
- Row 1 (critical/high): none.
- Row 2 (gated_paths): false.
- Row 3 (deleted high-risk): no deletions; the high-risk matches are all (modified) with no findings.
- Rows 4–6: no medium findings; no prior escalation.
- Row 7: no no-auto-approve team match.
- Row 8: fewer than three medium findings (zero).
- Row 9: approve.
Note: high_risk is true only via (modified) files in server/src/addie/** and server/src/routes/**, but with no medium-or-higher finding on them, those modifications are presumed safe and do not warrant escalation.
bokelley
added a commit
that referenced
this pull request
Nov 14, 2026
…ut (#9000) The fixture-unavailable case in compliance-validate-input-gates builds two compliance results. On 3.2.x each one loads its pinned storyboard from the hosted bundle without a cache (main has had one since #8507), so the case takes 2.5-7 s on a CI runner. On the 3.2.11 release push (Build Check 43436688553) one variant hit 10,023 ms against the 10 s default, although the tree was identical to the green Version Packages head. Test-only; no changeset. Co-authored-by: Claude Opus 5.5 <[email protected]>
KonstantinMirin
pushed a commit
to KonstantinMirin/adcp
that referenced
this pull request
Nov 21, 2026
Brings the published 3.2.12 release records to main. Resolved: - package.json, package-lock.json, static/schemas/source/index.json: main's. - static/compliance/published-versions.json: main's in this merge; the registration commit adds 3.1.34 and 3.2.12 after qualification. - CHANGELOG.md: main's plus the 3.2.12 block (forward-merge-release-records.cjs changelog). - dist/schemas/index.json, latest.json: 3.2.x's, regenerated in the next commit. - docs/governance/campaign/audit-trail.mdx and tasks/sync_plans.mdx: main's. adcontextprotocol#8980 is the 3.2 backport of adcontextprotocol#8931, which main carries in full. - tests/addie/compliance-validate-input-gates.test.ts: reverted to main's. adcontextprotocol#9000's 30 s timeout is 3.2.x-only; main caches the storyboard lookup (adcontextprotocol#8507). adcontextprotocol#9128 (3.2.x backport of adcontextprotocol#8894) auto-merged with no net change: 3.2.x's webhook-emission files equal main's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Build Check on main kept going red, which blocked deploys (main had to be re-run by hand twice today), and the local pre-commit hook failed for the same reasons. Three causes, each fixed here.
1.
getComplianceStoryboardByIdparses the entire bundle on every callIn
@adcp/sdk,getComplianceStoryboardByIditerateslistAllComplianceStoryboards(), which reads and parses every storyboard YAML in the bundle to return one storyboard. That's about 1.3 s of CPU per call for the 3.3 bundle, measured. The server calls it on hot paths:deriveStoryboardStatusesandclassifyRunStep, throughpinnedStoryboard, cached only per result object. Every compliance run with a skipped step paid it.storyboard-skip-details,v4-readiness, Addie member tools,services/storyboards.This is what pushed
compliance-validate-input-gatespast its 10 s timeout under load: a synchronous test took 2.4 to 3.6 s alone and about 11 s in a loaded run.Fix:
server/src/compliance/storyboard-cache.tsparses each bundle once per process and looks storyboards up by ID afterwards. The key is the four fields that select a bundle (version,complianceDir,schemaRoot,hostedStableLineAlias). Bundles are immutable per version and directory. Lookups return astructuredClone, so callers can't mutate the cache, and a bundle that fails to load isn't cached. Every server call site uses it. The four tests that mocked the SDK function now mock the wrapper instead.Result: the gate test's per-case time goes from 2.5 to 3.6 s to about 20 ms after the first parse.
2. A hung canonical stage burned the whole job
Canonical shard 2/4 hung until the 25-minute job timeout cancelled it, and cancelled jobs lose their logs. The four
node --testscripts without--test-force-exitcan hang on any leftover handle.--test-force-exiton those four scripts, matching the rest ofpackage.json.test:sdk-runner-capability-gatesandtest:release-workflowboth pass with it.scripts/run-test-stage-shard.mjsgets a per-stage watchdog: 15 minutes, overridable withTEST_STAGE_TIMEOUT_MS. A hung stage now fails by name before the job timeout, and stage timings are printed. The longest stage in a recent run took about 4 minutes, and shards finish in 16 minutes or less.3. A cold-start budget
The first
member-toolscollection round-trip pays the SDK's one-time AJV schema compilation. A CPU profile showsaddNamesandcompileSchemadominating: about 9 s alone and over 30 s under full-suite load; the other cases take about 150 ms. Its budget goes from 30 s to 90 s, with a comment explaining why. Speeding up that compilation, along with an SDK-level lookup cache, belongs upstream in@adcp/sdk.Tests
storyboard-cache.test.ts: one parse per bundle; unrelated run options share a bundle; clones are isolated; versions and directories stay apart; load errors aren't cached.--no-verify. Thetests/stage shows 1,276/1,276 with both former timeouts passing; server unit shards 4,763 + 3,636 + 4,907; typecheck.TEST_STAGE_TIMEOUT_MS=3000: the stage is stopped and named.🤖 Generated with Claude Code
Open workspace in Conductor