Repository navigation
Description
Task
T-097b· Milestone M9 — Gazebo backend · Size S · Priority P2 · Epic #9Implements FR-SIM-005 · FR-STO-002
Branch
feat/t-097b-rosbag-policy-failures-only-always— one task = one branch = one PR (doc 32 §6)
Summary
Implement record_bag policy: failures-only means re-record on confirmatory replays; store MCAP as an artefact (kind bag) with SHA-256; dashboard 'Open bag' downloads it.
Context / motivation
Doc 10 §6 last bullet.
Scope
In scope
- Size accounting for GC.
Implementation guidance
- Policy
record_bag ∈ {never, failures, always}(doc 27): a run's verdict is unknown in advance, sofailuresmeans recording only forconfirm/manualruns and replays of FAIL runs (doc 10 §6). Implementshould_record_bag(run, settings) -> boolinbags.py(pure). - After the episode, store the MCAP bag (already chunk-compressed) via
ArtifactStore.put(..., kind=ArtifactKind.BAG, run_id); bag size counts towards GC (T-013b). - 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).
backends.gazebo_nav2.record_bag
Acceptance criteria
- Replay of a failing run produces a bag artefact.
- Policy truth table tested.
- Bag artefact downloadable via the API (T-081e) in a sim test.
- Tests listed below added and green in CI; coverage of new code meets the gate in doc 18 §3.
- Docs, config reference and CHANGELOG
Unreleasedupdated where behaviour, keys or interfaces changed. - Definition of Done (doc 32 §3) satisfied.
Tests required
tests/sim/test_bag_policy.py.
Dependencies
Blocked by: #202 (T-096b), #66 (T-013a)
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/backends/gazebo_nav2/bags.py
Parallel.
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-097b (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 10 §6 · doc 11 §6
Requirements: FR-SIM-005 · FR-STO-002 (traceability: doc 28)
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity