Skip to content

fix(store): stop backups overwriting a new file; adopt kit v0.26.0 file helpers - #920

Merged
wesm merged 4 commits into
mainfrom
kit-v026-fs-helpers
Sep 26, 2026
Merged

wesm merged 4 commits into
mainfrom
kit-v026-fs-helpers

Conversation

@mariusvniekerk

@mariusvniekerk mariusvniekerk commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

SQLite maintenance backups now preserve files created at the target path during VACUUM INTO. Publication uses a hard link or atomic no-replace rename on Unix, and a write-through no-replace rename on Windows. A competing file survives and the backup returns "backup target already exists".

Filesystems with neither publication primitive still reject the backup. A check-then-rename fallback would restore the overwrite race.

Kit v0.26.0 also replaces repeated atomic-write and directory-sync code for tokens, deletion manifests, runtime state, cache publication, and developer tools. Sync errors propagate even when publication already succeeded. Migrated replacement writers reject symlink targets.

The token helper and credential stores retain their Windows permission handling. Kit's WithPrivate also grants SYSTEM and Administrators access, unlike their current-user-only policy.

API timing tests use virtual time for request-timeout policy and allow HTTP connection cleanup after the loopback read-deadline checks. Production timeout behavior is unchanged.

@roborev-ci

roborev-ci Bot commented Sep 23, 2026

Copy link
Copy Markdown

roborev: Combined Review (d9efd6b)

Verdict: No findings at or above medium severity.


Reviewers: 2 done | Synthesis: codex | Total: 6m9s

@wesm wesm self-assigned this Sep 24, 2026
@wesm

wesm commented Sep 26, 2026

Copy link
Copy Markdown
Member

looking

mariusvniekerk and others added 2 commits September 26, 2026 09:41
Adopt the shared file helpers to prevent backup publication from replacing
a newly created target and to reuse atomic writes for persisted state.

- fix(store): never overwrite an existing file when publishing a backup
- refactor: write tokens and deletion manifests through kit atomicfile
- refactor: publish private runtime state through kit atomicfile
- refactor: sync directories with kit atomicfile.SyncDir
- refactor: use kit atomicfile in developer tool writers

Generated with Claude Code
Generated with Codex
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Codex <noreply@openai.com>
Kit's hard-link-first publisher does not write through the new name on
Windows. Use its exclusive write-through rename, as kit does for new-file
publication, while retaining the no-overwrite contract on every platform.

Exercise the race by creating a competing file after the backup's initial
check. Document why unsupported publication must fail and why the existing
owner-only credential permissions cannot be replaced with kit's broader
Windows private-file permissions.

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@wesm
wesm force-pushed the kit-v026-fs-helpers branch from d9efd6b to f60586e Compare September 26, 2026 14:51
@roborev-ci

roborev-ci Bot commented Sep 26, 2026

Copy link
Copy Markdown

roborev: Combined Review (f60586e)

Verdict: No findings at or above medium severity.


Reviewers: codex, codex (security) | Synthesis: codex | Total: 6m12s

The Windows API job returned nil where the bounded CLI request should
report a deadline error. Its test races two wall-clock timers, so delayed
scheduling can leave both select branches ready.

Run each policy case with virtual time while keeping the real middleware
and the existing timeout and success assertions.

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@roborev-ci

roborev-ci Bot commented Sep 26, 2026

Copy link
Copy Markdown

roborev: Combined Review (10a50c3)

Verdict: No findings at or above medium severity.


Reviewers: codex, codex (security) | Synthesis: codex | Total: 4m37s

The loopback request-deadline test passed both request assertions but its
one-second shutdown deadline failed on CI. The rejected body leaves HTTP
connection cleanup to net/http, which delays closing and polls for shutdown.

Give cleanup five seconds without changing the request deadlines or the
assertions that distinguish marked and unmarked requests.

Generated with Codex
Co-authored-by: Codex <noreply@openai.com>
@roborev-ci

roborev-ci Bot commented Sep 26, 2026

Copy link
Copy Markdown

roborev: Combined Review (32b2075)

Verdict: No findings at or above medium severity.


Reviewers: codex, codex (security) | Synthesis: codex | Total: 8m6s

@wesm
wesm merged commit 75e659c into main Sep 26, 2026
25 checks passed
@wesm
wesm deleted the kit-v026-fs-helpers branch September 26, 2026 21:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants