Fix critical bugs in export/import feature (PR #225)
Addressed all 6 bugs identified in code reviews: CRITICAL FIXES: 1. SessionStore.ts: Fixed concepts filter bug - removed empty params.push() that was breaking SQL parameter alignment (line 849) 2. import-memories.ts: Removed worker_port and prompt_counter fields from sdk_sessions insert to fix schema mismatch with fresh databases 3. export-memories.ts: Fixed hardcoded port - now reads from settings via SettingsDefaultsManager.loadFromFile() HIGH PRIORITY: 4. export-memories.ts: Added database existence check with clear error message before opening database connection 5. export-memories.ts: Fixed variable shadowing - renamed local 'query' variable to 'sessionQuery' (line 90) MEDIUM PRIORITY: 6. export-memories.ts: Improved type safety - added ObservationRecord, SdkSessionRecord, SessionSummaryRecord, UserPromptRecord interfaces All fixes tested and verified: - Export script successfully exports with project filtering - Import script works on existing database with duplicate prevention - Port configuration read from settings.json - Type safety improvements prevent compile-time errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -845,10 +845,9 @@ export class SessionStore {
|
||||
// Apply concepts filter
|
||||
if (concepts) {
|
||||
const conceptsList = Array.isArray(concepts) ? concepts : [concepts];
|
||||
const conceptConditions = conceptsList.map(() => {
|
||||
params.push();
|
||||
return 'EXISTS (SELECT 1 FROM json_each(concepts) WHERE value = ?)';
|
||||
});
|
||||
const conceptConditions = conceptsList.map(() =>
|
||||
'EXISTS (SELECT 1 FROM json_each(concepts) WHERE value = ?)'
|
||||
);
|
||||
params.push(...conceptsList);
|
||||
additionalConditions.push(`(${conceptConditions.join(' OR ')})`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user