Skip to content

fix(reporting): unblock status webhook bootstrap - #1915

Merged
rachitm022 merged 2 commits into
nextfrom
rmatani/ai-21766-fix-dynamic-account-readiness-for-reporting
Nov 16, 2026
Merged

rachitm022 merged 2 commits into
nextfrom
rmatani/ai-21766-fix-dynamic-account-readiness-for-reporting

Conversation

@rachitm022

Copy link
Copy Markdown
Collaborator

Why

Reliable Reporting capability discovery currently requires a pre-existing external status subscriber or synthetic signing probe. That creates a bootstrap cycle: buyers will not enroll status webhooks until the seller advertises them, while the seller cannot advertise until a subscriber already exists.

Linear: AI-21766

What changed

  • Treat a complete empty account surface as a valid readiness snapshot.
  • Keep durable queue, complete-surface, per-account baseline, mounted-task, authorization, proof, signing, and delivery checks.
  • Validate every active subscription and every optional readiness probe, without requiring either to exist.
  • Project status_notification per capability request from ReportingStatusSupport.advertised_notifications() only when that request advertises webhook_signing.supported=true.
  • Preserve one immutable account-surface snapshot for each proof and reject malformed subscriptions or conflicting claims.
  • Document bootstrap behavior and ESA integration without changing the AdCP wire schema.

Public Python API for ESA

The existing exports and signatures remain source-compatible:

from adcp.reporting.outbox import (
    ReportingStatusAccountSurface,
    ReportingStatusAccountSurfaceResolver,
    ReportingStatusSupport,
)

ReportingStatusAccountSurface(
    *,
    account_ids: tuple[str, ...],
    account_surface_complete: bool,
    readiness_subscriptions: tuple[ReportingNotificationSubscription, ...],
)

class ReportingStatusAccountSurfaceResolver(Protocol):
    async def __call__(self) -> ReportingStatusAccountSurface: ...

ReportingStatusSupport(
    store: StatusNotificationStore,
    worker: ReportingNotificationWorker,
    projector: ReportingStatusProjector | None = None,
    sweeper: ReportingStatusSweeper | None = None,
    scheduled: bool = False,
    account_ids: tuple[str, ...] = (),
    account_surface_complete: bool = False,
    handler: ADCPHandler[Any] | None = None,
    readiness_subscriptions: tuple[ReportingNotificationSubscription, ...] = (),
    account_surface_resolver: ReportingStatusAccountSurfaceResolver | None = None,
)

The standard composition root remains:

serve(
    platform: DecisioningPlatform,
    *,
    reporting_status: ReportingStatusSupport | None = None,
    **serve_kwargs: Any,
) -> None

Minimal ESA wiring:

from adcp.decisioning import serve
from adcp.reporting.outbox import ReportingStatusAccountSurface, ReportingStatusSupport


async def account_surface() -> ReportingStatusAccountSurface:
    account_ids = await read_complete_reporting_account_ids()
    return ReportingStatusAccountSurface(
        account_ids=tuple(account_ids),
        account_surface_complete=True,
        readiness_subscriptions=(),
    )


status_support = ReportingStatusSupport(
    store=status_store,
    worker=status_worker,
    projector=status_projector,
    sweeper=status_sweeper,
    scheduled=True,
    account_surface_resolver=account_surface,
)

serve(platform, reporting_status=status_support)

platform must truthfully advertise webhook_signing.supported=true for the authenticated request. The handler automatically binds the generated decisioning handler and projects the ready status notification claim.

Release required by ESA

This is a patch on the 10.x next line after 10.0.0b18. Release Please will publish it as adcp==10.0.0b19 after this PR and the generated release PR are merged. ESA must use adcp==10.0.0b19 or later; 10.0.0b18 does not contain the bootstrap fix. No adcp-reporting-storage or wire-schema release is required.

Verification

  • 121 focused reporting/signing tests passed locally; 53 PostgreSQL variants are exercised in CI.
  • All 1,707 source files passed mypy.
  • All 78 strict adopter type-check fixtures passed mypy.
  • Ruff passed on every changed Python file.

@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: Request changes

Request changes — 1 blocking finding.

Blocking findings

  • tests/conformance/reporting/test_reporting_status_delivery.py:255 — The new webhook_signing.supported gate and the loosened durable() (empty readiness_subscriptions now valid) change behavior that breaks the existing conformance test test_status_capability_requires_each_component_independently_of_activity, which was not updated. Two PostgreSQL-matrix variants (missing=None and missing="signing_probe") will fail in CI though they pass on the in-memory local path. Per "CI gates stay armed," a behavior change that leaves a conformance test red must update the test to match the new intended behavior (or fix the regression).

The rest of the change is coherent: the _project_ready_status_claims projection and the signing gate are fail-closed, and advertised_notifications() is correctly skipped on the unsigned path. Address the broken conformance test and this is good to go.

Blocking findings

  • tests/conformance/reporting/test_reporting_status_delivery.py:255 — Behavior change (signing gate + loosened durable()) breaks unupdated conformance test on the PostgreSQL matrix

@aao-secretariat
aao-secretariat Bot dismissed their stale review November 16, 2026 09:11

Superseded by a later Ladon review that rechecked and resolved its blocking findings.

@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.

The prior blocking finding has been resolved. The previous run flagged a high finding — a behavior change that broke the unupdated conformance test in tests/conformance/reporting/test_reporting_status_delivery.py:255 (PostgreSQL matrix). This delta updates that test to match the new behavior: it drops the signing_probe variant (empty readiness_subscriptions=() is now valid under the loosened durable()) and adds webhook_signing: {supported: True} to the claim so the expected-case validate_status_claims clears the new signing gate. Error-case variants still raise via ready=False.

No new findings surfaced in this run. The high_risk flag is true only because src/adcp/decisioning/handler.py (modified) matches src/adcp/decisioning/**, but the reviewer found no medium-or-higher concerns on that file, so the modification is presumed safe (does not trigger row 5). No gated paths, no author team gate, no deletions.

Decision table: rows 1–8 do not fire (no critical/high/medium findings, gated_paths false, no deleted high-risk paths, no team gate). Falls through to row 9 — approve. The prior escalate-stickiness rule (row 6) does not apply (prior decision was request-changes, not escalate).

@rachitm022
rachitm022 force-pushed the rmatani/ai-21766-fix-dynamic-account-readiness-for-reporting branch from eaa670a to d000f99 Compare November 16, 2026 11:34

@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 — reporting status-notification advertisement reworked with sound, fail-closed logic and no blocking findings.

What I checked:

  • Capability now projects only when webhook_signing.supported is True per request; empty-account surface / zero-subscriber bootstrap handled; per-account signing-probe prerequisite dropped while per-subscription validation stays strict (malformed active subscription raises status_subscription_unready).
  • _validate_ready_status_claims and _project_ready_status_claims guard support is None/isinstance before dereferencing; advertised only non-empty after durable() succeeds so support.handler is bound.
  • Tests cover signed/unsigned discovery, incomplete infra, malformed subscriptions, and empty-surface bootstrap.

High-risk flag: src/adcp/decisioning/handler.py is high-risk (modified), but the reviewer surfaced no medium-or-higher concern on it, so the modification is presumed safe — not an escalation trigger on the flag alone.

Gated paths: false. review_decision is APPROVED. No no-auto-approve team match.

No Critical/High/Medium findings. Rows 1–8 do not fire → row 9 approve.

Non-blocking follow-up (out of delta scope, no finding filed): examples/reporting_status_notifications.py:149 calls validate_status_claims whose new contract requires webhook_signing.supported; worth updating the example so adopters copying it set that capability.

@rachitm022
rachitm022 merged commit ce0e21a into next Nov 16, 2026
39 of 40 checks passed
@rachitm022
rachitm022 deleted the rmatani/ai-21766-fix-dynamic-account-readiness-for-reporting branch November 16, 2026 11:46
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