test(openapi): read the real documents from the corpus, and sweep all three vendors - #132
Merged
Conversation
… three vendors Two tests claimed to check discovery and inference against the real ThousandEyes document. Neither has ever run. Both built their path with three parent hops instead of two, which resolves above the repository, and both guarded that path with an os.Stat and a t.Skipf -- so they skipped silently, reported PASS, and have done since they were written. The guard was meant to be helpful when the snapshot was absent. What it did was hide a typo indefinitely, which is the failure mode of every skip nobody counts. Reading through the corpus removes the hand-written relative path and the reason to guard it: a document that cannot be obtained skips or fails by one policy decided in one place, and a document that is present but wrong fails everywhere. Both pass on their first real execution, against 7.0.99 rather than the 7.0.97 they named. What they assert about tag's operations holds across those versions, so nothing was papering over a real disagreement -- but that is now something this repository knows rather than something it assumed. internal/snapshot's committed-snapshot test is deleted rather than repointed. Its subject was the artefact, not the mechanism, and the artefact is leaving; the mechanism is covered hermetically by the Verify and ordering tests beside it, and the corpus applies the same two gates on every materialisation. The cross-vendor sweep widens coverage rather than preserving it. Every ingestion defect this generator has had was found by a second vendor disagreeing with the first, never by a fixture written alongside the code it exercises, and Jamf Pro alone produced six. Discovery and inference now run over all three pinned documents, asserting what must hold whatever the vendor did: determinism across repeated discovery, since Go randomises map iteration and an ordering bug is otherwise invisible until it surfaces as a blueprint that differs between two identical generations; scale matching the lock; a stated reason on every classification; and a non-empty message on every dropped field, because a note with no text is a silent drop wearing a refusal's clothes. It reports 34 resources from ThousandEyes with 86 named refusals, 59 from Jamf Pro with 9, and 40 from GitHub with 62. The identifier test pins the disagreement that cost the most to find: Jamf Pro yields both int64 and string identifiers where ThousandEyes yields only string, so a future simplification that re-hardcodes one shape fails on the other. Two corrections to what landed in #131. internal/corpus no longer imports internal/openapi. That package's tests are in-package and among the corpus's most important consumers, so the import was a cycle that would have forced them back onto the relative paths which caused all this. The parser is installed as a hook by the binary, which has no such constraint. The cache defaulted to a relative path, and that is a genuine defect rather than a preference. `go test` runs every package in its own directory, so one suite run scattered a copy of every document through the tree, in package directories no root-anchored .gitignore pattern reaches -- it put 19 MB of fetched specifications into a staged commit whose entire purpose was removing artefacts from this repository. It now defaults to the user cache directory, which is absolute and outside any checkout. A test asserts that and a .gitignore pattern backs it up, because the mistake is easy to make again and expensive to notice. 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.
PR 2 of the artefact migration. Moves the spec-dependent tests in
internal/onto the corpus, and finds that two of them have never run.Two tests that have always skipped
TestUnit_Discover_AgainstTheCommittedSpecificationandTestUnit_Infer_AgainstTheCommittedSpecificationboth did this:Three parent hops from
internal/openapi/resolves above the repository. The path has never existed, so both tests have skipped silently and reported PASS since the day they were written:The
os.Statguard was meant to be helpful when the snapshot was absent. What it did was hide a typo indefinitely — the failure mode of every skip nobody counts. Reading through the corpus removes both the hand-written path and the reason to guard it.Both pass on their first real execution, against 7.0.99 rather than the 7.0.97 they named. What they assert about
tag's operations holds across those versions, so nothing was papering over a real disagreement — but that is now something the repo knows rather than assumes.The cross-vendor sweep
The part that widens coverage rather than preserving it. Every ingestion defect this generator has had was found by a second vendor's document disagreeing with the first, never by a fixture written alongside the code it exercises — Jamf Pro alone produced six.
Discovery and inference now run over all three pinned documents, asserting what must hold whatever the vendor did:
Determinism is the load-bearing one: discovery walks maps, Go randomises map iteration, and an ordering bug is invisible in a single run — it surfaces later as a blueprint that differs between two identical generations. Also asserted: scale matching the lock, a stated reason on every classification, and a non-empty message on every dropped field, because a note with no text is a silent drop wearing a refusal's clothes.
The identifier test pins the disagreement that cost the most to find:
so a future simplification that re-hardcodes one shape fails on the other.
Two corrections to what landed in #131
internal/corpusno longer importsinternal/openapi. That package's tests are in-package and among the corpus's most important consumers, so the import was a cycle — and would have forced them back onto the relative paths that caused this whole problem. The parser is now installed as a hook by the binary, which has no such constraint.The cache default was a real defect, not a preference. It was
.tfpfgen/cache/corpus, relative.go testruns every package in its own directory, so one suite run scattered a copy of every document through the tree, into package directories that the root-anchored.gitignorepattern never matches. I caught it becausegit add -Astaged 451,614 insertions — 19 MB of specifications, into the commit whose entire purpose is removing artefacts from this repository.It now defaults to the user cache directory (
~/Library/Caches/tfpfgen/corpus), which is absolute and outside any checkout. A test asserts it is not relative and not beneath the working directory, and a**/.tfpfgen/cache/pattern backs that up — the mistake is easy to make again and expensive to notice.Deletion
internal/snapshot's committed-snapshot test is deleted rather than repointed. Its subject was the artefact, not the mechanism, and the artefact is leaving. The mechanism stays covered hermetically byVerifyCatchesAnEditedSnapshot,VerifyToleratesMissingChecksumand the ordering tests beside it — and the corpus applies the same two gates (checksum against metadata, digest against the lock) on every materialisation.Verification
go build,go vet,go test ./..., gofumpt all clean.find . -name .tfpfgenoutsidepilot/returns nothing.🤖 Generated with Claude Code