Repository navigation
conformance: cmd/specpin — the ruby/spec corpus pinned durably, its commit read back, nothing deleted (#857) - #963
Merged
Merged
Conversation
…its commit back (#857) run.sh's corpus block had three defects: 1. CACHE defaulted to /tmp/rubyspec-corpus, which macOS purges and most Linux distributions empty at boot. 2. An existing cache was reused WITHOUT checking its commit, and the log printed `corpus: $SPECDIR @ $SPEC_SHA` -- the constant. A cache from another SPEC_SHA reads as a sweep with files added or missing, which is what cmd/ratchet calls a regression. 3. `rm -rf "$CACHE"` ran whenever "$CACHE/language" was absent -- true of almost every directory. CACHE=$HOME met it. cmd/specpin replaces the block. The default directory is os.UserCacheDir()/rbgo/rubyspec-corpus; the commit is read back from git after every path that can move it; a directory is never deleted -- one that is neither empty nor a checkout of its own is refused. AND A FOURTH, found by the first end-to-end run of the new wiring: SPECDIR pointed at a scratch directory that happened to be a git repository of its own, and specpin went straight to `fetch`. It failed only because that repository had no origin. "A checkout of its own" is not "a clone of ruby/spec": with a remote that served the commit, the fetch and `checkout --force` would both have succeeded and discarded its uncommitted work. A checkout is now MOVED only when remote.origin.url is -url (read raw from the config, not through `remote get-url`, which applies insteadOf rewrites). A tree already at the commit and shaped like ruby/spec is still used as is, offline: the commit is the content. The test for that guard first PASSED with the guard deleted: its fork was a path with nothing at it, so the fetch failed on its own and quoted the path the assertion looked for. The fork is now a bare clone that holds the commit; with the guard neutralised the test is red ("pin moved a checkout whose origin is not -url"), restored it is green. mutsweep over the package: 11 refusals, 3 caught, 0 survived, 8 it cannot mutate (deleting the `if` leaves a variable unused). It does not see the origin guard at all (an `if x, _ := ...; cond` form), hence the hand mutation above. Measured: specpin against the real ruby/spec at the pinned SHA cloned into ~/Library/Caches/rbgo/rubyspec-corpus and printed `corpus: ... @ 87b1631992bd00cf0c4934474766d54dad088191`. README and the conformance README name the new default, say that a SPECDIR clone is checked out with --force, and no longer cite /tmp/rubyspec-corpus. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 corpus is pinned in a durable place, its commit is read back, and nothing is ever deleted
run.sh's corpus block had three defects (#857):/tmp/rubyspec-corpus— purged by macOS, emptied at boot by most Linuxos.UserCacheDir()/rbgo/rubyspec-corpus@ $SPEC_SHA, the constantrm -rf "$CACHE"whenever$CACHE/languagewas absent —CACHE=$HOMEmet thatcmd/specpinreplaces the block;run.shcalls it and uses the directory it prints.⛔ A fourth defect, found by the first end-to-end run
SPECDIRpointed at a scratch directory that happened to be a git repository of its own, and specpin went straight tofetch. It failed only because that repository had noorigin. A checkout of its own is not a clone of ruby/spec: with a remote that served the commit,fetchandcheckout --forcewould both have succeeded and discarded the repository's uncommitted work.A checkout is now moved only when
remote.origin.urlis-url. It is read raw from the config, not throughremote get-url, becauseget-urlapplies the host'sinsteadOfrewrites and would refuse a clone specpin made itself. A tree that is already at the commit and has ruby/spec's layout is still used as is, offline: the commit identifies the content.The test for that guard first passed with the guard deleted
Its fork was a path with nothing at it. The fetch therefore failed on its own, and the fetch's message contained the very path the assertion was looking for. The fork is now a bare clone that holds the commit:
TestACheckoutOfAnotherRemoteIsNeitherFetchedIntoNorMovedfalse && …)Measured
mutsweepover the package: 11 refusals, 3 caught, 0 survived. It could not mutate 8 of them, because deleting theifleaves a variable unused. It does not see the origin guard at all (anif x, _ := …; condform), which is why that guard was mutated by hand above.~/Library/Caches/rbgo/rubyspec-corpus, printingcorpus: … @ 87b1631992bd00cf0c4934474766d54dad088191.go test ./scripts/conformance/rubyspec/...green; the root tests that readrun.shand the README (TestASpecCannotDictateItsOwnRecordedPassCount,TestShellCodeHasSeesCodeAndNotComments,TestReadmeConformance*) green.Not in this PR
run.shstill defaultsRBGOto/tmp/rbgo-rubyspecand builds onlyif [ ! -x "$RBGO" ]. A binary left there by an older checkout is therefore reused, so the sweep measures that older interpreter. That is a separate defect, filed separately.Closes #857
🤖 Generated with Claude Code