From 0d5b3b23eac6305888492299514cd18c2dbe0f71 Mon Sep 17 00:00:00 2001 From: sneak Date: Sun, 4 Oct 2026 03:20:01 +0000 Subject: [PATCH] Rewrite the -count=1 note to match the current files (closes #77) The note under the canonical Go `make test` example in `prompts/REPO_POLICIES.md` still named the cache-busting build argument that `--no-cache` replaced, and said Go's cache was baked into earlier image layers. It now says where Go's test result cache can replay a pass: on a developer's machine, where the Makefile target runs, so `-count=1` stays on both invocations. The `test` phase of the `Dockerfile` has nothing to replay: its base image holds no result for the repo's tests and no earlier step runs one. The first paragraph no longer says the rerun would replay a failure: Go stores only passes. Model: opus-5-5 --- TODO.md | 6 ++++++ prompts/REPO_POLICIES.md | 24 +++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/TODO.md b/TODO.md index dda29c2..a3ebb48 100644 --- a/TODO.md +++ b/TODO.md @@ -21,6 +21,12 @@ fmt-check, and commit. # Completed Steps +- 2026-10-04: Rewrote the note under the canonical Go `make test` example in + `REPO_POLICIES.md` (issue 77), which still named the cache-busting build + argument that `--no-cache` replaced. It now says where Go's test result cache + can replay a pass: on a developer's machine, where the Makefile target runs, + and not in the `test` phase of the `Dockerfile`, whose base image and earlier + steps hold no result for the repo's tests. - 2026-10-03: Fixed two defects in the canonical Go `Dockerfile` example (issue 73). The test phase now uses the Debian Go image, since `-race` needs cgo and the alpine image has no C compiler, so the phase failed before running a test. diff --git a/prompts/REPO_POLICIES.md b/prompts/REPO_POLICIES.md index 29b6ab0..db3f052 100644 --- a/prompts/REPO_POLICIES.md +++ b/prompts/REPO_POLICIES.md @@ -1,6 +1,6 @@ --- title: Repository Policies -last_modified: 2026-10-03 +last_modified: 2026-10-04 --- This document covers repository structure, tooling, and workflow standards. Code @@ -316,17 +316,19 @@ style conventions are in separate documents: ``` `-count=1` is required on both invocations: it defeats Go's test _result_ - cache, so the target cannot report a pass it did not earn, and the rerun - reproduces a failure instead of replaying it. It leaves the build cache - alone, so it costs the runtime of the suite and no recompilation. + cache, so neither run can report a stored pass in place of running the + tests. It leaves the build cache alone, so it costs the runtime of the suite + and no recompilation. - Note that this is a second, independent cache, stacked below the Docker - layer cache that [issue #26](https://git.eeqj.de/sneak/prompts/issues/26) - addresses. `CHECK_EPOCH` guarantees the `RUN make test` _step_ re-executes; - it does not guarantee `go test` inside that step does any work, because the - `GOCACHE` baked into earlier image layers survives into the re-executed - step. They are two separate defects requiring two separate fixes, and a fix - for one must not be recorded as covering the other. + That cache is Go's own, separate from Docker's layer cache. Go stores a + passing result in its cache directory (`GOCACHE`), and when the same tests + run again on unchanged code it prints that result, marked `(cached)`, + without running them. That matters on a developer's machine, where this + target runs and the directory lasts from one run to the next. The `test` + phase of the `Dockerfile` needs no `-count=1`: its base image holds no + result for this repo's tests and nothing before its `go test` step runs a + test, so there is nothing to replay. `--no-cache` (above) is what makes that + step run on an unchanged tree. Python example: