Skip to content

chore: bring the gate up to the standard of the sibling packages - #30

Merged
sylvesterdamgaard merged 2 commits into
mainfrom
polish/gate-and-branding
Aug 14, 2026
Merged

chore: bring the gate up to the standard of the sibling packages#30
sylvesterdamgaard merged 2 commits into
mainfrom
polish/gate-and-branding

Conversation

@sylvesterdamgaard

Copy link
Copy Markdown
Contributor

CI ran tests, a race pass and golangci-lint, and nothing else. It reported no
vulnerable dependencies, no licence problems and no formatting drift — because
it never looked for any of them.

The gate

Ported from cboxdk/fpm-exporter, where these were built last week:

  • govulncheck
  • A deterministic CycloneDX 1.5 SBOM. cyclonedx-gomod records the
    pseudo-version of HEAD, tags purls with the generating host's goos/goarch
    and embeds hashes of its own binary — so a laptop and a runner could never
    agree. tools/sbomnorm normalises all three; the committed file changes only
    when dependencies do.
  • A dependency licence check reading that SBOM rather than the network, so
    CI and offline give the same answer. 63 dependencies, all permissive, no
    exceptions needed
    (fpm-exporter needs one, for gopsutil's MPL-2.0
    Apple-Silicon helper; nothing here does).
  • gofmt and go mod tidy drift checks. 26 files were not gofmt-clean.
  • make check, running the identical set locally.

Linters

bodyclose, errorlint and misspell — added one at a time after fixing what
each surfaced, which is what this repo's own .golangci.yml says to do. Seven
findings, three real:

  • handleExecutionError type-asserted on the error instead of errors.As
  • two ==/!= comparisons against sentinel errors

Four are documented as deliberate rather than changed. Three are in the snapshot
client, where the existing comment explains that the cause is joined with %v
on purpose: wrapping it with %w would make it matchable and defeat the design
that callers test for ErrUnavailable and nothing else. The fourth is a
bodyclose false positive where the response body is the stream and is closed
by the reader goroutine.

Branding

The PHPeek name survived the rebrand in six places, two of them user-visible:
the TUI header, its keyboard-shortcut screen, the audit log's start and shutdown
records, the build-info metric's help text, and a config warning.

Scale-to-zero was treated as untouchable

Across internal/snapshot, internal/process and internal/autotune there is
exactly one production line changed:

-if err == syscall.ECHILD {
+if errors.Is(err, syscall.ECHILD) {

Equivalent for the bare errno Wait4 returns, and correct if it is ever
wrapped. Everything else in those packages is comments and test formatting.
go test -race passes over both internal/snapshot and internal/process in
full, not just -short.

Note on govulncheck's first run

It reports seven standard-library advisories against a local Go 1.26.4. All
are fixed in 1.26.6, and CI pins '1.26', which resolves to the latest patch —
so released binaries are unaffected. Worth knowing that the answer was simply
never being asked before.

CI ran tests, a race pass and golangci-lint, and nothing else. It reported no
vulnerable dependencies, no licence problems and no formatting drift because it
never looked for any of them.

Added, ported from cboxdk/fpm-exporter:
  - govulncheck
  - a deterministic CycloneDX 1.5 SBOM (tools/sbomnorm normalises the
    generator's host-dependent fields, so the committed file only changes when
    dependencies do)
  - a dependency licence check (tools/licensecheck) reading that SBOM rather
    than the network, so CI and offline agree. 63 dependencies, all permissive,
    no exceptions needed.
  - gofmt and `go mod tidy` drift checks
  - `make check`, running the identical set locally

Enabled bodyclose, errorlint and misspell -- one at a time after fixing what
each surfaced, which is the policy this repo's own .golangci.yml states. Seven
findings: three real fixes (a type assertion and two == comparisons on errors,
all of which stop matching once an error is wrapped), and four documented as
deliberate. Of those, three are in the snapshot client, where wrapping the cause
with %w instead of %v would make it matchable and defeat the stated design that
callers test only for ErrUnavailable; the fourth is a bodyclose false positive
where the response body is the stream and is closed by the reader goroutine.

26 files were not gofmt-clean.

The PHPeek name survived the rebrand in six places, two of them user-visible:
the TUI header and its keyboard-shortcut screen, the audit log's start and
shutdown records, the build-info metric's help text, and a config warning.

Scale-to-zero was treated as untouchable. Across internal/snapshot,
internal/process and internal/autotune the only production change is one line in
reap.go -- `err == syscall.ECHILD` becomes `errors.Is(err, syscall.ECHILD)`,
equivalent for the bare errno Wait4 returns and correct if it is ever wrapped.
Everything else there is comments and test formatting. Verified with
`go test -race` over both packages in full.
…pted

Two failures from the previous commit, both mine.

The licence checker's exception `reason` field was never read here: this repo
needs no exceptions, so the map is empty and the field was dead. It now prints
each accepted exception with its reason, which is what an operator actually
wants to see -- a count says nothing about whether the reasoning still holds.

govulncheck failed on six standard-library advisories. `go-version: '1.26'`
resolved to 1.26.5, and all six are fixed in 1.26.6 -- so the scan job was
running on a toolchain that still shipped them. Pinned to the patch. My earlier
claim that CI was unaffected because it tracked the latest patch was wrong:
released binaries were built on 1.26.5 too.
@sylvesterdamgaard
sylvesterdamgaard merged commit 8a0c57d into main Aug 14, 2026
8 checks passed
@sylvesterdamgaard
sylvesterdamgaard deleted the polish/gate-and-branding branch August 14, 2026 09:55
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