8000 refactor(store): typed migrations and tempdir tests by aorumbayev · Pull Request #136 · kagan-sh/kagan · GitHub
[go: up one dir, main page]

Skip to content

refactor(store): typed migrations and tempdir tests - #136

Merged
aorumbayev merged 5 commits into
mainfrom
fix/store-migrations
Nov 11, 2026
Merged

aorumbayev merged 5 commits into
mainfrom
fix/store-migrations

Conversation

@aorumbayev
Copy link
Copy Markdown
Member

Typed store migrations and tempdir tests, from a validated outside review (findings 3 and 7).

  • Migration tests use tempfile::tempdir() instead of a shared temp folder plus pid.
  • Migrations are typed (Sql / Guarded / Step): the generic migrate() no longer compares SQL text or a sentinel string. Every applied entry keeps its SQL byte-for-byte; user_version is unchanged.
  • New upgrade test: a main-line version-3 database reaches the latest schema.

Reviewed by a fresh reviewer (SHIP), CI green on Linux, macOS and Windows.

The schema tests wrote to the shared temp folder under the process id and
removed only the main file, so a panic left files behind. Each test now
gets its own tempdir, which is removed with its files.
…hema

Covers the upgrade path from the main line's third migration, which drops
threads.model, through the projects.sort and fields entries and the repair
entry, before the migration list changes shape.
The loader skipped two migrations by comparing their SQL text with the
list and repaired a conflicting history by matching a sentinel string.
Each entry is now a Migration: Sql runs its text, Guarded skips it while
its column exists, and Step runs code. Applied entries keep their SQL
byte for byte.
# Conflicts:
#	crates/store/src/store.rs
#	docs/decisions.md
@aorumbayev
aorumbayev merged commit 337aa6c into main Nov 11, 2026
19 checks passed
@aorumbayev
aorumbayev deleted the fix/store-migrations branch November 11, 2026 18:39
6C3F
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0