Skip to content

fix(retention): clear the lint findings in the retention plugin - #109

Merged
juicycleff merged 1 commit into
mainfrom
fix/retention-lint
Sep 6, 2026
Merged

juicycleff merged 1 commit into
mainfrom
fix/retention-lint

Conversation

@juicycleff

Copy link
Copy Markdown
Contributor

golangci-lint reports ten findings in plugins/retention on main, which
fails the ci / Lint job on every open PR regardless of what that PR touches.
It is currently red on #108, whose diff is three files and none of them here.

CI's output understates the problem

golangci-lint defaults to max-same-issues: 3, so it printed three bodyclose
findings where there were twenty-two. Fixing only the named lines surfaces
the next three. Worth knowing before trusting a pasted lint list as complete.

What changed

bodyclose, 22 sites. fakeResp builds a synthetic *http.Response for
classifyHTTPError to inspect. It has no Body: classification reads only the
status and headers, and nothing came from a real transport. The linter flags
the call sites because the function returns *http.Response, so they carry a
directive; closing a nil Body would panic. The reasoning sits on fakeResp
itself rather than being repeated 22 times.

errcheck, store_models.go. Job.Payload is a map[string]string, which
has no channel, func or cyclic value that could make json.Marshal fail.
Documented rather than given an error path that can never run.

govet shadow, provider_hubspot.go. The inner err in the PATCH branch
shadowed the one from findContactByEmail; renamed to patchErr.

revive unused-parameter, 6 handlers. Renamed r to _ where the handler
ignores the request — only those. The other handlers in these files do read
r, and renaming them all breaks compilation.

unparam, consent_test.go. Every caller passed purpose as "marketing",
so the parameter carried no information. Dropped, with the value bound as a
local const.

unused, provider_generic.go. Dropped classifierPolicyDecided, which no
longer gated anything, and kept its rationale as a comment. The point it makes
is worth keeping: an unwritten retry policy that only surfaced at the first CRM
error would decide by accident whether a transient 503 permanently drops a
customer's sync.

Verification

Full-repo golangci-lint run ./... on CI's exact version (2.12.2): 0 issues.
All 98 packages build and test clean.

Merging this should turn ci / Lint green on #108 and anything else currently
open.

golangci-lint reports ten findings in plugins/retention on main, which fails
the Lint job on every open PR regardless of what that PR touches.

Worth knowing that CI's output understates the problem. golangci-lint defaults
to max-same-issues: 3, so it printed three bodyclose findings where there were
twenty-two. Fixing only the named lines surfaces the next three.

What changed:

bodyclose, 22 sites. fakeResp builds a synthetic *http.Response for
classifyHTTPError to inspect. It has no Body, because classification reads only
the status and headers and nothing came from a real transport. The linter flags
the call sites because the function returns *http.Response, so they carry a
directive; closing a nil Body would panic. The reasoning lives on fakeResp
itself rather than being repeated at each site.

errcheck, store_models.go. Job.Payload is a map[string]string, which has no
channel, func or cyclic value that could make json.Marshal fail. Documented
rather than given an error path that can never run. If Payload ever holds
something richer, this needs revisiting.

govet shadow, provider_hubspot.go. The inner err in the PATCH branch shadowed
the one from findContactByEmail; renamed to patchErr.

revive unused-parameter, 6 handlers. Renamed r to _ where the handler ignores
the request. Only those; the other handlers in these files do read r.

unparam, consent_test.go. Every caller passed purpose as "marketing", so the
parameter carried no information. Dropped it and bound the value as a local
const. Take a parameter again if a test needs a second purpose.

unused, provider_generic.go. Dropped the classifierPolicyDecided constant,
which no longer gated anything, and kept its rationale as a comment. The point
it makes is worth keeping: an unwritten retry policy that only surfaced at the
first CRM error would decide by accident whether a transient 503 permanently
drops a customer's sync.

Full-repo lint is clean and all 98 packages pass.
@juicycleff
juicycleff merged commit 23a47de into main Sep 6, 2026
18 checks passed
@juicycleff
juicycleff deleted the fix/retention-lint branch September 6, 2026 20:51
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