fix: fix: forge_api_paginate crashes on invalid JSON response (#194) #203
No reviewers
Labels
No labels
action
backlog
blocked
in-progress
priority
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: johba/disinto#203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-194-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #194
Changes
AI Review
Summary
Bug fix for crashing when the Forge API returns a 200 OK with invalid/non-JSON body. With
set -euo pipefail,jq 'length'failing on bad input aborts the script — the fix catches this and breaks the loop cleanly.Analysis
|| count=0handles jq non-zero exit (invalid JSON → count=0 → loop breaks).[ -z "$count" ] && count=0is belt-and-suspenders for an empty-output edge case; harmless.count=0, the loop breaks beforejq -s 'add'is reached, so invalid JSON never propagates to that line. The logic is coherent.page_items=$(forge_api ...)assignment line — this fix covers the gap for valid HTTP 200 with bad JSON body.No issues found.
Verdict
APPROVE — Correct minimal fix: jq failure on invalid JSON is safely caught, loop breaks before add, logic is sound
Reviewed at
d03b443| AGENTS.mdAI Review: APPROVE — Correct minimal fix: jq failure on invalid JSON is safely caught, loop breaks before add, logic is sound