fix(pr): json output for pr status, fix relative-url crash (FJ-2) #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/pr-status-json-relative-url-fix"
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?
Resolves FJ-2.
What
fj pr status <id>gains a--jsonflag and no longer crashes on Forgejo responses that contain relative status URLs.Why
Two problems, both hit while building
claude-bot/actions/forgejo-ci-fix.yml:target_url/urlvalues for Forgejo Actions run/job links (e.g./owner/repo/actions/runs/85/jobs/0).forgejo-apitypesCommitStatus/CombinedStatustarget_url/urlasurl::Url, which rejects relative URLs, so deserialization aborted the entire call:Error: the response from forgejo was not properly structured ... expected relative URL without a base.fjand hit Forgejo's REST API directly (a Tooling Gap Discipline violation).How
The combined-status response is deserialized into local lenient mirror types (
CommitStatusLenientkeepstarget_urlas a plainString), fetched viaRequest::response_typewith manual pagination over thex-total-countheader, so the strict upstreamCommitStatus/CombinedStatustypes are never instantiated for this endpoint.--jsonemits a record withpr,head_sha,state,statuses[],mergeable, andmerged. The top-levelstatefollows Forgejo's combined-status semantics:failureif any check fails,successif every check passes,pendingotherwise (including zero checks). Human output is unchanged; progress rendering is suppressed under--jsonso--waitemits a single final JSON record.Verification
Reproduced the original crash with the released
fjagainst the issue's sandbox PR (longjacksonle/claude-fix-sandbox#10), then confirmed the rebuilt binary returns valid JSON for that same PR. Exercised one-check, many-check, success, and failure PRs in that repo; the zero-check path is deterministic (the pagination loop breaks immediately on an empty page andcombined_statereturnspending).Notes
mergeable).fjlives at https://codeberg.org/forgejo-contrib/forgejo-cli. This change should be mirrored upstream as a follow-up (no codeberg push access from this environment).🤖 Generated with Claude Code