chore: pin the corpus to a revision, and make a pin record its measurement - #95
Merged
Merged
Conversation
…ement The github pin's URL named a branch tip, so it re-pinned itself every time the vendor published: the hash stopped matching, every test reading the document failed, and the only remedy was to restate the pin — which is the review the lock exists to force. It now names the commit serving what it pinned, at the same 808 paths and 1220 operations. The tags that repository publishes are not maintained; the newest dates from 2022 and carries 30% less surface than the branch does. A Describer is now an argument rather than a package variable nothing installed. RewriteLock silently wrote "unparsed" and zero counts for every pin it restated, so a re-pin recorded that nothing had measured the document. specmodel.Describe is the implementation to pass. The lock's own test refuses a moving ref and a version no describer produced, so neither can return. Co-Authored-By: Claude Opus 5 (1M context) <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.
Two defects behind #92, both of which would have caused it again.
1. The github pin followed a branch
Its
upstreamUrlnamedgithub/rest-api-description/main/— a branchtip, not a revision. So it re-pinned itself every time the vendor published: the
hash stopped matching, every test reading the document failed, and the only
remedy was to restate the pin. It was already broken when I found it:
CI was green only because no test reads that document —
specmodelandintermediate_representationboth fetchthousandeyesalone. It was a traprather than a break.
It now names commit
67c14c7e, at the same 808 paths and 1220 operations theold pin recorded, so the corpus surface is unchanged.
Why not a tag
I proposed one and was wrong; the measurement corrected it. That repository's
tags are not maintained —
v2.0.0dates from 2022:main, 7 Aug)80850db267c14c7e81c0ff2bv2.1.0b138e9cdv1.1.4369b85bcPinning a tag would have quietly shrunk the corpus by a third.
2. A pin recorded that nothing had measured the document
corpus.Describerwas a package variable whose doc said "the CLI installs thereal parser". Nothing installed it, in
internal/orcmd/. SoRewriteLockwrote this for every pin it restated:
which is what my first attempt at #92 produced. Those counts exist to catch a
truncated download that happens to parse, so zeroing them disables the check
that the lock is for.
It is now an argument —
RewriteLock(ids, describe),CheckUpstream(id, describe)— so a caller cannot forget it and there is no default to be wrong. The
degraded describer survives as unexported
unparsed, used only byverifyAgainstPin, where the failure is already named by digest and the callergenuinely has no parser. It is never written to the lock.
specmodel.Describeis the implementation to pass. It lives on the specmodelside because the cycle the original comment describes is real: specmodel's
in-package tests import corpus.
Guards so neither can return
TestUnit_Corpus_LockPinsTheDocumentsTheTestsReadnow also refuses a pin whoseURL names a moving ref, and one whose version is empty or
unparsed.TestUnit_Corpus_AMovingRefIsRejectedproves that guard catchesmain/master/latestand passes a commit SHA, a tag, and the ThousandEyesURL — so it cannot pass by accident on a lock that happens to hold no branch URL.
TestUnit_Refresh_RewriteLockRestatesOnlyThePinsThatMovednow asserts the pincarries the describer's own measurements rather than
unparsed.Measured effect
No generated output changes; this is test infrastructure.
go test ./...isgreen, including both
TestIntegration_*_APinnedVendorDocument.Still not fixed
RewriteLockhas no caller — re-pinning needs a throwaway harness. Adding averb to drive it needs an owner-approved name, so it is not in this PR.
ThousandEyes serves from a URL with no ref at all and will drift again; the
mirrorUrlfield is the designed mitigation and is empty.Gates
gofmt -l internal cmd— emptyscripts/repo_hygiene_gate.sh— passgolangci-lint run— 0 issuesgo build ./... && go vet ./...— passgo test ./...— pass, coverage 91.4% total🤖 Generated with Claude Code