Skip to content

[T-013b] Artefact maintenance: roboprobe gc [--dry-run], artifacts verify, retention policy #67

Closed

Description

@CodewithJha

Task T-013b · Milestone M3 — Oracles + runner + store · Size S · Priority P2 · Epic #3

Implements FR-STO-002

Branch feat/t-013b-artefact-maintenance-retention-policy — one task = one branch = one PR (doc 32 §6)

Summary

Add garbage collection of orphaned blobs, hash verification, and the bag retention policy (storage.retention.*), exposed as CLI commands used by the runbook (doc 30 §3, RB-08).

Context / motivation

Long Gazebo campaigns accumulate GBs of rosbags; disk-low auto-pause (doc 21 §5.5) needs a safe way to reclaim space.

Scope

In scope

  • store/maintenance.py: find_orphans, gc(dry_run), verify() -> list[Mismatch], apply_retention(now) (keep failure bags if keep_failure_bags).
  • cli/artifacts.py: roboprobe gc [--dry-run], roboprobe artifacts verify.

Implementation guidance

  • Orphan = blob with no artifacts row; delete only blobs older than a grace period to avoid racing with in-flight put. Retention runs inside gc.
  • Standards: respect the layering contracts (doc 16 §2) and conventions in doc 34; no hard-coded tunables — thresholds/defaults come from typed settings (doc 27); no magic numbers (ruff PLR2004); public APIs typed (mypy strict) and documented.

Configuration keys

From the configuration reference (doc 27). Keys marked (new) must be added to the typed settings models and appear in the generated reference (T-003c).

  • storage.retention.bags_days
  • storage.retention.keep_failure_bags

Acceptance criteria

  • Dry-run lists but deletes nothing.
  • Verify detects a corrupted blob.
  • Retention never deletes bags of FAIL runs when keep_failure_bags=true.
  • Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
  • Docs, config reference and CHANGELOG Unreleased updated where behaviour, keys or interfaces changed.
  • Definition of Done (doc 32 §3) satisfied.

Tests required

  • tests/integration/store/test_maintenance.py with a fake clock.

Dependencies

Blocked by: #66 (T-013a), #62 (T-011b), #20 (T-008)

Blocks: no other task (leaf)

Parallelization notes

Files / paths owned by this task — avoid editing other paths; shared files (pyproject.toml entry points, cli/main.py, api/routers/__init__.py, router.tsx, docker/compose.yaml, ci.yml) are append-only:

  • backend/src/roboprobe/store/maintenance.py
  • backend/src/roboprobe/cli/artifacts.py

Independent; new modules only.

Definition of Done

Per doc 32 §3 and AGENTS.md §5: lint, format, mypy strict and import-linter green; tests added and passing; docs updated; PR template completed with Closes #<this issue>; Conventional Commit messages referencing T-013b (doc 16 §6); commits authored only by the repository owner identity (AGENTS.md §4); CI green; reviewer checklist (doc 32 §5.1) satisfied.

References

Design docs: doc 30 §3 · doc 30 §RB-08 · doc 27 §4.2 · doc 21 §5.5

Requirements: FR-STO-002 (traceability: doc 28)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCommand-line interfacearea:storagePostgres schema, repositories, artifactsmilestone:M3M3 — Oracles + runner + storepriority:P2Important, not blockingsize:S<= 1 daytaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions