Skip to content

feat(covgate): report build-cache pre-warm duration#35

Merged
ben-miru merged 1 commit into
mainfrom
perf/covgate-prewarm-visibility
Jun 24, 2026
Merged

feat(covgate): report build-cache pre-warm duration#35
ben-miru merged 1 commit into
mainfrom
perf/covgate-prewarm-visibility

Conversation

@ben-miru

Copy link
Copy Markdown
Contributor

What

Make the covgate build-cache pre-warm pass observable: announce it and report its wall time.

Pre-warming build cache (197 packages)...
Pre-warm complete in 1m46s

Running 197 packages with parallelism=8; progress:
...
Total time: 2m01s

Why

The pre-warm pass (added in #34) is a large slice of a covgate run but was invisible: it's deliberately excluded from "Total time" (which times only the parallel coverage phase) and emitted no output. So you couldn't see how long it took, or tell whether it was helping — which is exactly the situation that prompted this: a downstream run where the pre-warm appeared to underperform, with no way to confirm from the logs.

Change

  • Time the pre-warm and print Pre-warming build cache (N packages)... before it and Pre-warm complete in X after, to the same writer as the rest of the output.
  • Reorder so the pre-warm log sits above the "Running N packages..." progress header (clean ordering).
  • Extract the warm block into prewarmCache(...) so run() stays within the repo's function-length limit.

No behavior change to coverage measurement, thresholds, exclude handling, gating (parallelism > 1 && len(pkgs) > 1), or "Total time" — purely additive observability.

Tests

  • Extended TestRun_Prewarm_InvokedOnce_WhenParallelAndMultiPkg to assert both new lines appear.
  • Extended TestRun_Prewarm_Skipped_WhenSinglePackageOrSerial to assert they do not appear when the pass is gated off.
  • Build, vet, repo lint (custom ruleset), and the covgate self-gate (100%) all pass.

Context

This is the diagnostic prerequisite for an observed regression: when a downstream repo (backend) switched from a CI-side pre-warm step to covgate's internal self-warm, the combined warm + coverage time looked worse than the external step. With this output we can measure the pre-warm and coverage phases separately on a clean run and confirm the cause before changing the warm logic.

🤖 Generated with Claude Code

The pre-warm pass before the parallel coverage runs was invisible: it is
excluded from "Total time" (which times only the parallel phase) and emitted
no output, so its cost could not be observed or compared run-to-run.

Announce the pass ("Pre-warming build cache (N packages)...") and report its
wall time on completion ("Pre-warm complete in X"). Extract the warm logic
into prewarmCache so run() stays within the function-length limit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ben-miru
ben-miru merged commit 6a0cc47 into main Jun 24, 2026
3 checks passed
@ben-miru
ben-miru deleted the perf/covgate-prewarm-visibility branch June 24, 2026 23:48
ben-miru added a commit that referenced this pull request Jul 3, 2026
## What

Reverts the covgate **build-cache pre-warm** feature in its entirety.
covgate no longer pre-warms the Go build cache before its parallel
coverage runs.

Reverts, in order (newest first):
- #36 `perf(covgate): instrument the build-cache pre-warm` (`794e725`)
- #35 `feat(covgate): report build-cache pre-warm duration` (`6a0cc47`)
- #34 `perf(covgate): pre-warm build cache before parallel coverage
runs` (`0c3c0af`)

## Why

We no longer want covgate to pre-warm the build cache. The pre-warm
compiled an extra artifact set that inflated the CI `gobuild-test` cache
and pushed the backend repo back over the 10 GB Actions cache quota (the
very regression #36 tried to walk back). Rather than keep iterating on
the pre-warm, we're removing it.

## How

Three `git revert` commits, preserving history/attribution. The reverted
`internal/services/covgate/` and `internal/services/gocover/` files are
**byte-identical** to their pre-feature state, and the feature's design
doc (`plans/completed/20260624-covgate-prewarm-build-cache.md`) is
removed.

## Validation

- No lingering `prewarm` / `PrewarmBuild` references anywhere in
`internal/`, `cmd/`, or `scripts/`.
- Full `scripts/preflight.sh` passes clean: covgate coverage 94.3%
across all 30 packages, gocover 92.6% (≥ 92.1% required), custom lint +
gofumpt + golangci-lint + deadcode + surface-lint all green.
- Clean revert with no conflicts against current `main`; unrelated later
commits (#37 CI, #38 dep bumps, #39 max-param-count) required no
adjustment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- codesmith:footer -->
---
<a
href="https://app.blacksmith.sh/mirurobotics/codesmith/gotools/pr/40"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-light-v2.svg"><img
alt="View with Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/view-with-codesmith-dark-v2.svg"></picture></a>
<a
href="https://backend.blacksmith.sh/track/enable-autofix?expires=1785713638&installation_id=142588636&pr_number=40&repository=mirurobotics%2Fgotools&return_to=https%3A%2F%2Fgithub.com%2Fmirurobotics%2Fgotools%2Fpull%2F40&signature=00cc206a36c548207ac3606f293163ba579f08070387cbe5cc6ca77ed2f8cb48"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img
alt="Autofix with Codesmith"
src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"></picture></a>
<sup>Need help on this PR? Tag <code>/codesmith</code> with what you
need. Autofix is disabled.</sup>

<!-- codesmith:autofix:disabled -->
<!-- /codesmith:footer -->
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