Skip to content

build(ci): make the local and CI quality gates actually check what they claim - #1436

Merged
lklimek merged 6 commits into
v1.8-devfrom
fix/local-gates
Sep 9, 2026
Merged

lklimek merged 6 commits into
v1.8-devfrom
fix/local-gates

Conversation

@lklimek

@lklimek lklimek commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

The problem

Three of this repository's quality gates report success without checking what they appear to check. They were found while investigating an unrelated PR, by running each gate and comparing its result against what it claimed.

make lint cannot exit 0. It runs golangci-lint unfiltered across a repository carrying hundreds of pre-existing findings, so it exits 1 on a pristine v1.8-dev checkout — 180 issues at the version the Makefile pins today. Nobody can use it as a gate, and it also pins @v2.8 while CI's lint.yml runs v2.12, so a clean local run was never evidence about CI in the first place.

go test ./... cannot pass on the base branch. Three fmt.Errorf calls in test/e2e/pkg/testnet.go fail the vet subset that go test runs before building. The lines date from 2020 and nobody noticed, because:

No package without test files is ever built by CI. Makefile's shard list is go list -f '{{ if (or .TestGoFiles .XTestGoFiles) }}...', so test/e2e/pkg — which has no _test.go — is filtered out and never compiled. 74 packages are in that category.

The three filters are individually defensible: a shard list should contain packages with tests; --new-from-rev should hide pre-existing findings from a review gate; tests.yml should not rebuild on documentation changes. The defect fell through all three, and no layer was wrong.

What changed

fix(e2e) — the three fmt.Errorf calls report height, the result of a strconv.Atoi that just failed, so the message reads invalid ... height "0" for any malformed input and never shows the offending manifest key. The fix is the argument, not the verb: heightStr with %q, matching the six other sites in the repo that already do this. One message also named the wrong manifest section, sending a debugger to validator_updates for a chain_lock_updates failure. Clearing the vet failure is a consequence of fixing the diagnostic, not the goal.

build: make the lint target reproduce the CI gate — make lint now filters against a base ref, as CI does, and exits 0 on a clean tree. make lint-all preserves the unfiltered view under an honest name. The version is pinned to v2.12 to match CI's floating-patch semantics, and LINT_BASE is overridable. Two preflight checks fail legibly before the linter runs when the base ref is missing or the clone is shallow, so nobody debugs a confusing lint result that is really a git problem.

build: drop the unused BASE_BRANCH variable — declared, read by nothing since the protobuf targets that used it were removed, and defaulting to v0.8-dev. Because it is ?=, an exported value would silently take effect. It looks like the base-ref knob for the lint target while being wired to nothing, so someone adjusting it to fix a gate would watch the gate not change.

fix(dash) — nodeid_resolver.go formats a host/port pair with fmt.Sprintf("%s:%d"). ValidatorAddress.String() uses net.JoinHostPort on the same fields ten lines away, internal/p2p uses it at every equivalent site, and validator_address_test.go explicitly tests tcp://[::1]:26656, so a bare IPv6 literal is a supported state that the current code renders as the meaningless ::1:26656. Output is byte-identical for IPv4. This does not make IPv6 work — the call dials hardcoded "tcp4", which will still refuse the address; the improvement is a truthful error instead of a nonsense one. Whether node-ID resolution should support IPv6 is a connection-establishment question, deliberately left alone. It is fixed here because go vet ./... reports it, and a new gate shipping with a known finding inside it is not a gate.

ci: vet every package — a new vet.yml workflow running make vet (go vet ./...), covering all 176 packages including the 74 no workflow builds today.

Design decisions worth stating, because each looks like an oversight otherwise:

  • go build is deliberately absent. Measured against the restored defect: go build ./test/e2e/pkg/ exits 0 — it sails past the exact bug this PR exists to close — while go vet exits 1. Vet must typecheck to analyse, so it reports compile errors too. Build is strictly redundant, and including it would advertise coverage the gate does not have.
  • No trigger filter, deliberately. Three filters hid the original defect; a fourth on the gate built to catch it would repeat the mistake knowingly. The cost is roughly a minute of runner time, dominated by fixed setup, in parallel with the six test shards.
  • go-version pinned exact, not ^. Vet's diagnostics vary by toolchain, so a floating version lets the gate change what it enforces with no change to this repository. An earlier revision of this description offered "a stricter newer vet started rejecting these lines" as the leading explanation for why 2020-era code began failing. That has since been measured and refuted: Go 1.26.5 flags all three testnet.go lines, so whatever changed predates the toolchain versions in play here. The pin stands on the general variance; the story it was originally justified with was wrong. The real cause is not established and is deliberately not chased — the gate's value does not depend on knowing it.
  • libpcap-dev is required, not copied. cmd/abcidump imports gopacket/pcap via cgo, and it is one of the 74 packages CI does not build today.

Verification

Every gate has a control proving it can fail, because a gate that only ever exits 0 has not been shown to be a gate.

gate clean tree defect restored
make lint exit 0, 0 issues injected S1025 → non-zero
make vet exit 0, no findings testnet.go defect → non-zero, naming line 385
make vet — IPv6 finding → non-zero

The lint control was run twice: the first injection was a compile error, which proves nothing since anything catches those. The second used a compile-clean style finding.

go test -p 1 ./... -count=1 reaches exit 0 on this branch — 176 packages, 0 failures. No commit on v1.8-dev currently reaches that. go vet ./... exits clean repo-wide after the IPv6 fix, so the new gate ships without an exception baked in. gofmt clean.

Caveats, stated rather than left for a reader to trip over: quoted lint timings are warm-cache and are not a contributor's first-run cost, which was not measured; make lint-all reports 197 capped and 414 uncapped, which are different measurements; and internal/consensus fails in CI at roughly 18% per run on v1.8-dev independently of this PR, so a single green suite run is not evidence that flake is absent.

A note on branch names, because this PR predates a rename: every measurement above was taken on this PR's base branch, which was called v1.7-dev when the work was done and is now v1.8-dev. The branch that carries the name v1.7-dev today is a different lineage (the 1.7.0 release line) and none of these numbers describe it. The text has been updated to the current names so a reader checking the figures runs them against the branch they were measured on.

🤖 Generated with Claude Code

https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj

lklimek and others added 5 commits September 7, 2026 08:15
Three manifest-parsing errors in LoadTestnet formatted the result of the
failed strconv.Atoi rather than the input that failed it. Atoi returns 0
on error, so every malformed key in validator_updates, chain_lock_updates
and consensus_version_updates was reported as height 0 — the same message
for any typo, never naming the key the operator had to go and correct.

Print heightStr, which is the map key that failed to parse. Every other
parse error in the repository already quotes the offending string this
way; these three were the exception.

The chain-lock loop also carried the validator loop's wording, so a bad
chain_lock_updates key sent the reader to the wrong manifest section.

`go test` runs a subset of `go vet` before building, and its printf check
rejects %q with an int argument, so test/e2e/pkg failed to build and
`go test ./...` could not pass on a clean checkout. That is a consequence
of the same defect: the argument was wrong, not the verb.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
`make lint` ran golangci-lint unfiltered over the whole repository. That
repository carries several hundred pre-existing findings, so the target
could not exit 0 on a clean checkout of any branch and was unusable as a
gate. CI meanwhile filters with --new-from-rev against the pull request's
target branch and reports only findings on lines the branch changed, so
the two disagreed about what "lint passes" means -- and the local one was
the one contributors could not act on.

`make lint` now runs what CI runs. The unfiltered view keeps its value for
anyone reducing the backlog, so it stays as `make lint-all` rather than
being deleted.

The version pinned here was v2.8 while CI resolves v2.12, which is two
minors of new rules apart; a local run could pass a gate CI then failed.
Both now name the same floating minor, so a patch release moves them
together.

LINT_BASE selects the base ref and is overridable for other release lines.
Its default is a fixed ref rather than the current branch's upstream: a
gate whose scope changes per contributor is not a gate. Both git
preconditions are checked before the linter starts, because a missing ref
or a shallow clone otherwise surfaces as a puzzling lint result rather
than as the git problem it is.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
BASE_BRANCH was left behind when the protobuf generation targets that read
it were removed. Nothing in the repository references it; the only mention
is its own declaration.

It is not inert. Being `?=`, an exported BASE_BRANCH from a contributor's
environment silently takes effect, and its default names a branch six
release lines old. A variable that looks like the base-ref setting for the
lint target, but is not read by it, is a trap for whoever adjusts it next
and finds the gate unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
ValidatorAddress.Hostname holds a bare IPv6 literal when the address was
given as one -- url.Hostname() strips the brackets, and types has a test
asserting tcp://[::1]:26656 parses to "::1". Joining that to a port with
fmt.Sprintf("%s:%d") produces "::1:26656", which is not a malformed
rendering of an address but a string that denotes nothing.

net.JoinHostPort brackets a v6 literal and leaves a v4 one untouched, so
the output is byte-identical for every address that works today. It is
also what this repository already does everywhere else, including
ValidatorAddress.String() ten lines from the field it reads and both
dial sites in internal/p2p; this call was the one place that disagreed
with its own type.

This does not make IPv6 work here. The dial network is "tcp4", so a v6
host is now refused on address family rather than failing on a nonsense
address -- a truthful error instead of a confusing one. Whether node-ID
resolution should support IPv6 validators, as the rest of p2p does, is a
question about connection establishment and is left alone deliberately.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
The Test workflow derives its package list from `go list` filtered on
.TestGoFiles, so a package without tests is never compiled there and the
vet subset `go test` runs never sees it. Lint reports only findings on
changed lines, so anything long-standing in such a package is filtered out
there too. Three formatting errors in test/e2e/pkg survived six years in
that gap, and a `go test ./...` on a clean checkout could not pass because
of them.

Add a Vet workflow running `go vet ./...` across the whole module, and a
`make vet` target for it to call so the local and CI invocations cannot
drift -- the divergence between `make lint` and the lint workflow is what
hid the same class of defect on the other side.

The job has no trigger filter. Each existing filter is defensible on its
own and the defect fell through all of them together, so a gate whose
purpose is catching what they miss does not get one; it costs about a
minute of runner time, in parallel with the test shards, and is bounded by
a compile the other workflows already perform.

The Go version is pinned exactly rather than to a range. vet's diagnostics
differ between toolchain releases, and a floating version would let this
gate change what it enforces with no change to the repository.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_019gAC8rAzQagn5sgDxUJNjj
@coderabbitai

coderabbitai Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f2cd0312-737e-4d08-a880-e81582da6d6e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 7, 2026 •

Copy link
Copy Markdown

🕓 Queued for automated review — 28th in line, estimated start in ~8 h (commit 2b98d59)
Estimated review time once started: ~35 min (two-phase automated review; median of recent runs).

  • Request priority review — tick this box and the review moves to the front of the queue.

@lklimek lklimek changed the title build,ci: make the local and CI quality gates actually check what they claim build(ci): make the local and CI quality gates actually check what they claim Sep 8, 2026
@lklimek
lklimek requested a lite review from Copilot September 8, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

make lint’s default LINT_BASE is inconsistent with the PR’s stated current base branch, so the local gate can diverge from CI’s --new-from-rev=origin/${{ github.base_ref }} behavior.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR makes the repository’s “quality gates” (local Make targets and CI workflows) actually exercise the checks they claim to run, by aligning lint behavior with CI, adding a repo-wide go vet gate, and fixing a couple of concrete vet/diagnostic issues uncovered by the new coverage.

Changes:

  • Fixes incorrect fmt.Errorf arguments in test/e2e/pkg/testnet.go so errors report the malformed manifest key string (and clears a go test/vet failure).
  • Updates make lint to match CI’s “new issues only” behavior via --new-from-rev, adds lint-all, and adds a make vet target.
  • Fixes TCP address formatting in node ID resolution to use net.JoinHostPort, improving correctness for IPv6-literal addresses in diagnostics.
  • Adds a new Vet GitHub Actions workflow that runs make vet across all packages.
File summaries
File Description
test/e2e/pkg/testnet.go Corrects error formatting to report the input key (heightStr) instead of the parsed height.
Makefile Makes lint reflect CI’s new-issues gate, adds lint-all, and introduces vet.
dash/quorum/nodeid_resolver.go Uses net.JoinHostPort to format host/port safely (esp. IPv6 literals).
.github/workflows/vet.yml Adds CI gate to run go vet ./... repo-wide.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Makefile Resolved

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 2 only (queue backlog)

Both supplied findings are confirmed at head 32c34bf and prevent the local quality gates from meeting this PR's stated goal. Default lint fails on the obsolete base ref; vet and lint with a corrected base fail to locate BLS headers despite the native build being present. Repository-wide vet and lint against the pre-PR commit succeed when invoked through the Makefile's configured Go wrapper; no tracked files were changed.

Source: reviewer 1: gpt-6-astra (agent: phase2-reviewer, role: general); final verifier: gpt-6-astra (agent: astra-verifier, role: final-verifier)

Review provenance

  • Triage: critical by gpt-6-astra (effort low) — Although most changes are contained quality-gate tooling and diagnostics, the PR also changes address construction in the quorum node-ID resolver’s live connection path, touching networking and warranting the critical tier under the stated criteria.
  • Phase 1 reviewers: not run (skipped for throughput: 51 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6-astra — final-verifier; agent astra-verifier
  • Phase 2 reviewers: gpt-6-astra — general (completed, effort xhigh); agent phase2-reviewer

🔴 2 blocking

🤖 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 `Makefile`:
- [BLOCKING] Makefile:287: Default the lint comparison to the current development branch
  This PR targets v1.8-dev, and CI selects origin/${{ github.base_ref }}, but the new local default selects origin/v1.7-dev. In this checkout, which contains origin/v1.8-dev but not the old ref, make lint fails at the base-ref preflight. Where origin/v1.7-dev exists, it now identifies a different release lineage, so local lint evaluates a different diff from CI. Default to origin/v1.8-dev and retain LINT_BASE for explicit overrides.
- [BLOCKING] Makefile:317: Pass the configured CGO environment to the local quality gates
  The Makefile defines the repository's BLS include and library paths in non-exported CGO variables, but this recipe invokes plain go rather than $(GO). With the native BLS build present, make vet fails with 'dashbls/bls.hpp file not found'. The plain go invocation in GOLANGCI_LINT at line 279 causes the same type-check failure after correcting LINT_BASE. CI supplies exported CGO flags and globally installed BLS, so its success does not establish that these local gates work. Invoke vet through $(GO), and change GOLANGCI_LINT to start with $(GO) run. Both repository-wide vet and filtered lint succeeded with that configuration. Although lint previously omitted these flags too, fixing that omission is required for this PR's explicit goal of making local lint reproduce the CI gate.

Comment thread Makefile Resolved
Comment thread Makefile Resolved
@lklimek
lklimek merged commit 578b8db into v1.8-dev Sep 9, 2026
21 checks passed
@lklimek
lklimek deleted the fix/local-gates branch September 9, 2026 07:23
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.

3 participants