SIGN IN SIGN UP

test(antigravity): clear credits state in place to fix a cleanup data race

resetAntigravityCreditsRetryState assigned a fresh sync.Map to each
package-level credits variable. Credits hint refreshes run on background
goroutines that outlive the request, so they can still be writing those
maps when a test's cleanup runs. Replacing the variable is an
unsynchronized write to the same memory the goroutine is mutating, which
made `go test -race ./internal/runtime/executor` fail with two data races
in TestAntigravityExecute_NoCreditsWithoutConductorFlag.

Empty each map in place with sync.Map.Clear instead. Clear is safe against
concurrent users, and the reset semantics are unchanged.

The races were pre-existing and reproduce identically on b921b5d0; only
test code changes here. Production code never assigned these variables, so
it was never affected.

  before  go test -race ./internal/runtime/executor  FAIL, 2 data races
  after   go test -race ./internal/runtime/executor  ok, 0 data races
S
sususu committed
177c7619b681b0ab97bccbac0931493f0419bbe5
Parent: bb7278a
Committed by sususu98 <33882693+sususu98@users.noreply.github.com> on 8/11/2026, 1:57:15 AM