fix(kanban): create additive-column indexes after migration#28461
Closed
itsreverence wants to merge 1 commit into
Closed
fix(kanban): create additive-column indexes after migration#28461itsreverence wants to merge 1 commit into
itsreverence wants to merge 1 commit into
Conversation
267e7ce to
86d63c3
Compare
This was referenced May 19, 2026
Closed
3 tasks
This was referenced May 19, 2026
Collaborator
|
Thanks @itsreverence — you filed first and your write-up of the SCHEMA_SQL-vs-migration ordering trap was the clearest. Closing as duplicate of the salvage PR that combines all the open fixes into one: #28781 (merged in 7552e0f). That salvage hoists all four additive-column indexes ( |
This was referenced May 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #28464.
Fixes a Kanban DB migration ordering bug that can crash
hermes dashboardor any Kanban board load for users with an existing/legacykanban.db.connect()runsSCHEMA_SQLbefore_migrate_add_optional_columns(). The schema currently creates indexes on additive columns (tasks.session_idandtask_events.run_id) before legacy tables have those columns. On an older board DB, SQLite aborts schema initialization before the migration can add the missing column:This moves the indexes for additive columns out of
SCHEMA_SQLand creates them after the additive migration has guaranteed the columns exist.What changed
idx_tasks_session_idcreation fromSCHEMA_SQLto_migrate_add_optional_columns()aftertasks.session_idis added if missing.idx_events_runcreation fromSCHEMA_SQLto_migrate_add_optional_columns()aftertask_events.run_idis added if missing.connect()migrates it successfully and creates both indexes.Why
Fresh DBs are fine because the additive columns are present when the schema creates the indexes. Existing boards from before these columns were added can fail before migration runs. This is especially visible through the Kanban dashboard plugin because
/api/plugins/kanban/boardopens the board DB during page load.Validation
Confirmed the issue against
origin/mainby applying itsSCHEMA_SQLto a legacy DB shape:Confirmed this branch migrates the same legacy DB and preserves the expected indexes:
Ran the focused regression test:
Also verified local real board DBs migrated/opened successfully after the fix:
Suggested Labels
type/bugPlatform tested
origin/maincontains conflict-marker text inhermes_cli/config.pyarounddispatch_stale_timeout_seconds, producing aSyntaxErrorbefore CLI startup. That appears unrelated to this migration fix.