Skip to content

ci: lint job (ruff + golangci-lint) + baseline cleanup#4

Merged
KI7MT merged 2 commits into
mainfrom
ci/lint
May 10, 2026
Merged

ci: lint job (ruff + golangci-lint) + baseline cleanup#4
KI7MT merged 2 commits into
mainfrom
ci/lint

Conversation

@KI7MT

@KI7MT KI7MT commented May 10, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a lint gate to CI alongside the test matrix. Cleans up the small amount of lint debt surfaced on the v0.3.8 codebase.

Type of change

  • Tests / CI
  • Refactor (no behavior change — lint cleanup only)
  • Build / packaging (version bump 0.3.8 → 0.3.9)

What this catches

Layer Tool What it checks
Python ruff check E/F (errors), I (imports), B (bugbear), UP (pyupgrade), SIM (simplify)
Go golangci-lint v2 Standard set + misspell, unconvert, gocritic

Cleanup applied

File Issue Fix
src/agent_inbox/db.py UP035 (typing.Callable/Iterator deprecated) Moved imports to collections.abc
src/agent_inbox/db.py SIM108 (if/else for assignment) Replaced with ternary
tests/test_concurrency.py F401 (unused import) Removed typing.Any
tests/test_patton_v035.py F401, F841 Removed unittest.mock import + dead full variable

Go side was already clean against the chosen config — zero issues, no source changes.

Aggregator update

ci-all-green now requires [lint, python, go-and-frontend] to all succeed. Single stable check name for the eventual branch protection ruleset.

Checklist

  • All tests passing locally (159 Python + 7 Go)
  • ruff check clean
  • golangci-lint run clean
  • No secrets / debug logging

Notes for the reviewer

Doesn't add backward-incompatible behavior; pure infra + cosmetics. The errcheck *database/sql.Rows.Close exclusion is the idiomatic Go practice — see linters-settings.errcheck.exclude-functions in ui/.golangci.yml for the rationale.

KI7MT added 2 commits May 10, 2026 00:01
Adds a lint gate to CI alongside the existing test matrix, with a
small one-time cleanup of what surfaced on the v0.3.8 codebase.

Python (ruff)
==============
Config in pyproject.toml [tool.ruff]:
  line-length = 100
  target-version = "py310"
  select = E, F, I, B, UP, SIM
  ignore = E501

Cleanup applied:
  - src/agent_inbox/db.py:
    * UP035: imports moved from `typing` to `collections.abc` for
      Callable + Iterator
    * SIM108: replaced if/else with ternary in insert_message status
      assignment
  - tests/test_concurrency.py: removed unused `typing.Any` import (F401)
  - tests/test_patton_v035.py: removed unused `unittest.mock` import
    (F401) and dead `full` set in test_broadcast_calls_agents_once_per
    target (F841)

ruff itself added to dev deps (>=0.6).

Go (golangci-lint v2)
=======================
Config at ui/.golangci.yml:
  version: "2"
  default linter set: standard
  enabled extras: misspell, unconvert, gocritic
  gocritic: ifElseChain disabled (reads worse than the chain in our code)
  errcheck: exclude (*database/sql.Rows).Close — `defer rows.Close()`
    is the idiomatic Go pattern and the actionable error cases are
    checked elsewhere; we don't want to noise up code with `_ =` shims

Code is already clean against this config — zero issues — so no
source changes needed.

CI integration
================
New job: lint (ruff + golangci-lint), parallel with the test matrix,
ubuntu-only. ci-all-green aggregator updated to require lint as well,
so future branch-protection rulesets keep covering it via the single
stable check name.

Tests
=======
159 Python + 7 Go still passing locally, no behavior changes.
golangci-lint type-checks the Go sources, which means it needs to
resolve //go:embed all:frontend/dist in main.go — same prereq the
go test job already handles. Without the build step the lint action
fails with 'invalid go:embed: build system did not supply embed
configuration' before any actual lint check runs.

Caught immediately in the v0.3.9 PR's first CI run. Adding npm ci +
npm run build before the golangci-lint action mirrors the test job.
@KI7MT KI7MT merged commit 534c6e7 into main May 10, 2026
11 checks passed
@KI7MT KI7MT deleted the ci/lint branch May 10, 2026 00:06
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