refactor: commit the vendor OpenAPI specs instead of fetching them - #114
Merged
Conversation
The documents are test input. Fetching them at test time bought nothing and cost the build: the ThousandEyes URL serves whatever is current, so the pin went stale whenever Cisco published, and main went red with no push behind it — twice before this, and once more this week. The document is now committed and embedded. Tests read the same bytes on every machine, offline, and a vendor's release schedule cannot reach them. Deletes the machinery that existed only to make fetching safe: the lock, the SHA-256 verification, the cache with its atomic publication and staleness gates, the mirror fallback, the offline-versus-required skip split, and the pin-rewriting. Roughly 2,400 lines, tests included. The version and path count move into the consumer that asserts them, so replacing the document fails a test rather than passing quietly against whatever the new one contains. GitHub's document is dropped rather than committed: no test ever parsed it, so committing 12.9 MB would have bought nothing either. The size rule exempts testdata/, as the file-length and vendor-name rules already do — a committed vendor document is test input, not a binary. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…ments internal/vendor_openapi_specs names ThousandEyes in non-test source, because that is what the accessor returns. The rule exists so a general toolkit does not ship one vendor's constants as defaults, and a test document is not a default — the same reason testdata/ was already exempt. The exemption is one directory: a vendor name anywhere else still fails. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ShocOne
changed the base branch from
refactor/name-the-vendor-openapi-specs
to
main
August 25, 2026 10:44
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 documents are test input. Fetching them at test time bought nothing and cost the build.
thousandeyes.upstreamUrlserves whatever is current, so the pin went stale every time Cisco published — and it went stale with no push behind it, which is why Actions showedmaingreen while a fresh checkout was red. That has now happened three times: 7.0.99 → 7.0.100 (#92), → 7.0.102 (#112), and the 7.0.99 pin before it.What replaces it
The document is committed at
internal/vendor_openapi_specs/testdata/thousandeyes.yamland embedded:Every machine reads the same bytes, offline, and a vendor's release schedule cannot reach the build.
Nothing outside tests imports this package, so the embed never enters the shipped
tfpfgenbinary.What that deletes
All of it existed only to make fetching safe:
vendor_openapi_specs.lock.jsoncache.go— atomic publication, staleness gates, race handlingfetch.go— mirror-then-upstream fallbackREQUIREDskip splitrefresh.go—CheckUpstream,RewriteLock~2,400 lines including tests. The package is now 21 lines and one test.
This also removes the trap I flagged earlier:
fetch()returns the first source that answers 200 andverifyAgainstPin()checks the hash afterwards, with no fallback — so populatingmirrorUrlwithout rewriting it in lockstep withsha256would have made a pin permanently unfetchable and blamed our own mirror. That whole class is gone rather than defended against.Keeping the one property worth keeping
The pin's real value was noticing when the document changed. That moves to the consumer:
Replace the document and this fails, deliberately, instead of passing quietly against whatever the new one contains.
Two judgement calls
testdata/, as the 800-line and vendor-name rules already do. A committed vendor document is test input, not a binary; the rule still catches a build artefact at the repo root, which is what it was for.Verification
No network, so nothing here depends on Cisco being up:
🤖 Generated with Claude Code