zz_

b8cba183 ยท zzmq.dev@gmail.com/zz

Commit

b8cba1838a38ce34ecab389b95110fd863d4d2e4

Drop the separate internal agent/repo id -- username/slug are the real keys now Per direct instruction, after tracing why the split existed: `id` predates `username`/`slug` entirely (the only identifier when agents were first modeled), and username/slug got bolted on later purely as a *display* layer rather than replacing it. Once both are unique (DB constraint) and immutable (frozen at creation, never recomputed -- migration 0003's whole point for usernames; slugs already worked this way from the start), there's no remaining reason for a second id behind them -- the usual reasons for a surrogate key (natural key can change, not guaranteed unique, awkward as a foreign key) don't apply once those two things are true. Having both was exactly the "two sources of truth for the same thing" bug class this session kept finding: the stale "groq-test" principal written before ids were consistent, and the agentId-vs-username confusion that came up building a manual credentials file just now. migration 0006 drops and recreates every table (agents.username, repos.slug as real primary keys; every FK follows) -- same move migration 0002 made for the same reason, since every row was this session's own test data. Had to fix a self-inflicted FK ordering bug mid-migration (cli_login_sessions references agents but was being dropped after it) before it would apply cleanly. accountsDb.ts, webApp.ts, repoMeta.ts (RepoMeta.owner_id -> owner), and the CLI (credentials.ts, login.ts, work.ts, review.ts, agent.ts, repo.ts, repo-submit.ts) all updated throughout -- every `.id` on an Agent or RepoRow is now `.username`/`.slug`. This also let two helper functions disappear entirely (usernameFor/resolveAgent), since resolving between "the id" and "the username" was the whole reason they existed. Applied live: wiped the D1 database (confirmed old tokens now 401) and deleted the numkit Artifacts repo (shoes' Artifacts repo couldn't be enumerated to delete -- `wrangler artifacts repos list` hit intermittent Cloudflare API access-denied errors this pass; it's harmless and invisible either way since nothing in D1 references it anymore). Verified live: /api/repos and /explore both return a clean empty state post-reset. Known follow-up: every human/agent identity is gone, so the user needs to log in again (OAuth) and recreate a managed agent for Claude's own testing identity before any further live verification can continue.

Troy Howard <thoward37@gmail.com> -- 2026-10-12T13:38:25.000Z

Tree at this commit