You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(close): make issue close/cancel idempotent when already in terminal state (#113)
## Summary
- Adds `state` attribute to the `Issue` resource and includes `state {
id name type }` in GraphQL queries, giving the CLI visibility into an
issue's current workflow-state type.
- Short-circuits `close_issue/2` and `cancel_issue/2` in `IssueHelpers`:
when `issue.state.type` already matches the target (completed /
cancelled), skips the reason comment and `issueUpdate` mutation, prints
`"<identifier> is already <state name>"`, and returns `{:ok, issue}`.
- Fixes `Issue.Update.Close` mutation payload: omits `trashed` entirely
when not requested instead of sending `"trashed" => false`, which the
Linear API rejects.
## Test plan
- [x] `IssueHelpers.close_issue/2` no-ops and prints accessible message
when issue is already completed
- [x] `IssueHelpers.close_issue/2` no-ops when called with `cancel:
true` and issue is already cancelled
- [x] `IssueHelpers.cancel_issue/2` no-ops and prints accessible message
when issue is already cancelled
- [x] `Linear.close_issue/2` omits `trashed` from mutation input when
not requested
- [x] `Linear.close_issue/2` sends `trashed: true` only when explicitly
requested
- [x] `Issue.from_map/1` parses `state` from API response into a
`WorkflowState` struct
- [x] All 231 existing and new tests pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments