Repository navigation
feat(reporting): reconcile all_media_buys obligations against a seller-frozen media-buy set - #3778
Merged
Merged
Conversation
…sen membership
ExpectedReportingPeriod gains `membership` (ExpectedReportingMembership).
The default `{ kind: 'media_buy_ids' }` keeps exact mediaBuyIds and coverage
equality. `{ kind: 'all_media_buys', requiredMediaBuyIds? }` omits both and
instead requires valid coverage evidence whose partition equals the
obligation's own media_buy_ids, scope_resolved_at == period.end,
coverage.evaluated_at == scope_resolved_at, and coverageRequirement. A
required buy the seller omitted is a blocking REPORTING_SCOPE_MEMBER_MISSING
issue on ObligationReconciliation.issues: the obligation still matches for
the buys it lists, but the result is not definitive.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fuse ambiguous membership - Match an all_media_buys expected period on identity only. The frozen-set checks (cutoff, coverage partition and denominator, coverage requirement) surface as blocking reasons on the matched obligation, so the buyer never posts obligation_missing for an obligation that exists. - Compare all_media_buys cutoff instants by value, so `00.000Z` equals `00Z`. - Throw INVALID_EXPECTED_MEMBERSHIP for all_media_buys with mediaBuyIds or coverage pins, an unknown kind, or malformed requiredMediaBuyIds. - Strip a runtime `membership` from subscription expectation templates, which otherwise skipped the subscription buy-set comparison (fail-open). - Test the GCS fence's all_media_buys branch; correct the changeset wording. Co-Authored-By: Claude Opus 5.5 <[email protected]>
rachitm022
marked this pull request as ready for review
November 23, 2026 19:05
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — adds all_media_buys seller-chosen membership to reporting reconciliation.
Checked:
ExpectedReportingPeriodbecomes a union overExpectedReportingMembership; all_media_buys expectations match on identity alone and never report missing, with cutoff/coverage/requirement failures surfacing as blocking reasons on the matched obligation.pinnedMembershipguards every coverage/buy-set comparison; the default pinned path only loosens whenpinned===undefined, so existing behavior is unchanged.assertExpectedMembershipsfails closed before any seller read (test asserts statusReads===0).sameCutoff→sameInstant→normalizedInstant(reconciliation.ts:2715) normalizes RFC-3339 to UTC, scoped to the all_media_buys arm.- Rollup logic keeps per-buy REPORTING_SCOPE_MEMBER_MISSING non-definitive while the obligation stays definitive for listed buys.
- GCS fence refuses all_media_buys with CONTENT_CONFLICT.
- Changeset present (minor/patch), documents the union type-narrowing on an experimental surface — consistent with wire-change impact.
- Test file (+357) covers zero-buy full coverage, formatting-only instant equality, cutoff edge cases, partial/none/unknown coverage, and config-error rejection.
No blocking or medium findings. One Low follow-up recorded (reconciliation.ts:273 — trusts media_buy_ids pins) is omitted per severity model.
Decision table: no critical/high (row 1 n/a); gated_paths false (row 2 n/a); high_risk false (rows 3,5 n/a); no medium findings (rows 4,8 n/a); no prior escalation (row 6 n/a); no team gate (row 7 n/a). Falls through to row 9 → approve.
rachitm022
deleted the
rachitm022/reporting-all-media-buys-membership
branch
November 23, 2026 19:10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Buyers can now reconcile reliable-reporting obligations for a delivery config registered with
scope: {all_media_buys: true}. Under that scope the seller decides which media buys each period covers, freezing the set atperiod.end.ExpectedReportingPeriod.membership:{kind:'media_buy_ids'}is the default. Reconciliation behaves exactly as before.{kind:'all_media_buys', requiredMediaBuyIds?}covers all-scope periods. These expectations carry nomediaBuyIdsorcoveragepins.obligation_missing.SCOPE_CUTOFF_MISMATCH:scope_resolved_atis not the same instant asperiod.end, orcoverage.evaluated_atis not the same instant asscope_resolved_at. Instants are compared by value, so.000ZandZare equal.COVERAGE_SCOPE_MISMATCH:coverage.media_buy_idsdiffers fromobligation.media_buy_ids, or the coverage partition or status is invalid.COVERAGE_REQUIREMENT_NOT_MET: the requirement isfullbut the status is notfull. An empty buy set withfullcoverage is valid.requiredMediaBuyIdsentry is absent from the obligation, the result gets a blockingREPORTING_SCOPE_MEMBER_MISSINGissue and becomes non-definitive. The obligation still counts for the buys it lists, but a buy the seller left out is never treated as covered.INVALID_EXPECTED_MEMBERSHIPis thrown, before any seller read, for: all-scope combined with pins, an unknownkind, or badrequiredMediaBuyIds.membershipa template supplies at runtime is stripped.@adcp/reporting-storage: the GCS delivery fence refuses all-scope expectations.Breaking for type consumers
ExpectedReportingPeriodis now a union. Reading.mediaBuyIdsor.coveragewithout first narrowing to the explicit-buy variant now givesT | undefined. agentic-api'srevision-spend.tsneeds a one-line change when it bumps.Spec basis
AdCP 3.2
core/reporting-obligation.json. Itsx-adcp-validationrulesscope_resolutionandcoverage_resolutionsay:scope_resolved_atequalsperiod.end;coverage.evaluated_atequalsscope_resolved_at;coverage.media_buy_idsequalsmedia_buy_ids.core/reporting-coverage.jsondefines the coverage partition and status rules.Cross-repo context
This is one of four coordinated changes:
adcpSDK seller hook, onnext;agentic-api uses all-scope only for managed ESA sellers, behind a switch that is off by default.
Test plan
npm run build:lib,typecheck,typecheck:reporting-storage,lint,lint:boundariesnode --test test/reporting-reconciliation.test.js: 165/165, including new cases for each rule above (formatting-only instant match, each real mismatch, missing required buy, invalid membership, subscription strip)npm run test:reporting-storage: 194 pass, 1 skipped🤖 Generated with Claude Code