This repository was archived by the owner on Feb 1, 2026. It is now read-only.
Repository navigation
Schema Migration v8 Silently Fails #65
Replies: 1 comment
|
Resolved in commits:
What was fixed:
The schema version gaps (1, 4 missing) are historical artifacts from before this fix - they won't cause issues going forward. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Issue Summary
Schema migration v8 (
008_fix_spike_reports_columns.sql) is incorrectly marked as "applied" in theschema_versiontable, but theALTER TABLEstatements did not execute successfully. This results in missing columns in thespike_reportstable, causing runtime errors.Environment
~/.claude/emergent-learning/memory/index.dbSymptoms
When running
python ~/.claude/emergent-learning/src/query/query.py --context, the following error occurs:Root Cause Analysis
Expected Behavior
Migration v8 should add missing columns to the
spike_reportstable:topic TEXT NOT NULLgotchas TEXTresources TEXTdomain TEXTtags TEXTaccess_count INTEGER DEFAULT 0updated_at DATETIMEActual Behavior
Schema version table shows migration v8 as applied:
But
spike_reportstable is missing columns:Missing columns:
topic(the one causing the error)gotchasresourcesdomaintagsaccess_countupdated_atSuspected Bug Location
The bug is likely in
src/query/migrations.py, lines 86-118 (theapply_migration()method):Hypothesis: The
ALTER TABLE ADD COLUMNstatements may be throwing exceptions that are silently ignored by the overly broad error handling. The migration then records itself as successful even though critical statements failed.Possible scenarios:
ALTER TABLE ADD COLUMNwithNOT NULL(requires SQLite 3.32+)OperationalErrornot covered by the ignore listReproduction Steps
spike_reportstable with old schemapython ~/.claude/emergent-learning/src/query/query.py --contexttopiccolumn is missingno such column: t1.topicVerification
To verify the bug on an affected system:
If migration v8 shows as applied but
topiccolumn is missing, the bug is confirmed.Impact
--contextqueries)Suggested Fix
Short-term: Manual Fix for Users
Add a migration rollback/retry mechanism or manual fix instructions:
Long-term: Code Fix
Improve error logging in
apply_migration():Validate migration success:
Transaction safety:
Example fix for
migrations.py:Additional Notes
~/.claude/emergent-learning/memory/learnings.dbexists (0 bytes) but is unused. System usesindex.db(defined incore.py:182).Workaround Applied
User has manually added the missing columns using the SQL commands above. Query system now works correctly.
Reported by: Claude Code User (via automated diagnostics)
Date: 2026-01-06
Related Issue: #63 (if exists in GitHub repo)
All reactions