Repository navigation
ci: restore the Go cache in build, govulncheck and check-generated - #1458
Conversation
actions/setup-go ran before actions/checkout in these workflows, so its
cache step found no go.mod/go.sum and skipped the Go module and build cache
restore entirely ("Restore cache failed: Dependencies file is not found").
Every run compiled from scratch.
- run setup-go after checkout (and after get-diff-action where present)
- skip setup-go when the job's GIT_DIFF gate is empty, so skipped jobs don't
download a cache they never use
- key each workflow's cache on go.sum plus the workflow file, and in
check-generated on each job's tool config (.mockery.yaml / buf.*), so
these caches don't collide with the tests.yml/lint.yml cache key
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
get-diff-action's FILES input matches bare file names anywhere in the tree, so the full path `.github/workflows/check-generated.yml` never matched and edits to this workflow never triggered the mock check. List the path under PATTERNS (minimatch globs) instead. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
PR HygieneState: waiting-self-review · commit
Self-review is an author attestation that you have read the diff: This report does not bypass CI or repository protection rules. |
|
✅ Final review complete — no blockers (commit ba9df0e) · triage: normal |
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The cache ordering and per-workflow cache-key changes correctly address the primary CI cache issue, and the workflow-path pattern now reruns the mock check when the workflow changes. However, both generated-code jobs still trigger only on source-file patterns, so changes to their generation configuration can skip validation and allow stale generated output to merge.
🔴 2 blocking
Review provenance
Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: general); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
lowbygpt-6-astra(effort low) — This is a small, well-contained CI workflow change that reorders setup steps, adjusts cache keys and gates, and corrects a file-matching pattern without affecting product logic or critical surfaces. - Phase 1 reviewers:
muse-spark-1.3-contributor— general (completed, effort high); agentphase1-reviewer - Phase 1 model:
muse-spark-1.3-contributor— not quota-gated; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 11% left, 5h 100% left),glm-5.3-flash(zai below 15% reserve: 5h 100% left, weekly 13% left) - Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort medium); agentphase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.
In `.github/workflows/check-generated.yml`:
- [BLOCKING] .github/workflows/check-generated.yml:31-34: Run mock generation checks when Mockery configuration changes
The check-mocks job now hashes `.mockery.yaml` in its Go cache key, and `make mockery` uses that configuration to generate mocks, but `PATTERNS` does not include `.mockery.yaml`. A pull request that changes only `.mockery.yaml` leaves `GIT_DIFF` empty, so both setup-go and the generated-mock verification step are skipped. This allows configuration changes that require regenerated mocks to merge without validation. Add `.mockery.yaml` to the diff patterns.
- [BLOCKING] .github/workflows/check-generated.yml:70-72: Run protobuf generation checks when Buf configuration changes
The check-proto job's generation output depends on `buf.yaml`, `buf.gen.yaml`, and `buf.lock`, and all three files are included in its cache-dependency-path, but none is included in `PATTERNS`. A pull request changing only a Buf configuration file leaves `GIT_DIFF` empty, so protobuf generation and the generated-code diff check are skipped. Generated `.pb.go` output can therefore become stale without CI detecting it. Include the Buf configuration files, and the workflow file whose generation commands and inputs define this check, in the patterns.
check-mocks and check-proto skip their generation checks when only .mockery.yaml or a Buf config file (buf.yaml, buf.gen.yaml, buf.lock) changes, since GIT_DIFF stays empty and both setup-go and the verification step are skipped. Add these files (and the workflow file itself for check-proto, matching check-mocks) to PATTERNS. Co-Authored-By: Claude Sonnet 5 <[email protected]>
The check-proto CI job never ran on this branch's own workflow-file change until PATTERNS was widened to cover it (see previous commit), which surfaced generated code drift accumulated since the gogoproto fork bump in go.mod (unrelated PR #1189). Diff is purely cosmetic: regenerated gzipped FileDescriptorProto bytes and a comment-formatting change from the current protoc-gen-gogofaster/buf versions; no field, method, or wire-format changes (verified via `git diff --unified=0` with the descriptor-byte and comment-only lines filtered out). Co-Authored-By: Claude Sonnet 5 <[email protected]>
thepastaclaw
left a comment
There was a problem hiding this comment.
Final validation — Phase 1 + Phase 2
The CI changes correctly move setup-go after checkout, gate cache setup consistently with the existing diff checks, and isolate workflow and tool caches using appropriate dependency paths. The generated-code trigger fixes for Buf and Mockery configuration, including the workflow file itself, are present and address both prior findings. No new in-scope defects were found.
Review provenance
Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: gpt-6-astra (agent: phase2-reviewer, role: general); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)
- Triage:
normalbygpt-6-astra(effort low) — The diff changes multiple CI workflows, cache-key and job-gating behavior, and regenerates many protobuf files, making it broader than a trivial configuration fix, but it does not modify a critical surface such as consensus, cryptography, funds movement, networking deserialization, or storage migrations. - Phase 1 reviewers:
glm-5.3-flash— general (completed, effort max); agentphase1-reviewer - Phase 1 model:
glm-5.3-flash— zai quota: 5h 98% left, weekly 96% left; passed overgemini-3.8-flash-high(antigravity below 15% reserve: weekly 11% left, 5h 100% left) - Fresh verifier:
gpt-6-astra— final-verifier; agentastra-verifier - Phase 2 reviewers:
gpt-6-astra— general (completed, effort high); agentphase2-reviewer
Out-of-scope follow-up suggestions (1)
These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.
- Unify BLS revision handling in setup-go cache keys — The affected workflow caches, like the existing tests.yml and lint.yml caches, do not include the vendored BLS C headers or library revision in cache-dependency-path. Because cgo does not track external C dependencies in GOCACHE, a BLS revision change that does not also change go.sum could restore artifacts built against stale C inputs. This is an existing repository-wide cache-key policy issue and is outside this CI restoration PR.
- Follow-up: Track a separate issue to adopt the BLS dependency globs used by e2e.yml across all Go cache configurations, or document the repository-wide cache-key policy for cgo dependencies.
TL;DR: Three CI workflows rebuilt all Go code from scratch on every run because their cache never loaded. This PR fixes the step order so the cache is used, which makes those checks finish faster.
User story
As a contributor opening a pull request, I want the Build, Vulnerability Scan and Check-generated-code checks to reuse previous work, so I get CI results sooner.
Scenario
Base flow
A contributor pushes a change and waits for the Build, Vulnerability Scan and Check generated code checks.
Actual behavior
Each of these checks downloads all Go dependencies and compiles everything from zero on every run. The cache they are configured to use is never loaded. Separately, editing the check-generated workflow itself never re-runs the mock check it defines.
Expected behavior
The checks load a cache prepared by earlier runs and only rebuild what changed. Checks with nothing to do skip the cache download entirely. Editing the check-generated workflow re-runs its mock check.
Detailed discussion
Issue being fixed
In
build.yml(3 jobs),govulncheck.ymlandcheck-generated.yml(2 jobs),actions/setup-goran beforeactions/checkout. setup-go's built-in cache (cache: trueby default) hashescache-dependency-path(defaultgo.mod/go.sum) to build its key. At that point no files were checked out, so every run loggedRestore cache failed: Dependencies file is not found ... Supported file pattern: go.modand no GOMODCACHE/GOCACHE was ever restored or saved.tests.ymlandlint.ymlalready use the correct order.Current cost (latest green PR runs):
test_appsinstall 121s,buildinstall 41s,test_abci_cliinstall 42s, govulncheck scan 35s, check-mocks 48s — all cold.What was done
actions/setup-gonow runs afteractions/checkout(and afterget-diff-actionwhere a job has one).In jobs gated on
GIT_DIFF, setup-go is gated too. Jobs with nothing to check no longer download a cache they never use. All Go-using steps in those jobs were already gated, so nothing else changes.Each workflow gets its own cache key by adding files to
cache-dependency-path, a documented setup-go pattern (advanced usage: multi-target builds):build.yml,govulncheck.yml:go.sum+ the workflow file.check-generated.yml:go.sum+ workflow file + per-job tool config (.mockery.yamlfor check-mocks,buf.yaml/buf.gen.yaml/buf.lockfor check-proto), so the two parallel jobs don't race for one key.Without this, every workflow would share setup-go's default key with
tests.yml(-racebuilds). They would restore that cache, which is of little use to them, and never save their own.check-generated.yml's check-mocks listed.github/workflows/check-generated.ymlunderget-diff-action'sFILES.FILESmatches bare file names, so a full path never matched and edits to the workflow never triggered the check. The path is now listed underPATTERNS(minimatch globs).Cache footprint: caches are saved only on a key miss. Pull requests restore the base-branch entry and don't save while
go.sumand the workflow file are unchanged. Expect about one new entry of ~300 MB per workflow on the base branch.Known limitation, same as the existing
tests.yml/lint.ymlcaches: the key doesn't include the BLS C library revision. cgo does not track external C headers or libraries in GOCACHE. In practice a BLS bump normally also bumps thego-bindingsmodule ingo.sum, which rotates the key.Testing
actionlint1.7.12 on the three files: no new findings. The only report is the pre-existing SC2155 in the check-proto script, also reported on the base version.govulncheckmissed the cache as expected (new key) and saved it:Cache saved with the key: setup-go-Linux-x64-ubuntu24-go-1.27.1-eb3faf55…, distinct from thetests.ymlkey.check-mocksruns on this PR once thePATTERNSfix is in, which exercises its cache path.build.ymljobs andcheck-protoare gated on Go/proto diffs, so they're skipped here. They'll first exercise the new order on the next PR touching Go code.Breaking changes
None. CI-only change.
Checklist
Prior work
e2e.yml, as part of an e2e speed-up.🤖 Generated with Claude Code