From f965e8404c3b5312896aeebb990da0d24dfb3e14 Mon Sep 17 00:00:00 2001 From: cndgrr <59120057+cndgrr@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:14:19 +0000 Subject: [PATCH] test(issueflow): an absent fixture answers nothing to a --jq read, as gh does MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sourced stub returned a literal `[]` to --jq callers when a fixture was missing, where the real API answers an empty list and the filter yields nothing. last_issue_activity then sorted `[]` beside an ISO-8601 timestamp — and `[]` outsorts a timestamp in the C locale but not in a UTF-8 one, so the sweep dated an issue by a stub artifact on the runner and by created_at here. The old code swallowed the resulting `date` failure and graded the claim on a literal 0 anyway; #247's guards turn a failed read into a skip, which is what made the lie visible. Adopt the arrival stub's shape. Suite green under LC_ALL=C, C.UTF-8 and en_US.UTF-8. Refs #247 --- test/issueflow-reconcile.test.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/issueflow-reconcile.test.sh b/test/issueflow-reconcile.test.sh index 2ac02b0..07f4d9c 100644 --- a/test/issueflow-reconcile.test.sh +++ b/test/issueflow-reconcile.test.sh @@ -328,8 +328,17 @@ issue_stub_gh() { return 1 fi [ ! -f "$file.error" ] || { printf '%s\n' "$GH_STUB_STDERR" >&2; return 1; } - [ -f "$file" ] || { printf '[]\n'; return 0; } - if [ -n "$jqexpr" ]; then jq -r "$jqexpr" "$file"; else cat "$file"; fi + # An absent fixture answers an empty list, and a --jq call gets the filter + # applied to it — the arrival stub's shape, and gh's. Returning the raw + # `[]` to a --jq caller made every missing fixture answer a literal `[]` + # where the real API answers nothing, and `[]` outsorts an ISO-8601 + # timestamp in the C locale but not in a UTF-8 one, so last_issue_activity + # dated an issue by a stub artifact on the runner and by its created_at + # here. The old code swallowed the resulting date failure; #247's guards + # turn it into a skip, which is what made the lie visible. + local payload='[]' + [ ! -f "$file" ] || payload="$(cat "$file")" + if [ -n "$jqexpr" ]; then jq -r "$jqexpr" <<<"$payload"; else printf '%s\n' "$payload"; fi elif [ "$1" = issue ] && [ "$2" = comment ]; then local n="$3" body="" file shift 3