Skip to content

feat(reporting): deterministic admission and resolution, overrides, paging, in-place membership - #8619

Merged
bokelley merged 3 commits into
mainfrom
bokelley/beta3-determinism-scale
Oct 31, 2026
Merged

bokelley merged 3 commits into
mainfrom
bokelley/beta3-determinism-scale

Conversation

@bokelley

@bokelley bokelley commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

AdCP 3.3.0-beta.3, PR C of three: determinism and scale for experimental reporting subscriptions (media_buy.reporting_subscriptions).

1. Normative versions of what both SDKs implement

  • max_accounts admission (new x-adcp-validation.admission). Admission is sticky and per subscription, ordered by coverage start and then account_id in byte order. Coverage start here means the account's authorization.authorized_at. The key doesn't depend on the subscription, so a principal's subscriptions with the same scope and limit admit the same accounts. An admitted account keeps its place until it leaves coverage, and a waiting account carries an open capacity exception. Accounts without covered buys count: a buyer computes admission from list_accounts alone, and an account holds its place before its first buy, so that buy is reported.
  • Resolution is per package, made when a (buy, version) pair first resolves, at max(accepted_at, confirmed_at) (or when a package is added). It stays fixed until the resolved offering is withdrawn. A newly added offering never re-resolves it; a new version resolves afresh. This replaces the old "adding an offering is a resolution change" bullet.
  • Billing subscriptions MUST use match: exact with dimensions, enforced by the schema (previously SHOULD).

2. Scale

  • destination_overrides[]: each entry routes {account_ids | operator_domains} to a destination_id, with an optional path_template. An account_ids entry wins over an operator_domains entry; duplicates fail the request. Override destinations share the main destination's pattern and transport, so routing never changes resolution. Changing overrides is a destination change, so it needs a new version. destination_override_refs reads them back.
  • Paged per-account state. The inline accounts_with_exceptions and accounts_unauthorized stay capped at 1,000, now in account_id byte order. prior_versions is now bounded at the 16 newest. Each list carries a required total (*_count, enforced through dependencies). get_principal gains an optional reporting_subscription_page request (subscription_id, list, pagination), and the current result adds the page. The item schemas moved to definitions so the inline lists and the page share them.
  • Membership edits apply in place. Adding or removing account_ids, and changing exclude_account_ids, no longer bump subscription_version (new x-adcp-validation.membership). Each edit is a cutover for that account alone, recorded as excluded_by_buyer intervals:
    • Removal opens an interval at E.
    • Re-adding closes it at the next boundary.
    • An account that joins after accepted_at gets a closed interval over the time before it joined.
    • A removed account stays in subscription_coverage, as excluded, while the entry is retained.

3. Several pacing or analytics subscriptions per purpose

Two active pacing or analytics subscriptions at the same scope level may both apply to an account, for example hourly plus daily, or two breakdowns. Where both resolve the same offering for a package, the lower subscription_id in byte order owes it. The other records a buy-level overridden exception with package_ids, which package_ids now allows. Billing stays one per account at a scope level, and sync-principal-request validation is narrowed to billing.

4. Settled from the DX plan (owner-approved scope addition)

  • Partial grants. Coverage depends only on get_reporting_status in allowed_tasks. A grant without sync_reporting_receipts or sync_reporting_status keeps the account covered and readable. The seller refuses the missing task for that account with SCOPE_INSUFFICIENT, not with the unknown-identifier shape, which stays reserved for lost authority (feat(reporting): revocation means no access; wind down with a reduced grant #8607). A billing obligation the buyer can't receipt stays receipt-pending, and that pending receipt is the buyer's, never a seller delay. This is what both SDKs do.
  • account_id on delivered rows. A seller advertising subscriptions publishes every managed-delivery offering (one with method) with a row schema that declares account_id as a required string and lists it in primary_keys. Without the column, stamped rows fail validation; without the key, rows from several accounts in one consolidated destination can collide. Core offerings are exempt. The rule is in the new x-adcp-validation.subscription_rows on the offering and in the subscription destination rule.

5. Coverage vectors (adcp#8616)

The reference model now uses sticky resolution. resolution-change-is-a-cutover becomes a-newly-available-offering-never-re-resolves, with changed_from_origin recording the re-ruling, and withdrawal-of-the-resolved-offering-is-a-cutover is new. The selection rule now says a buy owes the union of its packages' resolutions, so it can owe two offerings even under exact or finest, as the packages-on-different-products-resolve-different-offerings vector already pins.

Owner decisions (approved)

  • What "coverage start" means for admission: authorized_at, then account_id (approved). It is the only key identical across a principal's subscriptions.
  • Admission counts accounts that have another open exception, such as overridden, offering_unsupported or action_required. They are still candidates. The alternative frees their places but makes admission depend on seller-side state.
  • Cross-level precedence is unchanged. An account_ids subscription still replaces all-accounts subscriptions of the same purpose, even ones that resolve different offerings. Only same-level multiplicity changed.
  • prior_versions is now capped. An earlier test pinned it as deliberately uncapped. Paging makes the cap safe, but the test change reverses that pin.
  • Row ruling strength. Requiring account_id in primary_keys, not only as a required column, is my call. It is stricter than "the schema allows it", which is what the SDKs check.
  • Override membership edits still bump the version, because they are destination changes.

Test plan

  • npm run build:schemas && npm run build:compliance (no symbol-link changes)
  • test:schemas, test:json-schema, test:compliance-snippets, test:owned-links, the MCP projection and analysis tests, and the bounds tests. No capabilities shape change: max_accounts gets a description only, so no repin.
  • test:docs-nav live-source checks pass. The snapshot checks need dist/docs, which the sparse worktree omits.
  • New tests: a reference admission model (stickiness, byte order, freed places), billing exact plus dimensions, override validation, membership intervals, package-level overridden, and the paged read request and response shapes.

Rebased onto #8622 and #8617 (both merged). The merged reference model re-derives every vector case, including the billing stub and notice-period cases, under sticky resolution, and the property tests pass.

🤖 Generated with Claude Code

@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: Escalate to human review

Escalate — gated-paths hard approval gate not satisfied.

This PR modifies 11 files under static/schemas/source/**, which are under the repo's deterministic hard approval gate (gated_paths: true). The required review status is REVIEW_REQUIRED, not APPROVED, so per decision table row 2 the outcome must be escalate rather than approve.

The reviewer found no Critical/High/Medium findings: schema↔docs coherence verified across all 11 schema files and 5 doc pages, changeset correctly scoped as minor to static/schemas/source/**, no undiscriminated oneOf regression (destination_overrides uses anyOf+not, a known walker-safe pattern), no dist/** edits, and the x-added-in sweep is correctly updated. The diff itself is clean.

However, a clean diff does not lift the gate — only a human/CODEOWNERS approval (review_decision: APPROVED) does.

Escalation reasons:

  • Modifies protocol source-of-truth schema files under static/schemas/source/** (gated path); human/CODEOWNERS review required because review_decision is REVIEW_REQUIRED, not APPROVED.

Why human review

  • Gated paths: PR modifies 11 files under static/schemas/source/** (hard approval gate) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/reporting-delivery-capabilities.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-delivery-offering.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription-coverage.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription-state.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/get-reporting-status-response.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-reporting-receipts-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-reporting-status-request.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-principal-request.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-principal-response.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/sync-principal-request.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Oct 31, 2026
bokelley and others added 3 commits October 31, 2026 03:01
…aging, in-place membership

Makes normative what the TS and Python SDKs implement for experimental
reporting subscriptions: sticky max_accounts admission ordered by
authorized_at then account_id byte order (accounts without buys count),
per-package resolution fixed per (buy, version) until withdrawal, and
billing subscriptions on match exact with dimensions. For scale it adds
destination_overrides, bounded inline readback with counts and a paged
get_principal reporting_subscription_page read, and in-place membership
edits recorded as excluded_by_buyer intervals. Several pacing or analytics
subscriptions may now apply to one account and purpose; billing stays one.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… account_id

Coverage depends only on get_reporting_status in allowed_tasks. A grant
without sync_reporting_receipts or sync_reporting_status keeps the account
covered, and the seller refuses the missing task with SCOPE_INSUFFICIENT
rather than as an unknown identifier. A seller advertising subscriptions
publishes every managed-delivery offering with a row schema that requires
account_id and keys on it, as both SDKs already assume.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… owes its packages' union

The reference model now resolves each (buy, version) pair once, at the later
of accepted_at and confirmed_at, and re-resolves only when the resolved
offering is withdrawn. resolution-change-is-a-cutover becomes
a-newly-available-offering-never-re-resolves, and
withdrawal-of-the-resolved-offering-is-a-cutover is new. The selection rule
says a buy owes every offering any of its packages resolves, so it can owe
two even under exact or finest.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@bokelley
bokelley force-pushed the bokelley/beta3-determinism-scale branch from 02d55ba to 269c4b9 Compare October 31, 2026 03:02

@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: Escalate to human review

Escalate — gated schema paths require human/CODEOWNERS approval.

This PR modifies 11 files under static/schemas/source/**, which fall under a hard, non-overridable approval gate (gated_paths: true). The current GitHub review decision is REVIEW_REQUIRED, not APPROVED, so the gate (decision table row 2) is not satisfied and Ladon cannot auto-approve regardless of how clean the diff is.

The reviewer pass was clean: no critical/high/medium findings. The only executable change (stickyResolution in coverage.cjs) was verified against the re-ruled coverage vectors; schema↔docs coherence holds across billing MUST, destination_overrides, sticky admission, partial-grant/SCOPE_INSUFFICIENT, and the inline caps. No undiscriminated oneOf, no dist/** mutation, changeset appropriate for the unreleased experimental surface. No prior blockers to re-surface.

Escalation reasons

  • Modifies 11 files under static/schemas/source/** (hard approval gate) while review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge.

Once a human/CODEOWNERS approval is recorded, this clean diff can fall through to approve on a subsequent run.

Why human review

  • Modifies 11 files under static/schemas/source/** (hard approval gate) and review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS review required before merge.
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/reporting-delivery-capabilities.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-delivery-offering.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription-coverage.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription-state.json (modified) matches static/schemas/source/**; static/schemas/source/core/reporting-subscription.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/get-reporting-status-response.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-reporting-receipts-request.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/sync-reporting-status-request.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-principal-request.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-principal-response.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/sync-principal-request.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

Copy link
Copy Markdown
Contributor Author

Ladon found no blocking or medium findings. It escalated only because the change touches the gated schema paths. The owner approved the beta.3 set, including the decisions listed in this PR (admission by authorized_at, then account_id; prior_versions capped at 16 and paged; account_id in primary_keys; same-purpose override precedence), so this is being merged by admin.

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

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant