Repository navigation
🧪 test(coverage): raise product coverage to 96.9% and enforce a 96% floor - #37
Merged
Merged
Conversation
…loor Drive statement coverage of the product packages (internal/* + cmd/portwing) from 74.8% to 96.9% and ratchet the CI gate to match. - 🧪 test: add table-driven tests across server, docker, metrics, edge, auth, mcp, adapter/drydock, banner, generic, audit, log, and cmd/portwing, targeting error paths, branch coverage, and previously-untested files - 🔧 config(ci): scope the coverprofile to product packages and bump COVERAGE_MIN 68→96. Excludes the three non-shipped tool mains (benchmarks/cmd/loadgen, benchmarks/cmd/mockdocker, internal/banner/gen); `go vet ./...` still compiles them so they can't rot. Gate change lands with the tests so the floor never reddens before coverage catches up. - 🔄 refactor(metrics): inject an overridable procRoot (defaults to /proc) so /proc parsers can be driven from fixtures deterministically on any OS - 🔄 refactor(cmd): split main() into a testable run() that returns exit codes and writes through injected io.Writer/Reader; behavior unchanged
scttbnsn
requested review from
ALARGECOMPANY and
biggest-littlest
as code owners
June 23, 2026 17:00
The coverage tests were verified with go test/vet but not golangci-lint. Fix all 27 findings: - 🐛 fix(test): close response bodies in bodyclose-flagged call sites (canonical guard, plus one //nolint where the body is read in a goroutine) - 🔧 config(lint): exclude unactionable fmt.Fprint* writes to injected io.Writers and (net.Listener).Close teardown in errcheck - 🗑️ remove(test): delete unused drydock test helpers + orphaned io import - 🎨 style(test): check w.Write/os.RemoveAll returns; #nosec G302 on the intentionally world-readable auth fixture
biggest-littlest
approved these changes
Jun 23, 2026
biggest-littlest
left a comment
Member
There was a problem hiding this comment.
Coverage tests look solid — product scope to 96.9%, lint/vet/race all green. Gate bump ships with the tests as intended.
ALARGECOMPANY
approved these changes
Jun 23, 2026
ALARGECOMPANY
left a comment
Member
There was a problem hiding this comment.
LGTM. Behavior-preserving refactors (procRoot, run()) and the 96 floor scoped to product packages. Approving.
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.
What
Drives statement coverage of the product packages (
internal/*+cmd/portwing) from 74.8% → 96.9% and ratchets the CI gate to enforce a 96% floor.Coverage by package
Gate change (lands with the tests on purpose)
The coverage gate previously counted everything via
go test ./..., which folded in three non-shipped tool mains (benchmarks/cmd/loadgen,benchmarks/cmd/mockdocker,internal/banner/gen). The Test step now scopes the coverprofile tointernal/* + cmd/*(minusbanner/gen) andCOVERAGE_MINgoes 68 → 96.go vet ./...still compiles the excluded tooling so it can't silently rot. The gate bump ships in the same PR as the tests so the floor never reddens before coverage catches up.Behavior-preserving refactors (only non-test product changes)
procRoot(defaults to/proc) so the/procparsers can be driven from fixtures deterministically on any OS (they were ~8% covered because this dev/CI matrix can't rely on live/proccontents).main()into a testablerun(args, stdin, stdout, stderr) intthat returns exit codes instead of callingos.Exit, writing through injected writers. Production behavior unchanged.Verification
go test -raceacross the product packages: PASS, total 96.9%gofmt -lclean,go vet ./...cleanRemaining uncovered lines are genuinely unreachable without product changes (crypto/rand failures,
json.Marshal-can't-fail paths, OS-specific dead code, multi-minute cleanup tickers, and themain()entry point itself) — documented per package in the agent reports.