Skip to content

fix(snapshot): restore reverted files from blobs, not checkout pathspecs#14

Merged
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
snapshot-blob-restore
Jul 4, 2026
Merged

fix(snapshot): restore reverted files from blobs, not checkout pathspecs#14
Aayam Bansal (aayambansal) merged 1 commit into
mainfrom
snapshot-blob-restore

Conversation

@aayambansal

Copy link
Copy Markdown
Member

The Test check still flaked on Linux after #9's hardening: git checkout <tree> -- <path> intermittently fails on the runners for unusual filenames even when the file IS in the tree — the previous fix stopped the destructive delete, but the file kept its modified content, so 'unicode filenames modification and restore' failed with a content mismatch instead.

This removes per-file git pathspecs from the restore path entirely:

  • the snapshot tree is listed once with ls-tree -r -z (NUL-delimited, raw paths)
  • every file is rewritten from its blob via cat-file blob <sha> — content addressed by sha only, nothing filename- or platform-dependent left
  • symlinks are recreated from the blob target; the executable bit follows the tree mode
  • fail-safe stays: unlistable tree or unreadable blob keeps files rather than deleting on unverified state

Verified locally: snapshot suite 41/41 across 3 consecutive runs, full backend suite 820/820, turbo typecheck clean. Will rerun the CI Test job multiple times on this PR to confirm stability on Linux runners.

The required Test check still flaked on Linux after the previous
hardening: 'git checkout <tree> -- <path>' intermittently fails there
for unusual filenames even when the file is in the tree, leaving the
modified content in place (and before the hardening, deleting the file
outright).

revert() no longer builds any per-file git pathspec. The snapshot tree
is listed once with 'ls-tree -r -z' (NUL-delimited raw paths), and each
file is rewritten from its blob via 'cat-file blob <sha>' — content is
addressed by sha only, so nothing platform- or filename-dependent is
left in the restore path. Symlinks are recreated from their blob target,
the executable bit follows the tree mode, and unlistable trees or
unreadable blobs keep files in place rather than risking destructive
deletes.
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openscience Ready Ready Preview, Comment Jul 4, 2026 6:42pm

Request Review

@aayambansal Aayam Bansal (aayambansal) merged commit 503a932 into main Jul 4, 2026
17 checks passed
@aayambansal Aayam Bansal (aayambansal) deleted the snapshot-blob-restore branch July 4, 2026 18:47
Aayam Bansal (aayambansal) added a commit that referenced this pull request Jul 7, 2026
…t bill the wrong one (#130)

Queued usage rows carried no account identity, so flushPendingUsage sent
every row under whatever session was active at startup. If usage was queued
under account A (or while the session was transiently unreadable) and account
B later logged in, the flush billed B for A's usage. dropUsageQueue only runs
on explicit logout, not a silent account swap.

Stamp each queued row with a stable account tag (user_id, else a short hash of
the api_key — never the raw key). On flush, a row tagged for a DIFFERENT
account is kept in the queue rather than sent (it flushes when that account is
active); legacy/untagged rows stay best-effort. Pure shouldFlushForAccount
helper is unit-tested. (#14)
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