[PR #591] fix: harden SQLite schema_metadata migration races #594

Closed
opened 2026-03-02 04:14:04 +03:00 by kerem · 0 comments
Owner

Original Pull Request: https://github.com/git-ai-project/git-ai/pull/591

State: closed
Merged: Yes


Summary

  • make schema version updates idempotent with UPSERT in both internal and metrics DB migration flows
  • keep version updates monotonic to avoid downgrading when multiple initializers race
  • add regression tests that simulate partial migration state where target tables already exist before migration runs

Why

Issue #590 reports table cas_cache already exists during startup migration. IF NOT EXISTS handles table/index creation, and this patch also removes version-row write races that can still occur when multiple processes initialize simultaneously.

Testing

  • cargo test --lib handles_preexisting

Fixes #590

**Original Pull Request:** https://github.com/git-ai-project/git-ai/pull/591 **State:** closed **Merged:** Yes --- ## Summary - make schema version updates idempotent with UPSERT in both internal and metrics DB migration flows - keep version updates monotonic to avoid downgrading when multiple initializers race - add regression tests that simulate partial migration state where target tables already exist before migration runs ## Why Issue #590 reports `table cas_cache already exists` during startup migration. `IF NOT EXISTS` handles table/index creation, and this patch also removes version-row write races that can still occur when multiple processes initialize simultaneously. ## Testing - cargo test --lib handles_preexisting Fixes #590
kerem 2026-03-02 04:14:04 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-ai#594
No description provided.