Files
loki/drizzle/0091_operator_usage_events.sql
CatoandClaude 0096d86a4c feat(ship): done means seen — ship reports, and Loki records how Build next is used (#1150)
"Build next" (#1141) was reported to the operator as a merge notice: merged
at 21:14, "should go live on its own", "I haven't confirmed that, or tried
the screen in a browser myself", open /loki and tap a chip. Read on a phone.
No link, no picture, no statement of what was checked — every rule this
repo already states ("confirm the commit is LIVE, not just merged"; the
fleet brief's "done means merged, deployed and checked live") skipped,
because checking took tooling nobody had wired together.

Ship report (`pnpm run ship:report -- /route --focus '<selector>'`):
- confirms the running site's build commit contains the shipped one
  (/api/health `commit`, with `--wait` to sit out the deploy), never a guess
  from a timestamp
- screenshots the real deployed page at 390 and 1440, crops the built
  section, counts console errors and 5xx during load
- writes REPORT.md: live URL first, screenshots, what was and was NOT
  checked; exits non-zero while the build is not live or the section is
  missing
- session auth shared with the responsive audit in
  scripts/test/lib/session-cookie.mjs (extracted, not duplicated)

The contract — docs/development/ship-report.md — keeps the message it
replaces, and the fleet brief now tells every dispatched agent to report
the live URL first, a screenshot, and what was verified.

After it ships, Loki watches whether it is used: operator_usage_events
records each show, tap and rotate of Build next (surfaces and actions SSOT
in src/config/usage-surfaces.ts; /api/usage refuses anything else; target
is an id, never prose). A pure summariser turns the rows into one line per
surface — shown, tapped, kinds offered and never taken — and a `usage`
retrieval source hands it to Loki: "how am I using Build next?" leads with
it, and every "what should I build?" reads it before recommending, with a
prompt line to say when a surface is shown and never used and propose the
one change.

Tests: scripts/test/usage-summary.ts (registry refuses unlisted pairs,
never-shown surface reported, window honoured, planner leads with usage
when asked about use); retrieval-plan, telemetry-freshness, fleet-brief and
account-deletion gates extended or passing as-is.


Claude-Session: https://claude.ai/code/session_016T1Vm7uYyhpgUxbD3xXro9

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-11 15:21:48 -07:00

16 lines
645 B
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- Migration: what the operator does with a surface Loki built — shown, tapped,
-- rotated, dismissed. Append-only; surfaces and actions are SSOT in
-- src/config/usage-surfaces.ts. Hand-written, like 0073–0090.
CREATE TABLE IF NOT EXISTS operator_usage_events (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
surface text NOT NULL,
action text NOT NULL,
target text,
path text,
meta jsonb,
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX IF NOT EXISTS idx_operator_usage_user_surface_time
ON operator_usage_events (user_id, surface, created_at);