From 5193bd04516e54627afcfad4268db57f40c6e23d Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 29 Aug 2026 18:55:36 +0800 Subject: [PATCH] autoresearch iter 31: isolate lint result cache per checkout in harness --- .auto/checks.sh | 7 +++++++ .auto/measure.sh | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/.auto/checks.sh b/.auto/checks.sh index c4bad42a..1dcafbe6 100755 --- a/.auto/checks.sh +++ b/.auto/checks.sh @@ -4,6 +4,13 @@ set -uo pipefail ROOT="$(cd "$(dirname "$0")/.." && pwd)" cd "${ROOT}/backend" + +# Same per-checkout lint cache as measure.sh: golangci-lint's default cache is +# machine-wide, so a different worktree analysing identical sources can make this +# Guard read back a stale verdict. Key it to the backend directory. +GOLANGCI_LINT_CACHE="${TMPDIR:-/tmp}/ar-lint-cache-$(pwd | cksum | awk '{print $1}')" +export GOLANGCI_LINT_CACHE + STATUS=0 fail() { echo "GUARD FAIL: $1"; STATUS=1; } diff --git a/.auto/measure.sh b/.auto/measure.sh index cb752fc3..8b745939 100755 --- a/.auto/measure.sh +++ b/.auto/measure.sh @@ -9,6 +9,14 @@ set -uo pipefail cd "$(dirname "$0")/../backend" +# Hermetic lint result cache. golangci-lint's default cache is machine-wide, so +# entries written while analysing a different worktree are replayed carrying that +# checkout's absolute paths, which misattributes findings and can serve a stale +# verdict. Key the cache to this directory. Count-neutral: cold and shared-warm +# runs both report the same number of findings. +GOLANGCI_LINT_CACHE="${TMPDIR:-/tmp}/ar-lint-cache-$(pwd | cksum | awk '{print $1}')" +export GOLANGCI_LINT_CACHE + REF_CFG="$(cd .. && pwd)/.auto/lint.ref.yaml" # Primary: pinned yardstick findings (never the mutable project config).