Skip to content

Comments

Fix migration 28 crash when client_state.data column is absent#70

Merged
lstein merged 2 commits intofeature/multiuserfrom
copilot/fix-client-state-table-migration
Feb 20, 2026
Merged

Fix migration 28 crash when client_state.data column is absent#70
lstein merged 2 commits intofeature/multiuserfrom
copilot/fix-client-state-table-migration

Conversation

Copy link

Copilot AI commented Feb 20, 2026

Migration 28 unconditionally executes SELECT data FROM client_state WHERE id = 1 when upgrading an existing table, but users who ran an older version of migration 21 without the data column would hit OperationalError: no such column: data.

Changes

  • migration_28.py: Before reading data, introspect the table schema via PRAGMA table_info(client_state). If the column is absent, skip data extraction and proceed directly to drop/recreate with the new multi-user schema.
  • tests/test_sqlite_migrator.py: Added two tests:
    • test_migration_28_with_existing_data_column — verifies JSON data is correctly migrated to per-user key-value rows under system
    • test_migration_28_without_data_column — verifies migration completes without error and produces a clean new schema when data is absent

QA Instructions

Run the new tests directly:

pytest tests/test_sqlite_migrator.py::test_migration_28_with_existing_data_column tests/test_sqlite_migrator.py::test_migration_28_without_data_column -v

To reproduce the original failure: create a client_state table with only id and updated_at columns (no data), then run Migration28Callback — before this fix it raises OperationalError: no such column: data.

Merge Plan

This touches the DB migration chain. No schema version bump is needed — the fix is purely defensive logic within migration 28. Safe to merge independently.

Checklist

  • The PR has a short but descriptive title, suitable for a changelog
  • Tests added / updated (if applicable)
  • ❗Changes to a redux slice have a corresponding migration
  • Documentation added / updated (if applicable)
  • Updated What's New copy (if doing a release after this PR)

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: lstein <111189+lstein@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix migration for client_state data column Fix migration 28 crash when client_state.data column is absent Feb 20, 2026
Copilot AI requested a review from lstein February 20, 2026 19:55
Copy link
Owner

@lstein lstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works as advertised

@lstein lstein marked this pull request as ready for review February 20, 2026 20:45
@lstein lstein merged commit a8fb5c9 into feature/multiuser Feb 20, 2026
19 of 25 checks passed
@lstein lstein deleted the copilot/fix-client-state-table-migration branch February 20, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants