Repository navigation
feat(reporting): skip ledger_changed for empty first snapshot revisions - #9354
Conversation
bokelley
left a comment
There was a problem hiding this comment.
Agreed on the problem: a 5-minute pacing feed rings 288 empty doorbells per account per day. A hand review while the bot is down. Requesting changes because the rule as written breaks sellers that conform today, but a softened version can go to 3.3.x as a patch.
1. MUST NOT is stronger than it needs to be (static/schemas/source/.../reporting-ledger-changed-webhook.json ~39, get_reporting_status.mdx ~430)
- Both reference SDKs ring the doorbell for every revision today:
- TS:
packages/reporting-storage/src/notifications/notification-activity.ts~1076 setsnotificationRequired: trueunconditionally. - Python:
src/adcp/reporting/ledger/store.py~1274 callsrevision_eventunconditionally.
- TS:
- Under MUST NOT, both become non-conformant overnight. The playbook (
.agents/playbook.md~552) also requires 6 weeks' notice and a migration note for breaking changes to an experimental surface, which rules out a patch. - Buyers already MUST poll, so being guaranteed the event never arrives gains them nothing.
- Please use SHOULD NOT. That gets the noise reduction without breaking sellers, and it fits a 3.3.x patch. If you'd rather keep MUST NOT, it belongs on main only (4.0), with a migration note and an update to the
media_buy.reporting_deliveryrow inexperimental-status.mdx.
2. "First revision" isn't defined unambiguously
- The PR treats "no
supersedes_reporting_revision_id" as first. Butreporting-obligation.json~465 only requires a revision to name the immediately prior retained snapshot. - So a late restatement whose predecessor has aged out of retention also has no supersedes, and a correction down to zero rows would be silently suppressed.
- Please define first-ness by the slice's history ("no earlier revision of this slice was ever committed"), not by whether the field is present.
3. Drop the control-totals branch
- What "every control total is zero" means depends on the profile, so the rule becomes profile-dependent and can suppress revisions that have rows.
- Please use
row_count == 0only.
4. Open question: status_changed fires on every obligation health change (TS notification-activity.ts ~1055). If each period's obligation moves from waiting to complete, do the 288 a day just move to that event?
Other notes
- The PR touches three files under
static/schemas/source/**(a gated path), so it needs explicit maintainer approval before merge. - The patch changeset is right only for the SHOULD NOT version.
- No storyboard references
ledger_changed, so none need to change. - The new test writes its own copy of the rule and checks it against hand-picked revisions; it doesn't exercise an implementation. A vector in
reporting-subscriptions/vectors.jsonwould be stronger. - I couldn't find the issue or discussion where this rule was agreed. Could you link it?
- With SHOULD NOT, follow-up issues in both SDKs to skip the empty first doorbell are enough.
A short-period pacing feed (for example PT5M snapshot periods) commits a revision for every elapsed period, including empty ones, so a quiet campaign rang 288 reporting.ledger_changed doorbells per account per day with nothing changed. A seller now MUST NOT fire reporting.ledger_changed for a revision that is the first of its logical slice (no supersedes_reporting_revision_id), has finality snapshot, and carries no delivery (row_count 0, or a non-empty control_totals whose values are all zero). Every other revision still fires, including superseding snapshots and every official revision (zero-row included), and every adjustment still fires. Unchanged: every elapsed period still commits its obligation and revision, changes_after still returns every revision, polling stays authoritative, and reporting.status_changed still announces late or missing periods. The rule is recorded as x-adcp-validation.empty_first_snapshot on the experimental webhook schema; the notification-type and capability descriptions and the reporting docs are aligned, and the reporting status contract test pins the rule with schema-valid revisions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
543b15e to
85adec2
Compare
|
Addressed review items 1–3 in
GitHub exposes the feedback as one top-level review rather than separate line threads, so this reply covers the three implemented comments. |
bokelley
left a comment
There was a problem hiding this comment.
Approved, with the gated-path OK for static/schemas/source/**. All three requested changes are in: the rule is SHOULD NOT, a first revision is decided by the slice's commit history, and empty means row_count == 0. As advisory guidance it's patch-safe, so it will also be cherry-picked to 3.3.x.
…ns (#9354) (#9397) * feat(reporting): skip ledger_changed for empty first snapshot revisions A short-period pacing feed (for example PT5M snapshot periods) commits a revision for every elapsed period, including empty ones, so a quiet campaign rang 288 reporting.ledger_changed doorbells per account per day with nothing changed. A seller now MUST NOT fire reporting.ledger_changed for a revision that is the first of its logical slice (no supersedes_reporting_revision_id), has finality snapshot, and carries no delivery (row_count 0, or a non-empty control_totals whose values are all zero). Every other revision still fires, including superseding snapshots and every official revision (zero-row included), and every adjustment still fires. Unchanged: every elapsed period still commits its obligation and revision, changes_after still returns every revision, polling stays authoritative, and reporting.status_changed still announces late or missing periods. The rule is recorded as x-adcp-validation.empty_first_snapshot on the experimental webhook schema; the notification-type and capability descriptions and the reporting docs are aligned, and the reporting status contract test pins the rule with schema-valid revisions. * fix(reporting): refine empty snapshot notification rule --------- (cherry picked from commit 473cd6d) Co-authored-by: Rachit <43431004+rachitm022@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Why
reporting.ledger_changedfires for every newly committed reporting revision or adjustment. Its job is to tell a buyer that reporting content changed when health didn't, for example a correction.A short-period pacing feed (say
period_duration: PT5Mwith snapshot finality) has to commit a revision for every elapsed period, empty ones included, because a zero-row report is different from no report. So a quiet campaign rings 288 doorbells per account per day, and none of them announces a change.What changes for sellers
A seller MUST NOT fire
reporting.ledger_changedfor a revision that meets all three conditions:supersedes_reporting_revision_id.snapshot.row_countis 0, orcontrol_totalsis non-empty and every value in it is zero.Everything else fires exactly as it does today:
officialrevision, including a zero-row oneThere is no new field, flag or capability. The rule is recorded as
x-adcp-validation.empty_first_snapshotoncore/reporting-ledger-changed-webhook.json.What changes for buyers
You will no longer get a doorbell for an empty first snapshot. You already have to poll, and polling still shows these revisions:
get_reporting_statuswithchanges_afterreturns every revision, empty ones included. You learn about empty periods by reading.What doesn't change
get_reporting_statuswithchanges_afterstill returns every revision.reporting.status_changedstill announces late and missing periods.Files
static/schemas/source/core/reporting-ledger-changed-webhook.json: description, plus the newempty_first_snapshotvalidation rule.static/schemas/source/enums/notification-type.jsonandstatic/schemas/source/core/reporting-delivery-capabilities.json: descriptions aligned.docs/media-buy/task-reference/get_reporting_status.mdx(Readiness and recovery),docs/media-buy/reporting-core-implementation-guide.mdx(What Core is not; Treat push as a wake-up),docs/reference/implementor-faq.mdx,docs/protocol/get_adcp_capabilities.mdx: prose aligned.tests/reporting-status-contract.test.cjs: a new case pins the rule with schema-valid revisions. An empty first snapshot gets no doorbell. A first snapshot with delivery, a superseding empty snapshot, an official revision, a zero-row official revision and an adjustment each get one. A revision with rows and no control totals also gets one, so an emptycontrol_totalsnever counts as "every total is zero"..changeset/ledger-changed-empty-first-snapshot.md: patch.Compatibility
x-status: experimental(media_buy.reporting_delivery).Release line: this targets
main(the 4.0 line). Please also cherry-pick it to3.3.xas a patch, so 3.3 implementations can adopt it; 3.3 is GA and there is no 3.4, and the touched files are identical on3.3.x. The webhook schema isx-status: experimentaland the doorbell is optional and non-authoritative, but sellers that fire on every revision would have to adapt, so please confirm whether this needs the experimental-change notice.The reference training agent needs no change in this repo. It emits reporting notifications through the
@adcp/reporting-storageSDK outbox, so the emission rule belongs in that package.🤖 Generated with Claude Code