Skip to content

fix(compliance): unblock the account_change_feed storyboard webhook and drain steps - #7716

Merged
bokelley merged 1 commit into
mainfrom
fix/account-change-feed-webhook
Sep 29, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/account-change-feed-webhook

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Closes #7715

Root cause

The training agent's emit path is fine. Two separate problems stopped the storyboard, and the second one was hidden behind the first.

1. No webhook: the controller targeted the wrong account (local harness). @adcp/sdk rc.49 builds comply_test_controller requests with context.account, not the authored account: { account_id: "acc_luma_shared", sandbox: true }. The runner's sync_accounts extractor fills context.account with the brand and operator that sync_accounts returned: luma-outdoor.example / pinnacle-agency.example. server/tests/manual/run-storyboards.ts then passes the test-kit brand (acmeoutdoor.example) as options.brand, and the runner's brand invariant writes that brand over the natural key. So seed_creative arrived as { brand: acmeoutdoor.example, operator: pinnacle-agency.example, sandbox: true }. That key matches no account the buyer synced, so controllerAccountId was undefined, seedCreative recorded no account change, and no account.change_recorded webhook fired. Temporary logging confirmed this: the subscriber was registered on fixture:acc_luma_shared, and the controller call resolved no account.

2. Drain mismatch: cross-phase $generate alias (storyboard). Once the webhook arrived, drain_after_checkpoint failed with Expected "<uuid A>", got "<uuid B>". The storyboard threaded the creative ID through $generate:uuid_v4#account_change_feed_external_creative across four phases. Runner aliases are scoped to one phase by design (adcontextprotocol/adcp-client#1658), so each later phase generated a new UUID.

The storyboard hasn't changed since it was added in #6811, and as far as I can tell it has never passed end to end on the training agent.

Fix

  • server/tests/manual/run-storyboards.ts: brandFromKit returns undefined for media_buy_seller/account_change_feed. This uses the same exclusion the harness already applies to the wholesale scope-isolation vectors, whose authored account identity also differs from the test-kit brand. With the exclusion, the controller receives the natural key sync_accounts returned, which resolves to acc_luma_shared.
  • static/compliance/source/.../account_change_feed.yaml: the creative ID is generated once through a context_outputs generate: uuid_v4 entry on acquire_latest_checkpoint. All 8 uses now read $context.account_change_external_creative_id. No assertions or timeouts changed.
  • Patch changeset for the storyboard change.
  • Regression test in server/tests/unit/account-change-feed.test.ts. It syncs acc_luma_shared by account_id with an account.change_recorded subscriber, then seeds a creative through the controller using the natural key sync_accounts returned, which is the shape the runner sends. It asserts one webhook with notification_id == change_id and the creative identity. It also asserts that a foreign-brand natural key (the test-kit brand) wakes no subscriber.

No training-agent source changed, and none of #7708's files are touched. Reporting-core code is untouched.

Storyboard results (TENANT_PATH=sales, ADCP_COMPLIANCE_DIR=dist/compliance/latest, as in CI)

State Result
main 3 passed / 1 failed (expect_account_change_webhook) / 13 skipped
harness fix only 4 passed / 1 failed (drain_after_checkpoint, UUID mismatch) / 12 skipped
storyboard fix only 3 passed / 1 failed (expect_account_change_webhook) / 13 skipped
this PR 17 passed / 0 failed / 0 skipped

The repro command in the issue doesn't set ADCP_COMPLIANCE_DIR, so it runs the storyboard copy bundled in @adcp/sdk (3.2.0-rc.7), not repo source. With this PR that run reaches 4 passed / 1 failed at drain_after_checkpoint. It will be clean once a release ships the fixed storyboard and the SDK bundles it.

Testing

  • npx vitest run --config server/vitest.config.ts src/ tests/unit/account-change-feed.test.ts tests/unit/comply-test-controller.test.ts: 185 of 186 pass. The one failure is src/training-agent/tenants/account-change-feed-transport.test.ts, which fails on main and is fixed by fix(training-agent): resolve comply_test_controller account_id targets and run server/src tests in CI #7708.
  • npm run typecheck passes.
  • Storyboard lints pass: context-entity, context-output-paths, validations-paths, fixture-resolution, sample-request-schema, scoping, and run-storyboards-schema-root.
  • The pre-commit server suite passes.

Follow-ups (not in this PR)

  • SDK: the comply_test_controller request builder drops an authored account.account_id in favor of context.account or the test-kit account. That is why the harness exclusion is needed. Worth an adcp-client issue.
  • Five other storyboards reuse a $generate alias across phases and may have the same bug: governance_conditions, governance-spend-authority, and the governance_approved scenarios for brand-rights, creative-transformers, and signal-marketplace.

🤖 Generated with Claude Code

…nd drain steps

The storyboard failed on the /sales tenant for two independent reasons,
neither in the training agent's emit path.

1. The local storyboard harness threads the test-kit brand
   (acmeoutdoor.example) into the SDK runner. The runner addresses
   comply_test_controller by the natural key sync_accounts returned
   (luma-outdoor.example / pinnacle-agency.example), and its brand
   invariant swapped in the test-kit brand. That key names no synced
   account, so seed_creative recorded no change and no
   account.change_recorded webhook fired. Skip the test-kit brand for this
   storyboard, as the harness already does for the wholesale
   scope-isolation vectors.

2. The storyboard threaded the external creative ID through a
   $generate:uuid_v4#alias across phases. Runner aliases are
   phase-scoped, so later phases compared the feed against a fresh UUID.
   Generate the ID once through context_outputs and read it via
   $context.

Adds a unit test that seeds a creative through the controller by the
synced natural key and asserts the subscriber receives
account.change_recorded, and that a foreign-brand key does not.

Closes #7715

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, tightly scoped compliance fix for the account_change_feed storyboard.

Checked:

  • Diff touches a changeset, a manual harness script, a unit test, and one compliance scenario YAML — no schema source (static/schemas/source/**), no dist/** artifact mutation, no docs/reference change, so no schema↔docs coherence or oneOf/immutability concerns apply.
  • Changeset present and correct (patch, protocol-scoped, correct type) — changeset scope/type gate satisfied.
  • Not based on 3.1.x; no transport/auth/signing changes; no breaking-class wire change, so the breaking-change hard gate does not fire.
  • External creative ID threaded through all 8 alias sites via the phase-1 context_outputs uuid_v4 generator; regression test added.

Gate checks:

  • No no-auto-approve team match.
  • gated_paths: false — row 2 does not apply.
  • high_risk: false.
  • No Critical/High/Medium findings.

None of decision-table rows 1–8 fire, so the outcome is approve (row 9).

@bokelley
bokelley merged commit 9377c59 into main Sep 29, 2026
53 checks passed
@bokelley
bokelley deleted the fix/account-change-feed-webhook branch September 29, 2026 04:47
bokelley added a commit that referenced this pull request Sep 29, 2026
…storyboards (#7731)

The @adcp/sdk storyboard runner scopes $generate:<kind>#<alias> values to
one phase (adcp-client#1658): the alias cache is keyed on the context
object, and each phase starts from a shallow copy that does not carry the
cache. A later phase that reuses an alias mints a different UUID.

Five storyboards reused an idempotency-key alias between the
check_governance payload and the governed mutation in a later phase, so
the executed request no longer matched the authorized payload:
media_buy_seller/governance_conditions, governance_spend_authority, and
the brand_rights, creative_transformers, and signal_marketplace
governance_approved scenarios. Each now generates the key once with a
context_outputs generator on the step before its first use and reads it
as $context.<name>. account_change_feed gets the identical fix from
#7716 so the new lint passes on its own.

Add scripts/lint-storyboard-generate-phase-scope.cjs, run from
build:compliance and from npm test (test:storyboard-generate-phase-scope),
which fails when a $generate alias appears in more than one phase.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@aao-release-bot aao-release-bot Bot mentioned this pull request Sep 30, 2026
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.

account_change_feed storyboard: no account.change_recorded webhook arrives after a shared-account creative change

1 participant