You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d2c0fd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(adr): store ADRs in a per-project sidecar DB, untouched by reindex
Reworks the ADR-loss-across-reindex fix to Alternative 1 (per the PR review):
remove the race rather than narrow it. ADRs live in a per-project sidecar SQLite
DB ("<graph_db>.adr.db"), separate from the graph DB a reindex rebuilds or
deletes, so there is no capture, re-read, re-apply, or lock — and no sleeps,
polling, or timeout deciding an outcome.
store.c:
- ADR ops route to the sidecar. Writes (store/delete/update_sections) use a
cached read-write handle opened SQLITE_OPEN_READWRITE|CREATE and configured
like the graph store — PRAGMA busy_timeout=10000 + journal_mode=WAL — so
cross-process access waits rather than failing SQLITE_BUSY. A :memory: store
keeps ADRs in the graph DB (never file-swapped, no race).
- Reads never write: cbm_store_adr_get uses the cached RW handle if open, else
opens the sidecar SQLITE_OPEN_READONLY when the file exists, else reads the
legacy graph row without creating anything (a query-only cache is never
mutated).
- One-time migration guarded by an adr_meta 'migrated' marker: copy the legacy
project_summaries row (INSERT OR IGNORE) into the sidecar exactly once, so it
can never resurrect a row deleted after migration. New public
cbm_store_adr_migrate_once. adr_update_sections' BEGIN IMMEDIATE runs on the
ADR connection it protects.
- Sidecar path built through cbm_path_for_file_api (Windows long-path prefix).
- Dropped the write-only adr_db_path field (keeps the memory-core baseline).
pipeline.c: migrate a legacy ADR into the sidecar BEFORE the format-change and
forced-full routes unlink the old generation (otherwise an upgrade whose first
action is a full reindex loses it); preserve-and-abort on failure. Migration
targets the FINAL path (staging suffix stripped), not the discarded stage's
sidecar. The early-capture/re-apply machinery and its test hook are gone.
artifact.c: the exported artifact carries the ADR — inject the sidecar's ADR
into the snapshot's project_summaries before compression; on import, restore it
into the destination sidecar via cbm_store_adr_migrate_once.
mcp.c: delete_project also removes "<db>.adr.db" (+ its -wal/-shm/-journal), and
its tool description says so. cli.c: exclude "*.adr.db" from index listing/
counting. README + memory-core baselines updated.
Tests (file-based): an ADR written mid-reindex survives; a legacy row migrates
before a forced-full/format reindex with no prior read; delete_project via the
MCP handler removes the sidecar and a same-name re-index has no ADR; the
artifact export→import round trip keeps the ADR.
ClosesDeusData#516
Signed-off-by: 0xb007ab1e <[email protected]>
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -671,7 +671,7 @@ JSON arguments can also be piped on stdin, for tools that take arguments. A tool
671
671
|------|-------------|
672
672
|`index_repository`| Index a repository into the graph. Auto-sync keeps it fresh after that. |
673
673
|`list_projects`| List all indexed projects with node/edge counts. |
674
-
|`delete_project`| Remove a project and all its graph data. |
674
+
|`delete_project`| Remove a project and all its graph data, including its ADR sidecar (`<db>.adr.db`). |
675
675
|`index_status`| Check indexing status of a project. |
676
676
|`check_index_coverage`| Check whether exact paths or a scope are indexed and fresh. A clean result means no recorded gap, not proof of completeness. |
0 commit comments