feat: pluggable storage backends — file, Archivista, memory#139
Conversation
mlieberman85
left a comment
There was a problem hiding this comment.
PR Review: Pluggable Storage Backends
Code is well-structured, tests are included and all 27 pass, and the interface is straightforward. No new bugs found in the storage module itself.
Design
Three-backend architecture:
- FileBackend — JSON files in
.darnit/, good default - ArchivistaBackend — HTTP upload to Archivista for attestations, falls back to FileBackend for metadata/research and on connection failure
- MemoryBackend — in-memory for testing
The StorageBackend base class defines a clear interface with 6 methods (store/retrieve for each of attestations, metadata, research results). Factory function handles config-based selection.
Not yet wired in
Acknowledged in the PR description — the storage module exists as a standalone module but isn't connected to the audit pipeline, attestation generator, or agent run. Should have a tracking issue for the wiring.
Minor
ArchivistaBackend.retrieve_attestationalways falls back to file — can never retrieve from Archivista since it stores by gitoid but looks up by repo+commit. The gitoid fromstore_attestationis returned but not persisted for later retrieval.- Same
plugin.pyindentation issue as the other PRs (lines 114, 136, 151, 165) _repo_sluguses simple string replacement (/→_) which could collide:org/repoandorg_repowould produce the same slug- Tests don't have
@pytest.mark.unitmarkers (minor inconsistency with the rest of the test suite)
What's good
- Ships 27 tests that all pass
- FileBackend handles errors gracefully (returns None/False instead of raising)
- Archivista fallback is a solid pattern — upload failures don't lose data
- MemoryBackend is a useful test utility for other code that needs storage
…g isinstance checks
…l, pytest markers, plugin protocol
|
Fixes pushed:
|
|
Not sure what happened but it looks like you broke the In addition there's a couple of minor merge conflicts. |
|
Sorry for the broken lock file, it got corrupted during a merge from main. |
|
@Marc-cn just fix the merge conflicts. In the followup it would be nice to see it hooked into an example module. |
Summary
Adds a pluggable StorageBackend interface addressing the database requirements discussed: storing attestations, project metadata when repo write access is unavailable, and reproducibility research results.
Type of Change
Framework Changes Checklist
uv run python scripts/validate_sync.py --verboseand it passesuv run python scripts/generate_docs.pyand committed any doc changesControl/TOML Changes Checklist
Not applicable — no controls or TOML modified in this PR.
Testing
What was built
Configuration:
[storage]
backend = "archivista"
archivista_url = "http://localhost:8082"
Covers all three requirements:
Additional Notes