fix(close): make issue close/cancel idempotent when already in terminal state - #113
Merged
Conversation
…al state
- Add `state` attribute to Issue resource; include `state { id name type }`
in both base_fields and full_fields GraphQL queries so the CLI can inspect
an issue's current workflow-state type.
- Short-circuit `close_issue/2` and `cancel_issue/2` in IssueHelpers: when
`issue.state.type` is already the target type (completed / cancelled), skip
the comment and mutation, print "<identifier> is already <state name>", and
return `{:ok, issue}`.
- Fix `Issue.Update.Close` mutation payload: omit `trashed` entirely when
false instead of sending `"trashed" => false`, which the Linear API rejects
(only `true` or null are valid).
- Tests: add idempotency cases for close, cancel, and close-with-cancel-flag;
verify state is parsed from API responses; update trashed-omission assertion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bougyman
pushed a commit
that referenced
this pull request
Aug 14, 2026
🤖 I have created a release *beep* *boop* --- ## [1.6.0](v1.5.1...v1.6.0) (2026-08-14) ### Features * **build:** add mix burrito.dinein for local binary builds ([#112](#112)) ([decf951](decf951)) ### Bug Fixes * **ai:** adds CLAUDE.md symlink ([#110](#110)) ([5165c4e](5165c4e)) * **close:** make issue close/cancel idempotent when already in terminal state ([#113](#113)) ([0a71060](0a71060)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
stateattribute to theIssueresource and includesstate { id name type }in GraphQL queries, giving the CLI visibility into an issue's current workflow-state type.close_issue/2andcancel_issue/2inIssueHelpers: whenissue.state.typealready matches the target (completed / cancelled), skips the reason comment andissueUpdatemutation, prints"<identifier> is already <state name>", and returns{:ok, issue}.Issue.Update.Closemutation payload: omitstrashedentirely when not requested instead of sending"trashed" => false, which the Linear API rejects.Test plan
IssueHelpers.close_issue/2no-ops and prints accessible message when issue is already completedIssueHelpers.close_issue/2no-ops when called withcancel: trueand issue is already cancelledIssueHelpers.cancel_issue/2no-ops and prints accessible message when issue is already cancelledLinear.close_issue/2omitstrashedfrom mutation input when not requestedLinear.close_issue/2sendstrashed: trueonly when explicitly requestedIssue.from_map/1parsesstatefrom API response into aWorkflowStatestruct🤖 Generated with Claude Code