Skip to content

ci: refresh the Go module cache on toolchain bumps, and pin semgrep - #23775

Merged
teddyknox merged 2 commits into
developfrom
claude/circle-go-cache-fixes
Nov 10, 2026
Merged

teddyknox merged 2 commits into
developfrom
claude/circle-go-cache-fixes

Conversation

@teddyknox

@teddyknox teddyknox commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Two small CircleCI fixes. Neither changes what CI does today; both remove a way for CI to get slower or to break without a change in this repo.

1. Go jobs stop re-downloading the Go toolchain after a go.mod-only bump.

  • Problem. The Go module cache key used only go.sum. A toolchain-directive bump such as security: Update go toolchain directive to v1.26.9 [SECURITY] #23290 or security: Update go toolchain directive to v1.26.10 [SECURITY] #23546 changes only go.mod. Cache keys are immutable, so the cache never captured the new toolchain, and every Go job downloaded it again until go.sum next changed.
  • Fix. The key now includes go.mod.
  • Second problem. Machine images default GOPATH to ~/.go_workspace, so they ignored the restored ~/go/pkg/mod. Today that affects the daily preimage-reproducibility job, which restored 2.3 GiB and still downloaded modules (job 5798921).
  • Fix. The restore helper now sets GOMODCACHE.

2. semgrep is pinned to 1.182.1 by tag and digest.

  • Problem. semgrep-scan-local and semgrep-test gate ci-gate. With a floating image, an upstream release can fail every PR.
  • Fix. The image is pinned. 1.182.1 is both the current latest and the pipx:semgrep pin in mise.toml, so nothing changes today.

Effect. CI only. No effect on any product code.

Trade-offs.

  • A cache snapshot saved while go.mod is ahead of mise's Go keeps that toolchain. Later snapshots carry it until c-go-cache-version is bumped, the same way old module versions accumulate today.
  • The key does not include mise.toml, so tool bumps do not re-save the ~2 GiB snapshot.
  • semgrep bumps are now manual. A comment at the pin points to mise.toml, but nothing enforces that the two stay equal.

Testing. All 116 CI checks pass on this PR. A new setup-job step (about 1–2 s) runs a regression test, .circleci/scripts/test-go-mod-cache.py. It checks that the key changes with go.mod and go.sum, and that Go reads the restored directory under a machine image's GOPATH. ci-config-reviewer found no blockers.

Context. This is one of four small PRs that change code CircleCI runs, found while reviewing the RWX pilot (#23151): #23772, #23775, #23776 and #23780. Each stands alone. The additive RWX shadow is #23783. The reviewer flagged the per-node go-tests build cache as unmeasured, so that change moved to #23776.

Tracked in #24044.

🤖 Generated with Claude Code

The Go module cache key now includes go.mod. A toolchain-directive bump
changes only go.mod, and cache keys are immutable, so after each such bump
every Go job downloaded the new toolchain until go.sum next changed. The
restore helper also sets GOMODCACHE, because machine images default GOPATH
to ~/.go_workspace and ignored the restored ~/go/pkg/mod. A setup-job test
checks both.

The semgrep image is pinned by tag and digest. Both semgrep jobs gate
ci-gate, so a floating tag lets an upstream release fail every PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@einar-oplabs
einar-oplabs self-requested a review November 10, 2026 14:32
@einar-oplabs einar-oplabs self-assigned this Nov 10, 2026
@teddyknox
teddyknox added this pull request to the merge queue Nov 10, 2026
Merged via the queue into develop with commit eb35685 Nov 10, 2026
104 checks passed
@teddyknox
teddyknox deleted the claude/circle-go-cache-fixes branch November 10, 2026 16:38
mds1 added a commit that referenced this pull request Nov 10, 2026
Resolve the Go module cache conflict with #23775. The key keeps the
branch scope and gains go.mod, so a toolchain bump still gets a fresh
key: <branch>:<go.mod>-<go.sum>, falling back to develop's.

prep-go-modules now counts the module cache through the GOMODCACHE that
restore-go-mod-cache sets, instead of "go env". After a go.mod toolchain
bump, "go env" downloads the toolchain before the count, so the halt
would skip the save that #23775 needs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teddyknox teddyknox self-assigned this Nov 10, 2026
@teddyknox teddyknox mentioned this pull request Nov 10, 2026
3 of 5 tasks
@github-actions

Copy link
Copy Markdown
Contributor

Agent approval check

Head branch claude/circle-go-cache-fixes matches agent prefix claude/

Current head: 9b770fa33b44d7e51766f8b67f7e28bbcbad7538
Human approvals: 1/2
Approvers: @einar-oplabs

A write-capable human can approve by submitting a native review or by commenting:

/approve 9b770fa33b44d7e51766f8b67f7e28bbcbad7538

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.

2 participants