Discard fx's own log in tests that build an fx app (closes #230) #426

Merged
clawbot merged 1 commits from issue-230-fx-test-log into next 2026-10-02 11:08:38 +02:00
Collaborator

Tests that build an fx app with fxtest.New sent fx's own event log to t.Logf. When a start or stop runs past fx's time limit, Start or Stop returns while the hook carries on in a goroutine, and fx logs from that goroutine after the test has returned, which the race detector reports. Every fxtest.New (handlers, server, resetpw, gormlog, config) now passes fx.NopLogger, as fx's own tests do, so nothing fx runs can reach the test. Each of these apps was already stopped by a deferred or cleanup RequireStop before its test returns.

Not visible in the diff: fx's event log no longer appears in a failing test's output. A failed start or stop still reports its error through RequireStart or RequireStop.

  • Judgement call: the fxtest.NewLifecycle(t) sites are unchanged; they run hooks on the goroutine that calls Start or Stop, which is always the test or its cleanup.
  • Deviation from the plan: an app whose start overruns fx's time limit still has its hook running after the test fails; it no longer touches the test, and that limit is #225.
  • Deviation: no load was added and make test takes no repeat count, so the race-enabled suite ran twice under the host's own load, load average 45 to 72 on 48 cores.
  • Unverified: the original race was not reproduced before the fix; the fix follows from where fx's source makes that write.

Model: opus-5-5

Tests that build an fx app with `fxtest.New` sent fx's own event log to `t.Logf`. When a start or stop runs past fx's time limit, `Start` or `Stop` returns while the hook carries on in a goroutine, and fx logs from that goroutine after the test has returned, which the race detector reports. Every `fxtest.New` (handlers, server, resetpw, gormlog, config) now passes `fx.NopLogger`, as fx's own tests do, so nothing fx runs can reach the test. Each of these apps was already stopped by a deferred or cleanup `RequireStop` before its test returns. Not visible in the diff: fx's event log no longer appears in a failing test's output. A failed start or stop still reports its error through `RequireStart` or `RequireStop`. - Judgement call: the `fxtest.NewLifecycle(t)` sites are unchanged; they run hooks on the goroutine that calls `Start` or `Stop`, which is always the test or its cleanup. - Deviation from the plan: an app whose start overruns fx's time limit still has its hook running after the test fails; it no longer touches the test, and that limit is https://git.eeqj.de/sneak/webhooker/issues/225. - Deviation: no load was added and `make test` takes no repeat count, so the race-enabled suite ran twice under the host's own load, load average 45 to 72 on 48 cores. - Unverified: the original race was not reproduced before the fix; the fix follows from where fx's source makes that write. Model: opus-5-5
clawbot added the needs-review label 2026-10-02 10:22:03 +02:00
clawbot self-assigned this 2026-10-02 10:22:03 +02:00
clawbot added 1 commit 2026-10-02 10:22:04 +02:00
fxtest.New sends fx's event log to t.Logf. When a start or stop runs
past fx's time limit, Start or Stop returns while the hook keeps
running in a goroutine, and that goroutine logs to the test after the
test has returned, which the race detector reports. Every fxtest.New
now passes fx.NopLogger, so nothing fx runs can reach the test. The
fxtest.Lifecycle sites are unchanged: they run hooks on the goroutine
that calls Start or Stop, which is always the test or its cleanup.

Model: opus-5-5
Author
Collaborator

Review passed: this fixes #230 and is ready to merge into next.

Model: opus-5-5

Review passed: this fixes https://git.eeqj.de/sneak/webhooker/issues/230 and is ready to merge into `next`. Model: opus-5-5
Author
Collaborator

Re-gate passed on current next.

Model: opus-5-5

Re-gate passed on current `next`. Model: opus-5-5
clawbot merged commit 2bb4683512 into next 2026-10-02 11:08:38 +02:00
clawbot deleted branch issue-230-fx-test-log 2026-10-02 11:08:38 +02:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/webhooker#426