Repository navigation
Description
Task
T-013a· Milestone M3 — Oracles + runner + store · Size M · Priority P0 · Epic #3Implements FR-STO-002 · NFR-SEC-003
Branch
feat/t-013a-artifactstore-local-content-addressed-blobs— one task = one branch = one PR (doc 32 §6)
Summary
Implement LocalArtifactStore per doc 05 §9 / doc 11 §6: put (sha256, atomic move into sha256/ab/cd/<hash>.<ext>, browsable links under runs/<campaign>/<run>/), open, path, behind an ArtifactStore port (ADR-0008).
Context / motivation
Traces, bags, reports and figures are large and immutable — storing them content-addressed with recorded SHA-256 gives integrity (TM-12) and deduplication; the port keeps MinIO/S3 possible later.
Scope
In scope
- Port
ArtifactStore+ArtifactRef/ArtifactKindinstore/artifacts.py; adapterLocalArtifactStore(root: Path). - Atomic write (temp file +
os.replace), streaming hash, media type detection by kind. - Every resolved path checked with
Path.resolve().is_relative_to(root)(doc 21 §1, TM-04). NullArtifactStorefor tests (Null Object, doc 34 §4).- Plugin registration under entry-point group
roboprobe.storeskeylocal(storage.backend).
Out of scope
- DB rows for artefacts (via
ArtifactRepo, T-011b — the store accepts an optional recorder callback) gc/verify(T-013b)
Implementation guidance
- Symlinks may fail on Windows: fall back to hard links or a small
.reffile; document the behaviour. Never accept user-supplied relative paths — artefacts are addressed by id/hash. - 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.artifact_rootstorage.backendstorage.workdir_root
Acceptance criteria
- Same content stored twice → one blob, two refs.
- Path-traversal attempts (
../../etc/passwd, absolute paths, symlink escapes) raiseValidationError. - Hash recorded equals
sha256sumof the blob. - 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/unit/store/test_artifacts.py(tmp_path), including traversal and symlink-escape tests.
Dependencies
Blocked by: #15 (T-002a), #19 (T-003a)
Blocks: #67 (T-013b), #125 (T-014), #80 (T-040a), #93 (T-039b), #150 (T-081e), #204 (T-097b), #220 (T-128)
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/artifacts.pybackend/tests/unit/store/test_artifacts.py
Independent of all DB tasks — can start right after M1.
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-013a (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 11 §6 · doc 11 §6.1 · doc 05 §9 · doc 21 §1 · doc 31 §3 · ADR-0008
Requirements: FR-STO-002 · NFR-SEC-003 (traceability: doc 28)
External:
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsReady
Activity
roboprobe gc [--dry-run],artifacts verify, retention policy #67roboprobe oracle reevaluate <run_id>: offline re-judgement from stored traces #93.tar.zst, JSON Lines + artefacts) with safe extraction #125make backup|restore(pg_dump + artefacts), verified restore test #220