clear queue → inbox, move pipeline card actions to the top
Build and Push Docker Image / build (push) Successful in 3m54s

- execute/clear now also resets sorted=0 so cleared items land back in the
  inbox where the distributor can re-classify them; previously they got
  stranded in Review with auto_class='auto', unreachable by both
  "Approve all ready" and "Auto Review"
- pipelinecard: action row moves to the top so Skip/Approve/Back-to-review
  sit in the same place regardless of card body height; title row follows;
  file info (copy/transcode reasons) gets a dedicated row with the
  ready/needs-decision badge pushed to the right
- tests: clearQueue preserves running/completed jobs, only pending plans
  flip back to sorted=0 pending

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-19 11:34:49 +02:00
parent 0d560743f3
commit 84e669922b
4 changed files with 220 additions and 114 deletions
+15 -4
View File
@@ -234,17 +234,28 @@ app.post("/job/:id/cancel", (c) => {
// ─── Clear queue ──────────────────────────────────────────────────────────────
app.post("/clear", (c) => {
const db = getDb();
/**
* Cancel every pending job and send its plan back to the Inbox so the
* distributor can re-classify it. Without `sorted = 0` the plan stays in
* Review with `auto_class='auto'` — where "Approve all ready" (auto_heuristic
* only) can't re-queue it and "Auto Review" (sort-inbox, sorted=0 only) can't
* see it, leaving the item stranded until the user manually approves.
*/
export function clearQueue(db: ReturnType<typeof getDb>): number {
db
.prepare(`
UPDATE review_plans SET status = 'pending', reviewed_at = NULL
UPDATE review_plans SET status = 'pending', reviewed_at = NULL, sorted = 0
WHERE item_id IN (SELECT item_id FROM jobs WHERE status = 'pending')
AND status = 'approved'
`)
.run();
const result = db.prepare("DELETE FROM jobs WHERE status = 'pending'").run();
return c.json({ ok: true, cleared: result.changes });
return result.changes;
}
app.post("/clear", (c) => {
const cleared = clearQueue(getDb());
return c.json({ ok: true, cleared });
});
app.post("/clear-completed", (c) => {