From 8203f081ead97a7d83fd4807b867f3710469ca54 Mon Sep 17 00:00:00 2001 From: claude-bot-andresmgsl Date: Thu, 23 Jul 2026 12:22:43 +0000 Subject: [PATCH] test: missing-fixture gh stub applies the caller's --jq; pin LC_ALL=C Real 'gh api --jq .[].created_at' on an empty collection emits no lines; the stub printed a literal '[]', which under byte-wise collation sorts after ISO-8601 timestamps and poisoned the PR-surface probe's last_activity. Route the synthesized empty array through the same jq projection as a present fixture, and pin the test's collation so the verdict cannot flip with the runner's ambient locale. Co-Authored-By: Claude Fable 5 --- test/labels-reconcile.test.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/labels-reconcile.test.sh b/test/labels-reconcile.test.sh index c112aec..fa89f25 100755 --- a/test/labels-reconcile.test.sh +++ b/test/labels-reconcile.test.sh @@ -1,5 +1,8 @@ #!/usr/bin/env bash set -euo pipefail +# Byte-wise collation, matching CI: the probes sort ISO timestamps, and the +# verdict must not flip with the runner's ambient locale. +export LC_ALL=C # Fixture tests for the labels-reconcile state machine: a comment is a # non-verdict whatever its body says (the AUTHOR escalates by requesting the @@ -529,7 +532,9 @@ ruling_sweep_probe() { # $1 = the PR's labels → reconcile_pr's log lines shift done file="$RTMP/$(printf '%s' "$endpoint" | tr '/' '_').json" - [ -f "$file" ] || { printf '[]\n'; return 0; } + # A missing fixture is an empty collection — projected through the + # caller's --jq exactly like real gh, so '.[].foo' yields no lines. + [ -f "$file" ] || { printf '[]\n' | jq -r "${jqexpr:-.}"; return 0; } if [ -n "$jqexpr" ]; then jq -r "$jqexpr" "$file"; else cat "$file"; fi elif [ "$1" = issue ] && [ "$2" = comment ]; then local n="$3" body="" file