Skip to content

bug: make bounded byte retention advance beyond the first 512 bundles #355

Description

@codeforester

Problem

Byte-only retention can permanently ignore bundles beyond its size-walk budget. Every invocation measures the same alphabetically first 512 entries; if their subtotal is below the byte limit, nothing is deleted and later passes never advance despite promising to reconcile the remaining debt.

Verified evidence

Reviewed on 2026-09-17 at 2d67cd24e8d704386f2be7d3a41addc06fb81e17 (local checkout matched GitHub main). Reproduced in isolated macOS environments with Python 3.14.6. Framework default probe environment: Click 8.5.0 and Typer 0.27.2. Demo probes used released base-cli 0.4.3 unless noted.

Created 513 valid finished bundles. The last sorted bundle held a 1 MiB payload; total measured disk content was 1,134,169 bytes. Ran prune_run_bundles(..., policy=RetentionPolicy(max_total_bytes=400_000)) three times without count or age bounds:

pass 1: 513 bundles remain; tail size_known=False
pass 2: 513 bundles remain; tail size_known=False
pass 3: 513 bundles remain; tail size_known=False

Each pass warned that one size walk was deferred and policy debt would be reconciled later. _discover_run_bundles() restarts the sorted scan with measured_sizes=0; no progress state or fair selection reaches the last bundle.

Sources:

Acceptance criteria

  • Make repeated bounded passes eventually inspect every eligible bundle under a byte-only policy.
  • Preserve the foreground work budgets, active/preserved protections, and filesystem revalidation before deletion; do not authorize deletion from an untrusted index alone.
  • Add a >512-bundle regression whose first batch is below the limit and later entries exceed it; assert eventual progress over multiple passes.
  • Cover protected early bundles and interrupted/restarted maintenance, and keep debt diagnostics accurate.

Related work

Follow-up to closed #281. This is a progress failure within the delivered budget, not a request to remove work bounds.

Project fields

  • Status: Backlog
  • Priority: P2
  • Area: Runtime
  • Initiative: v1.0 Readiness
  • Size: M
  • Assignee: @codeforester
  • Milestone: v1.0.0
  • Target date: unscheduled

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething is not working

Type

Projects

  • Status
    Backlog

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions