🐛 fix(config): remove racy log.Info in WatchAndApply cancel goroutine #48

Merged
arcodange merged 1 commits from fix/race-in-config-watcher into main 2026-05-05 09:40:04 +02:00
Owner

Race condition introduced by PR #47 (which itself accidentally bundled Mistral autonomous Phase 3.2 work due to a working-directory race condition between Claude and Mistral — Q-038 to be added). Fix removes the informational log call from the cancel-handler goroutine; the flag-set is sufficient. go test -race ./pkg/config/... now passes. Full BDD green.

Race condition introduced by PR #47 (which itself accidentally bundled Mistral autonomous Phase 3.2 work due to a working-directory race condition between Claude and Mistral — Q-038 to be added). Fix removes the informational log call from the cancel-handler goroutine; the flag-set is sufficient. `go test -race ./pkg/config/...` now passes. Full BDD green.
arcodange added 1 commit 2026-05-05 09:39:58 +02:00
🐛 fix(config): remove racy log.Info in WatchAndApply cancel goroutine
All checks were successful
CI/CD Pipeline / Build Docker Cache (push) Successful in 17s
CI/CD Pipeline / CI Pipeline (push) Successful in 6m20s
CI/CD Pipeline / Trigger Docker Push (push) Has been skipped
7d95259667
The cancel-handler goroutine emitted a "watcher stopped" log AFTER
setting the watcherStopped flag. Because viper's internal watcher
goroutine (started by viper.WatchConfig) has no public Stop and can
outlive the context, this log call would race with subsequent
zerolog.SetGlobalLevel from the next test's LoadConfig → SetupLogging.

Symptom (under go test -race ./pkg/config/...):
  WARNING: DATA RACE
  Write at zerolog.SetGlobalLevel
  Previous read by zerolog.(*Logger).disabled in log.Info(...)

Fix: drop the informational log. The flag is sufficient — the cancel
ack does not need to be observable. Test cleanups (defer cancel())
already serialize via the t.Cleanup teardown order.

Verified: go test -race ./pkg/config/... passes, full BDD suite green.
arcodange merged commit f97b6874c9 into main 2026-05-05 09:40:04 +02:00
arcodange deleted branch fix/race-in-config-watcher 2026-05-05 09:40:05 +02:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: arcodange/dance-lessons-coach#48