Skip to content

fix(compliance): backport committed-currency total_budget redistribution to 3.2.x - #8265

Merged
bokelley merged 1 commit into
3.2.xfrom
backport/3.2.x-total-budget-redistribution-currency
Oct 17, 2026
Merged

bokelley merged 1 commit into
3.2.xfrom
backport/3.2.x-total-budget-redistribution-currency

Conversation

@bokelley

@bokelley bokelley commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #8244 (main commit 20ace531a26509d079b07d1f1a4c4f3832239e8a) to the 3.2.x maintenance line. Fixes #8232 on the line the reporter actually hit it on — 3.2.4, now 3.2.5.

Why 3.2.x needs it

media_buy_seller/total_budget_redistribution hardcoded total_budget.currency: "USD" in both of its update_media_buy requests, so a seller whose buy is denominated in another currency was failed for correctly rejecting an update that would redenominate it. The storyboard grades redistribution, not currency selection (that's media_buy_seller/pricing_currency_filter).

I confirmed the bug is still present and unowned on this line: git cherry origin/3.2.x 20ace531a reports +, the storyboard on origin/3.2.x still carries currency: "USD" at both update steps, and no existing backport PR or branch covers it. 3.1.x does not have this storyboard at all, so no 3.1 backport is needed.

The fix replaces the literal with $context.media_buy_currency, captured by a new read_committed_currency step from media_buys[0].currency — the only required carrier of a committed buy's currency on this line too (verified against origin/3.2.x's own schemas, not main's).

Patch eligibility

Patch-eligible under the playbook's conformance harness rule: no renamed or repurposed step kinds, no new comply_test_controller enum values, no runner-output.json changes. The one genuinely new assertion — the read-back field_value on media_buys[0].currency — imposes no new requirement, because 3.2.x's own update-media-buy-request.json already states "currency MUST equal the existing media-buy currency; an update does not redenominate a buy." Only the storyboard was wrong. The changeset is the unmodified "adcontextprotocol": patch from main.

Conflict resolution — one file, one line

The cherry-pick hit exactly one conflict: package.json's test:schemas script, because main registers many more test files than 3.2.x does. This is ordinary branch divergence, not a newer-version dependency. I took 3.2.x's own list and inserted only tests/total-budget-redistribution-currency.test.cjs after the same anchor main uses. Verified by parsing both sides: 40 → 41 files, nothing removed, no main-only test leaked in (those files don't exist here and would break CI), and no other key in the file changed — version stays 3.2.5, dependencies untouched.

The three content files (storyboard, test, changeset) are byte-identical to main's, which is correct here: the pre-change storyboard on 3.2.x was itself identical to main's, so there is no maintenance-line divergence for an identical copy to clobber.

The SDK pin — checked, not assumed

3.2.x pins @adcp/[email protected]; main pins 15.9.2. This was the one plausible place a newer-version dependency could hide, so I reinstalled the maintenance line's own lockfile (npm ci → 14.0.0-rc.53) and ran everything against it rather than against main's tree. No newer-version dependency exists. storyboard-schema.yaml and runner-output-contract.yaml are byte-identical between the two lines, so narrative, phase depends_on, stateful, and context_outputs are all available here.

Testing (all on @adcp/[email protected])

  • tests/total-budget-redistribution-currency.test.cjs — 7/7 pass. Drives the storyboard through rc.53's real runStoryboard against EUR and USD sellers, plus three executable negatives: the pre-fix USD literal, a seller that redenominates mid-redistribution, and a failed capture that must cascade-skip rather than ship a raw $context token.
  • Real seller: TENANT_PATH=sales run-storyboards.ts --storyboard-id media_buy_seller/total_budget_redistribution → 10P / 0S / 0N/A, clean.
  • 16 storyboard lint suites + test-coverage registration + build:compliance: green.
  • check-changeset-protocol-scope.cjs origin/3.2.x and changesets status --since=origin/3.2.x → patch, adcontextprotocol.
  • Full pre-commit suite (server unit + typecheck) green.
  • No dist/** edit, no package-lock.json change, no manual version bump, no .changeset/pre.json — this cuts a stable 3.2.6, not an RC.

One behavior change worth naming

read_committed_currency calls get_media_buys immediately after create, whereas before the first read came only after an update_media_buy round-trip. A seller with a lagging read surface that was coasting on that extra latency could now fail the capture. Such a seller is already non-conformant (get_media_buys must reflect committed state), but no 3.2 normative text spells out a read-after-write deadline, so it is worth knowing rather than discovering at grading time.

Follow-ups for main (deliberately not changed here)

A backport should stay byte-identical to its source; both reviewers agreed these belong on main first, if at all:

  1. The read-back uses check: field_value with value: "$context.media_buy_currency". storyboard-schema.yaml names field_equals_context as the idiom for comparing a response field to a prior capture. Sound as written — the comparand came from a prior response, not the circular case the schema warns about — but a strengthening opportunity.
  2. The changeset's created_revision rationale says "convention extraction runs before explicit captures," which describes within-step precedence. The operative hazard is cross-step: the later read's convention extraction overwrites the earlier step's explicit capture. The fix is right; the sentence is imprecise.

🤖 Generated with Claude Code


Open workspace in Conductor

…distribution updates (#8244)

media_buy_seller/total_budget_redistribution grades total_budget
redistribution, not currency selection — that is graded by
media_buy_seller/pricing_currency_filter. Both of its update_media_buy
requests wrote total_budget.currency: "USD", so a seller whose buy is
denominated in another currency was failed for correctly rejecting an update
that would have redenominated it, and the read-back then graded the
consequentially unchanged total as wrong too (#8232).

A new read_committed_currency step captures media_buys[0].currency and both
updates send $context.media_buy_currency; the post-update read-back asserts
the redistribution did not redenominate the buy. get_media_buys is the source
because media_buys[].currency is the only required carrier of a committed
buy's currency — create-media-buy-response.json and
update-media-buy-response.json both leave currency optional and
core/package.json has none, so capturing from the create response as the
issue suggested would have traded a VALIDATION_ERROR for a
capture_path_not_resolvable against a conformant seller that omits it.

Two supporting corrections. create_fixed_buy captures its revision as
created_revision: CONTEXT_EXTRACTORS.get_media_buys writes `revision` by
convention and convention extraction runs before explicit context_outputs, so
the new read would otherwise have overwritten the revision create_media_buy
returned and the scenario would no longer grade that token.
reject_total_with_packages becomes stateful: true and its phase declares
depends_on: [setup]: expect_error steps are deliberately not skipped on
unresolved $context substitution, so a failed capture would otherwise put the
raw "$context.media_buy_currency" token on the wire — a value no ^[A-Z]{3}$
field accepts — and let the step pass on the seller's rejection of that
instead of on the inconsistent package sum it exists to grade. depends_on
keeps the probe graded when only the redistribute phase trips, and keeps the
reporter's observed symptom chain (failed update, consequential unchanged
read) intact.

The seeded USD rate card is unchanged; the scenario simply no longer assumes
it was the rate card that priced the buy. No currency capability gate is
added — pricing_currency_filter already grades currency selection, and
get_adcp_capabilities exposes no list of transactable currencies to gate on.

tests/total-budget-redistribution-currency.test.cjs drives the scenario
through the SDK runner against EUR and USD sellers (the EUR lane omits the
optional currency from its create response), plus three executable negatives:
the pre-fix USD literal, a seller that redenominates mid-redistribution, and
a failed capture that must cascade-skip rather than ship a raw token.

Co-authored-by: Claude Opus 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 backport with no findings.

This is a byte-identical backport of #8244 to the 3.2.x stable line, fixing #8232. The reviewer verified:

  • Patch-eligibility: conformance-harness fix with no step-kind rename, no new enum/runner-output surface; the new read-back asserts behavior update-media-buy-request.json already mandates.
  • Schema premises confirmed against base-pinned 3.2.x: get-media-buys-response.json:886 requires media_buys[].currency while create-media-buy-response.json:185-190 makes it optional, so get_media_buys is the correct currency source (no spec drift).
  • The 521-line test handles the cascade-skip asymmetry, proven by negative-control tests.
  • Changeset correctly scoped (patch/adcontextprotocol).

No Critical/High/Medium findings. high_risk is false, gated_paths is false, no author team gate, no prior decision. None of decision rows 1–8 fire → row 9 approve.

@bokelley
bokelley merged commit 01ba7ed into 3.2.x Oct 17, 2026
49 checks passed
@bokelley
bokelley deleted the backport/3.2.x-total-budget-redistribution-currency branch October 17, 2026 16:59
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.

1 participant