From the architecture review, "Inside rproxy", under "Waiting for reports is three fields on handler": #283 (comment). Approved for building: #283 (comment). The code was read at 809d266 on next. Line numbers are that commit's.
What is there
handler in internal/rproxy/rproxy.go holds three fields for the reports being sent: reports sync.WaitGroup, reportsMu and reportsStopped (lines 140 to 142).
sendReport in internal/rproxy/waf.go:256 locks, tests the flag and starts the goroutine.
Server.WaitForReports in rproxy.go:115 reaches into s.h to lock, set the flag and wait.
Why it matters
One invariant, that no report starts once waiting has begun, is held by two functions in two files on two types.
What changes
A small private type with two methods: one starts a report unless stopped, one stops and waits. About twenty lines, with the invariant in one place. handler holds one field of it.
Server.WaitForReports keeps its name and what it promises: internal/sww calls it as rproxy's last step.
A report still goes on a goroutine of its own, after the request's context has ended, and one that comes after the wait began is dropped.
Done when
the three fields are one field of the new type, and only that type's methods touch the lock and the flag;
behaviour is unchanged: every existing test passes with no assertion changed;
make check passes;
the PR body lists the new type's name and its methods'. Each says what the thing is to a reader of that one file, the standard of the symbol names audit (#213).
Model: fable-5-2
From the architecture review, "Inside `rproxy`", under "Waiting for reports is three fields on `handler`": https://git.eeqj.de/sneak/smallwebwaf/issues/283#issuecomment-173849. Approved for building: https://git.eeqj.de/sneak/smallwebwaf/issues/283#issuecomment-183550. The code was read at `809d266` on `next`. Line numbers are that commit's.
### What is there
- `handler` in `internal/rproxy/rproxy.go` holds three fields for the reports being sent: `reports sync.WaitGroup`, `reportsMu` and `reportsStopped` (lines 140 to 142).
- `sendReport` in `internal/rproxy/waf.go:256` locks, tests the flag and starts the goroutine.
- `Server.WaitForReports` in `rproxy.go:115` reaches into `s.h` to lock, set the flag and wait.
### Why it matters
One invariant, that no report starts once waiting has begun, is held by two functions in two files on two types.
### What changes
A small private type with two methods: one starts a report unless stopped, one stops and waits. About twenty lines, with the invariant in one place. `handler` holds one field of it.
Before (`rproxy.go`):
```go
func (s *Server) WaitForReports() {
s.h.reportsMu.Lock()
s.h.reportsStopped = true
s.h.reportsMu.Unlock()
s.h.reports.Wait()
}
```
After (the names are placeholders):
```go
func (s *Server) WaitForReports() {
s.h.reports.stopAndWait()
}
```
### What stays
- `Server.WaitForReports` keeps its name and what it promises: `internal/sww` calls it as `rproxy`'s last step.
- A report still goes on a goroutine of its own, after the request's context has ended, and one that comes after the wait began is dropped.
### Done when
- the three fields are one field of the new type, and only that type's methods touch the lock and the flag;
- behaviour is unchanged: every existing test passes with no assertion changed;
- `make check` passes;
- the PR body lists the new type's name and its methods'. Each says what the thing is to a reader of that one file, the standard of the symbol names audit (https://git.eeqj.de/sneak/smallwebwaf/issues/213).
Model: fable-5-2
clawbot
self-assigned this 2026-11-19 17:12:42 +01:00
Built in #453, branch issue-433-report-goroutines: reportGoroutines in internal/rproxy/waf.go replaces the three fields on handler.
Disclosure: one make check run failed in an untouched internal/waf test that timed out under host load; it is filed as #454.
Model: opus-5-5
Built in https://git.eeqj.de/sneak/smallwebwaf/pulls/453, branch `issue-433-report-goroutines`: `reportGoroutines` in `internal/rproxy/waf.go` replaces the three fields on `handler`.
Disclosure: one `make check` run failed in an untouched `internal/waf` test that timed out under host load; it is filed as https://git.eeqj.de/sneak/smallwebwaf/issues/454.
Model: opus-5-5
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.
From the architecture review, "Inside
rproxy", under "Waiting for reports is three fields onhandler": #283 (comment). Approved for building: #283 (comment). The code was read at809d266onnext. Line numbers are that commit's.What is there
handlerininternal/rproxy/rproxy.goholds three fields for the reports being sent:reports sync.WaitGroup,reportsMuandreportsStopped(lines 140 to 142).sendReportininternal/rproxy/waf.go:256locks, tests the flag and starts the goroutine.Server.WaitForReportsinrproxy.go:115reaches intos.hto lock, set the flag and wait.Why it matters
One invariant, that no report starts once waiting has begun, is held by two functions in two files on two types.
What changes
A small private type with two methods: one starts a report unless stopped, one stops and waits. About twenty lines, with the invariant in one place.
handlerholds one field of it.Before (
rproxy.go):After (the names are placeholders):
What stays
Server.WaitForReportskeeps its name and what it promises:internal/swwcalls it asrproxy's last step.Done when
make checkpasses;Model: fable-5-2
Built in #453, branch
issue-433-report-goroutines:reportGoroutinesininternal/rproxy/waf.goreplaces the three fields onhandler.Disclosure: one
make checkrun failed in an untouchedinternal/waftest that timed out under host load; it is filed as #454.Model: opus-5-5