feat(forgejo): add pull request state query to ForgejoClient #406
No reviewers
Labels
No labels
bug
contract
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
iterative-works/iw-cli!406
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/forgejo-pr-state-query"
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?
What
Adds
ForgejoClient.fetchPullRequestState(plus a pureparsePullRequestState) so callers can query whether a Forgejo PR is merged, open, or closed over the REST API.Why
ForgejoClientcould read a PR's head SHA (fetchPrHeadSha) but had no way to ask for its resolution state. The kanonbatch-implementpre-flight catch-up needs exactly that to tell, on restart, whether a merged-but-unadvanced phase's PR actually merged — without it, Forgejo projects always logged "Could not determine forge state" and fell back to re-dispatching claude.How
Forgejo splits PR resolution across two fields:
state(open/closed) and a separatemergedboolean (a merged PR isstate: closed, merged: true).parsePullRequestStatecollapses these into a canonicalmerged/open/closedtoken;fetchPullRequestStatewraps theGET /pulls/{index}call, mirroring the existingfetchPrHeadSha.Tests
12 new tests in
ForgejoClientTest(parser table incl. missing/nullmerged, unexpected state, malformed JSON; fetch happy-path + 401/404/network). TDD red→green.corecompiles-Werrorclean; scalafmt gate passed.Follow-up
The kanon
batch-implementcommand (dev-docs repo) consumes this method and gates oniw-cli >= 0.6.3, so this should ship as 0.6.3 before that plugin branch merges.