Repository navigation
fix: compile every build tag, so a tagged file cannot rot unobserved - #351
Merged
Merged
Conversation
A file behind a build tag is excluded from the default build. `go build ./...`, `go vet ./...`, and `go test ./...` all pass without type-checking it — not "untested", unbuilt. Four of this repo's tags had rotted through that gap. Measured on this commit: a type error injected into tests/e2e_test.go passes `go build ./...` (exit 0), `go vet ./...` (exit 0), and `go test ./tests/` (exit 0, "ok") while `go vet -tags=e2e ./...` exits 1. That gap is the issue. Repaired: - tests/aws_s3_test.go — ten PutObject call sites still passing three arguments after the method grew a fourth map[string]string parameter. - test/benchmarks/cache_test.go — fmt.Itoa, which has never existed in any release of Go, so that file has not compiled since it was written. Deleted, because repair was the wrong answer: - tests/posix_test.go — three successive API generations stale (removing the duplicate MockBackend yields `unknown field files`, then `undefined: vfs`, then metrics.NewCollector wanting *metrics.Config). Its eight suite methods are covered by internal/fuse's 13 test files against a real in-process S3 endpoint, by internal/difftest against the local OS filesystem, and by internal/fuse/kernel_options_live_test.go for what needs a kernel. Its assert.NoError on Mount also meant it would fail rather than skip without /dev/fuse, so it could not have joined CI as written. - tests/integration/ — a LocalStack suite, which CLAUDE.md, CONTRIBUTING.md, and DEVELOPMENT.md all rule out; nothing set the AWS_ENDPOINT_URL it needed, so it never ran even when it compiled. - pkg/optimization — those two files were its only importers in the tree. A 284-line interface set whose sole consumer tested its own self-consistency. - the integration-ready-check pre-commit hook, which inferred LocalStack from an environment variable, and `make test-integration`, which pointed at ./test/integration/... — a directory that has never existed. The gate: a build-tags job with one `go vet -tags=<tag> ./...` cell per tag. Vet rather than test, because several suites need credentials, a bucket, or /dev/fuse and correctly refuse to run without one — but compiling them needs nothing, and compiling is what was missing. The bespoke fuse_mount step folds into the matrix; it was the one tag already handled right. The tag list is checked against the tree, not maintained by hand — a stale hand-kept list is the defect this fixes. TestEveryBuildTagIsGated walks every //go:build line, strips the boolean operators, discards toolchain-selected tags, and fails naming the file. TestGatedTagsStillExist is the converse and is not symmetric: a cell for a deleted tag passes, because `go vet -tags=gone` selects nothing and reports success, and a green cell named after a deleted suite is worse than a red one. Verified by mutation five ways: dropping e2e from the matrix, adding a cell for the now-deleted posix, adding a new //go:build sekrit file, restoring the fmt.Itoa defect, and the injected e2e type error above. Closes #197 Closes #240
This was referenced Aug 4, 2026
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.
Closes #197. Closes #240.
The gap, measured
A file behind a build tag is excluded from the default build. Injecting a type error into
tests/e2e_test.goon this branch:go build ./...go vet ./...go test ./tests/ok)go vet -tags=e2e ./...Not "untested" — unbuilt. Four tags had rotted through that gap.
Repaired
tests/aws_s3_test.go— tenPutObjectcall sites still passing three arguments after the method grew a fourthmap[string]stringparameter. Passingnil, which the interface documents as valid; this suite asserts nothing about user metadata.test/benchmarks/cache_test.go—fmt.Itoa→strconv.Itoa.fmt.Itoahas never existed in any release of Go, so that file has not compiled since it was written.Deleted
tests/posix_test.go(tests: posix_test.go has never compiled — MockBackend redeclared under -tags=posix #197's question (2), answered "superseded"). Repair was tried and abandoned on evidence: removing the duplicateMockBackendyieldsunknown field files, fixing that yieldsundefined: vfs, adding the import yieldsmetrics.NewCollectorwanting*metrics.Config. Three API generations. Its ownMockBackendcopy had been half-edited by a later sweep — it takesmetaand carries a rename-preserves-metadata comment — which is the clearest available evidence someone updated this file without ever compiling it.Its eight suite methods (mount, file CRUD, mkdir/readdir/rmdir, permissions, seek, concurrent reads, stats) are covered by
internal/fuse's 13 test files against a real in-process S3 endpoint, byinternal/difftestdifferentially against the local OS filesystem, and byinternal/fuse/kernel_options_live_test.gofor what genuinely needs a kernel. Itsassert.NoErroronmanager.Mountalso meant it would fail rather than skip on a runner without/dev/fuse, so it could not have been added to CI as written — which is what tests: posix_test.go has never compiled — MockBackend redeclared under -tags=posix #197's verification asks for.tests/integration/— a LocalStack suite.CLAUDE.md,CONTRIBUTING.mdandDEVELOPMENT.mdall rule LocalStack out, and nothing in the repo set theAWS_ENDPOINT_URLit required, so it never ran even when it compiled.pkg/optimization— those two files were its only importers in the entire tree (verified). A 284-line interface set whose sole consumer was a test of its own self-consistency.Two pieces of broken wiring: the
integration-ready-checkpre-commit hook, which inferred LocalStack from an environment variable, andmake test-integration, which rango test -tags=integration ./test/integration/...— a directory that has never existed, so the target failed withlstat: no such file or directoryfor as long as git records it.The
integrationtag survives: it marks real-AWS tests ininternal/awsratesandinternal/storage/s3, whichmake test-awsandCONTRIBUTING.mdrun.The gate
A
build-tagsjob, onego vet -tags=<tag> ./...cell per tag:aws_s3,benchmark,distributed,e2e,integration,fuse_mount. Vet rather than test, deliberately — several of these need credentials, a bucket, or/dev/fuseand correctly refuse to run without one, but compiling them needs nothing, and compiling is what was missing. The bespokeCompile the fuse_mount tagstep folds in; it was the one tag already handled correctly and there's no reason for it to be special.The tag list is checked against the tree, not maintained by hand — a stale hand-kept list is precisely the defect this fixes.
TestEveryBuildTagIsGatedwalks every//go:buildline, strips the boolean operators, discards toolchain-selected tags (GOOS/GOARCH/cgo/race), and fails naming the file.TestGatedTagsStillExistis the converse and is not symmetric: a cell for a deleted tag passes, becausego vet -tags=gone ./...selects no files and reports success — a green cell named after a deleted suite is worse than a red one.Verification
Five mutations, each producing the intended failure:
e2efrom the matrixTestEveryBuildTagIsGatedfails, namingtests/e2e_test.goposixTestGatedTagsStillExistfails//go:build sekritto a new fileTestEveryBuildTagIsGatedfails, naming itfmt.Itoadefectbenchmarkcell failstests/e2e_test.goe2ecell exits 1; default build exits 0 (table above)Also:
go vet -tags=<tag> ./...clean for all six tags ·go build ./...· fullgo test -race -timeout 20m ./...green ·golangci-lint --new-from-merge-base=origin/main0 issues ·gofmtclean · markdownlintCHANGELOG.mdheld at its 361 baseline (I introduced one duplicate[#240]reference and removed the redundant one), README 24, design doc 28.One doc correction fell out:
docs/design/conditional-writes-vs-raft.mdcited fivePutObjecttest doubles includingtests/posix_test.go:443. Now four.Note
build-tagscells are not inmain's required status checks.cross-buildlists its cells individually, so the precedent is per-cell — worth adding the six once this run confirms the exact names.