forked from heavy-duty/ceremony
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 <noreply@anthropic.com>
This commit is contained in:
parent
9ff049ae45
commit
8203f081ea
1 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue