Skip to content

tasks: confirm before discarding unmerged worktree work on delete (#160) - #161

Merged
Lexus2016 merged 1 commit into
mainfrom
fix/160-force-delete-unmerged
Nov 27, 2026
Merged

Lexus2016 merged 1 commit into
mainfrom
fix/160-force-delete-unmerged

Conversation

@Lexus2016

Copy link
Copy Markdown
Owner

Closes the first half of #160.

What was actually missing

DELETE /api/tasks/:id has accepted ?force=1 / body.force since the chat delete gained it, and the chat itself (index.html, #129) already asks again and resends with force after a 409 UNMERGED_WORK. The two task screens did not:

  • kanban.html confirmDelete sent an unforced DELETE through apiFetch, which threw on 409, and the catch showed the raw JSON in a toast. The card stayed.
  • schedule.html deleteTask did the same.

So a task whose worktree still holds unmerged commits or uncommitted changes could not be removed from either screen; the only way out was manual git in the container.

Change

Both pages now use one small _taskDeleteRequest(tk, send, ask) helper:

  • first request is unforced;
  • on 409 UNMERGED_WORK it asks, naming the branch and the worktree the delete would destroy (new confirm.unmerged string in uk/en/ru/fr/he);
  • Cancel destroys nothing and closes the dialog;
  • a confirmed second attempt is the only one that carries ?force=1;
  • a forced attempt that is still refused is reported as an error instead of asking again (no loop);
  • 401 goes to /login, any other failure shows the server's message.

Verification (local, Node 24.22.1)

  • test/task-delete-unmerged.test.js (new) — 13/13: runs the real helper from both pages in a vm, pins that both delete buttons go through it (and that neither keeps a bare apiFetch DELETE), and that both dictionaries carry the new string five times.
  • i18n-completeness 139/139, schedule-actions 15/15, kanban-schedule 42/42, kanban-run-badges 40/40, sidebar-ux 8/8, kanban-group-button 6/6.
  • Both pages' inline scripts still parse (checked in the new suite and in kanban-group-button).

Not in this PR: a bulk purge of finished/cancelled/failed unmerged tasks (#2 in the issue) and an expiry setting that may discard unmerged worktrees (#4). Expiry deliberately keeps unmerged work — a setting to drop it is a policy decision, not a bug fix.

DELETE /api/tasks/:id already refuses with 409 UNMERGED_WORK unless forced, and
the chat has asked again and resent with ?force=1 since #129. The Kanban card and
the Schedule list did not: they surfaced the raw refusal in a toast and stopped,
so a task whose worktree still held unmerged commits or uncommitted changes could
not be deleted from either screen at all.

Both now go through the same small request helper: the first refusal becomes the
question, naming the branch and the worktree the delete would destroy; Cancel
destroys nothing, a confirmed second attempt carries ?force=1, and a forced
attempt that is still refused is reported instead of asking again in a loop.

test/task-delete-unmerged.test.js runs the real helper from both pages in a vm,
pins the wiring of both delete buttons, and checks the new string in all five
languages. Local: the new suite 13/13, i18n-completeness 139/139,
schedule-actions 15/15, kanban-schedule 42/42, kanban-run-badges 40/40,
sidebar-ux 8/8, kanban-group-button 6/6 under Node 24.22.1.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T18:08:24.263012Z 1893c41 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Lexus2016
Lexus2016 merged commit d6ebdce into main Nov 27, 2026
3 checks passed
@Lexus2016
Lexus2016 deleted the fix/160-force-delete-unmerged branch November 27, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant