feat(webui): bindings dashboard UI; fix app-wide Preact render regression

Completes t2db.8's remaining UI half. Mirrors ui/src/mappings/ exactly:
bindings.jsx (list + editor), binding-editor.jsx (pure StatusPill/
BindingRow), bindings.css, wired into main.jsx's route table with a new
icon. API helpers (bindingCreate/Update/Delete/Approve) added to
api.jsx following the existing mapping* pattern.

CRITICAL FIX, found via real browser verification (AGENTS.md's UI rule),
not by inspection: every JSX-based page in this app -- dashboard, tasks,
logs, captures, mappings, skills, workflows, memory, curators, channels,
settings, and now bindings -- silently rendered the literal text
"[object Object]" instead of its content. Root cause: main.jsx's router
passed each page's Preact VNode into dom.jsx's mount()/append(), which
only knows how to append real DOM Nodes or stringify everything else --
so a VNode object became exactly that string. Confirmed this predates
tonight's work entirely: extracted and served the already-committed
ui/dist bundle in isolation and reproduced the identical failure on the
stock dashboard, unrelated to any change here.

Fix: main.jsx's show() now detects a Preact VNode vs. a real DOM Node
(the unused `soon: true`/comingSoon() fallback) and calls Preact's own
render() for the former, leaving the generic mount() helper and its
other four vanilla-DOM call sites untouched. Verified every single page
renders correctly post-fix via a throwaway, fully-isolated webui.Server
harness (temp SQLite, no real config/forge/network calls) driven by
Playwright -- not assumed from the source diff alone.

Also found and fixed a second real bug the same way: editing a binding
without retyping its secret (the intended "leave blank to keep the
current one" UX, matching UpdateBinding's own documented COALESCE
contract) was rejected with 400, because the API handler validated
edits with the create-time Validate(), which unconditionally required
a full-length secret. Root-cause fix: split Binding.Validate() (create,
unchanged) from a new ValidateForUpdate() (skips the length floor only
when the secret is empty -- preserving the existing one -- still
enforces it on a genuinely-supplied new secret). Full state machine
(draft -> edit -> pending_approval -> approve -> armed -> delete)
verified end-to-end in the browser afterward.

Filed archie-core-mlro separately for the Pill component's pre-existing
duplication across 11 files -- not fixed here, out of scope for this
ticket, following this session's established discipline.
This commit is contained in:
sam committed 2026-09-03 06:17:24 +10:00
1 parent 2e5e5dbc7a
commit 4fa478a2de
9 files changed
+440 -10

No files matched your search

+38
View File
@@ -162,6 +162,44 @@ export const api = {
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
return res.json();
},
bindings: () => req("/api/bindings"),
bindingCreate: async (binding) => {
const res = await fetch("/api/bindings", {
method: "POST",
headers: { Accept: "application/json", "Content-Type": "application/json", "X-Archie-CSRF": "1" },
body: JSON.stringify(binding),
signal: AbortSignal.timeout(15000),
});
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
return res.json();
},
bindingUpdate: async (id, binding) => {
const res = await fetch(`/api/bindings/${id}`, {
method: "PATCH",
headers: { Accept: "application/json", "Content-Type": "application/json", "X-Archie-CSRF": "1" },
body: JSON.stringify(binding),
signal: AbortSignal.timeout(15000),
});
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
return res.json();
},
bindingDelete: async (id) => {
const res = await fetch(`/api/bindings/${id}`, {
method: "DELETE",
headers: { Accept: "application/json", "X-Archie-CSRF": "1" },
signal: AbortSignal.timeout(15000),
});
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
},
bindingApprove: async (id) => {
const res = await fetch(`/api/bindings/${id}/approve`, {
method: "POST",
headers: { Accept: "application/json", "X-Archie-CSRF": "1" },
signal: AbortSignal.timeout(15000),
});
if (!res.ok) throw new ApiError(await errorMessage(res), res.status);
return res.json();
},
memory: () => req("/api/memory"),
chatSessions: () => req("/api/chat/sessions"),
chatMessages: (id) => req(`/api/chat/sessions/${encodeURIComponent(id)}/messages`),
+1
View File
@@ -19,6 +19,7 @@ const paths = {
curators: '<circle cx="12" cy="12" r="8"/><path d="M12 8v4l3 2"/>',
captures: '<path d="M12 3v11M12 14l-4-4M12 14l4-4"/><path d="M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-4"/>',
mappings: '<circle cx="5" cy="7" r="2"/><circle cx="5" cy="17" r="2"/><circle cx="19" cy="12" r="2"/><path d="M7 7l10 5M7 17l10-5"/>',
bindings: '<rect x="3" y="9" width="8" height="6" rx="2.5"/><rect x="13" y="9" width="8" height="6" rx="2.5"/><path d="M9 12h6"/>',
settings: '<circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.9l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-2.9 1.2V21a2 2 0 1 1-4 0v-.1A1.7 1.7 0 0 0 7 19.4a1.7 1.7 0 0 0-1.9.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1A1.7 1.7 0 0 0 3 15H3a2 2 0 1 1 0-4h.1A1.7 1.7 0 0 0 4.6 7a1.7 1.7 0 0 0-.3-1.9l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1A1.7 1.7 0 0 0 9 3.6V3a2 2 0 1 1 4 0v.1A1.7 1.7 0 0 0 15 4.6h.1a1.7 1.7 0 0 0 1.9-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.9V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/>',
search: '<circle cx="11" cy="11" r="7"/><path d="M20 20l-3.6-3.6"/>',
moon: '<path d="M20 14.5A8.5 8.5 0 0 1 9.5 4a8.5 8.5 0 1 0 10.5 10.5z"/>',