Skip to content

feat(reporting): schedule retention in the production worker - #1476

Merged
bokelley merged 1 commit into
mainfrom
claude/issue-1457-retention-scheduling
Oct 11, 2026
Merged

bokelley merged 1 commit into
mainfrom
claude/issue-1457-retention-scheduling

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Part of #1457 (Stage 2 of adcontextprotocol/adcp#7996, section 4.3). The last PR of the stack; builds on the merged retention (#1469), change feed (#1472) and period retirement (#1474).

Change

ReportingProductionSupport runs the retention a store opted into every maintenance_seconds (default 300; None disables it), on the same worker loop as the producer and materializer:

Store option Operation Bound
row_storage sweep_row_write_intents 100 intents
row_storage or change_feed retire_expired_periods 20 periods
change_feed prune_changes 10,000 rows

Each operation is bounded and resumable. A failing operation never stops the worker: the next interval retries it, and only the closed operation name (REPORTING_MAINTENANCE_FAILED with intent_sweep, period_retirement or change_pruning) is logged, never an exception, provider message or identifier. An operation that finishes but reports failed items (a binding that cannot delete, for example) is logged the same way, so a stuck binding is visible; the stable per-item codes are in the result's causes.

retire_expired_periods also deletes the row bytes of every period it retires, so prune_expired_row_sets is not scheduled; call it yourself only to retire row bytes earlier than whole periods.

Locks

No new locks: the scheduled operations take the locks audited in #1467 (Python account lock, object lock aligned with the JS SDK).

Tests

tests/test_reporting_production_maintenance.py: only opted-in operations run, the interval and the disable switch, a raising operation never stops the others or leaks, and per-item failures in a result are logged by operation name.

Merged by the repo owner's watcher without waiting for code-owner review; @rachitm022 is requested for visibility and will test the finished stack.

🤖 Generated with Claude Code

ReportingProductionSupport runs the retention a store opted into every
maintenance_seconds (default 300, None disables), as adcontextprotocol/adcp#7996
section 4.3 asks of the production service: intent sweeps for row storage, period
retirement for row storage or the change feed, and change pruning for the feed.
Each operation is bounded and resumable. A failure never stops the worker; only the
closed operation name is logged.

Part of #1457.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@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 — clean, additive PR with no blocking or medium findings.

Checked:

  • _maintain schedules opt-in retention (sweep/retire/prune) on the worker loop; opt-in logic (service.py:123-130), per-operation failure isolation, and result-type handling are correct.
  • getattr(store, "_row_storage"/"_change_feed", default) safely no-ops on the in-memory store; prune_changes returning int never trips the .failed check.
  • _maintenance_failed mirrors the sanitized _worker_stopped signal; leak test confirms no exception/secret reaches the record.
  • Ops run inline without asyncio timeouts, but lock_timeout bounds the real blocking risk and failures retry next interval — consistent with the existing loop.
  • Semver feat: is the correct signal for an additive optional param; no public-surface breaks, no generated-code hand-edits, no import-layering issues.

No Critical/High/Medium findings. Not high-risk, no gated paths, no no-auto-approve team match. Falls through to row 9.

@bokelley
bokelley merged commit 5c23598 into main Oct 11, 2026
46 checks passed
@bokelley
bokelley deleted the claude/issue-1457-retention-scheduling branch October 11, 2026 22:41
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