Summary
The cache schema is keyed on commit_sha alone — no ref_name dimension. Any commit that ever holds notes on both refs/notes/prompts and refs/notes/prompts-private will have one silently overwritten in the SQLite cache. prov log / prov search lose the public-side prompt for those commits.
Affects:
- The post-commit dual-write path when a session has both public and private edits matched to the same diff.
- The
reindex_from(public) → overlay_from(private) sequence used by prov reindex and prov install.
Severity
P1 — silent data loss in the read pipeline. Confidence 90.
Evidence
crates/prov-core/src/storage/sqlite.rs (cache schema definitions).
crates/prov-cli/src/commands/hook.rs:577 (post-commit dual-write path).
Suggested fix
Add ref_name TEXT to the notes and edits tables and to all primary/unique constraints. Bump cache schema version (schema_version table) and write a migration. Update read paths to merge across refs when the resolver / search needs both.
Acceptance criteria
Reference
/tmp/compound-engineering/ce-code-review/20260502-075634-3af3d047/correctness.json (#1).
Summary
The cache schema is keyed on
commit_shaalone — noref_namedimension. Any commit that ever holds notes on bothrefs/notes/promptsandrefs/notes/prompts-privatewill have one silently overwritten in the SQLite cache.prov log/prov searchlose the public-side prompt for those commits.Affects:
reindex_from(public) → overlay_from(private)sequence used byprov reindexandprov install.Severity
P1 — silent data loss in the read pipeline. Confidence 90.
Evidence
crates/prov-core/src/storage/sqlite.rs(cache schema definitions).crates/prov-cli/src/commands/hook.rs:577(post-commit dual-write path).Suggested fix
Add
ref_name TEXTto thenotesandeditstables and to all primary/unique constraints. Bump cache schema version (schema_versiontable) and write a migration. Update read paths to merge across refs when the resolver / search needs both.Acceptance criteria
prov log <file>(subject to whatever visibility filtering ships alongside).prov reindexagainst a notes layout with overlappingcommit_shaentries on both refs preserves both.Reference
/tmp/compound-engineering/ce-code-review/20260502-075634-3af3d047/correctness.json(#1).