Skip to content

feat(reporting): bind package source coverage to media buys - #1928

Open
rachitm022 wants to merge 1 commit into
nextfrom
rachitm022/ai-22388-contract
Open

rachitm022 wants to merge 1 commit into
nextfrom
rachitm022/ai-22388-contract

Conversation

@rachitm022

Copy link
Copy Markdown
Collaborator

Why

Package reporting needs a source contract that binds each package to its parent media buy. An empty completed package report must retain its exact buy selector without inventing a buy-level metric cell or zero row.

What changed

  • Add opt-in V2 source request, capability, response, and manifest types. The request freezes media_buy_ids separately from package-pair constituents; V2 fingerprints and manifest admission bind both.
  • Permit a fully covered empty package denominator with zero metric cells and rows when the source report is dated through the requested cutoff. V1 request and manifest behavior remain unchanged.
  • Expose a request-and-rows validator for pre-stage package row checks and a request, manifest, and rows validator for final admission. Both reject rows outside the requested (media_buy_id, package_id) pairs, including zero-valued rows.
  • Reject duplicate rows at (media_buy_id, package_id, requested dimension values) in both validation paths while retaining rows for distinct requested dimension values.
  • Enforce the existing 1,000 constituent-metric cell limit at request validation and require package-item capability for V2 even when the pair set is empty.

Verification

  • Red-first V2 contract tests cover duplicate row admission, complete empty reports, distinct empty buy selectors, pair matching, zero-valued unlisted rows, external buy IDs, and the 500/501 pair boundary for two metrics.
  • make lint
  • make typecheck
  • Focused reporting source tests: 129 passed
  • Ruff format check and git diff --check

The prior broad make test run was canceled at 94% before a final result and was not rerun. make lint-all reports 49 E501 line-length errors outside this patch; Ruff checks for the three changed files pass.

Integration

Jakarta owns the inline source's pre-stage validator invocation and final package admission. This PR changes only the source contract and its tests. Public Core reporting obligation and flat coverage schemas are unchanged.

Tracks AI-22388.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — additive V2 package-aware reporting-source contract, no blocking findings.

What I checked:

  • No no-auto-approve team match; gated_paths: false; high_risk: false; first review of this PR.
  • Semver signal: V2 classes subclass V1; __all__ only gains entries (no removals/renames), so feat(reporting): is the correct non-breaking prefix — no public-surface break ships under a non-breaking signal.
  • DR-0032/33 version pathway is "Refused": version-negotiation gate in _validate_request_against_capabilities and manifest/response checks fail-closed on mismatch, and this is covered (test_v2_only_capability_rejects_v1_request, test_one_executor_can_negotiate_v1_and_v2_requests, test_mixed_request_manifest_versions_fail_admission).
  • Fingerprint identity binding verified: publication_content_fingerprint_v2 and coverage_denominator_fingerprint_v2 bind media_buy_ids/pairs so distinct buys yield distinct fingerprints even on empty coverage.
  • Row-fencing/explicit_zero logic, unique-package-pair enforcement, and strict echo of media_buy_ids/constituents all checked and safe; heavily tested (756-line contract test file).

Reviewer found no Critical/High/Medium findings. No decision-table trigger fired (rows 1–8 all negative), so this falls through to row 9 → approve.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant