Repository navigation
Persist the DHF store in SQLite behind a TraceabilityStore interface - #1
Merged
Merged
Conversation
- app/store.py: TraceabilityStore protocol, InMemoryStore, SqliteStore (one table per stored record type, columns mirror the Pydantic fields, idempotent CREATE TABLE IF NOT EXISTS migration, DHF_DB_PATH env var) - app/main.py: store injected via Depends; SQLite opened at startup - tests: unit suite injects InMemoryStore; `pytest -m integration` covers the SQLite round trip and API restart end to end - CI runs both suites and enforces 100% combined coverage - README / architecture: persistence model and its limits (no concurrent- write locking, no revision history, no schema evolution) Trace links and gaps stay derived by build_matrix, not stored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the in-memory
projectsdict with a persistent store. The API, the Pydantic schemas and the Archivist's behaviour are unchanged.Changes
app/store.pydefines theTraceabilityStoreprotocol (get/put) and two implementations:InMemoryStoreSqliteStore, which uses stdlibsqlite3and keeps one table per stored record type, with columns that mirror the Pydantic fields.CREATE TABLE IF NOT EXISTSruns on startup, or standalone withpython -m app.store.DHF_DB_PATH, defaultdata/dhf.db, which is gitignored.app/main.py: each endpoint gets the store throughDepends(get_store). The server opensSqliteStoreat startup, so there is no global.pytestruns the fast suite againstInMemoryStore.pytest -m integrationcovers:docs/architecture.mddescribe the persistence model and its limits.Not changed
build_matrixon every read and are not stored, so the gap report can't go stale.Known limits (also in the README)
VAL-n. Only single-writer use has been tested.ALTER TABLEor a fresh file.Verification
uvicorn, and the data was still there.🤖 Generated with Claude Code