Add -count=1 to the canonical Go make test example #45

Open
clawbot wants to merge 1 commits from go-test-count1 into main
Collaborator

Proposed answer to #44 — speculative, not yet ruled on.

The canonical Go test target omitted -count=1, so Go replayed cached successful results and the target could exit 0 having executed no test. Every repo that copied it inherited the false green.

Replacement:

test:
	@go test -count=1 -timeout 30s -race -cover ./... || \
		{ echo "--- Rerunning with -v for details ---"; \
		  go test -count=1 -timeout 30s -race -v ./...; exit 1; }

The rerun needs the flag too: without it a failing run replays from cache instead of reproducing the failure.

Changed:

  • prompts/REPO_POLICIES.md — the Go example (both invocations), plus one paragraph of justification and a last_modified bump. Root REPO_POLICIES.md is a symlink to it, so it is covered.
  • TODO.md — Completed Steps entry. Next Step left alone; this was not that item.

Searched and deliberately not changed:

  • prompts/CODE_STYLEGUIDE_GO.md line 91 mentions go test ./... in prose about committing a test file as a compile check; not a canonical target.
  • The generic <test-command> template above the Go example — language-agnostic, nothing to add.
  • The Python example (python -m pytest). pytest does not replay cached results by default; its .pytest_cache stores failure/nodeid state for --lf/--ff, not pass results substituted for a run. Result replay needs a plugin (e.g. testmon). No flag exists to add, and inventing one would be wrong.
  • No jest/vitest or other language example targets exist in this repo — jest/vitest appear only in a prose list of test frameworks.
  • This repo's own script/test is a No tests defined. stub (docs repo, no Go code), so it did not carry the bug.

Evidence and measurements are on #44.

make check green: no tests defined, prettier --check clean on all markdown.

Proposed answer to https://git.eeqj.de/sneak/prompts/issues/44 — speculative, not yet ruled on. The canonical Go `test` target omitted `-count=1`, so Go replayed cached successful results and the target could exit 0 having executed no test. Every repo that copied it inherited the false green. Replacement: ```makefile test: @go test -count=1 -timeout 30s -race -cover ./... || \ { echo "--- Rerunning with -v for details ---"; \ go test -count=1 -timeout 30s -race -v ./...; exit 1; } ``` The rerun needs the flag too: without it a failing run replays from cache instead of reproducing the failure. Changed: - `prompts/REPO_POLICIES.md` — the Go example (both invocations), plus one paragraph of justification and a `last_modified` bump. Root `REPO_POLICIES.md` is a symlink to it, so it is covered. - `TODO.md` — Completed Steps entry. `Next Step` left alone; this was not that item. Searched and deliberately not changed: - `prompts/CODE_STYLEGUIDE_GO.md` line 91 mentions `go test ./...` in prose about committing a test file as a compile check; not a canonical target. - The generic `<test-command>` template above the Go example — language-agnostic, nothing to add. - The Python example (`python -m pytest`). pytest does not replay cached results by default; its `.pytest_cache` stores failure/nodeid state for `--lf`/`--ff`, not pass results substituted for a run. Result replay needs a plugin (e.g. testmon). No flag exists to add, and inventing one would be wrong. - No `jest`/`vitest` or other language example targets exist in this repo — `jest`/`vitest` appear only in a prose list of test frameworks. - This repo's own `script/test` is a `No tests defined.` stub (docs repo, no Go code), so it did not carry the bug. Evidence and measurements are on https://git.eeqj.de/sneak/prompts/issues/44. `make check` green: no tests defined, prettier `--check` clean on all markdown.
clawbot added 1 commit 2026-08-10 15:51:50 +02:00
Add -count=1 to the canonical Go make test example (closes #44)
All checks were successful
check / check (push) Successful in 13s
3933e6bdfa
The canonical Go `test` target in `REPO_POLICIES.md` omitted `-count=1`, so
Go replayed cached successful results and the target could exit 0 having
executed no test. Every repo that copied it inherited the false green.

Both invocations get the flag; the rerun needs it so a failure is
reproduced rather than replayed.
clawbot added the needs-review label 2026-08-10 15:51:52 +02:00
sneak was assigned by clawbot 2026-08-10 15:51:55 +02:00
All checks were successful
check / check (push) Successful in 13s
Required
Details
This pull request has changes conflicting with the target branch.
  • prompts/REPO_POLICIES.md
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin go-test-count1:go-test-count1
git checkout go-test-count1
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/prompts#45