Skip to content

[T-011b] Repositories: failure modes, risk maps, analyses, experiments, workers, artifacts #62

Closed

Description

@CodewithJha

Task T-011b · Milestone M3 — Oracles + runner + store · Size M · Priority P1 · Epic #3

Implements FR-STO-001

Branch feat/t-011b-repositories-failure-modes-risk-maps — one task = one branch = one PR (doc 32 §6)

Summary

Complete the persistence layer with the remaining aggregates of doc 05 §9 (FailureModeRepo incl. members, RiskMapRepo, AnalysisRepo, ExperimentRepo, WorkerRepo, ArtifactRepo).

Context / motivation

Analysis (M6), experiments (M4) and the worker heartbeat (M3) need these repositories. Splitting from T-011a lets the campaign/run path ship first.

Scope

In scope

  • store/repositories/{modes,risk_maps,analyses,experiments,workers,artifacts}.py + UoW attributes.
  • FailureModeRepo.upsert_modes(campaign_id, modes, members) preserving label_is_user labels.
  • WorkerRepo.register/heartbeat/set_status/online(backend).
  • Ports added to store/ports.py.

Implementation guidance

  • Follow the same conventions as T-011a (records not ORM objects, keyset pagination, one session per UoW). FailureModeRepo must store members in the same transaction as modes. Workers are keyed by <prefix>:<pid>:<slot> (doc 27 §4.4).
  • 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

  • All repositories implement their Protocols; contract tests (T-015) pass.
  • Upserting modes never overwrites user-edited labels.
  • Worker heartbeat update is a single UPDATE (no read-modify-write).
  • 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_repositories_analysis_experiment_worker.py.

Dependencies

Blocked by: #61 (T-011a)

Blocks: #64 (T-012), #67 (T-013b), #125 (T-014), #108 (T-102a)

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/repositories/{modes,risk_maps,analyses,experiments,workers,artifacts}.py
  • backend/src/roboprobe/store/uow.py (append attributes)
  • backend/src/roboprobe/store/ports.py (append)

Parallel with T-011c and T-012 (different modules).

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-011b (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 05 §9 · doc 11 §3 · doc 09 §3.3

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

External:

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:storagePostgres schema, repositories, artifactsmilestone:M3M3 — Oracles + runner + storepriority:P1Required for milestone exitsize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions