Repository navigation
fix(reporting): resolve dynamic status account readiness - #1910
Conversation
There was a problem hiding this comment.
Ladon verdict: Comment (human reviewer recommended)
Comment — 2 medium findings on a high-risk-path change; a human should review the behavior changes.
What I checked: Dynamic reporting-status account-surface change (~1500 LOC). Core design is sound and well-tested: frozen immutable snapshot, resolver-is-authoritative, one-snapshot-per-proof, fail-closed on resolver error/invalid type, cancellation propagates (catches Exception not BaseException), secret-free logging. Public surface is additive (new optional field + two exports), with a correct fix(reporting): semver signal — no breaking-change gate triggered. No credential-in-ctx_metadata, import-layering, generated-code, or discriminated-union concerns.
Why not approve: The two medium findings both fall on src/adcp/decisioning/handler.py, a modified high-risk-path file (src/adcp/decisioning/**). Decision table row 5 (high_risk true AND a (modified) reason AND a medium finding) would point to escalate — but finding #2 is on status_service.py, and finding #1 is on the modified high-risk handler. Re-checking: finding #1 (handler.py:1495) IS on a modified high-risk file with medium severity, so row 5 applies.
Medium findings
- src/adcp/decisioning/handler.py:1495 — Unconditional reporting_status_handler binding flips rc.6 version guard for all reliable-reporting decisioning servers (out of scope, untested)
- src/adcp/reporting/outbox/status_service.py:57 — Lifecycle methods now require account_surface_complete=True, breaking static adopters on the default flag
Note: the handler.py medium on a modified high-risk file means row 5 fires → escalate.
Medium findings
- src/adcp/decisioning/handler.py:1495 — Unconditional reporting_status_handler binding flips rc.6 version guard for all reliable-reporting decisioning servers
- src/adcp/reporting/outbox/status_service.py:57 — Lifecycle methods now require account_surface_complete=True, breaking static adopters on the default flag
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent pass, both prior Medium findings resolved, no current blocking or Medium findings.
What changed since the prior comment decision:
handler.py:1495(prior Medium, resolved): thereporting_status_handlerbinding is now guarded onreporting_status is not None, so the rc.6 version guard no longer flips for every reliable-reporting decisioning server. Covered by the new straddle test asserting 3.1 succeeds without support and refuses with it.status_service.py:57(prior Medium, resolved):_account_surfacenow refuses an incomplete surface only when a dynamic resolver is present, letting static adopters on the defaultaccount_surface_complete=Falserun lifecycle work while capability proof (durable()) stays gated. Covered by two new tests.
Remaining delta: a cosmetic ...→pass in the status_support Protocol body (Low, omitted).
Gate checks:
- No critical/high findings (row 1 n/a).
gated_paths: false(row 2 n/a) —review_decision: REVIEW_REQUIREDdoes not force escalation since no gate applies.high_risk: truebut only(modified)reasons with NO current Medium finding (rows 3/5 n/a).- No Medium findings in data-loss/schema/infra (row 4 n/a).
- Prior decision was
comment, notescalate(row 6 n/a). - No no-auto-approve team match (row 7 n/a).
- Zero Medium findings, fewer than three (row 8 n/a).
- Falls through to row 9 → approve. Net improvement over the prior pass.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent review, prior Medium findings resolved, no current findings.
This is a follow-up push responding to the prior comment decision. Both prior Medium findings have been addressed:
- handler.py:1495 — the unconditional
reporting_status_handlerbinding now gates onreporting_status is not None and reporting is not None(handler.py:1498), so the rc.6 version-straddle guard activates only for servers that explicitly mount status support. Covered bytest_generated_status_version_straddle_requires_explicit_support. - status_service.py:57 — completeness refusal now gates on
account_surface_resolver is not None, so static lifecycle-only adopters on the defaultaccount_surface_complete=Falsecan baseline/drain/run while dynamic resolvers still fail-closed. Covered bytest_static_lifecycle_runs_without_capability_completenessandtest_static_lifecycle_default_iterates_without_advertising_status.
The reviewer surfaced no new Critical/High/Medium findings in the delta.
Decision table: no critical/high findings (row 1 n/a); gated_paths is false (row 2 n/a); high_risk reasons are all (modified) with no medium findings (rows 3–5 n/a); prior decision was comment, not escalate, and no new actionable findings exist (row 6 n/a); no no-auto-approve team match (row 7 n/a); fewer than three medium findings — zero (row 8 n/a). Falls through to row 9: approve. The high_risk flag on the modified decisioning files is a look-closer heuristic only; the reviewer found no concerns there.
Fixes AI-21766.
Reporting accounts can be enrolled while a seller remains running. Readiness and lifecycle work now resolve a fresh, complete deployment account surface, so the global
reporting.status_changedclaim stays suppressed until every current account is baselined and signing-ready, then becomes available without a restart. Ordinary decisioningserve()also binds its generated handler to the configured support and verifies the installed reporting service's ledger, escalation policy and consumer-status setting.Each proof uses one immutable snapshot. Resolver failures, incomplete evidence and handler mismatches fail closed. Request bodies,
extand request context never enter the zero-argument resolver; dynamic evidence is authoritative and never merged with static fields. Static construction retains the original nine positional parameters.Public API
adcp.reporting.outboxexportsReportingStatusAccountSurfaceandReportingStatusAccountSurfaceResolveralongsideReportingStatusSupport:The snapshot copies its collections into tuples. The exact support constructor keeps its existing parameters and appends the optional resolver:
ReportingStatusService.baseline()resolves once per call;drain()resolves once per turn, including accounts added at runtime. Explicit account operations check membership in the current surface. The service lifecycle,create_adcp_server_from_platform()and decisioningserve()signatures are unchanged.Minimal ESA integration
With the real platform reporting handlers, status store, worker, projector and sweeper configured:
Read account IDs, completeness and validated readiness probes together from one deployment-wide registry transaction or revision. ESA supervises lifecycle work and baselines added accounts;
scheduled=Truedoes not start a scheduler. An empty readiness-probe tuple type-checks but cannot prove readiness. No adopter handler construction or mutation is required.ESA requires
adcp>=9.6.3. Noadcp-reporting-storagebump, no changeset file, and no wire-schema change. Release-please receives the conventionalfix(reporting)release input; package versions are not manually bumped.Validation
uv run make lint: passed for both distributions.uv run make typecheck-all: 1,555 source files, 77 strict adopter fixtures and 66 configured Pyright fixtures passed, including the no-type-ignore contract. The example and focused adopter fixture also passed strict mypy.git diff --check: passed. The final formatting-only test cleanup preserves its complete AST and every comment.ADCP_PG_TEST_URLset: 4,884 passed, 46 skipped, 46 failed, 4 setup errors in 3062.39s. Every failure group matches baseline evidence. Additional groups were reproduced againstorigin/main, individually or with representative cases where all variants share the same guard: PostgreSQL 18 catalog differences versus exact manifests/PostgreSQL-16-only compatibility gates; missingADCP_PYTHON310; existing recovery-count andBINDING_MISMATCHassertions; and the previously reproduced macOS subprocess-cleanup failure. No failing check or test was disabled, and no unrelated product fix was included.Whole-branch senior review and the follow-up review of both Important fixes completed before this verification pass. The fixes freeze resolver-owned collections and keep resolver exception details out of logs while preserving exception chaining.