feat: atomization pipeline with job queue, atomizer client, WS hub, and board UI (phase 7)

- internal/extsvc: circuit breaker (§11.16) + retrying bearer JSON client
- atomizer client: §5.1 contract incl. defensive coefficient normalization
  and extension coefficient range (0,2]
- persisted jobs collection: atomic claim, panic recovery, exponential
  backoff (max 3), stale-running requeue, shutdown-safe bookkeeping
- subdivide (async 202, atomizing status, re-run replaces unpublished
  children after confirm) and extend (sibling task, source budget)
- failure path reverts status and notifies the consultant on final attempt
- PATCH task editing with bounty recompute, budget cascade to descendants
- publish single + bulk; task detail endpoint role-scoped
- coder/websocket hub: multiplexed channels, origin check, 30s heartbeats;
  client ws.js with reconnect + 15s polling fallback
- consultant atomization board: tree by root, coefficient sliders with live
  per-parent sum indicator, bounty preview, modals, shimmer, atomizer-down
  gating via /api/v1/service-health
- fix: tasks external-ref unique index is partial, not sparse (compound
  sparse indexed every task through customerId and broke child inserts)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
etalon
2026-06-12 19:17:09 +02:00
parent 4e01b64bbd
commit f87b954f27
23 changed files with 2628 additions and 7 deletions
+91
View File
@@ -0,0 +1,91 @@
{{define "content"}}
<div class="spread">
<h1>Atomization Board</h1>
<span id="atomizer-health" class="badge" aria-live="polite">checking atomizer…</span>
</div>
<div class="error-box" id="error" role="alert"></div>
<div class="spread mt">
<label for="board-customer" class="muted" style="display:inline">Customer:&nbsp;
<select id="board-customer" style="width:auto"></select>
</label>
<span>
<button class="btn small" id="select-all">Select all atomized</button>
<button class="btn primary small" id="bulk-publish" disabled>Publish selected (0)</button>
</span>
</div>
<div id="board" class="stack mt"></div>
<dialog id="subdivide-dialog">
<form method="dialog" id="subdivide-form" class="stack" style="min-width:420px">
<h2>Subdivide task</h2>
<p class="muted" id="subdivide-task-title"></p>
<div class="field">
<label for="sd-note">Note for the atomizer (optional)</label>
<textarea id="sd-note" placeholder="e.g. split backend/frontend, keep DB migration separate"></textarea>
</div>
<div class="row">
<div class="field">
<label for="sd-min">Min subtasks</label>
<input type="number" id="sd-min" min="0" max="20" value="2">
</div>
<div class="field">
<label for="sd-max">Max subtasks</label>
<input type="number" id="sd-max" min="0" max="20" value="8">
</div>
</div>
<p class="hint" id="sd-replace-warning" hidden>⚠ This task already has subtasks. Re-running replaces the unpublished ones.</p>
<div class="spread">
<button class="btn" type="button" id="sd-cancel">Cancel</button>
<button class="btn primary" type="submit">Subdivide</button>
</div>
</form>
</dialog>
<dialog id="extend-dialog">
<form method="dialog" id="extend-form" class="stack" style="min-width:420px">
<h2>Extend task</h2>
<p class="muted" id="extend-task-title"></p>
<div class="field">
<label for="ex-note">Extension note (required)</label>
<textarea id="ex-note" required placeholder="describe the additional scope"></textarea>
</div>
<div class="spread">
<button class="btn" type="button" id="ex-cancel">Cancel</button>
<button class="btn primary" type="submit">Create extension</button>
</div>
</form>
</dialog>
<dialog id="edit-dialog">
<form method="dialog" id="edit-form" class="stack" style="min-width:480px">
<h2>Edit task</h2>
<div class="field">
<label for="ed-title">Title</label>
<input type="text" id="ed-title" required>
</div>
<div class="field">
<label for="ed-desc">Description</label>
<textarea id="ed-desc" rows="6"></textarea>
</div>
<div class="field">
<label for="ed-ac">Acceptance criteria (one per line)</label>
<textarea id="ed-ac" rows="4"></textarea>
</div>
<div class="row">
<div class="field">
<label for="ed-budget">Budget</label>
<input type="number" id="ed-budget" min="0" step="0.01">
</div>
<div class="field" id="ed-cascade-wrap">
<label><input type="checkbox" id="ed-cascade" checked> Apply budget to subtasks</label>
</div>
</div>
<div class="spread">
<button class="btn" type="button" id="ed-cancel">Cancel</button>
<button class="btn primary" type="submit">Save</button>
</div>
</form>
</dialog>
{{end}}