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:
@@ -80,8 +80,8 @@ function importMemories(inputFile: string) {
|
||||
INSERT INTO sdk_sessions (
|
||||
claude_session_id, sdk_session_id, project, user_prompt,
|
||||
started_at, started_at_epoch, completed_at, completed_at_epoch,
|
||||
status, worker_port, prompt_counter
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
status
|
||||
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`);
|
||||
|
||||
const insertSummary = db.prepare(`
|
||||
@@ -127,9 +127,7 @@ function importMemories(inputFile: string) {
|
||||
session.started_at_epoch,
|
||||
session.completed_at,
|
||||
session.completed_at_epoch,
|
||||
session.status,
|
||||
session.worker_port || null,
|
||||
session.prompt_counter || null
|
||||
session.status
|
||||
);
|
||||
stats.sessionsImported++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user