internal/rproxy: the handler gives the circuit breaker the time through a breakerClock field, time.Now in production. TestAnswersThatCannotBePassedOnOpenTheBreaker stops that clock before the server serves, through StopBreakerClock in export_test.go. Its five failures then fall inside the five-second window, and the next request comes within the one-second interval, however slow the host. The window and interval stay covered by the clock-driven tests in breaker_test.go.
startServerLogging is split into newServer and serve, so a test can change the server before it serves without a data race.
internal/sww: TestRProxyStoppingCutsOffARequestAfterFiveSeconds sets its read deadline to the stop plus five seconds plus waitLimit. sendAndKeepOpen no longer sets a deadline; this test was its only caller.
Disclosure: TestFiveFailedAsksKeepTheNextRequestFromAskingWAF still reads the real clock, so a slow enough host can fail it the same way. The issue does not name it, so it is unchanged; StopBreakerClock would fix it in two lines.
Model: opus-5-5
Closes https://git.eeqj.de/sneak/smallwebwaf/issues/474
- `internal/rproxy`: the handler gives the circuit breaker the time through a `breakerClock` field, `time.Now` in production. `TestAnswersThatCannotBePassedOnOpenTheBreaker` stops that clock before the server serves, through `StopBreakerClock` in `export_test.go`. Its five failures then fall inside the five-second window, and the next request comes within the one-second interval, however slow the host. The window and interval stay covered by the clock-driven tests in `breaker_test.go`.
- `startServerLogging` is split into `newServer` and `serve`, so a test can change the server before it serves without a data race.
- `internal/sww`: `TestRProxyStoppingCutsOffARequestAfterFiveSeconds` sets its read deadline to the stop plus five seconds plus `waitLimit`. `sendAndKeepOpen` no longer sets a deadline; this test was its only caller.
Disclosure: `TestFiveFailedAsksKeepTheNextRequestFromAskingWAF` still reads the real clock, so a slow enough host can fail it the same way. The issue does not name it, so it is unchanged; `StopBreakerClock` would fix it in two lines.
Model: opus-5-5
The circuit breaker reads the time through a clock the handler holds,
which is time.Now outside tests. The test that answers waf's
questions with answers rproxy cannot pass on stops that clock, so how
long its requests take on a slow host no longer decides whether the
breaker opens or turns the next request away.
The test that stops rproxy mid-request sets its read deadline from the
stop, not from the send, so a slow wait for the app no longer shortens
it.
Model: opus-5-5
The circuit breaker test and the five-second stop test no longer depend on host speed and still catch the behaviour they check, which meets #474.
Judgement call: TestFiveFailedAsksKeepTheNextRequestFromAskingWAF can still fail on a slow host, as the PR body says. The issue names only two tests, so this is not a finding here; that test needs its own issue.
Model: opus-5-5
Verdict: PASS
Head: 123f34679fdbc3b141881b1728ac50d0315dd71d
The circuit breaker test and the five-second stop test no longer depend on host speed and still catch the behaviour they check, which meets https://git.eeqj.de/sneak/smallwebwaf/issues/474.
- Judgement call: `TestFiveFailedAsksKeepTheNextRequestFromAskingWAF` can still fail on a slow host, as the PR body says. The issue names only two tests, so this is not a finding here; that test needs its own issue.
Model: opus-5-5
clawbot
merged commit aaa28f541b into next2026-11-19 19:59:34 +01:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Closes #474
internal/rproxy: the handler gives the circuit breaker the time through abreakerClockfield,time.Nowin production.TestAnswersThatCannotBePassedOnOpenTheBreakerstops that clock before the server serves, throughStopBreakerClockinexport_test.go. Its five failures then fall inside the five-second window, and the next request comes within the one-second interval, however slow the host. The window and interval stay covered by the clock-driven tests inbreaker_test.go.startServerLoggingis split intonewServerandserve, so a test can change the server before it serves without a data race.internal/sww:TestRProxyStoppingCutsOffARequestAfterFiveSecondssets its read deadline to the stop plus five seconds pluswaitLimit.sendAndKeepOpenno longer sets a deadline; this test was its only caller.Disclosure:
TestFiveFailedAsksKeepTheNextRequestFromAskingWAFstill reads the real clock, so a slow enough host can fail it the same way. The issue does not name it, so it is unchanged;StopBreakerClockwould fix it in two lines.Model: opus-5-5
Verdict: PASS
Head:
123f34679fThe circuit breaker test and the five-second stop test no longer depend on host speed and still catch the behaviour they check, which meets #474.
TestFiveFailedAsksKeepTheNextRequestFromAskingWAFcan still fail on a slow host, as the PR body says. The issue names only two tests, so this is not a finding here; that test needs its own issue.Model: opus-5-5