From a0dabf7340188816c3c9119e806f5917b5fd285b Mon Sep 17 00:00:00 2001 From: clawbot Date: Tue, 17 Mar 2026 20:33:49 -0700 Subject: [PATCH] docs: document conditional -v test rerun pattern in REPO_POLICIES.md Add policy recommending the conditional verbose test rerun pattern for make test targets. Tests run without -v first for clean output on success, then automatically rerun with -v on failure for full diagnostics. Includes generic pattern, Go example, and Python example. --- prompts/REPO_POLICIES.md | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/prompts/REPO_POLICIES.md b/prompts/REPO_POLICIES.md index 9ec540c..e644449 100644 --- a/prompts/REPO_POLICIES.md +++ b/prompts/REPO_POLICIES.md @@ -1,6 +1,6 @@ --- title: Repository Policies -last_modified: 2026-03-12 +last_modified: 2026-03-18 --- This document covers repository structure, tooling, and workflow standards. Code @@ -149,6 +149,42 @@ style conventions are in separate documents: - `make test` must complete in under 20 seconds. Add a 30-second timeout in the Makefile. +- **`make test` should use the conditional verbose rerun pattern.** Run tests + without `-v` (verbose) first. If tests fail, automatically rerun with `-v` to + show full output. This keeps CI logs and `docker build` output clean on + success (just package/suite summaries) while providing full diagnostic detail + on failure (every test case, every assertion). The general shell pattern: + + ```makefile + test: + @ || \ + { echo "--- Rerunning with -v for details ---"; \ + ; exit 1; } + ``` + + Go example: + + ```makefile + test: + @go test -timeout 30s -race -cover ./... || \ + { echo "--- Rerunning with -v for details ---"; \ + go test -timeout 30s -race -v ./...; exit 1; } + ``` + + Python example: + + ```makefile + test: + @python -m pytest || \ + { echo "--- Rerunning with -v for details ---"; \ + python -m pytest -v; exit 1; } + ``` + + The `exit 1` ensures the target always fails after a rerun — the first run + already proved the tests are broken, so the build must not pass even if a + flaky test happens to succeed on the second attempt. The rerun exists solely + for diagnostic output. + - Docker builds must complete in under 5 minutes. - `make check` must not modify any files in the repo. Tests may use temporary