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:
1 parent
64352a06f3
commit
6fe1a7d037
19 files changed
+219
-183
No files matched your search
@@ -243,7 +243,7 @@ func TestPersistenceAcrossRestart(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer s2.Close()
|
||||
defer func() { _ = s2.Close() }()
|
||||
|
||||
task, err := s2.TaskByIssue(ctx, "acme", "todo", 1)
|
||||
if err != nil || task == nil {
|
||||
@@ -459,8 +459,8 @@ func TestStatusCountsAfterTransitions(t *testing.T) {
|
||||
s := openTest(t)
|
||||
ctx := context.Background()
|
||||
|
||||
s.EnqueueIssue(ctx, "acme", "repo", 1, "t1", "", "", "")
|
||||
s.EnqueueIssue(ctx, "acme", "repo", 2, "t2", "", "", "")
|
||||
_, _ = s.EnqueueIssue(ctx, "acme", "repo", 1, "t1", "", "", "")
|
||||
_, _ = s.EnqueueIssue(ctx, "acme", "repo", 2, "t2", "", "", "")
|
||||
|
||||
task1, _ := s.ClaimNext(ctx)
|
||||
task2, _ := s.ClaimNext(ctx)
|
||||
@@ -470,7 +470,7 @@ func TestStatusCountsAfterTransitions(t *testing.T) {
|
||||
t.Errorf("expected 2 running, got %d", counts[store.StatusRunning])
|
||||
}
|
||||
|
||||
s.Transition(ctx, task1.ID, store.StatusRunning, store.StatusPROpen, "")
|
||||
_ = s.Transition(ctx, task1.ID, store.StatusRunning, store.StatusPROpen, "")
|
||||
counts, _ = s.StatusCounts(ctx)
|
||||
if counts[store.StatusPROpen] != 1 {
|
||||
t.Errorf("expected 1 pr_open, got %d", counts[store.StatusPROpen])
|
||||
@@ -497,8 +497,8 @@ func TestInsertEventsSinceAndRecent(t *testing.T) {
|
||||
if len(evs) < 2 {
|
||||
t.Fatalf("expected at least 2 events, got %d", len(evs))
|
||||
}
|
||||
if evs[0].ID < evs[1].ID {
|
||||
// Oldest first — correct.
|
||||
if evs[0].ID >= evs[1].ID {
|
||||
t.Errorf("EventsSince order: evs[0].ID=%d, evs[1].ID=%d, want oldest first", evs[0].ID, evs[1].ID)
|
||||
}
|
||||
|
||||
// RecentEvents returns newest first.
|
||||
|
||||
Reference in new issue
Block a user