Repository navigation
ci(lint): verify the golangci config against a vendored schema - #445
Conversation
|
Warning Review limit reached
This review includes 5 billable files and costs up to $1.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 33 minutes for your next included review. View limit details
Comment |
|
@coderabbitai review |
|
Independent review verdict: CLEAN at 9bf5a43Reviewer: fresh Claude agent (Sonnet, high effort), not the author. Coordinator: claude-cc-reviewer. Blocking findings: none. What was checked:
Non-blocking notes:
Gate:
|
|
CI is green on head
So the runner's |
golangci-lint v2.10.1 config verify downloads its JSON schema from golangci-lint.run with a 2s timeout, and the lint action runs it on every leg, so a slow schema endpoint failed lint before any source was checked. The schema is now vendored byte-for-byte from the v2.10.1 tag with a pinned sha256, and one leg verifies the config against it through --schema file://. A negative step proves an invalid config still fails for a schema reason, and the script fails loud if the Makefile pin, the action version and the installed binary drift apart. Closes #420 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9bf5a43 to
35da47f
Compare
Summary
CI lint failed intermittently before any source was checked. golangci-lint v2.10.1's
config verifydownloadshttps://golangci-lint.run/jsonschema/golangci.v2.10.jsonschema.jsonwith a hard 2s HTTP timeout (pkg/commands/config_verify.go:217-221), andgolangci/golangci-lint-actionruns that verify by default on every matrix leg. This hit #413, #419, #444 and #429.The fix keeps validation and removes the live network dependency. It uses upstream's own mechanism: the
--schemaflag acceptsfile://(config_verify.go:129-137), and upstream CI uses it (pr-checks.yml:92)..github/golangci/golangci.v2.10.jsonschema.jsonis a byte-exact copy ofjsonschema/golangci.jsonschema.jsonat tag v2.10.1. That file is identical to what the site serves for v2.10; the versioned filename only exists from v2.11.0. Its sha256 (692e8da7…e3403) is pinned in a.sha256file. Both files are excluded from the whitespace hooks, and the JSON also from check-json.scripts/verify-golangci-config.sh <bin> [config]. It builds an absolutefile://path; a relative one parses as the URL host. It checks the schema sha256, then runsconfig verify --schema file://…. It fails loud if the Makefile pin, the action'sversion:(read only from the lint-action step) and thego installpin are not all the same version, or if the installed binary's version doesn't match them.ci.yml, lint job.if: strategy.job-index == 0, so a matrix rename can't silently skip it), the job installs v2.10.1, verifies the real config, then runs a negative step. That step verifies a generated invalid config and requires a non-zero exit plus bothdoes not validateandinvalid elements, so a missing or corrupt schema cannot pass.verify: falseon every leg. It still lints.Not done, by design:
Closes #420
Verification (macOS, golangci-lint v2.10.1 via go install, network blocked with
HTTPS_PROXY=HTTP_PROXY=http://127.0.0.1:9)config verify --config .golangci.ymlproxyconnect … connection refused(the bug)scripts/verify-golangci-config.sh <bin>linters: {bogus: 1})"linters" does not validate … additional properties 'bogus' not allowedandthe configuration contains invalid elements--schemadroppedgo installpin changedversion:changedversion:keys in ci.ymlAll mutations ran in scratch copies. Vendored file:
cmpagainst a freshgh apifetch at v2.10.1 returned rc 0.Tooling:
actionlintrc 0,shellcheckclean,zizmor(pedantic) no new findings, andpre-commithooks passed on commit.Review: an independent non-author reviewer reviewed the plan in two passes and the diff in one. Findings fixed:
file://path;No actionable findings on tree
e7b11496.The Linux paths (
go installon the runner, thesha256sumfallback) are proven only by this PR's CI run.🤖 Generated with Claude Code