Skip to content

fix(lint): clear the 14 findings ziglint reported on its first real run - #18

Merged
alleneubank merged 1 commit into
mainfrom
fix/ziglint-findings
Aug 21, 2026
Merged

alleneubank merged 1 commit into
mainfrom
fix/ziglint-findings

Conversation

@alleneubank

Copy link
Copy Markdown
Owner

zig build lint had never executed anywhere — it shells out to a binary nothing installed — so findings had been accumulating unseen. With ziglint now in the flake (#17), it reports 14. This clears them and adds the floor that keeps them cleared.

The findings

11x Z030deinit frees the struct's memory but leaves the struct readable, so a later use returns plausible bytes instead of failing. self.* = undefined poisons it, which in ReleaseSafe turns use-after-deinit into a loud crash.

The GraphqlClient.Response case is the one that matters: every parsed field is a slice into parsed's arena, so any read after deinit was already use-after-free. It now fails loudly instead.

bulk.Targets was resetting items/storage by hand at the end of deinit. It is only ever reached through defer at scope exit, so nothing could observe those resets — poisoning replaces them rather than adding to them.

1x Z020 — an anonymous struct bound @This() inline; now const Self = @This().

2x Z010return Error.RequestTimedOut where the inferred error set already covers it; now return error.RequestTimedOut. Note ziglint flagged 2 of the 3 occurrences; the third is fixed too for consistency.

The floor

CI gains a lint job running nix develop -c zig build lint. A finding the harness should have caught earns a floor, not just a patch — without one this drifts straight back, which is how it reached 14 in the first place.

Verification

  • zig build test — passes
  • zig build lint0 findings (was 14)
  • zig fmt --check — clean

`zig build lint` had never executed anywhere — it shells out to a binary
nothing installed — so the findings had been accumulating unseen. With
the tool now in the flake, it reports 14.

11 are Z030: deinit frees the struct's memory but leaves the struct
readable, so a later use returns plausible bytes instead of failing.
`self.* = undefined` poisons it, which in ReleaseSafe turns
use-after-deinit into a loud crash. The GraphqlClient Response case is
the one that matters: every parsed field is a slice into `parsed`'s
arena, so any read after deinit was already use-after-free.

bulk.Targets was resetting `items`/`storage` by hand at the end of
deinit. It is only ever reached through `defer` at scope exit, so nothing
could observe those resets — poisoning replaces them rather than adding
to them.

The rest: one anonymous struct binding `@This()` inline (now
`const Self = @this()`), and `return Error.RequestTimedOut` ->
`return error.RequestTimedOut`. ziglint flagged two of the three
occurrences; the third is changed too, because leaving one behind would
be the only reason a reader would think the two forms differ. They do
not — Zig error sets are global, so both name the same error value.
`pub const Error` stays as the module's declared error contract.

CI gains a `lint` job running through the flake dev shell. A finding the
harness should have caught earns a floor, not just a patch — without it
this drifts straight back, which is how it got to 14.

Verified: `zig build test` passes, `zig build lint` reports 0 findings,
`zig fmt --check` clean.
@alleneubank
alleneubank force-pushed the fix/ziglint-findings branch from e6e0bd8 to dd375aa Compare August 21, 2026 17:02
@alleneubank
alleneubank merged commit b15105b into main Aug 21, 2026
3 checks passed
@alleneubank
alleneubank deleted the fix/ziglint-findings branch August 21, 2026 17:14
@alleneubank alleneubank mentioned this pull request Aug 21, 2026
alleneubank added a commit that referenced this pull request Aug 21, 2026
Bumps the four manifests. 0.3.0 shipped to GitHub but never reached npm
(the release token had expired), so this is the first tag that exercises
trusted publishing end to end and the first that gets npm off 0.2.11.

Content is 0.3.0 plus the ziglint fixes from #18.
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