Skip to content

feat(ui): expose cancel_synthesis in the queue entry menu - #174

Merged
xilec merged 1 commit into
mainfrom
feat/161-cancel-menu-item
Aug 1, 2026
Merged

feat(ui): expose cancel_synthesis in the queue entry menu#174
xilec merged 1 commit into
mainfrom
feat/161-cancel-menu-item

Conversation

@xilec

@xilec xilec commented Aug 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a "Отменить синтез" item to the queue entry context menu in QueueList, enabled only for processing entries, calling the existing cancel_synthesis Tauri command (backend landed in pipeline: leading-dot decimals like ".5" are never read #147).
  • Failures show a red "Не удалось отменить синтез: …" notification.
  • The menu now resolves the entry from live entries state instead of the right-click snapshot, so the item can't be triggered against an entry whose status changed while the menu was open (found in review: cancel on a just-finished entry would have silently flipped it back to pending).
  • OpenSpec change expose-cancel-synthesis-menu archived; queue-lifecycle spec updated ("Per-entry actions").

Test plan

  • pnpm test:unit — 129 passed (new QueueList component suite: cancel click dispatches the command, item disabled for ready/playing/pending/error, rejection shows the error notification)
  • just lint green
  • cargo test green

Follow-up (not in this PR)

Backend cancel_entry flips status to pending unconditionally — worth hardening to a no-op/error unless processing (separate issue).

Closes #161

Expose the existing cancel_synthesis command in the per-entry menu,
enabled only while the entry is processing; failures surface as an
error notification. Resolve the menu entry from live state instead of
the right-click snapshot so actions always see the current status.
@xilec
xilec merged commit 75671df into main Aug 1, 2026
6 checks passed
@xilec
xilec deleted the feat/161-cancel-menu-item branch August 1, 2026 11:14
xilec added a commit that referenced this pull request Aug 1, 2026
## Summary

- `cancel_entry` previously flipped **any** entry to `pending`
unconditionally. A cancel arriving after the entry left `processing`
(the race fixed frontend-side in #174: synthesis finishes while the
context menu is open) silently regressed a `ready`/`error` entry and
orphaned its audio from the state machine (playback requires `ready`;
the entry would be re-synthesized on the next trigger).
- Now `ready`/`playing`/`error` are rejected with `synthesis_error`
before touching the registries or storage — same error style as
`play_entry`'s "entry is not ready".
- `pending` stays allowed **deliberately**: cancel is idempotent for
idle entries (existing #129 orchestration test pins this), and a
just-added entry briefly sits in `pending` with its synthesis task
already registered — rejecting it would break that window.
- OpenSpec change `harden-cancel-entry-status-guard` archived;
`ipc-commands` spec updated (idle-cancel allowed, terminal-entry
rejection, new scenarios).

## Test plan

- [x] `cargo test` — 974 passed (new: reject `ready`/`error` with
registries untouched; `pending` with a registered task still aborts it)
- [x] `just lint` green
- [x] `openspec validate --specs --strict` green

## Follow-up (not in this PR)

A µs-scale read-decide-write race remains between `require_entry` and
`update_entry` (guard reads a clone, synthesis can complete before the
write). Closing it needs a storage-level compare-and-set, which would
also harden `apply_ready_if_current`/`apply_error_if_current` — will be
filed as a separate tech-debt issue.

Closes #176
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.

feat(ui): expose cancel_synthesis in the queue entry menu

1 participant