Skip to content

[T-013a] ArtifactStore: local content-addressed blobs, run symlinks, path confinement #66

Closed

Description

@CodewithJha

Task T-013a · Milestone M3 — Oracles + runner + store · Size M · Priority P0 · Epic #3

Implements 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/ArtifactKind in store/artifacts.py; adapter LocalArtifactStore(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).
  • NullArtifactStore for tests (Null Object, doc 34 §4).
  • Plugin registration under entry-point group roboprobe.stores key local (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 .ref file; 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_root
  • storage.backend
  • storage.workdir_root

Acceptance criteria

  • Same content stored twice → one blob, two refs.
  • Path-traversal attempts (../../etc/passwd, absolute paths, symlink escapes) raise ValidationError.
  • Hash recorded equals sha256sum of 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 Unreleased updated 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.py
  • backend/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:

Activity

  1. added
    area:storagePostgres schema, repositories, artifacts
    area:securitySecurity hardening, supply chain
    priority:P0Critical path / blocks others
    milestone:M3M3 — Oracles + runner + store
    taskChild task of a milestone epic
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:securitySecurity hardening, supply chainarea:storagePostgres schema, repositories, artifactsmilestone:M3M3 — Oracles + runner + storepriority:P0Critical path / blocks otherssize:M1-3 daystaskChild task of a milestone epictype:featureNew functionality

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions