Skip to content

Session row right-click: 'Mark issue done' — close GitHub issue / transition Jira to mapped completed status #526

@dhilgaertner

Description

@dhilgaertner

Summary

Add a right-click context-menu item on a session row that moves the linked issue into its done/closed state:

Why

On some workspaces there's no automation linking the merged PR → issue, so the issue doesn't auto-close on merge and has to be closed by hand in the provider UI. A one-click "mark done" on the Crow session row removes that manual round-trip.

Current state / where it plugs in

  • Context menu: the session-row .contextMenu { … } is in Packages/CrowUI/Sources/CrowUI/SessionListView.swift. Add the new item there (gated on the session having a linked ticket).
  • Backend abstraction (ADR 0005): TaskBackend (Packages/CrowProvider/Sources/CrowProvider/TaskBackend.swift), obtained via ProviderManager.taskBackend(for:host:)GitHubTaskBackend / GitLabTaskBackend / Jira backend.
  • Important distinction: TaskBackend.setTaskStatus(url:status:) is not the right call for GitHub here — for GitHub it runs a Projects-v2 board-column mutation (capability .projectBoardStatus), which sets a board status but does not close the issue. The user wants the issue closed. So add a dedicated close operation rather than overloading setTaskStatus(.done).

Proposed implementation

  1. New TaskBackend methodfunc closeTask(url: String) async throws (name TBD), implemented per provider:
    • GitHubTaskBackendgh issue close <url> (consider also moving the Projects-v2 card to Done if the repo has a board, but closing is the required behavior).
    • Jira backend → transition the work item to the mapped completed status: consult this workspace's jiraStatusMap (Settings UI to map Crow ticket states ↔ Jira workflow statuses #523) for the name mapped to Done/completed; fall back to "Done" when unmapped. Use the same transition path the backend already uses (transitionJiraIssue / jiraStatusName(for:)).
    • GitLabTaskBackendglab issue close <url>.
    • StubCorveilTaskBackendProviderError.unimplemented (or no-op), consistent with the other optional ops.
  2. Context-menu item in SessionListView.swift — e.g. "Mark Issue Done" (GitHub label could read "Close Issue", Jira "Mark Done") on the session row, calling closeTask(url:) for the session's linked ticket via the resolved backend. Show only when the session has a ticket link.
  3. Session reflection (optional, decide in impl): after a successful close, optionally also set the Crow session status to completed (crow set-status … completed) so the row reflects the new state — or leave session status untouched and only act on the issue. Recommend in the PR.
  4. Errors: surface failures (auth, transition not allowed, already closed) without crashing; best-effort, log + non-fatal toast/notice consistent with existing backend error handling.

Acceptance criteria

  • Right-clicking a session row with a GitHub ticket shows a "Close Issue" (done) item that closes the issue on GitHub.
  • Right-clicking a session row with a Jira work item shows a "Mark Done" item that transitions it to the project's mapped completed status (via Settings UI to map Crow ticket states ↔ Jira workflow statuses #523's jiraStatusMap; "Done" fallback).
  • The item is hidden/disabled when the session has no linked ticket.
  • Failures are surfaced gracefully (no crash); success is reflected in the UI (and optionally the session status).

Dependencies / notes

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions