Repository navigation
test(compliance): canonical reporting-subscription coverage vectors and reference model - #8616
Conversation
|
Ladon cannot review this PR until merge conflicts are resolved. |
…nd reference model Adds the SDK-independent conformance foundation for AdCP 3.3 reporting-subscription coverage (experimental media_buy.reporting_subscriptions): - static/compliance/source/test-vectors/reporting-subscriptions/: 113 cases with case.schema.json, pinned to IANA tzdata 2026f. 81 are ported from the adcp-client#3505 parity table and re-derived from the spec text. 32 are new: midnight DST in Santiago, Havana, and Cairo; Lord Howe's 30-minute DST; Kathmandu sub-daily; month-end clamps; P7D, P1W, and P1Y; compound changes at one instant; four-grant chains; max_accounts per offering; fractional seconds and offsets; empty flights; the confirmation period. - scripts/reference/reporting-coverage/: a brute-force reference model that enumerates every period and intersects one predicate per clause. Its time zone evaluator reads the pinned zic source itself and is checked against zic output; it uses no ICU, Intl, or zoneinfo. - tests: the model reproduces every vector; each case's wire objects validate against the AdCP schemas. Seeded property tests cover exception monotonicity, nothing owed twice, cutover stretch bounds, prefix stability, no retroactive extension, and calendar invariants. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
9da247f to
0236d31
Compare
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — additive, experimental reporting-subscription coverage test vectors plus an independent brute-force reference model (coverage/calendar/tz scripts), with no edits to static/schemas/source/**.
What I checked:
- No wire-shape changes: no schema source edits, so schema↔docs coherence and oneOf-audit gates don't trigger.
- Changeset present (
patch, non-breaking, in-scope compliance surface); not Breaking-class, not 3.1.x. - No released-artifact mutations (
dist/**untouched). - Reference-model correctness spot-checked: coverage.cjs owed/authorized predicates and boundary handling cite spec; tz.cjs resolveWall fold/gap handling matches period_generation; baseline expected rows consistent with stated rule; property tests assert real invariants.
- high_risk is true only via
docs/reference/test-vectors/index.mdx (modified), with no medium-or-higher finding on that file, so the modification is presumed safe (no escalation on the flag alone). - extract-tzdata.cjs
execFileSynclacks a timeout but is a manual dev-only regeneration tool, not a production/worker path — out of scope.
No no-auto-approve team match, gated_paths false. No blocking or medium findings. Falls through to row 9.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve.
The delta since the prior approve is a single file: scripts/reference/reporting-coverage/extract-tzdata.cjs. It replaces a TOCTOU existsSync/readFileSync read of tzdata.json with a hoisted readPrevious() helper that returns null only on ENOENT and rethrows all other errors — so malformed JSON, EISDIR, and permission failures now surface instead of being silently masked. This is a clean refactor with correct error handling in developer-only reference tooling (not published protocol surface).
Checked: changeset present (.changeset/reporting-subscription-coverage-vectors.md); no static/schemas/source/** changes so no schema↔docs coherence or oneOf-discriminator concerns; no dist/** artifact modifications; no hand-edited package.json version; no breaking-class protocol change. The high-risk flag fires only on docs/reference/test-vectors/index.mdx (modified), but the reviewer surfaced no medium-or-higher concerns on it, so the modification is presumed safe.
No critical/high/medium findings. No gated paths, no no-auto-approve team match, no deletions in sensitive paths. Prior decision was approve with no findings; nothing here changes that. Rows 1–8 do not fire → row 9 approve.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean re-review, no blocking or medium findings.
This PR adds experimental reporting-subscription coverage test vectors, a case schema, a docs index row, and a self-contained brute-force reference model (calendar/coverage/tz + zic-cross-checked tzdata) with vector and seeded property tests. All additions are experimental compliance assets.
Checks performed:
- Changeset present, scoped and typed correctly (patch; additive experimental compliance assets).
- No edits to static/schemas/source, published schemas, or dist artifacts — release-artifact immutability preserved.
- case.schema.json oneOf is cleanly discriminated; no oneOf discriminator regression.
- coverage.cjs owed-period intersection and authority/cutover logic are consistent and test-backed.
- No package.json version hand-edit.
High-risk flag is true only because docs/reference/test-vectors/index.mdx is modified (adding a docs index row); this is a benign additive modification with no reviewer-found concerns, so the flag does not warrant escalation. gated_paths is false, no no-auto-approve team match, and no critical/high/medium findings. Head SHA matches the prior-approved SHA — net state is clean. Falls through to row 9.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Adds error-codes.json (SDK error codes with recovery, dispatched, and fix) and reason-codes.json (why a period is or isn't owed, with the fixed rule order) beside the coverage vectors. The case schema carries both vocabularies, and expected_error now gives a frozen COVERAGE_INPUT_* code and detail. Tests check the vocabularies against the case schema, the wire exclusion and gap reasons, and every error the reference model raises. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent review with a clean diff and no findings.
This PR adds a reporting-subscription coverage test-vector suite (new compliance assets, coverage scripts, and tests) plus a modified normative reference page (docs/reference/test-vectors/index.mdx). The delta since the prior approve is a single-line cleanup at scripts/reference/reporting-coverage/coverage.cjs:757, replacing an iteration that destructured an unused schedule binding with side.offerings.keys(). Semantically identical, no behavior change; the second loop at line 783 still uses the binding where needed.
Gate checks:
- No no-auto-approve team match.
gated_paths: false, so row 2 does not fire despitereview_decision: REVIEW_REQUIRED.high_risk: trueonly fromdocs/reference/test-vectors/index.mdx (modified); no medium-or-higher finding on that file, so rows 4/5 do not fire. No(deleted)reasons (row 3 N/A).- Prior decision was
approve, so sticky-escalation (row 6) does not apply. - No critical/high/medium findings (rows 1, 8 N/A).
- No released-artifact mutation (changes are under
static/compliance/source/**, notdist/**). A changeset is present.
Falls through to row 9 → approve.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — no blocking or medium findings.
This is a subsequent review on top of a prior clean approve. The only delta is a single-line cleanup in scripts/reference/reporting-coverage/coverage.cjs:757: the floors-computation loop now iterates side.offerings.keys() instead of destructuring [offeringId, schedule], dropping an unused schedule binding. .keys() yields the same offering IDs in insertion order, so behavior is unchanged; the second loop at line 783 correctly retains full entry destructuring since it uses schedule. No semantic change.
Decision-table walk:
- Rows 1 (critical/high): no findings.
- Row 2 (gated paths):
gated_pathsis false — does not fire. - Row 3 (deleted high-risk): the high-risk match is
docs/reference/test-vectors/index.mdx (modified), not deleted. - Row 4 (medium data-loss/schema/infra): no findings.
- Row 5 (modified high-risk + medium finding): high-risk file is modified but there are zero medium findings — does not fire.
- Row 6 (sticky escalate): prior decision was
approve, not escalate. - Row 7 (no-auto-approve team): no team match.
- Row 8 (3+ medium): zero medium findings.
- Row 9: approve.
Note: review_decision is REVIEW_REQUIRED, but that only forces escalation when gated_paths is true (row 2), which it is not here. This is a test-vector / coverage-tooling PR (new test vectors, coverage scripts, tests) with a changeset present; no schema source edits, no artifact mutation, no breaking-class wire change. Falls through to row 9.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, additive compliance-vector addition with no blocking findings.
This PR extracts the coverage error vocabulary into code+detail and adds two frozen vocabulary files (error-codes.json, reason-codes.json) with schema definitions and coherence tests for reporting-subscription coverage. The reviewer verified:
- calendar.cjs
startsWith('missing_')derivation maps all 11 raised details correctly (7 INCOMPLETE, 4 INVALID) against error-codes.json; - coverage.cjs null-config guard raises an in-vocabulary detail;
- the new wire-enum assertions match ReportingSubscriptionExclusionReason and gaps reason enums;
- case.schema.json reason/rule enums match reason-codes.json order;
- the changeset is
patch, correct for an experimental compliance-vector addition.
No Critical/High/Medium findings.
Decision-table walk: Rows 1 (no critical/high), 2 (gated_paths false), 3 (no deletions), 4/5 (no medium findings), 6 (prior decision was approve, not escalate), 7 (no no-auto-approve team match), 8 (fewer than three medium findings) do not fire. Falls through to row 9 → approve. The high_risk flag is set only via a (modified) docs/reference index file, and with no medium-or-higher finding on it the modification is presumed safe — not escalation-worthy on the flag alone. review_decision: REVIEW_REQUIRED does not block because gated_paths is false and no author/gated-path hard gate applies.
… the coverage vectors Rulings on ambiguities the canonical coverage vectors surfaced (#8616): the local day start is always a boundary (PT24H equals P1D and days nest in sub-daily schedules where midnight does not exist); Lord Howe's 90-minute hour stands; E never precedes the outgoing side's own start; reactivation resumes after the last period owed before deactivation; UTC aliases are exactly UTC and Etc/UTC; billing_cycle needs a date component; P7D weeks start on Thursday; status_retention_days counts 24-hour days. The reference model and vectors pin each. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… the coverage vectors Rulings on ambiguities the canonical coverage vectors surfaced (#8616): the local day start is always a boundary (PT24H equals P1D and days nest in sub-daily schedules where midnight does not exist); Lord Howe's 90-minute hour stands; E never precedes the outgoing side's own start; reactivation resumes after the last period owed before deactivation; UTC aliases are exactly UTC and Etc/UTC; billing_cycle needs a date component; P7D weeks start on Thursday; status_retention_days counts 24-hour days. The reference model and vectors pin each. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… the coverage vectors (#8622) Rulings on ambiguities the canonical coverage vectors surfaced (#8616): the local day start is always a boundary (PT24H equals P1D and days nest in sub-daily schedules where midnight does not exist); Lord Howe's 90-minute hour stands; E never precedes the outgoing side's own start; reactivation resumes after the last period owed before deactivation; UTC aliases are exactly UTC and Etc/UTC; billing_cycle needs a date component; P7D weeks start on Thursday; status_retention_days counts 24-hour days. The reference model and vectors pin each. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Summary
This PR adds a canonical, SDK-independent conformance foundation for AdCP 3.3 reporting-subscription coverage (experimental
media_buy.reporting_subscriptions). It follows the protocol expert review: canonical vectors in the spec repo, an independent reference model, and property tests.static/compliance/source/test-vectors/reporting-subscriptions/holdsvectors.json(113 cases),case.schema.json, and a README. It is registered indocs/reference/test-vectors, andbuild:compliancecopies it todist/compliancelike every other set.2ad906d8. I re-derived every expected row from the spec text. Each case hasspec_refscitations.unauthorized_at + status_retention_days.max_accountscapacity exception per offering.error-codes.jsonhas 14 codes, following the DX plan's §2.12 table. Each hasrecovery(transient,correctable, orterminal) anddispatched(false,absent, ornot_applicable), plus the fix the message ends with and the TS and Python classes. Coverage errors split intoCOVERAGE_INPUT_INCOMPLETE,COVERAGE_INPUT_INVALID, andCOVERAGE_BUDGET_EXCEEDED, each with a frozendetail. A case'sexpected_erroris now{code, detail}.reason-codes.jsonhas 20 reasons, following §2.5. It fixes the rule order (scope…timezone) and defines each rule and reason precisely. A period takes the reason of the first rule that rejects it, thenperiod_not_endedor anowed*variant.case.schema.jsoncarries both vocabularies. Tests check them against:ReportingSubscriptionExclusionReasonandgaps[].reasonenums;CoverageInputErrorthe reference model can raise.scripts/reference/reporting-coverage/enumerates every period of every schedule in play. The owed set is the intersection of one predicate per clause: cutover ownership, authority chains, confirmed_at, the flight atscope_resolved_at, exceptions, andnow.tz.cjsevaluates the zic source lines of the pinned release itself;tzdata.jsonis extracted byextract-tzdata.cjsafter a SHA-512 check. It uses no ICU, Intl, Temporal, TZif files, or host zoneinfo. The TS SDK uses Intl/ICU and Python uses zoneinfo/TZif, so this shares no time zone code or compiled data with either. Temporal isn't a dependency here.tests/reporting-subscription-coverage-vectors.test.cjschecks that:case.schema.json;spec_refsfile exists;non_wire_inputsmatches the fields the case actually uses;tests/reporting-subscription-coverage-properties.test.cjsruns seeded property tests. fast-check is only a transitive dependency, so it uses a mulberry32 generator. Properties:nowadvances;test:schemas.Where the TS table disagrees with the re-derivation
numeric offset timezone is refused. The TS table expects an error foraccount.timezone: "+05:00", but its offering is utc-aligned. Underperiod_generation, a utc schedule never reads the account timezone, so its periods are derivable, and the refusal doesn't follow from the coverage rule oriana_timezone. The canonical case uses an account_timezone offering instead; seechanged_from_origin.reporting-delivery-offering.json. They lackmethod.provider, useformatswhere the schema hasmethod.format, and theconsumer_receiptofferings lack thecanonicalization_*fields. The canonical cases complete them. Coverage is unchanged.The other 80 expected rows match my derivation.
Running the #3505 TS code on the new cases turns up two SDK divergences, which aren't table errors:
max-accounts-capacity-per-offering: the TS code ignoresexcluded[].offering_id, so it drops off_a's 11-07 period.p1w-is-not-a-schedule-duration: it returns[]instead of refusing the input.Vocabulary decisions to confirm
COVERAGE_INPUT_INVALIDis added. The DX plan has onlyCOVERAGE_INPUT_INCOMPLETE, but an invalid zone or duration isn't incomplete input.excluded:excluded_by_buyersits under thescoperule, becauseexclude_account_idsis scope.before_coverage_startcovers the first chain only; periods between chains arenot_authorized.cutover_stretchalso covers timezone-rule rejections, since the frozen list has no separate code for them.owed_under_other_versionis defined by comparing the period end with the side's handoff E.Spec ambiguities
period_generationsays "a wall time that does not exist yields no boundary". In Havana, Santiago, or Cairo on a spring-forward day, PT2H, PT3H, or PT24H then has no boundary at the day's advanced start. So PT24H is not "exactly like P1D" there (Havana's 2026-03-07 PT24H period would be 47 h), and P1D and PT2H don't nest. The vectors pin only PT1H there, where both readings agree.two-cutovers-inside-one-period). The cutover text doesn't define E when the outgoing side owes nothing before T. The model and the TS table carry the outgoing side's own start forward, which is the reading under which "nothing is owed twice" holds.reactivated_at, not a cutover. So after a version change to a misaligned schedule during the inactive interval, the first new period can overlap the last one owed before deactivation. Example: a New York day ending 05:00Z and a UTC day starting 00:00Z are both owed. No vector pins this. The property test leaves inactive intervals out of its single-offering overlap check.period_timezonematches a utc offering only for "UTC or Etc/UTC". IANA links such asEtc/UniversalandZulu, andGMT, are excluded by the literal text. The vectors pin GMT as non-matching, as the TS table does.finest.status_retention_daysas 24-hour days. The model treats them that way; the spec doesn't say whether they are 24-hour or civil days.Test plan
node --test tests/reporting-subscription-coverage-vectors.test.cjs tests/reporting-subscription-coverage-properties.test.cjs tests/reporting-subscriptions.test.cjsnode scripts/lint-conformance-doc-freshness.cjs,test:compliance-source-authority,test:compliance-packaged-refs, changeset scope check🤖 Generated with Claude Code