fix: lint cleanup across repo (errcheck, staticcheck, ineffassign, unused)

- daemon.go: real bug — maybeRetryParked resolved fg := d.forgeFor(task)
  (matching markDead's pattern) but called d.Forge.SetStateLabel instead
  of fg.SetStateLabel, silently using the wrong forge client for
  multi-identity/multi-forge task routing. Fixed to use fg throughout.
- telegram.go: updateThreadID existed but was never called anywhere;
  wired it into updateLoggingMiddleware so debug logs include thread_id.
- Two SA9003 empty-branch tests (nell adapter_test.go, tools
  toolentry_test.go) were dead assertions with no body; implemented the
  actual check instead of deleting them.
- memory manager_test.go: mockProvider.lastConfigSchema/lastBackupPaths
  were declared but never recorded; wired GetConfigSchema/BackupPaths to
  populate them and strengthened the aggregation tests to assert on
  per-provider content, not just counts.
- Removed genuinely dead gateway messageevent_test.go helpers (intPtr/
  i64Ptr, marked //go:fix inline, already fully superseded by the new()
  builtin used throughout the file).
- Remaining errcheck findings (defer Close/Flush/Write, os.Setenv, etc.
  in test files) fixed with the existing `_ = ` convention already used
  elsewhere in the codebase.

go build ./..., go test ./... (all packages ok), and
golangci-lint run ./... all clean.
This commit is contained in:
sam committed 2026-07-27 03:49:33 +10:00
1 parent 64352a06f3
commit 6fe1a7d037
19 files changed
+219 -183

No files matched your search

+2 -2
View File
@@ -86,8 +86,8 @@ func TestEnvelopeJSONRoundTrip(t *testing.T) {
t.Errorf("expected error 'request failed', got %v", decoded.Err())
}
// Error field flattens into parent JSON.
if decoded.Envelope.Error != "request failed" {
t.Errorf("Error = %q", decoded.Envelope.Error)
if decoded.Error != "request failed" {
t.Errorf("Error = %q", decoded.Error)
}
})
}