Run lint and tests as phases of the Dockerfile (closes #5) #18

Merged
clawbot merged 1 commits from lint-in-docker into next 2026-10-06 06:59:54 +02:00
Collaborator

Implements #5 as its plan comment describes: lint and test are phases of the one Dockerfile, in the shape REPO_POLICIES.md gives at dd4027b.

The build stage copies go.sum from both phases, so even a plain docker build . stops on a lint finding or a failing test; it no longer runs make check. make check now needs Docker. The test phase uses the Debian Go 1.25.7 image, the builder's Go version, because -race needs a C compiler.

CI used to run only docker build .. It now also runs script/bootstrap and script/fmt-check on the runner, which has no Go: bootstrap installs Go from apt, and that Go fetches the version go.mod names. The image build in script/cibuild runs lint and test a second time, which the policy accepts.

Deviations from REPO_POLICIES.md:

  • The test phase runs as an unprivileged user: as root the permission test fails, since root can read a file with mode 0000.
  • The version step stays as on next (#7) and builds through make build, so the build stage installs make as well as git.
  • The lint phase stays at v2.12.2, not v2.14.0; that move and the new .golangci.yml belong to #13.
  • script/bootstrap still checks goimports by presence, not by version; also left to #13.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/attrsum/issues/5 as its plan comment describes: lint and test are phases of the one `Dockerfile`, in the shape `REPO_POLICIES.md` gives at `dd4027b`. The build stage copies `go.sum` from both phases, so even a plain `docker build .` stops on a lint finding or a failing test; it no longer runs `make check`. `make check` now needs Docker. The test phase uses the Debian Go 1.25.7 image, the builder's Go version, because `-race` needs a C compiler. CI used to run only `docker build .`. It now also runs `script/bootstrap` and `script/fmt-check` on the runner, which has no Go: bootstrap installs Go from apt, and that Go fetches the version `go.mod` names. The image build in `script/cibuild` runs lint and test a second time, which the policy accepts. Deviations from `REPO_POLICIES.md`: - The test phase runs as an unprivileged user: as root the permission test fails, since root can read a file with mode 0000. - The version step stays as on `next` (https://git.eeqj.de/sneak/attrsum/issues/7) and builds through `make build`, so the build stage installs `make` as well as `git`. - The lint phase stays at v2.12.2, not v2.14.0; that move and the new `.golangci.yml` belong to https://git.eeqj.de/sneak/attrsum/issues/13. - `script/bootstrap` still checks goimports by presence, not by version; also left to https://git.eeqj.de/sneak/attrsum/issues/13. Model: opus-5-5
clawbot added the needs-review label 2026-10-06 04:14:54 +02:00
clawbot self-assigned this 2026-10-06 04:14:54 +02:00
Author
Collaborator

Review failed.

  1. Dockerfile, test phase comment (lines 11 to 14): it says running as root would make the permission tests "spuriously pass with no error". The opposite is true: as root TestPermissionErrors fails, because root can read the mode 0000 file and the error the test expects never comes. The test also expects any error, not EACCES in particular. The commit message and PR body get this right, so the comment contradicts them. Acceptable: a comment that says what the commit message says: root can read a file with mode 0000, so the permission test would fail.
  2. Dockerfile, lines 17 and 18: the unprivileged user in the test phase is called builder, the same name as the build stage (AS builder) below it, so USER builder reads as if it belonged to that stage. Acceptable: a user name that says what the user is for and matches no stage name.

Model: opus-5-5

Review failed. 1. `Dockerfile`, test phase comment (lines 11 to 14): it says running as root would make the permission tests "spuriously pass with no error". The opposite is true: as root `TestPermissionErrors` fails, because root can read the mode 0000 file and the error the test expects never comes. The test also expects any error, not EACCES in particular. The commit message and PR body get this right, so the comment contradicts them. Acceptable: a comment that says what the commit message says: root can read a file with mode 0000, so the permission test would fail. 2. `Dockerfile`, lines 17 and 18: the unprivileged user in the test phase is called `builder`, the same name as the build stage (`AS builder`) below it, so `USER builder` reads as if it belonged to that stage. Acceptable: a user name that says what the user is for and matches no stage name. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-06 04:50:08 +02:00
clawbot force-pushed lint-in-docker from 1290806eb1 to 1a7b33c7c5 2026-10-06 05:09:13 +02:00 Compare
Author
Collaborator

Rework of the review in this thread: the test phase comment now says root can read a file with mode 0000, so the permission test would fail; the unprivileged test user is testuser. PR body cut to the changes and deviations. Nothing else changed.

Model: opus-5-5

Rework of the review in this thread: the test phase comment now says root can read a file with mode 0000, so the permission test would fail; the unprivileged test user is `testuser`. PR body cut to the changes and deviations. Nothing else changed. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-06 05:09:47 +02:00
Author
Collaborator

Review passed.

Judgement call: the branch no longer merges into next at 4fd857b (TODO.md conflicts); this review covers it rebased onto 4fd857b with both 2026-10-06 TODO.md entries kept, this PR's first.

Model: opus-5-5

Review passed. Judgement call: the branch no longer merges into `next` at `4fd857b` (`TODO.md` conflicts); this review covers it rebased onto `4fd857b` with both 2026-10-06 `TODO.md` entries kept, this PR's first. Model: opus-5-5
clawbot added needs-rebase and removed needs-review labels 2026-10-06 06:31:41 +02:00
clawbot added 1 commit 2026-10-06 06:47:20 +02:00
The Dockerfile gets a lint phase on the pinned golangci-lint v2.12.2
image and a test phase on the Debian Go image. The tests run as an
unprivileged user, because root reads a file with mode 0000 and the
permission test then fails. The build stage copies a file from each
phase, so no build finishes unless both pass, and it no longer runs
make check. script/lint and script/test each build their phase,
uncached and tagged; script/cibuild bootstraps, runs script/check, then
builds the image. script/bootstrap no longer installs golangci-lint.
README.md and TODO.md describe the new setup.

Model: opus-5-5
clawbot force-pushed lint-in-docker from 1a7b33c7c5 to 2d996df335 2026-10-06 06:47:20 +02:00 Compare
clawbot added needs-review and removed needs-rebase labels 2026-10-06 06:47:24 +02:00
clawbot merged commit d010135618 into next 2026-10-06 06:59:54 +02:00
clawbot deleted branch lint-in-docker 2026-10-06 06:59:54 +02:00
Sign in to join this conversation.