fix(snapshot): restore reverted files from blobs, not checkout pathspecs#14
Merged
Merged
Conversation
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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
ls-tree -r -z(NUL-delimited, raw paths)cat-file blob <sha>— content addressed by sha only, nothing filename- or platform-dependent leftVerified 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.