feat(recovery): add "Ask CEO to fix" delegated recovery to the recovery card

Implements the recovery-card UI integration for PAP-12752, wiring the
delegated recovery backend contract into the issue detail experience.

- issuesApi.delegateRecoveryAction() calls POST /issues/:id/recovery-actions/delegate.
- IssueRecoveryActionCard offers "Ask CEO to fix" (outcome delegate_ceo) first in
  the Resolve popover, with a Recommended pill. It is backend-authoritative and shown
  only when wakePolicy.type === "manual_repair_required", the state is not
  resolved/observe_only, and it has not already been delegated. A persistent
  "Recovery task" link row surfaces the created recovery issue.
- IssueDetail wires delegate_ceo through a mutation: on success it refreshes the
  source issue (now blocked on the recovery task) and shows a success toast linking
  to the created task; on failure it surfaces the API error without mutating local
  recovery state. False-positive actions stay board-only.
- Tests cover menu rendering + placement, API invocation, success toast/link, and
  failure handling. Storybook states show the delegate menu and delegated card.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
committed 2026-07-31 23:30:43 +00:00
1 parent 82d4e4162b
commit 71b3e304eb
7 files changed
+331 -5

No files matched your search

+9
View File
@@ -37,6 +37,13 @@ export type ResolveRecoveryActionResponse = {
recoveryAction: IssueRecoveryAction;
};
export type DelegateRecoveryActionResponse = {
issue: Issue;
recoveryIssue: Issue;
recoveryAction: IssueRecoveryAction;
reused: boolean;
};
export type IssueListFilters = {
attention?: "blocked";
status?: string;
@@ -170,6 +177,8 @@ export const issuesApi = {
resolutionNote?: string | null;
},
) => api.post<ResolveRecoveryActionResponse>(`/issues/${id}/recovery-actions/resolve`, data),
delegateRecoveryAction: (id: string, data: { actionId: string; target: "ceo" }) =>
api.post<DelegateRecoveryActionResponse>(`/issues/${id}/recovery-actions/delegate`, data),
previewTreeControl: (id: string, data: PreviewIssueTreeControl) =>
api.post<IssueTreeControlPreview>(`/issues/${id}/tree-control/preview`, data),
createTreeHold: (id: string, data: CreateIssueTreeHold) =>