Repository navigation
Save review findings to cora.db (v5 tables) #397
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or requestpriority:highscope:coreCore review engineCore review engine
Milestone
Description
Problem
cora review currently only saves a DebtSnapshot (aggregate counts) to .cora/history/*.json. The full ReviewResponse with per-finding detail is only printed to stdout and lost.
Solution
After every review, persist full results to the reviews + findings tables (from #396 migration v5).
Changes
-
src/commands/review.rs— Aftersave_snapshot(), also:- Generate UUID v7 for review
- INSERT into
reviewstable (project_id, command="review", commit, branch, quality_score, gate_status, files_scanned, lines_scanned, provider, model, tokens, cost, duration, summary) - For each
ReviewIssue: INSERT intofindingswith computedfingerprint - Fix hardcoded
files_reviewed: 0(line 299 — populate from actual diff file count)
-
New module:
src/engine/db_writer.rs— Encapsulate DB write logic:pub fn save_review_to_db( conn: &Connection, project_id: i64, command: &str, commit: Option<&str>, branch: Option<&str>, files_scanned: usize, lines_scanned: Option<usize>, duration_ms: Option<u64>, response: &ReviewResponse, llm_config: &LLMConfig, ) -> anyhow::Result<String> // returns review_id
-
Fingerprint computation:
fn finding_fingerprint(file: &str, line: Option<u32>, title: &str) -> String { // Normalize: lowercase title, strip non-alphanumeric // Hash: sha256(file:line:normalized_title) use std::hash::{Hash, Hasher}; let mut h = std::collections::hash_map::DefaultHasher::new(); format!("{}:{}:{}", file, line.unwrap_or(0), title.to_lowercase()).hash(&mut h); format!("{:016x}", h.finish()) }
Data Flow
cora review --staged
│
├── LLM call → ReviewResponse
├── DebtSnapshot → .cora/history/*.json (existing, keep)
└── NEW: save_review_to_db() → cora.db
├── INSERT reviews
└── INSERT findings (per issue)
Dependencies
- Depends on: Rename graph.db → cora.db with auto-migrate #395 (cora.db), Migration v5: reviews, findings, finding_events tables #396 (v5 schema)
Acceptance Criteria
- Every
cora reviewrun creates 1 row inreviews+ N rows infindings -
fingerprintis deterministic (same finding = same hash) -
files_reviewedis accurate (not hardcoded 0) -
cora review --format jsonstdout unchanged -
.cora/history/*.jsonstill written (backward compat) - Works with and without
--ciflag
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestpriority:highscope:coreCore review engineCore review engine
Activity
feat(db): persist review & scan findings to cora.db (#397, #398)
chore: bump version to 0.8.4
perf: Phase 1 + Search + Indexing — 1.8x cold index, 52x incremental,…
ajianaz commentedon Jul 28, 2026
Resolved by PR #421. save_review_to_db() persists findings to cora.db v5 tables.
chore: v0.9.0 release prep (#423)
chore: sync v0.9.0 release prep to develop (#424)
chore: sync v0.9.0 release prep to develop (#424) (#425)
release: v0.10.0 (#442)
release: v0.11.1 → main (#450)