Skip to content

fix(reporting): serve 1.2 report definitions to AdCP 3.3 callers only - #3802

Merged
bokelley merged 7 commits into
mainfrom
fix/3709-pre-3-3-report-definition-gate
Nov 24, 2026
Merged

bokelley merged 7 commits into
mainfrom
fix/3709-pre-3-3-report-definition-gate

Conversation

@bokelley

@bokelley bokelley commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3709.

Problem

AdCP 3.3 adds report-definition contract_version 1.2 (adcontextprotocol/adcp#8983). The spec restricts which callers get it, in core/reporting-report-definition.json x-adcp-validation.package_dimension:

Callers pinned below 3.3 accept only 1.0 and 1.1 definitions, so a seller MUST serve them offerings whose definitions are 1.0 or 1.1; a 1.2 offering serves 3.3 callers only.

An offering pins its definition only by report_definition_uri and report_definition_sha256, so SDK-hosted sellers could not tell a 1.2 offering apart. They behaved as follows for callers pinned to 3.2:

  • They advertised it in get_adcp_capabilities, on any server whose media_buy protocol is available at 3.2 (any seller with sales tools).
  • They accepted sync_accounts reporting_delivery_configs that named it.

Change

Declaring versions (@adcp/sdk). createReliableReportingService takes two new options:

  • reportDefinitionVersions: hex report_definition_sha256 (matched case-insensitively) → '1.0' | '1.1' | '1.2'. It is keyed by the content address, so a declaration cannot drift from the definition the offering pins. A bad key or value, or one SHA declared twice with different versions, is a construction TypeError.
  • undeclaredReportDefinitions: 'assume_pre_1_2' (the default) or 'withhold_from_pre_3_3'.
    • The default serves an undeclared offering to every caller as a 1.0/1.1 definition, which is today's behavior. It warns once per process at construction with the offering id, the SHA-256, the URI and the entry to add.
    • The strict option serves undeclared offerings to 3.3 callers only.

The 3.3-only offerings are published as platform.reporting.adcp33OnlyOfferings, mapping offering id to '1.2' or 'undeclared'. createAdcpServerFromPlatform then:

Surface Callers pinned below 3.3
get_adcp_capabilities 1.2 offerings are dropped from media_buy.reporting_delivery.offerings. When none is left, reporting_delivery and the media_buy.reporting_delivery feature id are dropped. This uses the new capabilities.reportingAdcp33OnlyOfferingIds, which createAdcpServer also accepts directly.
sync_accounts reporting_delivery_configs A request whose configs name a 3.3-only offering fails as a whole, before accounts.upsert runs. The error is UNSUPPORTED_FEATURE with recovery: "correctable", field: "reporting_delivery_configs" and details: { offering_id } for the first offending config. offering_id is the seller's own id. The buyer's delivery_config_id is request text and is not echoed, because error details reach the caller's model context. No entry is applied. Per-entry refusal would shorten a delete_missing roster (deleting the account), and an entry keyed by account_id has no failed row a 3.2 caller accepts.
Server pinned below 3.3 Boot PlatformConfigError when any 1.2 offering (or undeclared offering under withhold_from_pre_3_3) is installed, because it could be served to no one.
installConfiguration Accepts an optional servedAdcpVersion (pass ctx.servedAdcpVersion), so a sync_accounts handler supplied outside accounts.upsert gets the same refusal.

"Pinned below 3.3" compares MAJOR.MINOR, so every 3.3 prerelease counts as 3.3. A request with no served release counts as the SDK's pinned release, and one the SDK can't parse counts as older, which fails safe.

The refusal message names the reason:

  • a declared 1.2 definition: …its report definition is at contract_version 1.2…;
  • an undeclared one under the strict mode: …its report definition's contract_version is undeclared….

Production service (@adcp/reporting-storage). createPostgresReliableReportingProductionService inherits the two options and forwards adcp33OnlyOfferings on its platform, the object a seller mounts as platform.reporting.

Intentionally unchanged:

  • get_reporting_status and the account readback of reporting_delivery_configs. The spec rule covers serving offerings, not reporting the state of a configuration the buyer already holds. Hiding a buyer's own obligations would tell it nothing is owed. On a 3.3 server, get_reporting_status is also bound to the server's exact pin, so pre-3.3 callers cannot call it.
  • Subscription offering resolution. Subscriptions are a 3.3 surface, and resolution runs in the engine with no caller version.
  • get_products reporting_capabilities.reporting_delivery_offering_ids. Products are the seller's own catalog, so the option doc and docs/guides/REPORTING-LEDGER.md tell sellers to filter 1.2 ids for pre-3.3 callers themselves.

Parity with the Python SDK

This matches adcp-client-python#1959 (for #1906), agreed point by point with its implementer:

  • the same declaration map and default;
  • the same strict mode and warning;
  • MAJOR.MINOR comparison, with an unparseable version counted as older;
  • the same capability filter;
  • the same refusal code, field, recovery, messages and details (offering_id only, as of Python head 422dc3b6c);
  • operation-level refusal on the SDK-owned sync_accounts path, and per call on installConfiguration (Python's core configure);
  • the same boot error;
  • no status, readback or subscription filtering;
  • products left to the adopter.

One difference: Python also derives a version from definition bytes it already holds and verifies against the SHA-256 (its production verifier registry), and treats a conflicting declaration as a boot error. The TS SDK holds definition bytes only at delivery time (the GCS contract reader), never at boot, so TS is declaration-only.

Tests

test/lib/reporting-definition-version-gate.test.js (37 tests):

  • option validation, including case-insensitive keys and conflicting duplicates;
  • adcp33OnlyOfferings (with reasons) under both modes;
  • the warning (once per process, absent when declared or strict);
  • the installConfiguration refusal matrix (3.2, 3.2.10 and unparseable refused; 3.3, 3.3.0-rc.3, 3.3.0-beta.1 and absent allowed; a 1.1 offering allowed at 3.2) and both exact messages;
  • the boot refusal;
  • get_adcp_capabilities per caller pin on a seller with a 3.2-available sales tool: 1.1 only for 3.2, both for 3.3 and unpinned, the block and feature id dropped when only 1.2 remains, nothing dropped for a 1.1-only service;
  • sync_accounts operation-level refusal: the first offending config's offering_id in details and its delivery_config_id nowhere in the error, upsert never called, a delete_missing regression that keeps the refused account, an account_id-keyed settings-update regression, and pass-through for a 3.3 caller.

The existing test/lib/reliable-reporting-service.test.js still passes (112/112).

🤖 Generated with Claude Code

bokelley and others added 6 commits November 24, 2026 13:52
Callers pinned below AdCP 3.3 accept only 1.0 and 1.1 report definitions,
so a seller must serve them only offerings whose definition is 1.0 or
1.1 (core/reporting-report-definition.json package_dimension,
adcontextprotocol/adcp#8983). The SDK could not tell a 1.2 offering
apart and advertised and accepted it for every caller.

createReliableReportingService takes reportDefinitionVersions, keyed by
report_definition_sha256, and undeclaredReportDefinitions
(assume_pre_1_2 by default, with a construction warning, or
withhold_from_pre_3_3), and publishes the 3.3-only offerings as
platform.reporting.adcp33OnlyOfferingIds. createAdcpServerFromPlatform
drops them from get_adcp_capabilities for pre-3.3 callers, refuses
those callers' sync_accounts reporting_delivery_configs naming them per
account entry with UNSUPPORTED_FEATURE, and refuses to start a server
pinned below 3.3 that has one. installConfiguration takes an optional
servedAdcpVersion for handlers outside accounts.upsert. The production
service in @adcp/reporting-storage forwards the platform field. Same
behavior as the Python SDK (adcp-client-python#1906).

Closes #3709

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Treat an unparseable served release as older, as the Python SDK and the
existing reporting gates do, so a garbage pin fails safe. Publish the
3.3-only offerings with their reason (platform.reporting.adcp33OnlyOfferings,
'1.2' or 'undeclared') so the refusal says the contract_version is
undeclared for an undeclared offering under withhold_from_pre_3_3, with the
same message as Python. Match reportDefinitionVersions keys
case-insensitively and refuse a key declared twice with different versions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-only offering

Refusing just the offending account entry was unsafe. Dropping it from the
roster made a delete_missing sync delete that account, and an entry keyed
only by account_id has no failed row a 3.2 caller accepts, so it already
fell back to an operation error. A pre-3.3 caller whose
reporting_delivery_configs name a 3.3-only offering now fails the request
before accounts.upsert runs, with the first offending config in details,
as the Python SDK's production path does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — additive AdCP 3.3 report-definition-1.2 gating for Reliable Reporting.

Checked:

  • Pathway-back (DR-0033): verified for every pre-3.3 caller — droppable via the get_adcp_capabilities offering filter (create-adcp-server.ts:10229-10240), refused in sync_accounts (fails whole-request before upsert, from-platform.ts:9523-9540), installConfiguration gate, and boot refusal. acceptsReportDefinition12 fails closed on unparseable/older releases.
  • Witness-not-translator: no fabrication or silent re-shaping; drops/refusals are reported end-to-end.
  • Changesets: two patch changesets present, appropriate for a purely additive surface.
  • Tests: 612-line suite covers all four source paths including delete_missing non-shortening (test:1108).

No critical, high, or medium findings. One minor, non-blocking observation noted by the reviewer: the || reporting.offerings?.length === 0 clause at create-adcp-server.ts:10241 also drops reporting_delivery for a pre-3.3 caller in the unlikely empty-offerings-with-configuration_task case. This is a low-severity edge case, not blocking.

Decision table: no findings at critical/high (row 1 no), gated_paths false (row 2 no), high_risk false (rows 3/5 no), no medium findings (rows 4/8 no), no prior escalation (row 6 no), no team gate (row 7 no) → row 9 approve. Note: gated_paths is false, so the REVIEW_REQUIRED status does not force a gate.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 24, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

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 delta, no blocking findings.

This is a subsequent push following a prior approve (head a120a26). The reviewer reports a clean pass with no critical/high/medium findings.

What was checked:

  • Reshapes the unreleased adcp33OnlyOfferingIds (string array) into adcp33OnlyOfferings (offering-id → reason map), with case-insensitive SHA matching and same-key/different-version conflict detection (service/index.ts:160,170-174).
  • Flips acceptsReportDefinition12 to fail-closed on an unparseable version (reporting-definition-release.ts:474) — correct conservative default.
  • Converts the sync_accounts gate from per-entry drop to whole-request refusal before accounts.upsert (from-platform.ts:9523-9543) — refuse-not-drop, aligned with the witness rule; dropping an entry would have shortened a delete_missing roster. Exercised by the delete_missing and account_id-keyed tests.
  • Throw placement follows in-file precedent; null-config access short-circuited by optional chaining.
  • Changesets present for both @adcp/sdk and @adcp/reporting-storage; repo in beta pre-mode.

Gate checks: no no-auto-approve team match; gated_paths false; high_risk false. review_decision is REVIEW_REQUIRED but gated_paths is false, so row 2 does not fire. No findings trigger rows 1–8; falls through to row 9 → approve.

…fusal details

The 1.2 offering refusal echoed the buyer's delivery_config_id into
error details, which reach the caller's model context. Details now carry
only offering_id, the seller's own id (matched exactly before the
refusal is raised). Code, field, recovery and message are unchanged.
This matches adcp-client-python#1959 (head 422dc3b6c).

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve.

Delta pass over 6 files since the prior approve (head 34a955a). The only substantive change: reportingOfferingRequiresAdcp33Error now drops the buyer-supplied delivery_config_id from the UNSUPPORTED_FEATURE error details, keeping only the seller's own offering_id. Helper signature, both call sites (service/index.ts:1417, from-platform.ts:9531), docs, changeset, and tests all move in lockstep; the test adds a positive assertion that the buyer id never appears in the serialized error. This is a clean fail-closed tightening consistent with CTX-METADATA-SAFETY (no request text echoed back) — not fabrication or wire re-shaping.

No critical/high/medium findings in this run. No author team gate, gated_paths is false, high_risk is false. No escalation triggers fire. Rows 1-8 do not match → row 9 approve.

@bokelley
bokelley merged commit 4c6f99f into main Nov 24, 2026
48 checks passed
@bokelley
bokelley deleted the fix/3709-pre-3-3-report-definition-gate branch November 24, 2026 21:36
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.

Reliable Reporting: serve only 1.0/1.1 report definitions to callers pinned below AdCP 3.3 (adcp#8983)

1 participant