Skip to content

chore: errcheck cleanup + flip lint job to blocking#71

Merged
tzone85 merged 2 commits into
mainfrom
chore/errcheck-cleanup
Jun 11, 2026
Merged

chore: errcheck cleanup + flip lint job to blocking#71
tzone85 merged 2 commits into
mainfrom
chore/errcheck-cleanup

Conversation

@tzone85

@tzone85 tzone85 commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

`golangci-lint` reports 0 issues across the project (default-standard linters, 5 minute timeout). The `lint` job in CI lost its `continue-on-error: true` and is now a blocking gate.

Before: 473 errcheck hits + 9 staticcheck QF/SA warnings. After: 0.

What changed

Silent event-store failures fixed (44 sites) in `internal/cli/{approve,reject,resume}.go` + `internal/engine/{conflict_resolver,monitor_dispatch,monitor_escalation,monitor_post_execution,reaper,supervisor,watchdog}.go`. Every story state transition now logs append/project failures with full story-ID context. This is the load-bearing part of the PR — lost audit-trail events were the real risk.

Dangerous data-write sites now return wrapped errors (15):

File What it persists
`improve/discovery.go` discovered-sources JSONL
`improve/opportunities.go` opportunity pipeline JSONL
`improve/repolearn.go` learning entries
`memory/server.go` revenue + opportunity + source state
`state/sqlite.go` `projectStoryRewritten` Exec calls
`engine/executor.go` launch-config artifact + log dir
`engine/monitor_post_execution.go` review + QA artifacts
`cli/init.go` store close errors propagate

Best-effort cleanup sites (~30) carry explicit `_ =` discards with one-line rationale (deferred Close, `git rebase --abort` after failed rebase, exec.Cmd.Run for stale-branch cleanup, `fmt.Sscanf` with valid zero-fallback semantics).

Config-level noise suppression in `.golangci.yml`: `exclude-functions` covers benign sites (`fmt.Fprint*` to stdout/stderr, `(io.Closer).Close`, `tabwriter.Flush`, HTTP body close). Test-file exemption widened from errcheck-only to all linters so test refactor hints (QF1011/QF1003) don't fail CI.

Staticcheck QF/SA fixes in production code:

  • QF1012 (`WriteString(fmt.Sprintf)` → `fmt.Fprintf`) across `codegraph/analysis.go`, `devdb/docker/pg.go`, `engine/{criteria_db,integration_fix,metrics,summary,verification_loop}.go`, `improve/feedback.go`, `repolearn/profile.go`
  • QF1002 / QF1003 tagged-switch refactors in `repolearn/scanner.go`
  • QF1001 De Morgan's law in `sqlsafety/sql_safety.go` (`!(s[i] == '' && s[i+1] == '/')` → `(s[i] != '' || s[i+1] != '/')`)

Misc: `metrics.go` CRLF→LF normalised (it was the reason a perl rewrite missed half the file).

Test plan

  • `go build ./...` clean
  • `go vet ./...` clean
  • `go test ./... -count=1` — all 30 packages pass
  • `golangci-lint run --timeout=5m ./...` returns 0 issues
  • `.github/workflows/ci.yml` lint job runs without `continue-on-error: true`
  • CLAUDE.md item 53 added; "Still open" section shrunk by one entry
  • Obsidian launch playbook updated

tzone85 added 2 commits June 11, 2026 16:31
golangci-lint reports 0 issues across the project (default-standard linters,
5 minute timeout). The lint job in CI lost its continue-on-error: true and
is now a blocking gate.

What changed:

- 44 silent event-store / projection-store sites (Append + Project) across
  internal/cli + internal/engine now log with full story-ID context.
  Lost audit-trail events were the load-bearing risk here — every story
  state transition now has a non-silent failure path.

- 15 dangerous data-write sites now return wrapped errors:
  - improve/discovery.go, improve/opportunities.go, improve/repolearn.go:
    f.Write to opportunity/learning JSONL files
  - memory/server.go: revenue/opportunity/source persistence
  - state/sqlite.go: projectStoryRewritten Exec calls (title/desc/AC/complexity)
  - engine/executor.go: launch-config artifact + log-dir creation
  - engine/monitor_post_execution.go: review/QA artifact writes
  - cli/init.go: store close errors propagate
  - cli/{approve,reject,resume}.go: event append/project errors propagate

- ~30 best-effort cleanup sites carry explicit `_ =` discards with a
  one-line rationale (deferred Close, git rebase --abort after a failed
  rebase, exec.Cmd.Run() for stale-branch cleanup, fmt.Sscanf with valid
  zero-fallback semantics).

- .golangci.yml gains exclude-functions for benign noise: fmt.Fprint*
  writes to stdout/stderr, (io.Closer).Close, tabwriter.Flush, HTTP body
  close. Test-file exemption widened to cover all linters (not just
  errcheck) so test refactor hints (QF1011, QF1003, etc.) don't fail CI.

- staticcheck QF1012 / QF1002 / QF1001 / SA9003 fixes across production
  code (WriteString(fmt.Sprintf) → fmt.Fprintf, tagged switch, De Morgan).

- CRLF→LF normalised in metrics.go (was the reason a perl rewrite missed
  half the file).

Verified: go build, go vet, full test suite (30 packages) pass.
v2.5.0 was built with Go 1.25 and rejects the Go 1.26.4 toolchain pinned
in PR #66. v2.12.2 is built with the current Go release line.
@tzone85 tzone85 merged commit 551ae8d into main Jun 11, 2026
5 checks passed
tzone85 added a commit that referenced this pull request Jun 16, 2026
* chore: errcheck cleanup + flip lint job to blocking

golangci-lint reports 0 issues across the project (default-standard linters,
5 minute timeout). The lint job in CI lost its continue-on-error: true and
is now a blocking gate.

What changed:

- 44 silent event-store / projection-store sites (Append + Project) across
  internal/cli + internal/engine now log with full story-ID context.
  Lost audit-trail events were the load-bearing risk here — every story
  state transition now has a non-silent failure path.

- 15 dangerous data-write sites now return wrapped errors:
  - improve/discovery.go, improve/opportunities.go, improve/repolearn.go:
    f.Write to opportunity/learning JSONL files
  - memory/server.go: revenue/opportunity/source persistence
  - state/sqlite.go: projectStoryRewritten Exec calls (title/desc/AC/complexity)
  - engine/executor.go: launch-config artifact + log-dir creation
  - engine/monitor_post_execution.go: review/QA artifact writes
  - cli/init.go: store close errors propagate
  - cli/{approve,reject,resume}.go: event append/project errors propagate

- ~30 best-effort cleanup sites carry explicit `_ =` discards with a
  one-line rationale (deferred Close, git rebase --abort after a failed
  rebase, exec.Cmd.Run() for stale-branch cleanup, fmt.Sscanf with valid
  zero-fallback semantics).

- .golangci.yml gains exclude-functions for benign noise: fmt.Fprint*
  writes to stdout/stderr, (io.Closer).Close, tabwriter.Flush, HTTP body
  close. Test-file exemption widened to cover all linters (not just
  errcheck) so test refactor hints (QF1011, QF1003, etc.) don't fail CI.

- staticcheck QF1012 / QF1002 / QF1001 / SA9003 fixes across production
  code (WriteString(fmt.Sprintf) → fmt.Fprintf, tagged switch, De Morgan).

- CRLF→LF normalised in metrics.go (was the reason a perl rewrite missed
  half the file).

Verified: go build, go vet, full test suite (30 packages) pass.

* ci: bump golangci-lint to v2.12.2 (Go 1.26 compatible)

v2.5.0 was built with Go 1.25 and rejects the Go 1.26.4 toolchain pinned
in PR #66. v2.12.2 is built with the current Go release line.

---------

Co-authored-by: Thando Mini <tzone85@users.noreply.github.com>
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