Repository navigation
Description
Task
T-082c· Milestone M7 — API · Size S · Priority P1 · Epic #7Implements FR-ANA-006 · FR-REP-001 · FR-SCN-008 · FR-STO-003
Branch
feat/t-082c-api-run-export-campaign-bundle— one task = one branch = one PR (doc 32 §6)
Summary
Implement action endpoints: POST /campaigns/{id}:analyze, POST /runs/{id}:replay {repeats, fresh_seeds}, GET /runs/{id}/scenario.yaml, and an export endpoint for bundles (202 + job) when T-014 is available.
Context / motivation
Every dashboard action must map to a service shared with the CLI (FR-CLI-001).
Scope
In scope
- Thin routers calling existing services.
Implementation guidance
- Router
api/routers/actions.pyhosting command-style endpoints that wrap existing services:POST /campaigns/{id}:analyze→AnalysisJobRunner.request(kind)(202{analysis_id});POST /runs/{id}:replay {repeats ≤ runner.max_manual_repeats, fresh_seeds: bool}→ replay service (T-044) (202{run_ids});GET /runs/{id}/scenario.yaml→ regression export (T-026) withContent-Type: application/yamlandContent-Disposition. - Bundle export (FR-STO-003):
POST /campaigns/{id}:export→ 202 job using T-014; status via the report-jobs mechanism from T-084a (reuse, don't duplicate). - Note: doc 05 §10 lists the minimum router set; splitting commands into
actions.py/campaign_commands.pyis deliberate so each file has a single owner for parallel work — record this as a one-line note in doc 05 §10. - 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.
Acceptance criteria
- Replay creates runs with
replay_of; scenario.yaml validates against schema. - Exported scenario.yaml validates against
schemas/scenario.schema.jsonand re-imports to the same scenario hash. - Replay runs carry
replay_ofand deterministic seeds unlessfresh_seeds. - 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/api/test_actions.py.
Dependencies
Blocked by: #149 (T-081d), #138 (T-075b), #92 (T-044), #39 (T-026)
Blocks: #158 (T-084b)
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/api/routers/actions.py
Independent file.
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-082c (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 12 §2 · doc 14 §7 · doc 06 §6 · doc 05 §10
Requirements: FR-ANA-006 · FR-REP-001 · FR-SCN-008 · FR-STO-003 (traceability: doc 28)
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsBacklog
Activity
roboprobe analyze#138roboprobe replay <run_id> [--repeats N] [--fresh-seeds]with verdict agreement #92schemas/scenario.schema.json) #39api/openapi.json) + oasdiff breaking-change check + schemathesis nightly #158feat(api): version mode edits, serve risk slices and persist report j…
CodewithJha commentedon Nov 22, 2026
Shipped on main (merged PR).
feat(api): complete risk, replay and durable reports (T-082/T-084) (#318