Fix doctor DB-JSONL sync check to exclude ephemeral wisps (#1144)

The DB-JSONL Sync check was showing a false positive warning when wisps
(ephemeral issues) existed in the database. Wisps are intentionally
excluded from JSONL exports, so they shouldn't be counted when comparing
database and JSONL issue counts.

Changes:
- Updated CheckDatabaseJSONLSync to exclude ephemeral issues from count
  using 'WHERE ephemeral = 0 OR ephemeral IS NULL'
- Added 'ephemeral' column to test database schema
- Added test case to verify ephemeral issues are excluded from count
- Updated TestCheckDatabaseJSONLSync_MoleculePrefix to include ephemeral column

This prevents false warnings like 'database has 92 issues, JSONL has 30'
when the difference is entirely due to wisps that should not be exported.

Co-authored-by: Roland Tritsch <roland@ailtir.com>
This commit is contained in:
Roland Tritsch
2026-01-19 18:11:23 +00:00
committed by GitHub
parent aa3b318939
commit 34b741d2e0
2 changed files with 33 additions and 4 deletions

View File

@@ -412,9 +412,9 @@ func CheckDatabaseJSONLSync(path string) DoctorCheck {
}
defer db.Close()
// Get database count
// Get database count (exclude ephemeral/wisp issues - they're never exported to JSONL)
var dbCount int
err = db.QueryRow("SELECT COUNT(*) FROM issues").Scan(&dbCount)
err = db.QueryRow("SELECT COUNT(*) FROM issues WHERE ephemeral = 0 OR ephemeral IS NULL").Scan(&dbCount)
if err != nil {
// Database opened but can't query. If JSONL has issues, suggest recovery.
if jsonlErr == nil && jsonlCount > 0 {