Skip to content

ci: enforce >=90% line coverage on go_test targets#382

Merged
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/nice-black-1323fb
Jun 22, 2026
Merged

ci: enforce >=90% line coverage on go_test targets#382
tinder-maxwellelliott merged 1 commit into
masterfrom
claude/nice-black-1323fb

Conversation

@tinder-maxwellelliott

Copy link
Copy Markdown
Collaborator

What

Adds coverage enforcement for go_test targets. Go production code under tools/go/ is now held to a 90% line-coverage bar, enforced in CI — gated independently of the existing Kotlin gate so thin coverage in one language can't hide behind well-covered code in the other.

This is groundwork for Go tooling landing under tools/go/ soon; the enforcement is live today against a sample target.

How

The existing LCOV checker (tools/coverage_check.py) is already language-agnostic — it scopes a combined LCOV report by path prefix. rules_go emits workspace-relative SF: paths (tools/go/.../*.go), so the gate is just a second invocation of the same binary with a Go-scoped --include.

  • MODULE.bazel — add rules_go 0.60.0 + gazelle 0.45.0 + a hermetic Go SDK (go_sdk.download(version = "1.23.1")), all dev_dependency = True (matching the existing rules_python/rules_nodejs pattern) so module consumers don't inherit them via MVS. Versions match the nested go_mod_change test-resource workspace.
  • tools/go/sample/ — a tiny go_library + go_test (100% covered) that exercises the gate end-to-end and keeps it green until real Go code lands. Replace/extend with real code under tools/go/.
  • .github/workflows/ci.yaml — include //tools/go/... in the bazel coverage run; add an "Enforce Go coverage threshold" step running //tools:coverage-check -- --include tools/go/ --threshold 90.
  • Makefile + README.md/tools/readme_template.md — mirror and document the Go gate locally (make coverage now runs both gates).

Validation

  • bazel coverage //tools/go/... emits SF:tools/go/sample/sample.go — confirmed the tools/go/ prefix matches and cleanly excludes the Python tools/coverage_check.py.
  • Go gate: 100% (8/8) PASS at threshold 90, evaluated independently of Kotlin.
  • Buildifier: new BUILD/MODULE files already formatted (no changes).

Notes

  • The Go gate exits non-zero if tools/go/ ever contains zero instrumentable Go code ("no instrumented production-source lines"). The sample prevents that — keep at least one real Go target under tools/go/.

🤖 Generated with Claude Code

Adds a separate Go coverage gate so Go production code under tools/go/ is
held to the same >=90% line-coverage bar as the Kotlin cli/src/main sources,
gated independently so thin coverage in one language can't hide behind the
other.

- MODULE.bazel: add rules_go/gazelle + a hermetic Go SDK (dev_dependency, so
  consumers don't inherit them via MVS), matching the nested test-resource
  workspace versions.
- tools/go/sample: a tiny go_library + go_test that exercises the gate
  end-to-end (and keeps it green until real Go code lands).
- ci.yaml: include //tools/go/... in the coverage run and add a step that
  runs //tools:coverage-check with --include tools/go/ --threshold 90.
- Makefile + README/template: document and mirror the Go gate locally.

The existing language-agnostic LCOV checker (tools/coverage_check.py) is
reused unchanged; rules_go emits workspace-relative SF: paths
(tools/go/.../*.go) that the --include prefix scopes cleanly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tinder-maxwellelliott tinder-maxwellelliott merged commit b9bb56f into master Jun 22, 2026
15 checks passed
@tinder-maxwellelliott tinder-maxwellelliott deleted the claude/nice-black-1323fb branch June 22, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant