Skip to content

chore(lint): enable strict errorlint#1008

Merged
cpcloud merged 3 commits into
micasa-dev:mainfrom
cpcloud:worktree-harmonic-snuggling-sutherland
May 21, 2026
Merged

chore(lint): enable strict errorlint#1008
cpcloud merged 3 commits into
micasa-dev:mainfrom
cpcloud:worktree-harmonic-snuggling-sutherland

Conversation

@cpcloud
Copy link
Copy Markdown
Collaborator

@cpcloud cpcloud commented May 21, 2026

Summary

  • Pin the strict errorlint settings (errorf + errorf-multi + comparison + asserts) in .golangci.yml. The codebase passes cleanly across 700+ fmt.Errorf call sites.
  • Reuse the existing MIMEApplicationPDF constant for the in-package internal/extract/llmextract_test.go fixtures.
  • Refresh .claude/codebase/*.md to cover the packages that have landed since the last verification: relay, sync, crypto, mcp, sqlfmt, address, uid. Document the sync oplog hooks, the rlsdb.DB.Tx scoping rule, and the per-entity store_*.go split in internal/data/.

The original branch also extracted provider/tool/lock constants and converted backward loops to slices.Backward, but main landed equivalent (often broader) changes in #1006 first, so those commits dropped out during rebase. What's left is the errorlint pin, the test-fixture cleanup, and the codebase-map refresh.

@cpcloud cpcloud added chore Maintenance and housekeeping refactor Code restructuring without behavior change documentation Improvements or additions to documentation labels May 21, 2026
cpcloud added 3 commits May 21, 2026 09:53
errorlint was already enabled via `default: all` but ran with upstream
defaults (comparison + asserts only). Lock in the stricter `errorf` and
`errorf-multi` checks so future regressions to `%v`-wrapped errors get
caught at lint time. Codebase is already clean against these settings.
Extract semantic constants where the literal carries meaning:
- `internal/llm/client.go`: provider names (`providerLlamacpp`,
  `providerAnthropic`, `providerOpenAI`, etc.) so `localProviders` and
  the `createProvider` switch share a single source of truth.
- `internal/extract/ocr_progress.go`: `toolPDFToCairo` / `toolTesseract`
  for the strings emitted in `AcquireToolState.Tool`.
- `internal/relay/pgstore.go`: `lockForUpdate` for the GORM
  `clause.Locking.Strength` used in five FOR UPDATE call sites.
- `internal/extract/sqlcontext.go`: use existing `data.ColName`.
- `internal/extract/llmextract_test.go`: use existing
  `MIMEApplicationPDF` for the in-package fixtures.

Disable `goconst` in `.golangci.yml`: it produced 400+ findings here, the
overwhelming majority on UI labels, JSON test fixtures, and SQL keywords
where the literal IS the value. Also disable `gomodguard` (superseded by
`gomodguard_v2` in golangci-lint, which is already enabled via the
default-all set).
Update .claude/codebase/*.md to reflect the current layout:
- Add the packages that have landed since the last refresh: relay
  (Postgres + RLS), sync (encrypted oplog engine), crypto (NaCl keys
  and box encryption), mcp (Model Context Protocol server), sqlfmt
  (extracted SQL pretty-printer), address (postal-code lookup), uid
  (ULID wrapper).
- Document the SyncOplogEntry / SyncDevice models and the
  WithSyncApplying context flag that suppresses oplog writes on
  remote-apply.
- Note the relay Store interface (24 methods), the rlsdb.DB.Tx
  scoping rule, and the WithoutHousehold allowlist.
- Capture per-entity store_*.go file split and the new oplog.go /
  fts.go / defaults.go files in internal/data/.
- Add the errorlint strict configuration to the patterns reference.
@cpcloud cpcloud force-pushed the worktree-harmonic-snuggling-sutherland branch from 1048052 to ac96e0b Compare May 21, 2026 14:05
@cpcloud cpcloud changed the title chore(lint): enable strict errorlint, clean up backward loops chore(lint): enable strict errorlint May 21, 2026
@cpcloud cpcloud enabled auto-merge (squash) May 21, 2026 14:23
@cpcloud cpcloud merged commit b71a707 into micasa-dev:main May 21, 2026
41 of 43 checks passed
@cpcloud cpcloud deleted the worktree-harmonic-snuggling-sutherland branch May 21, 2026 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance and housekeeping documentation Improvements or additions to documentation refactor Code restructuring without behavior change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant