Skip to content

fix(ci): readiness gate was packing multi-line body into a single read#75

Merged
WiktorStarczewski merged 1 commit into
mainfrom
wiktor/auto-patch-gate-ifs-tab
Apr 30, 2026
Merged

fix(ci): readiness gate was packing multi-line body into a single read#75
WiktorStarczewski merged 1 commit into
mainfrom
wiktor/auto-patch-gate-ifs-tab

Conversation

@WiktorStarczewski
Copy link
Copy Markdown
Collaborator

Followup to #73. The gate's read -r body base_ref state <<<... was reading only through the first newline of the multi-line PR body, then splitting on whitespace IFS — so a body starting with 'Client PR: #2059' assigned body='Client', base_ref='PR:', state='#2059'. State '#2059' isn't 'open' → the gate exited early with 'PR is #2059 — skipping.' and never posted the readiness status.

Fix: extract body separately (multi-line tolerated), pack base_ref + state alone with IFS=$'\t'.

Previous form:
  read -r body base_ref state <<<"$(gh api ... --jq '"\(.body // "")\t\(.base.ref)\t\(.state)"')"

PR bodies are multi-line and the marker is itself space-separated. read
defaults to whitespace IFS and only consumes through the first newline,
so a body starting with 'Client PR: #2059\n...' assigned:
  body  = 'Client'
  base_ref = 'PR:'
  state = '#2059'

The gate then hit the early-return:
  if [ "$state" != "open" ] && [ "$state" != "OPEN" ]; then
    echo "PR #$PR_NUM is $state — skipping."
    exit 0
  fi

…and exited with the visible-in-the-job 'PR #25 is #2059 — skipping.',
never posting the linked-client-pr-ready custom status. The job logged
'success' because exit 0 is what the early-return does, but the
readiness verdict never reached the commit.

Fix:
  - body = separate gh api call (multi-line tolerated naturally)
  - base_ref + state packed into a tab-separated single-line, read with
    IFS=$'\t' so a hypothetical future whitespace in either field
    wouldn't repeat the bug
  - Same IFS=$'\t' added to the second read of (merged, merge_commit_sha)
    for consistency, even though neither field can contain whitespace
    today
@WiktorStarczewski WiktorStarczewski added the no changelog PR doesn't need a CHANGELOG entry (trivial / non-user-visible) label Apr 30, 2026
@WiktorStarczewski WiktorStarczewski merged commit 5bfc8dc into main Apr 30, 2026
20 of 21 checks passed
@WiktorStarczewski WiktorStarczewski deleted the wiktor/auto-patch-gate-ifs-tab branch April 30, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no changelog PR doesn't need a CHANGELOG entry (trivial / non-user-visible)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant