Skip to content

fix(compliance): make the reporting_core non-empty phase pass on the training agent - #7717

Merged
bokelley merged 1 commit into
mainfrom
fix/reporting-core-revision-vector
Sep 29, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/reporting-core-revision-vector

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Closes #7714

Summary

reporting_core ("Reliable Reporting: Core lifecycle") failed at publish_nonempty_core on the training agent's /sales tenant, and the 11 steps after it were skipped. Fixing the reported vector mismatch exposed two more defects further down the same phase. This PR fixes all three, so the storyboard now passes all 23 steps.

Root cause

1. Revision identity: the agent was wrong, not the vector. The training agent derived the publish_nonempty revision ID with stableId('reporting-revision', [obligationId(account, config, period_end), 'zero-row-v1']). The storyboard pins that ID as part of its literal RFC 8785/JCS vector, because the runner has no check that recomputes a digest from captured values. So the binding digest can only be fixed if the ID is fixed too.

  • The agent's canonicalization was already correct. With the vector's ID, canonicalize({reporting_revision_id, row_count, control_totals, reporting_rows}) hashes to exactly 5199a776…. The digest mismatch came entirely from the ID.
  • ee48b534… is exactly obligationId("reporting_core_lab", training-pacing-core, 1), the account the controller actually resolved (see 2).
  • No account/config/period input anywhere in the repo reproduces ecc62efa…. The vector's ID was never reachable by the agent. On the commit that introduced the vector (049bca3, feat(reporting): harden Reliable Reporting for RC1 #7254), the sales tenant skipped this storyboard (0P / 1S), so the step was never graded.
  • The vector has shipped in every released bundle from dist/compliance/3.2.0-rc.1 through rc.7. Fixing the agent makes that step pass against the released artifacts too. Rewriting the vector to the agent's account-derived ID would bake training-agent internals into a conformance vector.

2. Account routing in the storyboard. @adcp/sdk's runner sends comply_test_controller and get_media_buy_delivery with the test-kit account (acmeoutdoor.example), but passes get_reporting_status accounts through unchanged. The non-empty phase used a second account, reporting_core_nonempty_lab, that the controller never wrote to, so read_nonempty_revision_status returned NOT_FOUND. This can't pass under either runner behavior. If the runner honored the fixture account instead, the delivery reads would miss.

3. probe_scheduler_dst was in the wrong handler. The request schema assigns it to the Reliable Reporting tier probes, and the reporting_core_lifecycle_probe operation enum omits it. reliable_reporting_core_integrity_probe's own error text listed it too. Only the lifecycle handler implemented it, so run_real_source_calendar_dst_scheduler got INVALID_PARAMS.

Fix

  • Agent (server/src/training-agent/):
    • publish_nonempty commits REPORTING_CORE_NONEMPTY_VECTOR: the literal rows plus the fixed reporting-revision.ecc62efa00946aa1e2788ad9, defined once in reporting-reliability.ts. Revision content is scoped per (principal, account) ledger, so a fixed ID is safe. It also removes a latent collision between the non-empty revision and the zero-row revision ID.
    • reliable_reporting_core_integrity_probe now handles probe_scheduler_dst.
  • Storyboard (static/compliance/source/universal/reporting-core.yaml, patch changeset):
    • The non-empty phase re-prepares reporting_core_lab. prepare is a documented deterministic reset.
    • The two rejection steps get expect_error: true. This was the only storyboard of 71 grading error_code without it.
    • Every vector assertion is unchanged.
  • Doc (docs/building/by-layer/L3/comply-test-controller.mdx): adds the missing publish_nonempty row. The doc also said "implementations choose fixture identifiers"; it now names publish_nonempty's revision ID as the one exception that the test vector fixes.
  • Test: a regression test asserts that publish_nonempty returns the literal vector ID and digest for two different accounts, and that the status ledger exposes them.

dist/** is untouched.

Storyboard results

TENANT_PATH=sales PUBLIC_TEST_AGENT_TOKEN=storyboard-local-token ADCP_COMPLIANCE_DIR=dist/compliance/latest npx tsx server/tests/manual/run-storyboards.ts --storyboard-id reporting_core

Result
Before (main) ✗ 11P / 1F / 11S — publish_nonempty_core fails (ecc62efa… expected, ee48b534… got), and the 11 steps after it are prerequisite_failed
After ✓ 23P / 0S / 0N/A — 23 passed, 0 failed, 0 skipped

Verification

  • npx vitest run --config server/vitest.config.ts src/ tests/unit/reporting-reliability-regressions.test.ts tests/unit/reporting-reliability.test.ts: all reporting tests pass. The one failure is in src/training-agent/tenants/account-change-feed-transport.test.ts, and it fails identically on unmodified main (the account_change_feed area, tracked separately in account_change_feed storyboard: no account.change_recorded webhook arrives after a shared-account creative change #7715).
  • npm run typecheck: passes.
  • Storyboard lints and reporting contract tests (tests/lint-storyboard-*, tests/lint-compliance-*, tests/lint-doc-compliance-drift, tests/reporting-status-contract, tests/reporting-reconciliation-fixture): 300/300 pass.
  • node scripts/check-changeset-protocol-scope.cjs origin/main and changeset status --since=origin/main: pass.

Follow-up (not in this PR)

The runner overrides sample_request.account on controller calls (except for the four force_* scenarios). As a result, per-step controller accounts in storyboards are silently ignored. That is @adcp/sdk behavior, which lives in adcp-client.

🤖 Generated with Claude Code

…formant agent

The reporting_core storyboard failed at publish_nonempty_core on the
training agent's /sales tenant, and skipped the 11 steps after it.

Root cause, in three layers:

- The training agent derived the non-empty revision ID from the
  caller's obligation (account + delivery config + period), but the
  storyboard pins that ID as part of its literal RFC 8785/JCS vector.
  No account/config input produces reporting-revision.ecc62efa...; the
  agent's canonicalization was already correct and yields the vector
  digest once it uses the vector's identity. publish_nonempty now
  commits the fixed vector (rows + identity) from one exported fixture.
- The runner addresses comply_test_controller and get_media_buy_delivery
  with the test-kit account but passes get_reporting_status accounts
  through, so the phase's separate reporting_core_nonempty_lab account
  named a ledger the controller never wrote to. The phase now
  re-prepares reporting_core_lab (prepare is a deterministic reset).
  Its two rejection steps declare expect_error: true like every other
  error_code storyboard step.
- reliable_reporting_core_integrity_probe advertised probe_scheduler_dst
  (schema and its own error text) but only the lifecycle probe
  implemented it.

The controller doc now lists publish_nonempty and notes its identity is
the one fixture identifier fixed by the test vector.

Closes #7714

Co-Authored-By: Claude Opus 5.5 (1M context) <[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: Approve

Approve — clean three-part fix to the reporting_core non-empty phase with no blocking or medium findings.

What I checked:

  • Vector ID/digest/control-total consistency across code (reporting-reliability.ts), doc (comply-test-controller.mdx), and test (reporting-reliability-regressions.test.ts) — consistent.
  • Account routing to reporting_core_lab and probe_scheduler_dst moved to integrity probe — coherent.
  • prepare is a true ledger reset.
  • Patch changeset present and correctly scoped (fix-reporting-core-nonempty-account-routing.md).
  • No dist/** immutable artifacts touched.
  • static/compliance/source/universal/reporting-core.yaml change matches the code/doc/test — no spec drift.

No no-auto-approve team match. gated_paths is false, so the REVIEW_REQUIRED status does not force escalation. high_risk is false. No critical/high/medium findings; only one Low follow-up (omitted). Falls through to row 9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reporting_core storyboard: training agent's non-empty revision identity and binding digest don't match the fixed vector

1 participant