test(ledger): a project fold outlives a branch switch and a new commit - #754
Merged
Merged
Conversation
The host's prompt cache is pinned to the git snapshot it started on, so a checkout or a new commit starts the next session cold even where the bytes are identical. The ledger's project scope is keyed on the repository root and never reads a ref, so it folds across both. That is the one saving in this lane the cache structurally cannot make, and nothing asserted it. Real git rather than a hand-built .git directory: the property is that a real snapshot change does not move the scope, and a fabricated .git would still pass if someone made the key shell out to git rev-parse. Run hermetically, with GIT_CONFIG_GLOBAL and GIT_CONFIG_SYSTEM pointed at files that do not exist, so the machine's own git config decides nothing. Closes #739
Greptile on #754: the helper called itself hermetic while only pinning the config files. GIT_DIR alone points the whole test at another repository, and it surfaces as 'fatal: this operation must be run in a work tree' from a test that never mentions one. Reproduced with GIT_DIR set, rc=101 on 'git add'. Removing every inherited GIT_* rather than a list of the ones that bite: the list would need maintaining, and the loop is shorter than the list.
Windows treats environment names case-insensitively and git honours them that way, so a git_dir would have survived the case-sensitive prefix check and kept the hole the previous commit closed.
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 host's prompt cache is pinned to the git snapshot it started on, so a checkout or a
new commit means the next session shares no prefix and starts cold, even where the bytes
are identical. The ledger's project scope is keyed on the repository root and never reads
a ref, so it folds across both. That is the one saving in this lane the cache
structurally cannot make, and nothing asserted it:
grep -n branch src/ledger/mod.rsreturned a doc comment about something else.
The test primes a project scope from a real repository's
project_key, switches branchand lands a commit under it, then asks a new session id for the same block and requires
the fold.
Real git rather than a hand-built
.gitdirectory, because the property is that a realsnapshot change does not move the scope, and a fabricated
.gitwould still pass ifsomeone made the key shell out to
git rev-parse. It runs hermetically:GIT_CONFIG_GLOBALandGIT_CONFIG_SYSTEMpoint at files that do not exist and theidentity is set per process, so the machine's own git config decides nothing.
Verification:
make cigreen, includingsmoke_test.sh70/70. Driven red twice, onceper direction it can be wrong.
Making
project_keyread.git/HEAD, which is the refactor this exists to catch:Pointing the second session at another project scope, which proves the fold assertion
carries its own weight:
Closes #739
Greptile Summary
The PR adds a regression test proving that project-scoped ledger folding survives a real Git branch switch and subsequent commit.
Confidence Score: 5/5
The PR appears safe to merge.
No blocking failure remains.
Important Files Changed
Reviews (3): Last reviewed commit: "test(ledger): uppercase the GIT_ prefix ..." | Re-trigger Greptile