Fix the data races that fail make test (closes #104) #105

Open
clawbot wants to merge 2 commits from fix/104-router-before-start into next
2 Commits
Author SHA1 Message Date
clawbot 6a200ea639 Read the IRC client's nick under its lock in the relay
check / check (push) Successful in 3m4s
After registration each IRC connection runs a second goroutine that sends
queued messages to the client, and it read c.nick without holding c.mu.
The goroutine that reads client commands changes c.nick under c.mu when
the client sends NICK, so the race detector failed
TestIntegrationTwoClients. Every read of c.nick in relay.go now takes
c.mu. No other field that goroutine reads changes after it starts.

Model: opus-5-5
2026-09-29 10:48:48 +00:00
clawbot 6a514b565c Build the HTTP router before the server starts (closes #104)
check / check (push) Successful in 2m22s
The fx OnStart hook started a goroutine that built the router and then
began serving, so OnStart returned before the router existed. Code that
served requests through the started Server, as the internal/handlers
tests do, raced with that goroutine or hit a nil router.

OnStart now configures the server, enables Sentry and builds the router
itself, and only then starts serving in the background. Sentry is set up
first because the routes depend on whether it is enabled. Run, whose
only caller was that hook, is folded into it.

Model: opus-5-5
2026-09-29 10:40:36 +00:00