feat(relations): add multi-target issue relation removal - #254
Conversation
Implements `lc issue relation remove ISSUE RELATED_ISSUE... --type TYPE` (aliases: r, rm) as the deletion counterpart to `relation add`. - Adds ManualDestroy action to IssueRelation backed by the `issueRelationDelete(id: String!)` GraphQL mutation - Adds `delete_issue_relation/1` domain code interface - Adds `issue_relation_remove/1` in CLI.Commands: resolves the stored relation by listing the subject's relations then matching by wire type, direction, and endpoint identifier; handles blocked-by reversal; absent relation is a per-target no-op; ambiguous match (multiple rows) fails with all matching IDs listed; each target processed independently with per-target human/JSON result reporting and non-zero exit on failure - Adds `remove` subcommand spec and dispatch; aliases r and rm - Extends IssueRelation, Commands, and CLI alias tests; updates ERD doc Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
73d05c7 to
5ed1603
Compare
|
There's an ugly case at https://github.com/rubyists/linear-cli/pull/254/files#diff-3c0f086fbd3d0b0af6f9c0e48ed5b2fbc473169f2cbdd632bf4e79ee701af2ebR1222 that needs to be idiomatically elixired. (multiple methods with matchers) |
Replace the `case matches do` in `remove_single_relation/4` with three `do_remove/2` function clauses, matching on the empty list, single-element list, and multiple-element list patterns — the idiomatic Elixir approach. No behaviour change; all 471 tests still pass.
Rework: addressed review feedbackReview comment addressed: "There's an ugly case at line 1222 that needs to be idiomatically elixired. (multiple methods with matchers)" What changed: Refactored
The dispatch is now a single pipeline in subject_id
|> find_matching_relations(related_id, user_type, all_relations)
|> do_remove(related_id)No behaviour change. All 471 tests still pass, credo 0 issues (716 mods/funs now with the 3 new Commit: e029548 |
Summary
lc issue relation remove ISSUE RELATED_ISSUE... --type TYPE(aliases:r,rm)issueRelationDelete(id:)— no arbitrary deletionblocked-bycorrectly targets the inboundblocksrelation (same reversal logic asadd)Scope of changes
app/lib/linear_cli/linear/issue_relation.ex—destroy :destroyaction +ManualDestroymodule callingissueRelationDeleteapp/lib/linear_cli/linear.ex—delete_issue_relationcode interfaceapp/lib/linear_cli/cli/commands.ex—issue_relation_remove/1with per-target result tuples, matching logic, and human/JSON outputapp/lib/linear_cli/cli.ex—removesubcommand spec, dispatch clause,r/rmaliasesdocuments/ash-domain-erd.adoc—:destroyaction anddelete_issue_relationinterface documentedTest plan
mix precommitpasses (format + credo + tests) — confirmed in commit hookCloses EXT-42
🤖 Generated with Claude Code