Go tests run with -race and -cover under Go's own timeout (closes #88) #89

Merged
clawbot merged 1 commits from issue-88-race-cover-tests into next 2026-10-03 16:26:17 +02:00
Collaborator

Closes #88, the Go half of #21.

backend/script/test now runs go test -timeout 30s -race -cover ./...; on failure it reruns with -v and exits 1, as REPO_POLICIES.md shows.

The root script/test no longer wraps both halves in one shell timeout 30: compiling with -race from a cold Go build cache can take that long, and Go's -timeout leaves the compile out. Each half keeps its own limit.

The race detector needs cgo, which Go turns on only when it finds a C compiler. The Dockerfile builder stage installs gcc and musl-dev; script/bootstrap installs gcc when missing, with libc6-dev on apt and musl-dev on apk. make build still sets CGO_ENABLED=0.

New tests: the health check's status, content type and fields; the answer to a valid report; a report file's exact lines, in order; the flush at 10 MiB. The handlers TestImport stub is deleted.

What the diff does not show:

  • pkg_install's apt and apk arguments may now each name several packages.
  • Only the apk install was run. The apt names are Debian's and Ubuntu's; nix's gcc is the wrapped compiler, which brings glibc's headers; Homebrew itself needs a compiler installed, so the check never fires there.
  • The 10 MiB flush writes in the background, so that test retries for up to 10 seconds; readReportFiles returns an error instead of failing the test.
  • The health check test builds the handlers without the fx graph: no config or data directory.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/netwatch/issues/88, the Go half of https://git.eeqj.de/sneak/netwatch/issues/21. `backend/script/test` now runs `go test -timeout 30s -race -cover ./...`; on failure it reruns with `-v` and exits 1, as `REPO_POLICIES.md` shows. The root `script/test` no longer wraps both halves in one shell `timeout 30`: compiling with `-race` from a cold Go build cache can take that long, and Go's `-timeout` leaves the compile out. Each half keeps its own limit. The race detector needs cgo, which Go turns on only when it finds a C compiler. The `Dockerfile` builder stage installs `gcc` and `musl-dev`; `script/bootstrap` installs `gcc` when missing, with `libc6-dev` on apt and `musl-dev` on apk. `make build` still sets `CGO_ENABLED=0`. New tests: the health check's status, content type and fields; the answer to a valid report; a report file's exact lines, in order; the flush at 10 MiB. The handlers `TestImport` stub is deleted. What the diff does not show: - `pkg_install`'s apt and apk arguments may now each name several packages. - Only the apk install was run. The apt names are Debian's and Ubuntu's; nix's `gcc` is the wrapped compiler, which brings glibc's headers; Homebrew itself needs a compiler installed, so the check never fires there. - The 10 MiB flush writes in the background, so that test retries for up to 10 seconds; `readReportFiles` returns an error instead of failing the test. - The health check test builds the handlers without the fx graph: no config or data directory. Model: opus-5-5
clawbot self-assigned this 2026-10-03 15:09:10 +02:00
clawbot added the needs-review label 2026-10-03 15:09:10 +02:00
Author
Collaborator

FAIL: needs-rebase

  1. Conflict with next. The branch no longer applies to the current next: TODO.md conflicts, because #78 added its own entry at the top of Completed Steps. Acceptable: rebased onto next, keeping both entries.

  2. script/bootstrap does not install what make test now needs. backend/script/test now runs the tests with -race, which needs a C compiler. script/bootstrap neither installs one nor warns when one is missing. REPO_POLICIES.md says bootstrap installs all dependencies and assumes nothing is present, and the README's script/bootstrap line says the same. On a host without a compiler, make bootstrap succeeds, and then make test, and so make check, stops with an error that -race requires cgo. Acceptable: script/bootstrap installs a C compiler when none is found, through pkg_install as it does make and git, with the C library headers where the package manager ships them separately (as apk does with musl-dev). The README's script/bootstrap line also names it.

Judgement call: the health check test's fxtest lifecycle is read as allowed under "testing and net/http/httptest only". It is fx's own helper, the reportbuf tests already use it, and it is not an assertion library.
Judgement call: the PR body, at 257 words, is taken as within about 250; the rework should not make it longer.

Model: opus-5-5

**FAIL: `needs-rebase`** 1. **Conflict with `next`.** The branch no longer applies to the current `next`: `TODO.md` conflicts, because https://git.eeqj.de/sneak/netwatch/issues/78 added its own entry at the top of Completed Steps. Acceptable: rebased onto `next`, keeping both entries. 2. **`script/bootstrap` does not install what `make test` now needs.** `backend/script/test` now runs the tests with `-race`, which needs a C compiler. `script/bootstrap` neither installs one nor warns when one is missing. `REPO_POLICIES.md` says bootstrap installs all dependencies and assumes nothing is present, and the README's `script/bootstrap` line says the same. On a host without a compiler, `make bootstrap` succeeds, and then `make test`, and so `make check`, stops with an error that `-race` requires cgo. Acceptable: `script/bootstrap` installs a C compiler when none is found, through `pkg_install` as it does `make` and `git`, with the C library headers where the package manager ships them separately (as apk does with `musl-dev`). The README's `script/bootstrap` line also names it. Judgement call: the health check test's `fxtest` lifecycle is read as allowed under "`testing` and `net/http/httptest` only". It is fx's own helper, the reportbuf tests already use it, and it is not an assertion library. Judgement call: the PR body, at 257 words, is taken as within about 250; the rework should not make it longer. Model: opus-5-5
clawbot added needs-rebase and removed needs-review labels 2026-10-03 15:44:15 +02:00
clawbot added needs-rework and removed needs-rebase labels 2026-10-03 15:46:45 +02:00
clawbot added 1 commit 2026-10-03 16:01:03 +02:00
backend/script/test runs go test -timeout 30s -race -cover and, if
that fails, runs it again with -v and fails. The root script/test drops
its one 30-second timeout around both halves: from a cold Go build
cache, compiling the tests with -race used it all up. Each half keeps
its own limit. The race detector needs a C compiler: the Dockerfile
builder stage gains gcc and musl-dev, and script/bootstrap installs gcc,
with the C library headers on apt and apk, when gcc is missing; make
build still sets CGO_ENABLED=0. New tests: the health check's answer, a
valid report's answer, a report file's exact lines, and the flush at the
10 MiB threshold. The handlers TestImport stub is gone.

Model: opus-5-5
clawbot force-pushed issue-88-race-cover-tests from 57b29df445 to 02fcd3ae8f 2026-10-03 16:01:03 +02:00 Compare
clawbot added needs-review and removed needs-rework labels 2026-10-03 16:02:25 +02:00
Author
Collaborator

Rework for #89 (comment):

  1. Rebased onto next; TODO.md keeps both Completed Steps entries, this one on top.
  2. script/bootstrap installs gcc through pkg_install when gcc is missing, with libc6-dev on apt and musl-dev on apk, and the README's script/bootstrap line names it; pkg_install's apt and apk arguments may now list several packages.

Model: opus-5-5

Rework for https://git.eeqj.de/sneak/netwatch/pulls/89#issuecomment-116752: 1. Rebased onto `next`; `TODO.md` keeps both Completed Steps entries, this one on top. 2. `script/bootstrap` installs `gcc` through `pkg_install` when `gcc` is missing, with `libc6-dev` on apt and `musl-dev` on apk, and the README's `script/bootstrap` line names it; `pkg_install`'s apt and apk arguments may now list several packages. Model: opus-5-5
Author
Collaborator

PASS: both findings of the first review are resolved, and the change meets the definition of done of #88.

Model: opus-5-5

PASS: both findings of the first review are resolved, and the change meets the definition of done of https://git.eeqj.de/sneak/netwatch/issues/88. Model: opus-5-5
clawbot merged commit aa35625d47 into next 2026-10-03 16:26:17 +02:00
clawbot deleted branch issue-88-race-cover-tests 2026-10-03 16:26:17 +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/netwatch#89