Skip to content

Fix v1 migration on Windows: close the old file before replacing it - #9

Merged
ChromaBeast merged 1 commit into
mainfrom
fix/windows-v1-migration
Nov 16, 2026
Merged

ChromaBeast merged 1 commit into
mainfrom
fix/windows-v1-migration

Conversation

@ChromaBeast

Copy link
Copy Markdown
Owner

Summary

main fails Engine Tests (windows-latest) since #8 (run):

install migrated database: rename ...\v1.bin.migrated.tmp ...\v1.bin: Access is denied.
--- FAIL: TestV1DatabaseMigratesToV2

migrateV1ToV2 held the old data file open (defer src.disk.Close()) until it returned, so the rename that installs the migrated file over it failed: Windows refuses to replace an open file, while macOS and Linux allow it. In practice a version 1 database could not be opened on Windows. Nothing was damaged: the failure happens before any file is replaced, and the next start retries.

The fix closes the old file before the install step. The v0 migration already did this, and the WAL files are closed before they are moved.

Testing

  • go build ./... && go vet ./... && go test ./... -race pass on macOS.
  • The regression test is the existing TestV1DatabaseMigratesToV2, which fails on windows-latest without this change; this PR's Windows job is the check.

migrateV1ToV2 kept the old data file open until it returned, so the rename
that installs the migrated file over it failed on Windows with "Access is
denied" and a version 1 database could not be opened there. Close it
before the install step. TestV1DatabaseMigratesToV2 fails on windows-latest
without this.
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-16T15:15:16.513094Z
We couldn’t complete this review. Comment @codex review to try again.
15e9415 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@ChromaBeast
ChromaBeast merged commit c41a4a0 into main Nov 16, 2026
4 checks passed
@ChromaBeast
ChromaBeast deleted the fix/windows-v1-migration branch November 20, 2026 08:49
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