You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 011db8f
Browse filesBrowse the repository at this point in the historyBrowse files
test(reporting): drive the whole Core lifecycle over docker Postgres (#1155)
* test(reporting): drive the whole Core lifecycle over docker Postgres
Adds an end-to-end conformance test: a simulated reporting source drives
`ReportingProducer`, which writes `PgReportingLedgerStore`, which
`ReportingStatusHandler` projects onto the wire, which this SDK's *own*
buyer-side `reconcile_reporting_core` then reconciles.
That last hop is the point. The buyer half was written against the spec, not
against this producer; if the seller's projection is wrong, the buyer's
reconciler says so in the same terms a real buyer would. The payload is also
validated against the generated `GetReportingStatusResponse`, so "the seller
emits valid AdCP" is asserted rather than assumed.
The narrative: install a config → close a period (obligation committed before
any source data exists) → obligation visible and reconciliation not yet
definitive → source answers, immutable revision committed → exact read with
the binding independently recomputed → a genuinely empty period commits a
zero-row revision and satisfies its obligation → a period the source never
answers for has none → that period reads delayed, then action_required →
a restatement supersedes rather than edits.
Two further tests cover why the buyer derives its own denominator (a seller
that simply omits a period returns a complete-looking, internally consistent
ledger) and that Core reconciliation refuses a managed-delivery ledger rather
than quietly trusting evidence it never verified.
Writing it against the generated types found four real projection gaps, now
fixed: obligations and revisions were missing `coverage`; revisions were
missing the content-addressed definition binding, scope, and period; every
view was missing the envelope `status`; periods were missing their
`source_timezone`; and `scope` / `obligation_counts` did not match the schema.
`scope` now derives from configuration generations rather than from whichever
obligations landed on a page, so every page of one cursor reports an identical
denominator.
Two behavioral fixes the test forced:
- A restatement needs a new observation identity. The source execution key now
includes the committed revision count, so a *retry* replays the sealed
publication (count unchanged) while a *restatement* genuinely re-reads the
source (count advanced). The ordinal comes from durable state, not the clock.
- Control totals preserve the source's declared decimal scale instead of
normalizing "4.80" to "4.8", and the integer/decimal choice is made per
metric rather than per value — otherwise a money total would flip type on
the days it happened to land on a whole number. An integral float carries no
scale (the wire's `10` arrives as `10.0`), and a non-finite value yields no
total at all.
`sync_reporting_status` is exercised through the vendored preview models, with
an explicit TODO(rc.2) to re-drive it through `adcp.types` once the tag is cut
— the same generated-type round trip the `get_reporting_status` test does.
Runs against Postgres 16 via `ADCP_PG_TEST_URL`; skips without it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test(reporting): drive sync_reporting_status through the generated types
The lifecycle test's `TODO(rc.2)` is discharged. `sync_reporting_status` is in
the published AdCP 3.2.0-rc.2 bundle, so the consumer-status batch no longer
goes through vendored preview models: it is built with
`adcp.types.SyncReportingStatusRequest` and the result is asserted to parse as
`adcp.types.SyncReportingStatusResponse`.
That matches the generated-type round trip
`test_the_status_projection_validates_as_adcp_wire` already does for
`get_reporting_status`, so "the seller speaks valid AdCP here too" is asserted
rather than assumed — a batch this SDK would reject on the wire can no longer
pass through the ingest in a test.
Refs adcontextprotocol/adcp#7287
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
0 commit comments