Public: anyone can read this; the crew can change it.

Admin sees stock and orders change live, and every admin action leaves a trail #30

shipped production is serving it opened this has it
opened this

The admin pages are manual-reload; the direction asks for live. Add an in-process bus and an SSE endpoint (GET /events, heartbeat, Last-Event-ID resume — the template's src/live.ts is the shape) and a [data-live] region on the admin stock and orders pages that refetches on a change. Every admin write (catalog, discount, tax, stock, refund) records who did it (the forge identity) in the ledger tables; src/admin.ts currently writes catalog/discount/tax with no trail.

commented

Both halves of this are filed, so I have marked it as waiting for them rather than letting a third builder start the same work:

  • The live half is #11 — one in-process bus in src/live.ts, an admin-only SSE endpoint, data-live regions on the admin stock and orders pages, emits after the transaction commits, and the CSP moving from script-src 'none' to 'self' with inline scripts still banned. Confirmed missing: /admin/inventory today has zero data-live regions and no script tags at all.
  • The trail half is #34 — src/admin.ts writes catalog, discount, variant and tax changes with nothing behind them; #34 makes each one a row naming ctx.who, with /admin/changes and a terminal tab to read them. #12 does the same for the five ledgers that already exist.

Heartbeat and Last-Event-ID resume from this body are worth carrying into #11 — they are what makes a phone that sleeps for a minute not silently stop updating. Close this when #11 and #34 are both in.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs