From 1c769afa8f1668bfe02b02990b421d556c434dd1 Mon Sep 17 00:00:00 2001 From: ShocOne <62835948+ShocOne@users.noreply.github.com> Date: Tue, 25 Aug 2026 10:47:28 +0100 Subject: [PATCH] refactor: name the vendor OpenAPI specs for what they are "Corpus" named a collection without saying whose documents it held or what they were for, and it sat one letter of context away from "spec", which in this repo means the single document a provider is generated from. These are the opposite: third-party documents this toolkit's own tests parse and derive, read and never written, imported into nothing. internal/corpus becomes internal/vendor_openapi_specs, corpus.lock.json becomes vendor_openapi_specs.lock.json, and TFPFGEN_CORPUS_* becomes TFPFGEN_VENDOR_OPENAPI_SPECS_*. The package spells the acronym OpenAPI in Go identifiers, as the other seventy-four occurrences in the tree do. Mechanical throughout: no behaviour changes, and the pins are untouched. Co-Authored-By: Claude Opus 5 (1M context) --- CLAUDE.md | 4 +- docs/comment-style.md | 2 +- docs/glossary.md | 2 +- ...s_test.go => vendor_openapi_specs_test.go} | 8 +-- internal/specmodel/describe.go | 2 +- internal/specmodel/describe_test.go | 2 +- ...s_test.go => vendor_openapi_specs_test.go} | 10 +-- .../{corpus => vendor_openapi_specs}/cache.go | 2 +- .../cache_test.go | 2 +- .../{corpus => vendor_openapi_specs}/fetch.go | 2 +- .../fetch_test.go | 2 +- .../refresh.go | 8 +-- .../refresh_test.go | 4 +- .../testdata/vendor_openapi_specs.lock.json} | 0 .../testing.go | 4 +- .../testing_test.go | 2 +- .../vendor_openapi_specs.go} | 32 ++++----- .../vendor_openapi_specs_test.go} | 68 +++++++++---------- 18 files changed, 79 insertions(+), 77 deletions(-) rename internal/intermediate_representation/{corpus_test.go => vendor_openapi_specs_test.go} (93%) rename internal/specmodel/{corpus_test.go => vendor_openapi_specs_test.go} (82%) rename internal/{corpus => vendor_openapi_specs}/cache.go (99%) rename internal/{corpus => vendor_openapi_specs}/cache_test.go (99%) rename internal/{corpus => vendor_openapi_specs}/fetch.go (98%) rename internal/{corpus => vendor_openapi_specs}/fetch_test.go (99%) rename internal/{corpus => vendor_openapi_specs}/refresh.go (95%) rename internal/{corpus => vendor_openapi_specs}/refresh_test.go (98%) rename internal/{corpus/testdata/corpus.lock.json => vendor_openapi_specs/testdata/vendor_openapi_specs.lock.json} (100%) rename internal/{corpus => vendor_openapi_specs}/testing.go (95%) rename internal/{corpus => vendor_openapi_specs}/testing_test.go (99%) rename internal/{corpus/corpus.go => vendor_openapi_specs/vendor_openapi_specs.go} (91%) rename internal/{corpus/corpus_test.go => vendor_openapi_specs/vendor_openapi_specs_test.go} (83%) diff --git a/CLAUDE.md b/CLAUDE.md index 7360f5d..0fbad63 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -50,7 +50,9 @@ Set by the repository owner; not open to per-PR relitigating: - **Never commit generated pilot output or binaries.** Generated provider trees live in provider repos; this repo holds only the machinery and its fixtures. - **Every verb keeps its exit-code contract** documented in `docs/contract.md`. -- **Corpus documents are pinned by hash and fetched, not vendored.** +- **Vendor OpenAPI specs are pinned by hash and fetched, not committed.** + A pin names bytes, so a document that moves under it fails loudly rather than + quietly changing what a test means. - **No hand-written file over 800 lines.** Decompose by protocol instead. Generated and fixture code under `testdata/` is exempt — it is produced, not maintained, and reproducing it is cheap. diff --git a/docs/comment-style.md b/docs/comment-style.md index 83a4565..65a3bfa 100644 --- a/docs/comment-style.md +++ b/docs/comment-style.md @@ -47,7 +47,7 @@ These are facts, and they are the point of the comment. status, a framework type name. They are what makes the surrounding claim checkable. - **Indented tabular blocks.** They render as godoc code blocks and usually carry - more than the prose around them. See `internal/corpus/cache.go` (the cache + more than the prose around them. See `internal/vendor_openapi_specs/cache.go` (the cache layout) and `internal/sdkbind/binder_kiota.go` (document shape → builder chain). Keep the table, rewrite the prose framing it. - **Cross-references.** Prefer paths and symbols over URLs: `docs/contract.md`, diff --git a/docs/glossary.md b/docs/glossary.md index b392ed9..e271518 100644 --- a/docs/glossary.md +++ b/docs/glossary.md @@ -22,7 +22,7 @@ sweep, doctor, facts, rehearsal, curate) is retired and may not reappear. | **authored** | A committed data path generation may never write: tfpfgen.yaml, corrections, inputs. Enforced by the manifest, not by convention. There are no authored *code* files — provider repos are 100% generated code. | | **manifest** | The ledger of every derived file (path, digest, source, origin) and every authored path. `manifest.json` at the provider-repo root. | | **quirkserver** | The deliberately-misbehaving stub API that serves as offline ground truth for audit logic and as the fake live API in pipeline rehearsals. | -| **corpus** | Third-party OpenAPI documents pinned by SHA-256 and fetched at test time, never vendored. | +| **vendor OpenAPI specs** | The third-party OpenAPI documents this toolkit's own tests parse and derive — a vendor's document exactly as published, pinned by SHA-256 and fetched at test time, never committed. Distinct from **spec**, which is the one document a provider is generated from: these are only ever read, never imported, corrected or revised. `internal/vendor_openapi_specs`, pinned in `vendor_openapi_specs.lock.json`, cached under `TFPFGEN_VENDOR_OPENAPI_SPECS_DIR`. The earlier name *corpus* is retired: it named a collection without saying whose documents or what they are for. | | **backend** | An SDK generator behind the common interface: `kiota` or `openapi-generator`. Exactly one per provider repo. | | **intermediate representation** | The ephemeral, never-committed derivation (`internal/intermediate_representation`) recomputed from the revised spec and config on every generation run; its model vocabulary (Model, Resource, Datasource, ListResource, Action, AttributeTree, ComputedOptionalRequired, Operation, Names) is approved. Every identifier in the package is fully worded — no abbreviated type, field, function, parameter or local. `Operation`/`Operations` replace the earlier `Op`/`Ops`, `AttributeType` replaces `TypeKind`, `Parameter`/`PathParameters` replace `Param`/`PathParams`, and `APIVersionDirectory` replaces `APIVersionDir`. `OneOf` is the one deliberate exception: it is named for the `stringvalidator.OneOf` it generates, and generated things are spelt the way HashiCorp spells them. `Datasource` likewise stays one word here, per the fixed spelling below. | | **ComputedOptionalRequired** | How an attribute participates in a plan, and the four values it takes: `required`, `optional`, `computed`, `computed_optional`. The name and the values are [terraform-plugin-codegen-spec](https://github.com/hashicorp/terraform-plugin-codegen-spec)'s (`schema.ComputedOptionalRequired`), adopted so the toolkit and the specification that could describe its output call the same fact by the same name. It replaces the earlier `Presence` / `PresenceRequired` / `PresenceOptional` / `PresenceComputed` / `PresenceOptionalComputed`, and the value `optional-computed`; those spellings are retired. | diff --git a/internal/intermediate_representation/corpus_test.go b/internal/intermediate_representation/vendor_openapi_specs_test.go similarity index 93% rename from internal/intermediate_representation/corpus_test.go rename to internal/intermediate_representation/vendor_openapi_specs_test.go index a44ddfe..d4bdce9 100644 --- a/internal/intermediate_representation/corpus_test.go +++ b/internal/intermediate_representation/vendor_openapi_specs_test.go @@ -8,17 +8,17 @@ import ( "strings" "testing" - "github.com/deploymenttheory/terraform-plugin-framework-codegen/internal/corpus" "github.com/deploymenttheory/terraform-plugin-framework-codegen/internal/specmodel" + "github.com/deploymenttheory/terraform-plugin-framework-codegen/internal/vendor_openapi_specs" ) // The inline fixtures prove each rule in isolation; this proves derivation // against a real vendor document, where the shapes were not chosen to pass. // Skips when the pinned document is not cached and cannot be fetched, -// unless TFPFGEN_CORPUS_REQUIRED says the machine must be honest — the -// same split every corpus-backed test in this repo follows. +// unless TFPFGEN_VENDOR_OPENAPI_SPECS_REQUIRED says the machine must be honest — the +// same split every pinned-document test in this repo follows. func TestIntegration_IntermediateRepresentation_DerivesAPinnedVendorDocument(t *testing.T) { - path := corpus.SpecPath(t, "thousandeyes") + path := vendor_openapi_specs.SpecPath(t, "thousandeyes") data, err := os.ReadFile(path) if err != nil { t.Fatalf("reading %s: %v", path, err) diff --git a/internal/specmodel/describe.go b/internal/specmodel/describe.go index d08db1f..ffe6d56 100644 --- a/internal/specmodel/describe.go +++ b/internal/specmodel/describe.go @@ -3,7 +3,7 @@ package specmodel // Describe reports what a document says about itself: the version its info // object declares, and how much surface it carries. // -// It satisfies corpus.Describer, which is where a pin's recorded counts come +// It satisfies vendor_openapi_specs.Describer, which is where a pin's recorded counts come // from. Those counts are what catch a truncated download that happens to // parse, so a document this cannot read reports zero rather than a guess. func Describe(doc []byte) (version string, paths, operations int) { diff --git a/internal/specmodel/describe_test.go b/internal/specmodel/describe_test.go index 51aa3b6..a1ce6ea 100644 --- a/internal/specmodel/describe_test.go +++ b/internal/specmodel/describe_test.go @@ -3,7 +3,7 @@ package specmodel import "testing" // TestUnit_Specmodel_DescribeMeasuresWhatAPinRecords proves Describe reports -// the three values a corpus pin is written from, and reports nothing rather +// the three values a pin is written from, and reports nothing rather // than a guess for bytes it cannot read — a truncated download must not pass // as a document with a plausible shape. func TestUnit_Specmodel_DescribeMeasuresWhatAPinRecords(t *testing.T) { diff --git a/internal/specmodel/corpus_test.go b/internal/specmodel/vendor_openapi_specs_test.go similarity index 82% rename from internal/specmodel/corpus_test.go rename to internal/specmodel/vendor_openapi_specs_test.go index c7069d1..6980e74 100644 --- a/internal/specmodel/corpus_test.go +++ b/internal/specmodel/vendor_openapi_specs_test.go @@ -4,16 +4,16 @@ import ( "os" "testing" - "github.com/deploymenttheory/terraform-plugin-framework-codegen/internal/corpus" + "github.com/deploymenttheory/terraform-plugin-framework-codegen/internal/vendor_openapi_specs" ) // The inline fixtures above prove each rule in isolation; this proves the // loader against a real vendor document, where the shapes were not chosen // to pass. Skips when the pinned document is not cached and cannot be -// fetched, unless TFPFGEN_CORPUS_REQUIRED says the machine must be honest — -// the same split every corpus-backed test in this repo follows. +// fetched, unless TFPFGEN_VENDOR_OPENAPI_SPECS_REQUIRED says the machine must be honest — +// the same split every pinned-document test in this repo follows. func TestIntegration_Specmodel_LoadsAPinnedVendorDocument(t *testing.T) { - path := corpus.SpecPath(t, "thousandeyes") + path := vendor_openapi_specs.SpecPath(t, "thousandeyes") data, err := os.ReadFile(path) if err != nil { t.Fatalf("reading %s: %v", path, err) @@ -24,7 +24,7 @@ func TestIntegration_Specmodel_LoadsAPinnedVendorDocument(t *testing.T) { t.Fatalf("Load: %v", err) } - pin := corpus.MustPin(t, "thousandeyes") + pin := vendor_openapi_specs.MustPin(t, "thousandeyes") if doc.Info.Version != pin.Version { t.Errorf("info.version = %q, want the pinned %q", doc.Info.Version, pin.Version) } diff --git a/internal/corpus/cache.go b/internal/vendor_openapi_specs/cache.go similarity index 99% rename from internal/corpus/cache.go rename to internal/vendor_openapi_specs/cache.go index 27a4f9b..d058395 100644 --- a/internal/corpus/cache.go +++ b/internal/vendor_openapi_specs/cache.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs // The cache layout, one directory per pinned document: // diff --git a/internal/corpus/cache_test.go b/internal/vendor_openapi_specs/cache_test.go similarity index 99% rename from internal/corpus/cache_test.go rename to internal/vendor_openapi_specs/cache_test.go index ea68904..4e37636 100644 --- a/internal/corpus/cache_test.go +++ b/internal/vendor_openapi_specs/cache_test.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "errors" diff --git a/internal/corpus/fetch.go b/internal/vendor_openapi_specs/fetch.go similarity index 98% rename from internal/corpus/fetch.go rename to internal/vendor_openapi_specs/fetch.go index 7b2f54d..71d6761 100644 --- a/internal/corpus/fetch.go +++ b/internal/vendor_openapi_specs/fetch.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "context" diff --git a/internal/corpus/fetch_test.go b/internal/vendor_openapi_specs/fetch_test.go similarity index 99% rename from internal/corpus/fetch_test.go rename to internal/vendor_openapi_specs/fetch_test.go index dee44ff..d9b30f9 100644 --- a/internal/corpus/fetch_test.go +++ b/internal/vendor_openapi_specs/fetch_test.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "net/http" diff --git a/internal/corpus/refresh.go b/internal/vendor_openapi_specs/refresh.go similarity index 95% rename from internal/corpus/refresh.go rename to internal/vendor_openapi_specs/refresh.go index 74e1f3f..b9e3e29 100644 --- a/internal/corpus/refresh.go +++ b/internal/vendor_openapi_specs/refresh.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "crypto/sha256" @@ -11,11 +11,11 @@ import ( ) // LockFile is the pin set's name. -const LockFile = "corpus.lock.json" +const LockFile = "vendor_openapi_specs.lock.json" // EnvLockPath relocates the lock for a pin update invoked from outside the // repository root. -const EnvLockPath = "TFPFGEN_CORPUS_LOCK" +const EnvLockPath = "TFPFGEN_VENDOR_OPENAPI_SPECS_LOCK" // LockPath is where RewriteLock writes. // @@ -26,7 +26,7 @@ func LockPath() string { if p := os.Getenv(EnvLockPath); p != "" { return p } - return filepath.Join("internal", "corpus", "testdata", LockFile) + return filepath.Join("internal", "vendor_openapi_specs", "testdata", LockFile) } // Upstream is what a source is serving now, measured against a pin. diff --git a/internal/corpus/refresh_test.go b/internal/vendor_openapi_specs/refresh_test.go similarity index 98% rename from internal/corpus/refresh_test.go rename to internal/vendor_openapi_specs/refresh_test.go index 397b2a8..94bf259 100644 --- a/internal/corpus/refresh_test.go +++ b/internal/vendor_openapi_specs/refresh_test.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "encoding/json" @@ -19,7 +19,7 @@ func TestUnit_Refresh_LockPathHonoursTheEnvironment(t *testing.T) { } t.Setenv(EnvLockPath, "") - if got, want := LockPath(), filepath.Join("internal", "corpus", "testdata", LockFile); got != want { + if got, want := LockPath(), filepath.Join("internal", "vendor_openapi_specs", "testdata", LockFile); got != want { t.Errorf("LockPath() = %q, want %q", got, want) } } diff --git a/internal/corpus/testdata/corpus.lock.json b/internal/vendor_openapi_specs/testdata/vendor_openapi_specs.lock.json similarity index 100% rename from internal/corpus/testdata/corpus.lock.json rename to internal/vendor_openapi_specs/testdata/vendor_openapi_specs.lock.json diff --git a/internal/corpus/testing.go b/internal/vendor_openapi_specs/testing.go similarity index 95% rename from internal/corpus/testing.go rename to internal/vendor_openapi_specs/testing.go index 5166555..7b85603 100644 --- a/internal/corpus/testing.go +++ b/internal/vendor_openapi_specs/testing.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "errors" @@ -17,7 +17,7 @@ type TB interface { // Document returns the pinned document, or ends the test. // -// Skipping when offline and failing when TFPFGEN_CORPUS_REQUIRED is set is a +// Skipping when offline and failing when TFPFGEN_VENDOR_OPENAPI_SPECS_REQUIRED is set is a // deliberate split rather than a hedge. Failing always would turn a // developer's flaky connection into a red suite, which teaches people to // ignore red. Skipping always would let CI skip its way to green, which is a diff --git a/internal/corpus/testing_test.go b/internal/vendor_openapi_specs/testing_test.go similarity index 99% rename from internal/corpus/testing_test.go rename to internal/vendor_openapi_specs/testing_test.go index f81dcf3..f0322b9 100644 --- a/internal/corpus/testing_test.go +++ b/internal/vendor_openapi_specs/testing_test.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "fmt" diff --git a/internal/corpus/corpus.go b/internal/vendor_openapi_specs/vendor_openapi_specs.go similarity index 91% rename from internal/corpus/corpus.go rename to internal/vendor_openapi_specs/vendor_openapi_specs.go index 0aee0c0..bfe88fc 100644 --- a/internal/corpus/corpus.go +++ b/internal/vendor_openapi_specs/vendor_openapi_specs.go @@ -1,4 +1,4 @@ -// Package corpus acquires the real third-party API documents the tests run +// Package vendor_openapi_specs acquires the real third-party API documents the tests run // against, without committing any of them to this repository. // // This repository turns OpenAPI documents into providers; it is not the home @@ -7,7 +7,7 @@ // other, not by synthetic ones that agree with the code -- so the documents // are fetched at test time and pinned here rather than vendored. // -// Pinned means pinned. testdata/corpus.lock.json pins a version, a SHA-256 and +// Pinned means pinned. testdata/vendor_openapi_specs.lock.json pins a version, a SHA-256 and // the path and operation counts for every document, and a fetch that does not // match all of them fails loudly. That matters more than it looks: several // tests assert properties of these documents -- enum members, field shapes, @@ -18,7 +18,7 @@ // The cache holds one verified copy of each pinned document, in a directory // named deterministically from the pin so a pinned document is findable again // rather than merely present. See cache.go for the layout. -package corpus +package vendor_openapi_specs import ( "crypto/sha256" @@ -38,18 +38,18 @@ import ( // resolves it identically. It is the reviewable file of this whole scheme: // every change to what the tests read against shows up as a diff here. // -//go:embed testdata/corpus.lock.json +//go:embed testdata/vendor_openapi_specs.lock.json var lockBytes []byte // EnvCacheDir relocates the cache. CI sets it so the cache lands somewhere // actions/cache can restore. -const EnvCacheDir = "TFPFGEN_CORPUS_DIR" +const EnvCacheDir = "TFPFGEN_VENDOR_OPENAPI_SPECS_DIR" // EnvRequired makes a missing document a failure rather than a skip. Set in // CI, unset on a developer's machine: see the Document test helper. -const EnvRequired = "TFPFGEN_CORPUS_REQUIRED" +const EnvRequired = "TFPFGEN_VENDOR_OPENAPI_SPECS_REQUIRED" -// cacheSubdir is the corpus's place within the user cache directory. +// cacheSubdir is these documents' place within the user cache directory. // // Deliberately outside the repository, and this is not a preference. A // relative default is resolved against the working directory, and `go test` @@ -59,15 +59,15 @@ const EnvRequired = "TFPFGEN_CORPUS_REQUIRED" // each. // // A cache belongs where the operating system puts caches. CI overrides it with -// TFPFGEN_CORPUS_DIR to somewhere its cache action can restore. -var cacheSubdir = filepath.Join("tfpfgen", "corpus") +// TFPFGEN_VENDOR_OPENAPI_SPECS_DIR to somewhere its cache action can restore. +var cacheSubdir = filepath.Join("tfpfgen", "vendor_openapi_specs") // ErrOffline reports that a document is not cached and could not be fetched. // Callers decide whether that is fatal; the Document test helper applies the // policy. var ErrOffline = errors.New("the document is not cached and could not be fetched") -// Lock is corpus.lock.json. +// Lock is vendor_openapi_specs.lock.json. type Lock struct { FormatVersion string `json:"formatVersion"` OpenAPI map[string]Pin `json:"openapi"` @@ -116,11 +116,11 @@ var ( func LoadLock() (Lock, error) { lockOnce.Do(func() { if err := json.Unmarshal(lockBytes, &lock); err != nil { - lockErr = fmt.Errorf("parsing corpus.lock.json: %w", err) + lockErr = fmt.Errorf("parsing vendor_openapi_specs.lock.json: %w", err) return } if len(lock.OpenAPI) == 0 { - lockErr = errors.New("corpus.lock.json pins no documents") + lockErr = errors.New("vendor_openapi_specs.lock.json pins no documents") } }) return lock, lockErr @@ -138,7 +138,7 @@ func PinFor(id string) (Pin, error) { for k := range l.OpenAPI { known = append(known, k) } - return Pin{}, fmt.Errorf("corpus.lock.json pins no document %q (it pins %v)", id, known) + return Pin{}, fmt.Errorf("vendor_openapi_specs.lock.json pins no document %q (it pins %v)", id, known) } return p, nil } @@ -156,7 +156,7 @@ func IDs() ([]string, error) { return out, nil } -// CacheDir is the corpus cache root. +// CacheDir is the cache root these documents are materialised under. func CacheDir() string { if d := os.Getenv(EnvCacheDir); d != "" { return d @@ -281,7 +281,7 @@ func publish(root, name string, doc []byte, pin Pin, source string) (CachedDocum return CachedDocument{}, fmt.Errorf("creating %s: %w", filepath.Dir(root), err) } - staging, err := os.MkdirTemp(filepath.Dir(root), ".corpus-staging-*") + staging, err := os.MkdirTemp(filepath.Dir(root), ".vendor-openapi-specs-staging-*") if err != nil { return CachedDocument{}, fmt.Errorf("creating a staging directory: %w", err) } @@ -342,7 +342,7 @@ func verifyAgainstPin(id string, doc []byte, pin Pin, source string) error { Tests assert properties of the pinned document -- enum members, field shapes, operation counts -- so this changes what they mean rather than merely failing a transport check. Review the change deliberately and update the %s pin in -internal/corpus/testdata/corpus.lock.json`, +internal/vendor_openapi_specs/testdata/vendor_openapi_specs.lock.json`, id, source, shortSHA(pin.SHA256), pin.Version, pin.PathCount, pin.OperationCount, shortSHA(digest), version, paths, operations, diff --git a/internal/corpus/corpus_test.go b/internal/vendor_openapi_specs/vendor_openapi_specs_test.go similarity index 83% rename from internal/corpus/corpus_test.go rename to internal/vendor_openapi_specs/vendor_openapi_specs_test.go index 0064694..1d9fade 100644 --- a/internal/corpus/corpus_test.go +++ b/internal/vendor_openapi_specs/vendor_openapi_specs_test.go @@ -1,4 +1,4 @@ -package corpus +package vendor_openapi_specs import ( "crypto/sha256" @@ -64,11 +64,11 @@ func pinFor(t *testing.T, url, body string) Pin { } } -// TestUnit_Corpus_LockPinsTheDocumentsTheTestsRead guards the lock itself. It +// TestUnit_VendorOpenAPISpecs_LockPinsTheDocumentsTheTestsRead guards the lock itself. It // is the file every other test's meaning rests on, so a malformed or truncated // one should fail here rather than as a confusing failure somewhere // downstream. -func TestUnit_Corpus_LockPinsTheDocumentsTheTestsRead(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_LockPinsTheDocumentsTheTestsRead(t *testing.T) { t.Parallel() l, err := LoadLock() @@ -144,10 +144,10 @@ func slicesEqual(a, b []string) bool { return true } -// TestUnit_Corpus_ColdCacheFetchesAndWarmCacheDoesNot is the property the +// TestUnit_VendorOpenAPISpecs_ColdCacheFetchesAndWarmCacheDoesNot is the property the // whole scheme is for: the network is touched once, and never again until the // pin changes. -func TestUnit_Corpus_ColdCacheFetchesAndWarmCacheDoesNot(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_ColdCacheFetchesAndWarmCacheDoesNot(t *testing.T) { t.Parallel() url, hits := serve(t, aDocument) @@ -178,11 +178,11 @@ func TestUnit_Corpus_ColdCacheFetchesAndWarmCacheDoesNot(t *testing.T) { } } -// TestUnit_Corpus_ADocumentThatIsNotThePinnedOneFailsLoudly is the failure +// TestUnit_VendorOpenAPISpecs_ADocumentThatIsNotThePinnedOneFailsLoudly is the failure // that must never be a skip: the tests assert properties of the pinned // document, so different bytes mean something different, not merely a // transport problem. -func TestUnit_Corpus_ADocumentThatIsNotThePinnedOneFailsLoudly(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_ADocumentThatIsNotThePinnedOneFailsLoudly(t *testing.T) { t.Parallel() url, _ := serve(t, aDocument) @@ -202,7 +202,7 @@ func TestUnit_Corpus_ADocumentThatIsNotThePinnedOneFailsLoudly(t *testing.T) { shortSHA(pin.SHA256), shortSHA(digestOf(aDocument)), "1.2.3", - "corpus.lock.json", + "vendor_openapi_specs.lock.json", } { if !strings.Contains(msg, want) { t.Errorf("the mismatch message does not mention %q:\n%s", want, msg) @@ -210,10 +210,10 @@ func TestUnit_Corpus_ADocumentThatIsNotThePinnedOneFailsLoudly(t *testing.T) { } } -// TestUnit_Corpus_ACorruptedCachedCopyIsReplaced covers the case a plain +// TestUnit_VendorOpenAPISpecs_ACorruptedCachedCopyIsReplaced covers the case a plain // existence check would get wrong: a directory with the right name whose bytes // are not the pinned ones, which is what an interrupted write leaves. -func TestUnit_Corpus_ACorruptedCachedCopyIsReplaced(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_ACorruptedCachedCopyIsReplaced(t *testing.T) { t.Parallel() url, hits := serve(t, aDocument) @@ -243,10 +243,10 @@ func TestUnit_Corpus_ACorruptedCachedCopyIsReplaced(t *testing.T) { } } -// TestUnit_Corpus_ACacheWrittenByAnOlderLockIsNotReused covers the second gate +// TestUnit_VendorOpenAPISpecs_ACacheWrittenByAnOlderLockIsNotReused covers the second gate // on a cache hit: a cached copy that is internally consistent but was written // under a pin the lock no longer states. -func TestUnit_Corpus_ACacheWrittenByAnOlderLockIsNotReused(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_ACacheWrittenByAnOlderLockIsNotReused(t *testing.T) { t.Parallel() oldURL, _ := serve(t, aDocument) @@ -274,10 +274,10 @@ func TestUnit_Corpus_ACacheWrittenByAnOlderLockIsNotReused(t *testing.T) { } } -// TestUnit_Corpus_TheMirrorIsPreferredAndCannotChangeMeaning proves both +// TestUnit_VendorOpenAPISpecs_TheMirrorIsPreferredAndCannotChangeMeaning proves both // halves of the mirror's contract: it is asked first, and bytes that are not // the pinned ones are refused however authoritative the source looked. -func TestUnit_Corpus_TheMirrorIsPreferredAndCannotChangeMeaning(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_TheMirrorIsPreferredAndCannotChangeMeaning(t *testing.T) { t.Parallel() mirror, mirrorHits := serve(t, aDocument) @@ -306,9 +306,9 @@ func TestUnit_Corpus_TheMirrorIsPreferredAndCannotChangeMeaning(t *testing.T) { } } -// TestUnit_Corpus_AnUnreachableSourceIsOfflineNotCorruption keeps the two +// TestUnit_VendorOpenAPISpecs_AnUnreachableSourceIsOfflineNotCorruption keeps the two // failure modes apart. Offline is skippable; a mismatch never is. -func TestUnit_Corpus_AnUnreachableSourceIsOfflineNotCorruption(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_AnUnreachableSourceIsOfflineNotCorruption(t *testing.T) { t.Parallel() pin := Pin{ @@ -327,10 +327,10 @@ func TestUnit_Corpus_AnUnreachableSourceIsOfflineNotCorruption(t *testing.T) { } } -// TestUnit_Corpus_PublishToleratesLosingTheRace simulates the concurrent +// TestUnit_VendorOpenAPISpecs_PublishToleratesLosingTheRace simulates the concurrent // publisher: the destination already holds the identical bytes when the rename // lands, and that is success, not failure. -func TestUnit_Corpus_PublishToleratesLosingTheRace(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_PublishToleratesLosingTheRace(t *testing.T) { t.Parallel() root := filepath.Join(t.TempDir(), "openapi", "fixture") @@ -350,10 +350,10 @@ func TestUnit_Corpus_PublishToleratesLosingTheRace(t *testing.T) { } } -// TestUnit_Corpus_PublishReportsAnUnwritableDestination: a destination that +// TestUnit_VendorOpenAPISpecs_PublishReportsAnUnwritableDestination: a destination that // cannot be created is reported at the point of failure, not as a later // missing-copy mystery. -func TestUnit_Corpus_PublishReportsAnUnwritableDestination(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_PublishReportsAnUnwritableDestination(t *testing.T) { t.Parallel() base := t.TempDir() @@ -376,9 +376,9 @@ func TestUnit_Corpus_PublishReportsAnUnwritableDestination(t *testing.T) { } } -// TestUnit_Corpus_ShortSHAAbbreviatesOnlyWhatIsLong keeps failure messages +// TestUnit_VendorOpenAPISpecs_ShortSHAAbbreviatesOnlyWhatIsLong keeps failure messages // readable without ever truncating a digest into ambiguity silently. -func TestUnit_Corpus_ShortSHAAbbreviatesOnlyWhatIsLong(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_ShortSHAAbbreviatesOnlyWhatIsLong(t *testing.T) { t.Parallel() if got := shortSHA("abc"); got != "abc" { @@ -389,10 +389,10 @@ func TestUnit_Corpus_ShortSHAAbbreviatesOnlyWhatIsLong(t *testing.T) { } } -// TestUnit_Corpus_EnsureNamesTheLockOnAnUnknownID pins Ensure's failure mode +// TestUnit_VendorOpenAPISpecs_EnsureNamesTheLockOnAnUnknownID pins Ensure's failure mode // for an id the lock does not carry, and that asking twice gives the one // answer rather than re-resolving. -func TestUnit_Corpus_EnsureNamesTheLockOnAnUnknownID(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_EnsureNamesTheLockOnAnUnknownID(t *testing.T) { t.Parallel() _, err := Ensure("no-such-document") @@ -406,9 +406,9 @@ func TestUnit_Corpus_EnsureNamesTheLockOnAnUnknownID(t *testing.T) { } } -// TestUnit_Corpus_CacheDirIsRedirectable matters because CI must be able to +// TestUnit_VendorOpenAPISpecs_CacheDirIsRedirectable matters because CI must be able to // put the cache where actions/cache can restore it. -func TestUnit_Corpus_CacheDirIsRedirectable(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_CacheDirIsRedirectable(t *testing.T) { t.Setenv(EnvCacheDir, filepath.Join("somewhere", "else")) if got, want := CacheDir(), filepath.Join("somewhere", "else"); got != want { @@ -419,7 +419,7 @@ func TestUnit_Corpus_CacheDirIsRedirectable(t *testing.T) { } } -// TestUnit_Corpus_TheDefaultCacheIsNotRelative is the guard for a mistake v1 +// TestUnit_VendorOpenAPISpecs_TheDefaultCacheIsNotRelative is the guard for a mistake v1 // made once. // // A relative default resolves against the working directory, and `go test` @@ -427,7 +427,7 @@ func TestUnit_Corpus_CacheDirIsRedirectable(t *testing.T) { // document through the tree, in directories no root-anchored .gitignore // pattern reaches. The cache must be absolute and outside any checkout, // whatever else changes. -func TestUnit_Corpus_TheDefaultCacheIsNotRelative(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_TheDefaultCacheIsNotRelative(t *testing.T) { t.Setenv(EnvCacheDir, "") dir := CacheDir() @@ -446,10 +446,10 @@ func TestUnit_Corpus_TheDefaultCacheIsNotRelative(t *testing.T) { } } -// TestUnit_Corpus_NoUserCacheDirFallsBackToTempNotToRelative covers the +// TestUnit_VendorOpenAPISpecs_NoUserCacheDirFallsBackToTempNotToRelative covers the // machine with no resolvable user cache directory: the fallback must still be // absolute and outside the checkout. -func TestUnit_Corpus_NoUserCacheDirFallsBackToTempNotToRelative(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_NoUserCacheDirFallsBackToTempNotToRelative(t *testing.T) { t.Setenv(EnvCacheDir, "") t.Setenv("HOME", "") t.Setenv("XDG_CACHE_HOME", "") @@ -458,15 +458,15 @@ func TestUnit_Corpus_NoUserCacheDirFallsBackToTempNotToRelative(t *testing.T) { if !filepath.IsAbs(dir) { t.Fatalf("the fallback cache is %q, which is relative", dir) } - if !strings.HasSuffix(dir, filepath.Join("tfpfgen", "corpus")) { - t.Errorf("the fallback cache %q is not under tfpfgen/corpus", dir) + if !strings.HasSuffix(dir, filepath.Join("tfpfgen", "vendor_openapi_specs")) { + t.Errorf("the fallback cache %q is not under tfpfgen/vendor_openapi_specs", dir) } } -// TestUnit_Corpus_AMovingRefIsRejected proves the guard above catches the +// TestUnit_VendorOpenAPISpecs_AMovingRefIsRejected proves the guard above catches the // shape it exists for, so it cannot pass by accident on a lock that happens // to hold no branch URL. -func TestUnit_Corpus_AMovingRefIsRejected(t *testing.T) { +func TestUnit_VendorOpenAPISpecs_AMovingRefIsRejected(t *testing.T) { t.Parallel() for _, url := range []string{