chore: sync staging-v6 to main HEAD (post mc#991 merge) #1007
Reference in New Issue
Block a user
Delete Branch "main"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
mc#975 root cause: TestListDelegationsFromLedger_* and TestListDelegationsFromActivityLogs_* assign db.DB = mockDB then defer mockDB.Close(), but never save/restore the previous db.DB value. With go test -race (parallel execution), any test running after one of these 13 tests sees db.DB pointing at a closed sqlmock and fails. Fix: save prevDB := db.DB before assignment, then t.Cleanup(func() { mockDB.Close(); db.DB = prevDB }) — the same pattern already used by setupTestDB for the SSRF/restore path. Also fix setupTestDB in handlers_test.go: it called t.Cleanup(func() { mockDB.Close() }) but left db.DB pointing at the closed mock; now it also restores prevDB. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>activity_test.go: 6 test functions used `defer mockDB.Close(); db.DB = mockDB` without saving/restoring the previous db.DB. go test -race could run subsequent tests with db.DB pointing at a closed mock. a2a_queue_test.go: setupTestDBForQueueTests had the same bug as setupTestDB — called `t.Cleanup(func(){mockDB.Close()})` without restoring prevDB. All callers of this helper are now protected. Pattern applied everywhere: save prevDB, assign mockDB, t.Cleanup restores both. Together with the delegation_list_test.go fix in the previous commit, this should eliminate all remaining race-condition failures in CI/Platform (Go). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>Five more test helpers have the same setupTestDB bug (save db.DB but don't restore on teardown). go test -race runs tests in parallel; when test A sets db.DB = mockA and test B sets db.DB = mockB, if A runs first and cleanup closes mockA, B then runs with db.DB pointing at a closed mock. Fixed files: - internal/registry/liveness_test.go setupLivenessTestDB - internal/registry/hibernation_test.go setupHibernationMock - internal/registry/access_test.go setupMockDB - internal/registry/healthsweep_test.go setupTestDB - internal/scheduler/scheduler_test.go setupTestDB All now follow: prevDB := db.DB; db.DB = mockDB; t.Cleanup(func() { mockDB.Close(); db.DB = prevDB }) Total files fixed for mc#975: 8 files, ~20 test helper functions across the workspace-server. Together with the CI fix to remove the PHASE3_MASKED workaround, this should make CI/Platform (Go) stable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>canvas-deploy-reminder has: if: needs.changes.outputs.canvas == 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main' ci_job_names() only skipped jobs with `github.event_name` in their `if:`. The `github.ref` branch was invisible to the detector, so canvas-deploy-reminder was flagged as missing from all-required.needs — a false positive that fires on every PR touching canvas/ code. Now the skip check also fires when `github.ref` is present in the `if:` condition string, matching the same rationale as the event_name skip: these jobs never execute in a PR context, so requiring them under all-required.needs: is not meaningful. Refs: mc#958 (main), mc#959 (staging) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>