Skip to content

lint(errcheck): reasons for the nine bare suppressions - #367

Merged
David-Noble-at-work merged 1 commit into
developfrom
lint/errcheck-reasons
Aug 11, 2026
Merged

David-Noble-at-work merged 1 commit into
developfrom
lint/errcheck-reasons

Conversation

@David-Noble-at-work

Copy link
Copy Markdown
Contributor

Phase 1a of the audit remediation plan (issue #365).

Nine //nolint:errcheck directives carried no reason. The repository already has a convention for this — 32 sites use it — placing the directive on its own line above the statement:

//nolint:errcheck // diagnose-ignored-error: <reason>; see docs/architecture/2.8-eventing-infrastructure.md

These nine now match it, rather than inventing new wording.

Site Reason given
internal/console/console.go ×6 console write
internal/pwsh/pwsh.go audit log write
cmd/lore/lore/commands.go (Scanln) a failed read leaves response empty, which cancels
cmd/lore/lore/commands.go (MarkFlagRequired) "from" is registered immediately above

The two cmd/lore reasons cite the specific behavior that makes each discard safe, rather than asserting it is safe. For Scanln, a short read leaves response empty and the following EqualFold treats that as "not y" — the prompt cancels, which is the correct outcome.

Bare nolint directives: 18 → 9. The nine remaining are all gocognit/gocyclo and belong to stage 1b, where ruling 4 decomposes them under the #312 discipline and deletes the suppressions rather than annotating them.

Verified: make vet, make build, and the full make test suite green — zero FAIL or panic lines, counted rather than read off a truncated tail. gofmt clean over the change set. Comment-only; no behavior change.

Nine //nolint:errcheck directives carried no reason at all, against 32 sites
already using the repository's convention: the directive on its own line above
the statement, reading "diagnose-ignored-error: <reason>; see
docs/architecture/2.8-eventing-infrastructure.md". These nine now match it.

Six are console writes (internal/console/console.go) and one an audit-log write
(internal/pwsh/pwsh.go) — terminal and file output with no recovery path. In
cmd/lore/lore/commands.go the Scanln at the low-confidence confirmation prompt
cites the behavior that makes the discard safe: a failed read leaves response
empty, which the following EqualFold treats as "not y" and cancels. The
MarkFlagRequired cites that "from" is registered immediately above, which is
the only condition under which it can fail.

Bare nolint directives in the tree: 18 -> 9. The nine that remain are all
gocognit/gocyclo, and they are stage 1b's scope, where ruling 4 decomposes and
deletes them rather than annotating them.

Verified: make vet, make build, and the full make test suite green — zero FAIL
or panic lines, counted rather than read off a truncated tail. gofmt clean over
the change set.
Plan: docs/plans/audit-remediation.md (phase 1a).
Issue: #365
@David-Noble-at-work David-Noble-at-work self-assigned this Aug 11, 2026
@David-Noble-at-work
David-Noble-at-work merged commit e19d35c into develop Aug 11, 2026
5 checks passed
@David-Noble-at-work
David-Noble-at-work deleted the lint/errcheck-reasons branch August 11, 2026 22:27
David-Noble-at-work added a commit that referenced this pull request Aug 11, 2026
…verdicts (#370)

Reviewing cmd/lore and cmd/writ for the issue #365 phase 1b decomposition
surfaced two correctness defects. Both are recorded as their own issues and
plans rather than folded into behavior-preserving refactoring work, where a
semantic change would hide inside an extract-method diff.

Issue #368 — lore deploy silently skips a manifest it cannot load.
parseLoreDeployConfig logs the failure and continues, so the error return is
dead and the //nolint:unparam on it documents a consequence as an intention.
"lore deploy @typo.yaml some-package" deploys some-package and exits 0, having
fulfilled half the request; "lore deploy @typo.yaml" reports "no packages to
deploy", which is the wrong cause. Parsing precedes all deployment, so aborting
costs nothing already done.

Issue #369 — writ segment matching ignores its own suffix grammar. The grammar
is [<project>|common][.<os>][.<distro>][.<arch>][.<custom>...] and segment.go:18
states it, but ParseDirName discards position and Match tests each suffix against
one flat set of every dimension's values. So order is never validated
(common.arm64.Darwin is accepted), position never selects a dimension, and
specificity is a suffix count that cannot rank DISTRO above OS. common.Unix and
common.Darwin both measure 1 on a Mac and tie; the tie is then resolved by
sort.Slice, which is unstable, so the winner is undefined by contract.

The phase 1b verdicts are recorded with measured gocyclo and gocognit for all
nine targets. Ruling 5 is added: treatment is decided per function by whether it
reads as steps. That produced five treatments rather than one — six extract, one
flattens, one keeps an argued suppression, and applyGraphModifications needs no
work at all (gocyclo 7, gocognit 8, under both thresholds; its directive
suppresses nothing).

buildMultiSource is deferred to #369. Its collision predicate at builder.go:280
has zero coverage, confirmed by make cover, and is reachable only through a tie
whose winner is undefined. A behavior-preserving refactor of a predicate with no
defined behavior is not possible.

Phase 1a is marked completed — PR #367, bare nolint directives 18 to 9.

Documentation only; no code changes.
Issues: #365, #368, #369

Co-authored-by: David Noble <[email protected]>
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