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
fix: close 7 audit findings from v0.2.0 council review
HIGH fixes:
- #5: clearSession now cleans FTS/index data (prevents unbounded DB growth)
- #13: Memory TTL expires_at enforced in getMemoriesByProject and searchMemoriesFTS
- #14: Embedding API key hash included in model identity (fixes stale provider on key rotation)
MEDIUM fixes:
- #16: updateSessionMeta moved inside compaction transaction
- #11: Added idx_dream_queue_pending index for started_at/enqueued_at
- #18: Dream timer returns cleanup function for proper lifecycle management
LOW fix:
- #12: Removed redundant if(args.drop) guard after early return
Copy file name to clipboardExpand all lines: src/features/magic-context/memory/storage-memory-fts.ts
+4-2Lines changed: 4 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ function getSearchStatement(db: Database): PreparedStatement {
15
15
.join(", ");
16
16
17
17
stmt=db.prepare(
18
-
`SELECT ${selectColumns} FROM memories_fts INNER JOIN memories ON memories.id = memories_fts.rowid WHERE memories.project_path = ? AND memories.status IN ('active', 'permanent') AND memories_fts MATCH ? ORDER BY bm25(memories_fts), memories.updated_at DESC, memories.id ASC LIMIT ?`,
18
+
`SELECT ${selectColumns} FROM memories_fts INNER JOIN memories ON memories.id = memories_fts.rowid WHERE memories.project_path = ? AND memories.status IN ('active', 'permanent') AND (memories.expires_at IS NULL OR memories.expires_at > ?) AND memories_fts MATCH ? ORDER BY bm25(memories_fts), memories.updated_at DESC, memories.id ASC LIMIT ?`,
19
19
);
20
20
searchStatements.set(db,stmt);
21
21
}
@@ -52,7 +52,9 @@ export function searchMemoriesFTS(
`SELECT ${getMemorySelectColumns()} FROM memories WHERE project_path = ? AND status IN (${placeholders}) ORDER BY category ASC, updated_at DESC, id ASC`,
215
+
`SELECT ${getMemorySelectColumns()} FROM memories WHERE project_path = ? AND status IN (${placeholders}) AND (expires_at IS NULL OR expires_at > ?) ORDER BY category ASC, updated_at DESC, id ASC`,
216
216
);
217
217
statements.set(db,stmt);
218
218
}
@@ -399,7 +399,7 @@ export function getMemoriesByProject(
0 commit comments