diff --git a/.changeset/reporting-status-changed-empty-first-snapshot.md b/.changeset/reporting-status-changed-empty-first-snapshot.md new file mode 100644 index 0000000000..2fab0ffb42 --- /dev/null +++ b/.changeset/reporting-status-changed-empty-first-snapshot.md @@ -0,0 +1,5 @@ +--- +"adcontextprotocol": patch +--- + +Reliable Reporting (experimental): a seller SHOULD NOT fire `reporting.status_changed` when the only health change is an obligation moving from `waiting` to `healthy` or `complete` because a `snapshot` revision has `row_count` 0 and no earlier revision of the same logical slice was ever committed. Firstness comes from the slice's commit history, not from whether `supersedes_reporting_revision_id` is present, because a predecessor may have aged out of retention. Control totals do not determine emptiness. Every informative health transition still fires, including becoming late or overdue, a failure, recovery, a non-empty first revision, and any later revision that changes health. Polling `get_reporting_status` remains authoritative. This is the `reporting.status_changed` companion to the empty-first-snapshot `reporting.ledger_changed` recommendation in #9354; no field, enum, or capability changes. diff --git a/docs/media-buy/reporting-core-implementation-guide.mdx b/docs/media-buy/reporting-core-implementation-guide.mdx index c6a970e0aa..a8f91d5fb0 100644 --- a/docs/media-buy/reporting-core-implementation-guide.mdx +++ b/docs/media-buy/reporting-core-implementation-guide.mdx @@ -168,7 +168,15 @@ obligation appears in the first ledger snapshot strictly after `02:00Z`; with task call, not a seller push or a buyer-hosted callback. If you do offer push, Core's doorbell is `reporting.status_changed` — an invalidation for health transitions in either direction, with stable - `issue_ids`. `reporting.ledger_changed` is the separate optional invalidation + `issue_ids`. It SHOULD NOT fire when the only health change is an empty first + snapshot moving an obligation from `waiting` to `healthy` or `complete`: a + `snapshot` revision with `row_count` `0` when no earlier revision of the same + logical slice was ever committed. Firstness comes from that commit history, + not from whether `supersedes_reporting_revision_id` is present. Control + totals do not determine emptiness. Late and overdue transitions, failures + that change health, and recoveries still fire, as do transitions caused by a + non-empty first revision or any later revision. `reporting.ledger_changed` + is the separate optional invalidation for each new revision or adjustment, including changes that leave health untouched. It SHOULD NOT fire for an empty first snapshot: a `snapshot` revision with `row_count` `0` when no earlier revision of the same logical @@ -308,7 +316,9 @@ digest is intentionally retained). ledger record, `reporting.status_changed` starts a non-incremental current summary or periods read. Poll periodically even when notifications are enabled: an empty first snapshot revision may ring no ledger doorbell, so your poll is - how you reliably see it. + how you reliably see it. When that snapshot's only health effect is moving + the obligation from `waiting` to `healthy` or `complete`, it may ring no + status doorbell either. ## How to verify diff --git a/docs/media-buy/task-reference/get_reporting_status.mdx b/docs/media-buy/task-reference/get_reporting_status.mdx index 29f219984d..ff37e473f7 100644 --- a/docs/media-buy/task-reference/get_reporting_status.mdx +++ b/docs/media-buy/task-reference/get_reporting_status.mdx @@ -417,7 +417,9 @@ offered. Three doorbells exist, with different purposes: `issue_ids` matching `issues[].issue_id`, so consumers can project AdCP reporting issues into durable work items. Repair it with a non-incremental current summary or periods read: a clock-only transition may have no new - immutable ledger record and therefore no `changes_after` delta. + immutable ledger record and therefore no `changes_after` delta. It SHOULD NOT + fire when the only health change is an empty first snapshot moving the + obligation from `waiting` to `healthy` or `complete` (see below). - **`reporting.delivery_ready`** (managed-delivery tier only) — positive readiness for one materialization at a destination. Core configurations never fire it. @@ -441,6 +443,19 @@ snapshot, and every `official` revision, including a zero-row one. Every adjustment fires. Health transitions remain the separate concern of `reporting.status_changed`. +A seller SHOULD NOT fire `reporting.status_changed` when the only health change +is an obligation moving from `waiting` to `healthy` or `complete` because a +`snapshot` revision has `row_count` `0` and no earlier revision of the same +logical slice was ever committed. Firstness comes from the slice's commit +history, not from whether `supersedes_reporting_revision_id` is present: a +later revision still fires when its predecessor has aged out of retention and +the field is absent. Control totals do not affect whether a revision is empty. +Every other health transition fires, including becoming `delayed` or +`action_required`, a failure that changes health, a recovery from `delayed` or +`action_required`, a non-empty first revision, and a health transition caused +by any later revision. A later revision that leaves health unchanged remains +the separate concern of `reporting.ledger_changed`. + When offered (advertised via `readiness_notification`), `reporting.delivery_ready` is an account-anchored doorbell registered through [`sync_accounts`](/docs/accounts/tasks/sync_accounts) `notification_configs[]`. It is diff --git a/docs/protocol/get_adcp_capabilities.mdx b/docs/protocol/get_adcp_capabilities.mdx index 209ceb205b..b761af7856 100644 --- a/docs/protocol/get_adcp_capabilities.mdx +++ b/docs/protocol/get_adcp_capabilities.mdx @@ -936,7 +936,9 @@ when the seller declares any reporting notification. Three optional doorbells: `status_notification` (`reporting.status_changed`) is tier-independent invalidation for health transitions in either direction — valid for Core, since it names no destination, and repaired through a full -current status read; `ledger_notification` +current status read — but SHOULD NOT announce an empty first `snapshot` moving +an obligation from `waiting` to `healthy` or `complete`: `row_count` `0` when +no earlier revision of the logical slice was ever committed; `ledger_notification` (`reporting.ledger_changed`) announces each new revision or adjustment even when health is unchanged, but SHOULD NOT announce a `snapshot` revision with `row_count` `0` when no earlier revision of its logical slice was ever committed; diff --git a/docs/reference/implementor-faq.mdx b/docs/reference/implementor-faq.mdx index 94d90dbffb..e5e99b10ea 100644 --- a/docs/reference/implementor-faq.mdx +++ b/docs/reference/implementor-faq.mdx @@ -45,6 +45,19 @@ after fully consuming a periods read, persist `changes_checkpoint` and pass it as `changes_after` to repair missed, duplicate, or out-of-order events without re-reading the entire retained history. +### Q: Does an empty period need a reporting status doorbell? + +**A:** Not when its only health change is the ordinary completion of an empty +first snapshot. A seller SHOULD NOT fire `reporting.status_changed` when a +`snapshot` revision with `row_count` `0` moves its obligation from `waiting` to +`healthy` or `complete` and no earlier revision of that logical slice was ever +committed. Use the slice's commit history for firstness, not the presence of +`supersedes_reporting_revision_id`; control totals do not determine emptiness. +Late and overdue transitions, failures that change health, and recoveries still +fire, as do transitions caused by a non-empty first revision or any later +revision. Polling remains the authoritative path for learning that the empty +period completed. + ### Q: Can I reuse a published SDK reporting ledger instead of hand-rolling one? **A:** Partly, and the honest answer depends on which contract version the SDK diff --git a/static/compliance/source/test-vectors/reporting-subscriptions/vectors.json b/static/compliance/source/test-vectors/reporting-subscriptions/vectors.json index 1b8a9f97ea..bf40ad2bdb 100644 --- a/static/compliance/source/test-vectors/reporting-subscriptions/vectors.json +++ b/static/compliance/source/test-vectors/reporting-subscriptions/vectors.json @@ -2,7 +2,7 @@ "contract_version": "3.3", "feature": "media_buy.reporting_subscriptions", "status": "experimental", - "description": "Canonical, SDK-independent vectors for experimental principal-level reporting subscriptions. cases covers every period the seller owes: each entry gives the buyer-side input and either the exact owed periods (expected, one row per buy, resolved offering, and period, and expected_obligations, the same rows grouped the way obligations carry them) or the input error (expected_error). ledger_notification_cases covers the reporting.ledger_changed recommendation for committed records. Every expected result is derived from the spec text cited in spec_refs. scripts/reference/reporting-coverage is a brute-force reference model for the coverage cases; tests/reporting-subscription-coverage-vectors.test.cjs runs it. Each coverage case validates against case.schema.json in this directory. Like the feature, the vectors are experimental and change with it.", + "description": "Canonical, SDK-independent vectors for experimental principal-level reporting subscriptions. cases covers every period the seller owes: each entry gives the buyer-side input and either the exact owed periods (expected, one row per buy, resolved offering, and period, and expected_obligations, the same rows grouped the way obligations carry them) or the input error (expected_error). ledger_notification_cases covers the reporting.ledger_changed recommendation for committed records; status_notification_cases covers the reporting.status_changed recommendation for health transitions. Every expected result is derived from the spec text cited in spec_refs. scripts/reference/reporting-coverage is a brute-force reference model for the coverage cases; tests/reporting-subscription-coverage-vectors.test.cjs runs it. Each coverage case validates against case.schema.json in this directory. Like the feature, the vectors are experimental and change with it.", "tzdata": { "version": "2026f", "source": "https://data.iana.org/time-zones/releases/tzdata2026f.tar.gz", @@ -17,7 +17,8 @@ "input": "The input is what the buyer holds: its subscription versions as the get_principal readback shows them, the account's grants and timezone, the buys it can see through get_media_buys, the seller's offerings, and this subscription's get_reporting_status subscription_coverage entry for the account. case.schema.json describes each field.", "expected_error": "When the input cannot determine coverage, expected_error gives the error code and detail an SDK raises, from error-codes.json in this directory (COVERAGE_INPUT_INCOMPLETE or COVERAGE_INPUT_INVALID). wire_valid is false when the input also fails AdCP schema validation.", "vocabularies": "error-codes.json freezes the error codes SDKs raise for subscriptions and coverage; reason-codes.json freezes the reasons a period is or is not owed. Both SDKs use them verbatim.", - "ledger_notifications": "ledger_notification_cases freezes the recommended reporting.ledger_changed decision for a committed record. slice_commit_count_before is the number of revisions previously committed for the same logical slice, including revisions whose retention window has ended. should_not_fire is an advisory SHOULD NOT outcome; fire identifies records outside that exception." + "ledger_notifications": "ledger_notification_cases freezes the recommended reporting.ledger_changed decision for a committed record. slice_commit_count_before is the number of revisions previously committed for the same logical slice, including revisions whose retention window has ended. should_not_fire is an advisory SHOULD NOT outcome; fire identifies records outside that exception.", + "status_notifications": "status_notification_cases freezes the recommended reporting.status_changed decision for a health transition. slice_commit_count_before is the number of revisions previously committed for the same logical slice, including revisions whose retention window has ended. should_not_fire is an advisory SHOULD NOT outcome; fire identifies transitions outside that exception." }, "ledger_notification_cases": [ { @@ -127,6 +128,201 @@ "expected": "fire" } ], + "status_notification_cases": [ + { + "id": "empty-first-snapshot-waiting-to-healthy", + "rule": "A rowless snapshot is the slice's first revision and its only health effect is waiting to healthy, so the seller should not fire reporting.status_changed; control totals do not change emptiness.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 0, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "healthy" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 0, + "control_totals": [ + { "name": "spend", "value": "12.00" } + ] + }, + "expected": "should_not_fire" + }, + { + "id": "empty-first-snapshot-waiting-to-complete", + "rule": "A rowless snapshot is the slice's first revision and its only health effect is waiting to complete, so the seller should not fire reporting.status_changed.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 0, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "complete" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 0, + "control_totals": [] + }, + "expected": "should_not_fire" + }, + { + "id": "non-empty-first-snapshot", + "rule": "A first snapshot with rows fires reporting.status_changed when it moves the obligation from waiting to healthy, even when its profile-specific control total is zero.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 0, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "healthy" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 2, + "control_totals": [ + { "name": "spend", "value": "0.00" } + ] + }, + "expected": "fire" + }, + { + "id": "empty-later-snapshot-after-predecessor-retention", + "rule": "A rowless later snapshot fires because the slice has an earlier commit, even after that predecessor aged out and supersedes_reporting_revision_id is absent.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 1, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "healthy" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 0, + "control_totals": [] + }, + "expected": "fire" + }, + { + "id": "empty-superseding-snapshot", + "rule": "A rowless superseding snapshot fires because the logical slice already has an earlier committed revision.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 1, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "complete" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 0, + "control_totals": [], + "supersedes_reporting_revision_id": "rrv_prior" + }, + "expected": "fire" + }, + { + "id": "zero-row-first-official", + "rule": "An official revision fires reporting.status_changed when it moves the obligation from waiting to complete, even when it is the slice's first commit and has zero rows.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 0, + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "complete" + }, + "cause": { + "kind": "revision", + "finality": "official", + "row_count": 0, + "control_totals": [] + }, + "expected": "fire" + }, + { + "id": "obligation-becomes-late", + "rule": "A clock-driven transition from waiting to delayed fires reporting.status_changed.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "transition": { + "scope": "obligation", + "previous_health": "waiting", + "health": "delayed" + }, + "cause": { + "kind": "clock" + }, + "expected": "fire" + }, + { + "id": "obligation-becomes-overdue", + "rule": "A clock-driven transition from delayed to action_required fires reporting.status_changed.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "transition": { + "scope": "obligation", + "previous_health": "delayed", + "health": "action_required" + }, + "cause": { + "kind": "clock" + }, + "expected": "fire" + }, + { + "id": "obligation-failure", + "rule": "A failure that moves a healthy obligation to action_required fires reporting.status_changed.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "transition": { + "scope": "obligation", + "previous_health": "healthy", + "health": "action_required" + }, + "cause": { + "kind": "failure" + }, + "expected": "fire" + }, + { + "id": "empty-first-snapshot-recovery", + "rule": "Recovery from delayed to healthy fires reporting.status_changed even when the recovering record is a rowless first snapshot.", + "spec_refs": [ + "static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot" + ], + "slice_commit_count_before": 0, + "transition": { + "scope": "obligation", + "previous_health": "delayed", + "health": "healthy" + }, + "cause": { + "kind": "revision", + "finality": "snapshot", + "row_count": 0, + "control_totals": [] + }, + "expected": "fire" + } + ], "cases": [ { "id": "baseline", diff --git a/static/schemas/source/core/reporting-delivery-capabilities.json b/static/schemas/source/core/reporting-delivery-capabilities.json index a13ce194a8..b6d072268d 100644 --- a/static/schemas/source/core/reporting-delivery-capabilities.json +++ b/static/schemas/source/core/reporting-delivery-capabilities.json @@ -94,7 +94,7 @@ "status_notification": { "type": "string", "const": "reporting.status_changed", - "description": "Optional tier-independent invalidation doorbell for health transitions in either direction, including clock-driven waiting-to-delayed and delayed-to-action_required. Valid for Core: it names no destination. Polling status_task remains the authoritative recovery path whether or not this is offered." + "description": "Optional tier-independent invalidation doorbell for health transitions in either direction, including clock-driven waiting-to-delayed and delayed-to-action_required. A seller SHOULD NOT fire it when the only health change is an empty first snapshot moving an obligation from waiting to healthy or complete: a snapshot revision with row_count 0 when no earlier revision of the same logical slice was ever committed. Firstness comes from the slice's commit history, not the presence of supersedes_reporting_revision_id. Valid for Core: it names no destination. Polling status_task remains the authoritative recovery path whether or not this is offered." }, "ledger_notification": { "type": "string", diff --git a/static/schemas/source/core/reporting-status-changed-webhook.json b/static/schemas/source/core/reporting-status-changed-webhook.json index b8874a6c9c..9e5c106614 100644 --- a/static/schemas/source/core/reporting-status-changed-webhook.json +++ b/static/schemas/source/core/reporting-status-changed-webhook.json @@ -3,7 +3,7 @@ "$id": "/schemas/core/reporting-status-changed-webhook.json", "title": "Reporting Status Changed Webhook", "x-status": "experimental", - "description": "Account-anchored invalidation fired when a reporting obligation or configuration health state transitions in either direction — including purely clock-driven waiting-to-delayed and delayed-to-action_required transitions that no positive doorbell announces, and recovery back to healthy or complete. Valid in every reporting tier including Core: it names no destination or materialization. The payload is an invalidation signal carrying identifiers, the new health, and stable issue ids — never report rows or credentials. Receivers repair every fire, missed fire, and duplicate through get_reporting_status; push is optional in every tier and polling remains the authoritative recovery path.", + "description": "Account-anchored invalidation fired when a reporting obligation or configuration health state transitions in either direction — including purely clock-driven waiting-to-delayed and delayed-to-action_required transitions that no positive doorbell announces, and recovery back to healthy or complete. A seller SHOULD NOT fire it when the only health change is an empty first snapshot moving an obligation from waiting to healthy or complete (see x-adcp-validation.empty_first_snapshot). Valid in every reporting tier including Core: it names no destination or materialization. The payload is an invalidation signal carrying identifiers, the new health, and stable issue ids — never report rows or credentials. Receivers repair every fire, missed fire, and duplicate through get_reporting_status; push is optional in every tier and polling remains the authoritative recovery path.", "type": "object", "properties": { "idempotency_key": { @@ -107,6 +107,7 @@ } ], "x-adcp-validation": { + "empty_first_snapshot": "The seller SHOULD NOT fire this event when the only health change is an obligation moving from waiting to healthy or complete because a revision meets all three conditions: (a) no earlier revision of the logical slice was ever committed; (b) its finality is snapshot; and (c) row_count is 0. Firstness comes from the slice's commit history, not from whether supersedes_reporting_revision_id is present: a predecessor may have aged out of retention, and a health transition caused by any later revision still fires when that field is absent. Control totals do not determine whether a revision is empty. Every other health transition fires, including becoming delayed or action_required, a failure that changes health, a recovery from delayed or action_required, a non-empty first revision, and a health transition caused by any later revision. A later revision that leaves health unchanged remains the separate concern of reporting.ledger_changed.", "waived_mismatch_transition": "When an exact bilateral CONSUMER_STATUS_MISMATCH waiver removes the last impairment and restores underlying seller health, this is a recovery health transition. A seller advertising reporting.status_changed MUST fire it after the recovered projection is readable, with health set to healthy or complete, previous_health set to delayed or action_required, and issue_ids empty or absent. If another impairment keeps health unchanged, no reporting.status_changed fire is required; polling get_reporting_status remains authoritative." }, "additionalProperties": true, diff --git a/static/schemas/source/enums/notification-type.json b/static/schemas/source/enums/notification-type.json index 4fd14f51d8..b2e2c44502 100644 --- a/static/schemas/source/enums/notification-type.json +++ b/static/schemas/source/enums/notification-type.json @@ -67,7 +67,7 @@ "collection_catalog.bulk_change": "Experimental (media_buy.collection_catalog) account-anchored fire. Sent instead of per-card events when one operation touches more than 5% of the collection card catalog or more than 100 cards, whichever is smaller, such as a scheduled follower-count sweep. Payload: `wholesale-feed-webhook.json` carrying a `collection_catalog.bulk_change` event with a summary, approximate count, repair recommendation, and `applies_to`; no cards. Receivers replace the card mirror from a complete unfiltered `list_collections` read without `if_collections_version`. Separate from `wholesale_feed.bulk_change`, whose subscribers never receive it. **notification_id**: equals `event.event_id`; re-emissions of the same logical change reuse the same value under a new `idempotency_key`.", "capabilities.changed": "Agent-anchored fire. Sent when the seller's advertised `get_adcp_capabilities` document materially changes. Fires per subscriber against each caller-scoped agent `notification_configs[]` entry managed through `sync_principal` or `sync_agent_notification_configs` whose `event_types` includes this value. Payload: `capabilities-changed-webhook.json`. The payload does not include the full capability document; receivers SHOULD re-run `get_adcp_capabilities`, compare `adcp.capability_changes.capabilities_version` or `last_modified` when present, and update their cache from that fresh response. **notification_id**: stable per material capability revision; re-emissions of the same revision reuse the id, and a later material revision receives a new id.", "reporting.delivery_ready": "Experimental account-anchored readiness doorbell, managed-delivery tier only (it names a materialization at a destination; Core configurations never fire it). Fires after one immutable reporting materialization is observable through the intended consumer path. Payload: `reporting-delivery-ready-webhook.json`; it carries identities and readiness metadata, never report rows or credentials. Receivers repair missed, duplicate, or out-of-order fires through `get_reporting_status`. **notification_id**: stable per reporting_materialization_id reaching its ready state across re-emissions; a new retry/materialization receives a new id.", - "reporting.status_changed": "Experimental account-anchored invalidation, valid in every reporting tier including Core. Fires when an obligation or configuration health state transitions in either direction — waiting to delayed, delayed to action_required, and recovery back to healthy or complete — including purely clock-driven transitions that no positive doorbell would ever announce. Payload: `reporting-status-changed-webhook.json`; it carries identifiers, the new health, and stable issue ids, never report rows. Push is optional in every tier: polling `get_reporting_status` remains the authoritative recovery path, and receivers repair every fire through it. **notification_id**: stable per (reporting_obligation_id or delivery_config_id, health transition); re-emissions reuse the id, and a later distinct transition receives a new id.", + "reporting.status_changed": "Experimental account-anchored invalidation, valid in every reporting tier including Core. Fires when an obligation or configuration health state transitions in either direction — waiting to delayed, delayed to action_required, and recovery back to healthy or complete — including purely clock-driven transitions that no positive doorbell would ever announce. A seller SHOULD NOT fire it when the only health change is an empty first snapshot moving an obligation from waiting to healthy or complete: a snapshot revision with row_count 0 when no earlier revision of the same logical slice was ever committed. Firstness comes from the slice's commit history, not the presence of supersedes_reporting_revision_id; control totals do not determine emptiness. Every other health transition still fires, including a failure, recovery, non-empty first revision, or any later revision that changes health. Payload: `reporting-status-changed-webhook.json`; it carries identifiers, the new health, and stable issue ids, never report rows. Push is optional in every tier: polling `get_reporting_status` remains the authoritative recovery path, and receivers repair every fire through it. **notification_id**: stable per (reporting_obligation_id or delivery_config_id, health transition); re-emissions reuse the id, and a later distinct transition receives a new id.", "reporting.ledger_changed": "Experimental account-anchored invalidation, valid in every reporting tier including Core. Fires for each newly committed revision or post-official adjustment whether or not obligation health changes. A seller SHOULD NOT fire it for an empty first snapshot: a snapshot revision with row_count 0 when no earlier revision of the same logical slice was ever committed. Firstness comes from the slice's commit history, not the presence of supersedes_reporting_revision_id; control totals do not determine emptiness. Receivers learn about empty periods by reading. Payload: `reporting-ledger-changed-webhook.json`; it carries the immutable record identity but no rows or credentials. Receivers repair missed, duplicate, or out-of-order fires from their own durable get_reporting_status changes_after checkpoint. **notification_id**: stable per reporting_revision_id or reporting_adjustment_id; re-emissions reuse it.", "principal.changed": "Caller-anchored invalidation. Sent when the seller changes the authenticated principal's standing configuration through a seller-driven transition that does not advance configuration_version: a reporting destination moving between validating, ready, action_required, and rejected, a setup action nearing or passing expires_at, a proof invalidation, a change to the accepted declarations intersection, or a reporting subscription change (accounts_unauthorized changing, a coverage exception opening or closing, or the subscription moving to action_required). Not fired for the caller's own mutations — the sync response already reports those. Payload: `principal-changed-webhook.json`, an invalidation signal only; receivers repair by re-reading `get_principal`. **notification_id**: stable per logical principal-state transition; re-emissions reuse the id, and a later distinct transition receives a new id.", "proposal.created": "Experimental (media_buy.open_opportunities) account-anchored invalidation. Sent when the seller creates a later proposal for an opportunity under the buyer's later_proposals consent, after the creating task completed. A seller offer against an accepted media buy is not a later proposal and uses the buy-scoped sibling `proposal.offered` (media_buy.seller_offers); `media_buy_update` is out of scope for later proposals. Never sent for proposals returned in a task response, and never delivered to a task's push_notification_config. Payload: `proposal-created-webhook.json`, identifiers only; the payload is not the proposal, and receivers MUST read the snapshot with `list_proposals` before refining, accepting, or declining it. **anchor**: account. **notification_id**: equals `proposal_id`; a proposal is created once, so retries and deliberate re-emissions reuse it. **repair key**: `proposal_id` within the account, read through `list_proposals`. **classification**: invalidation.", diff --git a/tests/reporting-status-contract.test.cjs b/tests/reporting-status-contract.test.cjs index 1a54bea422..ed9c27f4e4 100644 --- a/tests/reporting-status-contract.test.cjs +++ b/tests/reporting-status-contract.test.cjs @@ -1761,6 +1761,38 @@ describe('managed reporting status contract', () => { } }); + it('drives the empty-first-snapshot status recommendation from conformance vectors', () => { + const validation = readSchema('/schemas/core/reporting-status-changed-webhook.json')['x-adcp-validation'].empty_first_snapshot; + assert.match(validation, /SHOULD NOT fire this event/); + assert.match(validation, /no earlier revision of the logical slice was ever committed/); + assert.match(validation, /row_count is 0/); + assert.match(validation, /waiting to healthy or complete/); + assert.doesNotMatch(validation, /control_totals.*zero/i); + + const vectors = JSON.parse(fs.readFileSync( + path.join(__dirname, '..', 'static', 'compliance', 'source', 'test-vectors', 'reporting-subscriptions', 'vectors.json'), + 'utf8', + )).status_notification_cases; + const recommendation = ({ slice_commit_count_before: priorCommits, transition, cause }) => { + const emptyFirstSnapshotCompletion = transition.scope === 'obligation' + && transition.previous_health === 'waiting' + && ['healthy', 'complete'].includes(transition.health) + && cause.kind === 'revision' + && priorCommits === 0 + && cause.finality === 'snapshot' + && cause.row_count === 0; + return emptyFirstSnapshotCompletion ? 'should_not_fire' : 'fire'; + }; + assert.equal(new Set(vectors.map(vector => vector.id)).size, vectors.length, 'vector ids are unique'); + for (const vector of vectors) { + assert.ok(vector.rule, `${vector.id}: rule`); + assert.deepEqual(vector.spec_refs, [ + 'static/schemas/source/core/reporting-status-changed-webhook.json#/x-adcp-validation/empty_first_snapshot', + ], `${vector.id}: spec_refs`); + assert.equal(recommendation(vector), vector.expected, vector.id); + } + }); + it('uses readiness as a secret-free account doorbell repaired through status', () => { assert.equal(validateNotificationConfig({ subscriber_id: 'reporting-ingest',