You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prototype: a throwaway server-rendered portal #241
Does the picked design hold when it is real? A throwaway prototype on a prototype/portal branch, filed as a never-merged PR with a Try it section: the list at /, the patch page, navigation, plain-form actions for retire, restore, delete, rollback, reassign and description edit, stale-action handling (the patch changed while the page was open), and the agent's patchy list / inspect against the same inventory. Astra evaluates it before it is discarded; the learning is kept on the ticket.
PR, never to be merged: #246 (branch prototype/portal). Its Try it section walks the cards; the dev instance for the worktree that built it is already up at http://127.0.0.1:28848 with the seed applied (Sam, Priya, a deactivated Jonas, twelve patches, two of them reading lunch-orders/orders, one retired, one deleted with 18 days left). To sign in as the seeded admin, add PATCHY_DEV_CLERK_USER_ID=<your Clerk dev user id> to ~/.config/patchy-cloud/dev.env and run pnpm dev stop && pnpm dev in that worktree; the seed survives a restart. Without the binding, /join creates a fresh empty company and the portal shows its empty state.
Built on the real server, session, rows and CLI: / and /patches/<name> as the list mocks picked (#239); the card's Manage side as the patch-page mocks picked (#240): description, who can open it and rollback inline, /retire, /delete (typed name), /restore (only when the patch's own sources are off) and /reassign (admins) as confirmation pages, /versions for the overflow; stale actions carry the row's revision and answer 409 with a notice; patchy list, list <patch> and list <patch> <primitive> over the same rows; a throwaway migration for the retired/deleted/description/reassign stamps. Not built: the retired notice at the patch address, the deactivation pages, the CLI lifecycle verbs, list connections, any sweep change. Typecheck, lint and the suite pass (13 files timed out under load beside the dev instance and pass in isolation).
Where the design held
Master-detail, the card with inline edits and confirmation pages, the three-state lifecycle, the stale-action 409 and one inventory feeding both the portal and patchy list all survived contact with real rows. Nobody has to rethink the shape. Astra's verdict, in full below: build it with amendments, do not rethink.
Where it broke, and what the spec must settle
The friction log (22 points, verbatim below) and astra's classification of it agree on these. Numbered so a reply can pick by number; each carries a recommendation.
Expiry is still alive under the three states. A retired patch can still vanish at its 90-day clock, and list does not filter expired rows. Recommendation: the spec drops expires_at and the top-ups outright; reclaim happens only at deleted_at + 30 days, names free then, and a publish under a reserved name answers name_taken during the window (the prototype already changed the test that expected the name to be free).
"Off is off" got applied to the owner, not just to readers. The one live-only write predicate now hides a retired patch from its own owner's publish (the CLI says "remove patch from patchy.json", which forks the tool) and the address answers 404 instead of the colleague notice The patch lifecycle: retire, restore, delete with a recovery window, rollback #232 decided. Recommendation: two predicates, "serving" and "exists for its owner or an admin"; a retired-specific publish refusal that says restore or ask an admin; the address notice as decided.
A global revision is the wrong stale-action rule.updated_at as the guard means a description save refuses after an unrelated rollback, and a scope change after a description edit, even though Patch metadata: a description the agent writes and the owner or admins edit #235 put the description outside versions. Recommendation (astra's, and mine): keep the hidden field and the 409 re-render, but each act checks its own precondition: retire needs live, delete needs not-deleted, restore needs off, rollback needs the expected current version, reassign the expected owner, scope the expected scope, description the expected description_updated_at.
Restore, rollback and scope leave no actor. The 409 notice can say "now version 7" but never by whom. Recommendation: one last_changed_by/at pair on the row, stamped by every act, so every notice names a person; the per-act stamps stay for the card.
The cumulative inventory is owner-only. A non-owner's patchy list <patch> falls back to the last manifest, so a table published earlier and omitted since is visible to the live owner and invisible to everyone else, which is exactly the dependency an agent is trying to find. Recommendation: a company-readable inventory read, openability-gated like list.
Nobody shows what a patch reads. The list mocks dropped "Uses" from the card as patchy list's job, and the discovery ticket's patch level shows only what a patch owns, so office-map prints "Tables: none" while it reads lunch-orders. Recommendation: a "Reads" section on patchy list <patch> (alias, source patch, table, state); the card keeps only the reverse edge, "Used by other patches".
Wire and CLI details.daysLeft is computed twice against two clocks: put purgeAt on the wire. --state is needed at the patch level to reach a deleted id: allow it there, refuse it at the primitive level. list <retired-name> succeeds with no flag while the top level hides retired: make drill-down follow the same default and say "retired; pass --state retired". A browser session cannot bear GET /api/patches (machine tokens only today): amend Discovery for agents: patchy list and patchy inspect under the machine token #234 to "one query the portal and the API share", not one HTTP route, and keep the API token-only.
Routing and the shell. Serving's /* catch-all claims / by registration order; the real build gives / and the catch-all one owner. Every first-party page is the auth card, so the portal hid the card's brand with CSS to fit a header: the spec names a second htmlPage body (app bar plus two columns) that Company, Connections and Your machines also move onto, or the header only exists on the portal. The migration id goes at the end of the global sequence wherever its file lives. An overlong :patchRef should be 414 like the other routes.
The index line. Cutting at the first ., ; or – and 80 characters reads well when the description front-loads what the tool does; the description hint on the card and in the skills should say so.
Everything else in the friction log is a prototype shortcut (a second HttpApi to spare docs/API.md, the migration split in Runtime's replay test, the role-switch cookie, the seed's rate-limit pause) and does not reach the spec.
Waiting on Allison
The verdict on the prototype itself: does the shape hold for you when you click through it, or is anything on the card or index wrong when it is real?
A pick, by number, on 3, 6, 7 and 8; the rest are follow-through I would carry into the spec ticket as written. Silence on a number means the recommendation stands.
Friction log, verbatim (the implementer's, kept per the ticket)
22 points: what the decision said, what the code forced, what was done
Expiry still runs. The lifecycle decision has three states (live, retired, deleted); the row also carries expires_at and the hourly sweep still hard-deletes expired rows, retired or not. The brief said leave it; the prototype carries expiry untouched, so a retired patch can still vanish when its 90-day clock runs out. The spec must say what retire does to the retention clock.
docs/API.md is a test.packages/api/src/api-md.test.ts asserts the committed markdown equals the render of PatchyApi. Adding the portalPrototype group to PatchyApi would force a docs change the brief forbids. I declared the group in api.ts but mounted it in a second HttpApi (PortalPrototypeApi), served beside PatchyApi on the same router; the CLI builds a second client for it. Same wire, no docs churn; the ApiGuard 414 table only sees PatchyApi, so an overlong :patchRef answers 404 instead of 414.
Serving's / test.packages/serving/src/Pages.test.ts lists / among the static routes that must answer 200 without a session. Removing renderHome's route makes Serving alone answer 404 there (the portal now owns /). I dropped / from that one assertion list and left renderHome in render.ts untested-by-route.
Names stay reserved after delete, and a test said otherwise.PatchesApi.test.ts ("frees the name on deletion") published a fresh patch under a deleted patch's name and expected 201. The publish contract's own text still says "deletion frees all names". I changed the test to expect 409 name_taken during the 30-day window and did not touch the contract text (docs are off limits). The spec has to restate what deletion does to the name and when it is finally freed (the sweep, presumably, after the window).
writable now refuses retired patches everywhere. Adding retired_at IS NULL to the one "may write" predicate means publish, share, inventory reads and the old API delete all answer "Patch not found." for a retired patch. That is what "off is off" asks for, but the CLI's patchy publish from a retired patch's repo now says "Patch is unavailable for update. Remove patch from patchy.json" which is the wrong advice. The spec needs a retired-specific refusal on publish.
Who owns / is decided by build order, not by the route table. Effect's router registers a /* catch-all at the root as well, and the root keeps the first handler added. With Serving's Pages.layer and the portal's layer merged, Serving's 404 won / and the portal answered 404 there. I build the portal layer as a dependency of Pages.layer (Layer.provide) so its routes register first. The real build needs / and the catch-all in one place, or the catch-all moved to the server.
pageResponse hard-codes the auth-card shell. Every first-party page is <main class="auth-card"> with the brand injected and an <h1> from the title. The portal needs a header bar with the brand inside it, so the page passes heading: "", widens .auth-card and hides the injected brand with page CSS. Fine for a prototype; the real build wants a second shell body (app bar + two columns) beside the auth card, both through htmlPage.
Two clocks under one row. The repo stamps audit columns with SQL now() and reads "now" from Effect's clock (so tests can wind it). The stale-action line needs to compare the form's revision (SQL time) with the actor stamps to say "retired by Sam 2 minutes ago"; with TestClock at epoch zero those never line up. I put the actor stamps on the Effect clock like expires_at, kept updated_at on SQL now() as the brief says, and derive the 409 line first by diffing the row this request read against the row now, falling back to stamps. The test sets its clock ahead of the wall. The real build should pick one clock for everything the portal displays.
No actor for restore, rollback and scope. The decisions stamp who retired, deleted, described and reassigned; a restore, a rollback and a sharing change leave no trace of who did them, so the 409 line can only say "now version 7" or "now open to the company only", never by whom. If the spec wants "who last touched it" on every stale notice it needs one last_changed_by/at pair, or an event table.
Ten creates a minute stops a seed at eleven.PATCHY_PATCH_CREATE_RATE_LIMIT_PER_MINUTE refused the eleventh publish with 429. The seed now sleeps out retryAfterSeconds and resends the same publish key. Not a portal problem, but a reviewer running pnpm proto:seed waits about a minute in the middle; say so in the PR body.
A per-package migration record cannot carry a later id.packages/runtime/src/migrations.test.ts replays an upgrade from "everything before Runtime" by spreading the Patches record; with 0008 inside that record the ledger already sits at 8 and Runtime's 0006 never applies. I split the prototype migration out in that test and applied it after Integrations. The ledger rule ("ids in landing order, never backfill") means a capability's record is not a self-contained history once another capability has landed after it; the real build's migration belongs at the end of the global sequence, wherever its file lives.
Primitive descriptions do not exist. The decided patchy list <patch> row carries a description per table and store; the manifest has no such field and neither does the inventory. Every primitive description is "" on the wire and omitted in text. Needs a manifest field (and a publish path) before the CLI can say what a table is for.
Inventory is owner-only, so the CLI's tables come from two sources.Patches.inventory locks the row through the owner-only writable predicate; a non-owner (and the owner of a retired patch) gets PatchUnavailable. The handler falls back to the current version's manifest, which is what the last publish declared, not the cumulative inventory: a table published earlier and omitted since is visible to the owner and invisible to everyone else. Seen live: patchy list expense-form as Dev Machine (Priya owns it after the seed's reassign) lists claims from the manifest. The spec needs a company-readable inventory read.
patchy list <patch> says what a patch owns, not what it reads. The decided levels are patch → tables and stores; a patch that only declares uses (office-map) prints "Tables: none", so an agent cannot see from the CLI that it depends on lunch-orders. The portal card shows the reverse edge ("Used by other patches"). One of the two views should show uses.
--state at the patch level. The brief says a flag on the wrong level is an error, and also asks for patchy list --state all <deleted id>. I let --state through at the patch level as the gate for deleted (by id, --state all required) and retired (--state live refuses) patches, and refuse it at the primitive level. --mine is top level only.
Days left is computed twice. The wire carries deletedAt; the portal and the CLI each compute "N days left" from it against their own clock. If the window ever moves off 30 days the CLI drifts; the spec should put daysLeft (or purgeAt) on the wire.
The index line's first clause. "Up to the first ., ; or –" cuts "Where everyone sits, by floor and desk number; searchable by name." at the semicolon and "Weekly pipeline and closed-won by rep, pasted in from the CRM export every Monday morning." at 80 characters with an ellipsis. Readable, but writers will learn to front-load; the spec should say so where the description is edited.
Retired and deleted cards keep only Restore. The brief lists Manage forms for the live card and Restore for off cards. I chose to hide description, sharing and version forms on retired and deleted cards (they would post to a patch nobody can open) and to keep Delete… on a retired card, since delete is allowed from retired. A deleted card offers only Restore.
Restore when the source is only retired.brokenSources treats a retired source the same as a deleted or missing one, so restoring a dependant asks for the acknowledgement even though the source may come back tomorrow. That matches the runtime (a retired source fails shared.* reads with access_denied) but the copy says "deleted" and "gone" in places where "retired" is the truth; the restore page states the source's actual state.
One header, two shells. Only the pages this prototype adds carry the shared header; Company, Connections and Your machines still render in the auth-card shell without it, so navigating from the portal to Company loses the header and the way back is the browser. Expected by the brief, but the first thing a reviewer will notice.
The prototype role switch is a cookie the real code never sees. It lowers an admin to member for the portal only; /company still treats the same session as admin. Good enough to see the member card, but it cannot show what a real member sees on /company/connections beside the portal.
Machine tokens reach the list API; browser sessions do not.Authorization resolves machine tokens only, so GET /api/patches from a signed-in browser is a 401 even though the same person can read /. The brief called both "bearers"; today only the token is. The CLI is unaffected.
Fresh session with tools over the branch, the friction log and the six decisions; the brief asked it to disagree where the evidence supports it.
Six sections: where the design broke, stale actions, authority, one inventory, how it expands, what the spec must settle
1. Where the design broke
Friction log, classified:
Expiry still runs. Hole. The patch lifecycle: retire, restore, delete with a recovery window, rollback #232 drops expires_at; the sweep still hard-deletes on the 90-day clock. Portal list does not even filter it, so an expired “live” row can list while the address 404s. Spec: drop the clock; deleted_at+30d is the only reclaim.
Names reserved through delete. Hole in follow-through, not in the decision. Publish contract still says deletion frees names; the test now expects name_taken. Spec restates: names free at gone, at the sweep.
writable + resolveName fold retire into “not found.” Hole, and a misread of “off is off.” That rule is consumer access_denied on shared reads, not owner publish and not the address URL. patchy publish then says “Remove patch from patchy.json” (fork). Signed-in GET /patchy-dev/vendor-list is 404; The patch lifecycle: retire, restore, delete with a recovery window, rollback #232 wants a colleague notice with Restore. The test encodes the 404 as intended.
/ vs Serving /*. Hole in the route table. First-registered catch-all won until portal was Layer.provided under Pages. Spec: one owner for / and the catch-all.
Two clocks; no actor on restore / rollback / scope. Hole for 409 copy. Actor stamps on Effect time, updated_at on SQL now().
daysLeft computed twice; 500 via .length; no primitive descriptions; connections: []. First two are spec; primitive descriptions and connections were already decided and just not built.
Shortcuts, ignore: second HttpApi to spare docs/API.md (overlong :patchRef is 404 not 414); / assertion; auth-card CSS hack; seed 429 sleep; migration 0008 split in Runtime’s replay; header only on new pages; proto role cookie; Copy address as user-select:all.
Missed: patchy list vendor-list succeeds with no --state (top-level defaults live; drill-down does not). Browser session cannot GET /api/patches (#234: both bearers).
2. Stale actions
updated_at as a global revision is a fine OCC hammer and the wrong product rule. Description sits outside versions (#235); a description save and a rollback must not refuse each other. Same for description vs scope, reassign, restore, and (if retired stays editable) retire.
Gate the precondition of the act:
retire: still live (re-query dependants; ack if any)
delete: not already deleted (typed name; ack only from live)
restore: still off (ack if sources broken)
rollback: live + expected currentVersionId
reassign: expected owner, target still active
scope: live + expected scope
description: expected description_updated_at (no-op must not stamp, as now)
Do not gate on a sibling field. Keep recover-in-place (re-render with a fresh hidden field).
409 copy for a non-builder, no codes, no “revision”: “This patch changed while you had this page open: retired by Sam 2 minutes ago. Nothing was done.” Name person and act when an actor exists; otherwise the new state (“now version 7”, “now open to the company only”). Point them at the card they are already looking at.
3. Authority and visibility
Actor
Shown / allowed
Verdict
Owner
Manage on own; 403 on Sam’s POST to someone else’s description
Matches
Admin
Manage on all, reassign, admin line only when not owner, deactivated-owner notice
Matches; publish stays out of the portal
Member
Facts + Open, no Manage
Matches (Sam). GET /patches/<name>/versions is unguarded by URL — unspecified
Deactivated owner
Patches stay live, marked; Jonas absent from reassign picker; they cannot sign in
Matches
Other company
company_id on every query → 404
Matches (code; not live-probed)
Machine token
GET /api/patches 200; HTML portal needs a session; no retire API
CLI-correct. Browser session on the same route is 401 — #234 forbids that
The admin/member cookie only lowers portal canManage. Own patches still show Manage (correct). It cannot show a real member on /company or connections. That hides the deactivation/connections gap, not a card-permission bug.
4. One inventory, two views
Same PortalQueries.list, same descriptions, owners, deactivated marks, states. Live probe: 10 live rows, connections [], qa-signoff empty string, Jonas deactivated: true.
Divergence that matters to “do we already have a tool for this”:
Retired by name is visible to the CLI without --state; hidden on / until ?all=1. An agent can conclude the tool exists while the skill says to pass --state retired first.
Tables: inventory vs manifest (above). Dependency discovery lies for everyone but the live owner.
uses absent; primitive description always ""; list connections still points at catalog.
Deleted-by-name on the card URL vs id-only in the CLI — decided, fine.
daysLeft is local to each clock.
Names + descriptions agree. That is enough for a first pass, not for add.
5. How it expands
The seam that breaks first is Patches’ live-only predicates (retired_at IS NULL on writable, resolveName, find, inventory). Address notice, retired publish, and company-readable inventory all hit it.
Then list is company_id, not openability — personal/group sharing. Then PatchList.connections: Never[] (second integration), the facts <dl> (tier 2), no sticky card (100+), Company pages still on the auth-card shell (deactivation pick — the one place master-detail already cannot go).
6. The spec
Must settle, not already closed:
Drop expiry; reclaim only at deleted_at + 30d; names free then; publish name_taken during the window.
Bearers: session and machine token on GET /patches….
Wire: {patches, connections} with a real connection row; purgeAt or daysLeft; PUT /patches/:id/description; --state at patch level; default for list <retired-name>.
OCC: per-action expected state, not global updated_at; actors on restore / rollback / scope, or accept “now …” copy.
Routes: who owns / and /*; /patches/<name>/{retire,delete,restore,reassign,versions}; Company deactivation/reactivation; address notice vs signed-out door vs foreign 404; second htmlPage shell.
409 / 422 / 403 copy; typed-name delete; ack only when something breaks; delete-from-retired copy (already in the prototype); unshare-at-publish warning; 414 on overlong :patchRef.
Migration id at the end of the global sequence. Index first-clause rule (front-load; ; and 80 chars cut). Catalog removed.
Build it with amendments, do not rethink. C (master-detail) and C (inline edits, destruction confirms) survived contact with a real inventory, stale POSTs, and patchy list. The lifecycle three-state model held. What failed is the one live-only write predicate, the global revision, expiry left in place, and the unresolved #235/#240 retired-edit clash — all spec deltas, not a new shape.
Allison's first pass, and one amendment on the branch
Allison clicked through on 2026-09-15: "this is good", with one oversight: Company, Connections and Your machines still rendered in the sign-in card while the portal had its own header, so the product felt like two things. Her call: everything signed-in shares the portal's nav and base feel. That was spec delta 9 above; it is now a decision, not a delta.
Applied on prototype/portal (commit 3d622c5, PR #246 updated): the header and wide card moved out of the portal into the shared page shell as a second body beside the sign-in card. The portal, Company, Connections and Your machines all render through it, with the current section marked and sign-out in the header; the duplicate Connections link under the Company title went. The sign-in door, create-or-join, the device-login confirm page and error pages stay on the card, since they are doors, not the app. The prototype-only role switch shows only on portal pages, where it has effect. Typecheck, lint and the page suites pass; the dev instance at http://127.0.0.1:28848 is restarted on the new shell.
For the spec: one htmlPage app body (header bar, four sections, viewer, sign-out) for every page a signed-in member reaches; the card only for doors. Still waiting on the picks by number (3, 6, 7, 8).
Decision from the first pass: one component set for everything Patchy renders
Allison, 2026-09-15, after the shared shell landed: sizing is now off where the pages are not consistent, and the fix is not per-page polish. Every first-party page composes one set of design components: buttons, inputs, selects, fact lists, notices, headings and spacing come from the shell and look and scale the same everywhere, so people always know what a button is and how a page behaves. Patches are exempt: inside a patch the author does what they want. Not applied to the prototype; it binds the real build and stays a standing rule after it.
What the prototype shows, as evidence for the spec:
Two button families on adjacent pages: the portal's compact .btn and Company's tall .auth-action. Same action, different height, weight and radius.
Two input treatments: the portal's .f-in and the sign-in card's .auth-card input rules, which the app shell had to re-declare for .app-page to keep Company's forms styled.
Two fact grids: the card's .c-facts and the connection page's .connection-details, both a dl in two columns with slightly different gaps and label colours.
Three heading scales: the sign-in card's h1, the portal card's .c-h1, and the app page's h1.
For the spec (#242) and the build: the shell in packages/core/src/html.ts grows a named component set (button, quiet and danger variants; field, hint and error; fact list; notice; section heading; pill), every first-party page composes those classes and keeps only layout in page CSS, and the ui-consistency review spec turns "prefer a shared class when a treatment repeats" into "a first-party page introduces no button, field, list or heading style of its own". The portal, Company, Connections, Your machines, the doors and the notices all move onto it in the build; a page-only override of a component's size, radius or colour is a review finding.
The picked design holds when it is real. Allison clicked through the prototype on 2026-09-15 and accepted it with two amendments and the ten spec deltas as recommended ("the decs are good"). Astra's verdict was the same: build it with amendments, do not rethink. Prototype PR #246 (prototype/portal) stays open, never merged; the friction log and astra's evaluation are in the comments above.
What held
Master-detail at / and /patches/<name>; the card with inline edits (description, who can open it, rollback) and confirmation pages (/retire, /delete with the typed name, /restore only when sources are off, /reassign for admins, /versions); the three-state lifecycle with names reserved through delete; stale actions answered with a 409 notice and nothing done; one inventory behind the portal and patchy list with drill-down.
Decided here
Expiry goes. No expires_at, no top-ups, no visit extension. Reclaim happens only at deleted_at + 30 days; names free then; a publish under a reserved name answers name_taken during the window.
Two predicates, not one. "Serving" (live, not disabled) gates the address, shared reads and the runtime. "Exists for its owner or an admin" gates the portal card, the API reads and publish. A publish to a retired patch gets a retired-specific refusal ("restore it or ask an admin"), never "remove it from patchy.json". The address of a retired or deleted patch shows colleagues the notice The patch lifecycle: retire, restore, delete with a recovery window, rollback #232 decided, with Restore for the owner or an admin.
Stale actions gate on the act's own precondition, not a global row revision: retire needs live; delete needs not-deleted; restore needs off; rollback the expected current version; reassign the expected owner; scope the expected scope; description the expected description_updated_at. A description save never refuses because of an unrelated rollback. The hidden field and the 409 re-render stay; the notice names the person and act when there is one, else the new state.
Every act stamps last_changed_by/at beside its own actor columns, so every stale notice can say who.
A company-readable cumulative inventory read, openability-gated like list, so a non-owner's patchy list <patch> shows every table the patch owns, not the last manifest.
patchy list <patch> gains a "Reads" section (alias, source patch, table, source state). The card keeps only the reverse edge, "Used by other patches".
Wire and CLI.purgeAt on the wire, never a locally computed days-left. --state allowed at the patch level (needed to reach a deleted id), refused at the primitive level. list <retired-name> follows the top-level default and says "retired; pass --state retired". GET /api/patches… stays machine-token only; Discovery for agents: patchy list and patchy inspect under the machine token #234's "one read path" means one query shared by the portal and the API, not one HTTP route.
One owner for / and the catch-all, in the server's wiring. The migration id goes at the end of the global sequence wherever its file lives. An overlong :patchRef is 414 like the other routes.
The index line cuts at the first ., ; or – and 80 characters; the description hint on the card and in the skills says to front-load what the tool does.
One app shell for every signed-in page (Allison's first amendment): an htmlPage app body with the header bar (brand, Patches, Company, Connections, Your machines, the viewer, sign-out) that the portal, Company, Connections and Your machines all render through; the sign-in door, create-or-join, device-login confirm and error pages keep the card.
One component set for first-party UI (Allison's second amendment): buttons, fields, selects, fact lists, notices, headings and spacing come from the shell and look and scale the same on every page Patchy renders; page CSS is layout only; a page-level override of a component's size, radius or colour is a review finding; patches are exempt. The ui-consistency review spec tightens accordingly.
Everything above, plus the route table as built (/, /patches/<name>, its six sub-routes, the two Company pages for deactivation and reactivation), the wire shapes for GET /api/patches and its two levels, PUT /patches/:id/description, the 409/422/403 copy from the prototype, delete-from-retired copy, and the doc lines #236 listed. Not built in the prototype and still to specify from the earlier tickets: the deactivation pick and confirmation pages, the CLI lifecycle verbs, list connections, the deletion sweep, primitive descriptions in the manifest.
Activity
allisonmahmood commentedon Sep 14, 2026
Prototype: the portal, made real
PR, never to be merged: #246 (branch
prototype/portal). Its Try it section walks the cards; the dev instance for the worktree that built it is already up athttp://127.0.0.1:28848with the seed applied (Sam, Priya, a deactivated Jonas, twelve patches, two of them readinglunch-orders/orders, one retired, one deleted with 18 days left). To sign in as the seeded admin, addPATCHY_DEV_CLERK_USER_ID=<your Clerk dev user id>to~/.config/patchy-cloud/dev.envand runpnpm dev stop && pnpm devin that worktree; the seed survives a restart. Without the binding,/joincreates a fresh empty company and the portal shows its empty state.Built on the real server, session, rows and CLI:
/and/patches/<name>as the list mocks picked (#239); the card's Manage side as the patch-page mocks picked (#240): description, who can open it and rollback inline,/retire,/delete(typed name),/restore(only when the patch's own sources are off) and/reassign(admins) as confirmation pages,/versionsfor the overflow; stale actions carry the row's revision and answer 409 with a notice;patchy list,list <patch>andlist <patch> <primitive>over the same rows; a throwaway migration for the retired/deleted/description/reassign stamps. Not built: the retired notice at the patch address, the deactivation pages, the CLI lifecycle verbs,list connections, any sweep change. Typecheck, lint and the suite pass (13 files timed out under load beside the dev instance and pass in isolation).Where the design held
Master-detail, the card with inline edits and confirmation pages, the three-state lifecycle, the stale-action 409 and one inventory feeding both the portal and
patchy listall survived contact with real rows. Nobody has to rethink the shape. Astra's verdict, in full below: build it with amendments, do not rethink.Where it broke, and what the spec must settle
The friction log (22 points, verbatim below) and astra's classification of it agree on these. Numbered so a reply can pick by number; each carries a recommendation.
listdoes not filter expired rows. Recommendation: the spec dropsexpires_atand the top-ups outright; reclaim happens only atdeleted_at+ 30 days, names free then, and a publish under a reserved name answersname_takenduring the window (the prototype already changed the test that expected the name to be free).updated_atas the guard means a description save refuses after an unrelated rollback, and a scope change after a description edit, even though Patch metadata: a description the agent writes and the owner or admins edit #235 put the description outside versions. Recommendation (astra's, and mine): keep the hidden field and the 409 re-render, but each act checks its own precondition: retire needs live, delete needs not-deleted, restore needs off, rollback needs the expected current version, reassign the expected owner, scope the expected scope, description the expecteddescription_updated_at.last_changed_by/atpair on the row, stamped by every act, so every notice names a person; the per-act stamps stay for the card.patchy list <patch>falls back to the last manifest, so a table published earlier and omitted since is visible to the live owner and invisible to everyone else, which is exactly the dependency an agent is trying to find. Recommendation: a company-readable inventory read, openability-gated likelist.patchy list's job, and the discovery ticket's patch level shows only what a patch owns, sooffice-mapprints "Tables: none" while it readslunch-orders. Recommendation: a "Reads" section onpatchy list <patch>(alias, source patch, table, state); the card keeps only the reverse edge, "Used by other patches".daysLeftis computed twice against two clocks: putpurgeAton the wire.--stateis needed at the patch level to reach a deleted id: allow it there, refuse it at the primitive level.list <retired-name>succeeds with no flag while the top level hides retired: make drill-down follow the same default and say "retired; pass --state retired". A browser session cannot bearGET /api/patches(machine tokens only today): amend Discovery for agents: patchy list and patchy inspect under the machine token #234 to "one query the portal and the API share", not one HTTP route, and keep the API token-only./*catch-all claims/by registration order; the real build gives/and the catch-all one owner. Every first-party page is the auth card, so the portal hid the card's brand with CSS to fit a header: the spec names a secondhtmlPagebody (app bar plus two columns) that Company, Connections and Your machines also move onto, or the header only exists on the portal. The migration id goes at the end of the global sequence wherever its file lives. An overlong:patchRefshould be 414 like the other routes..,;or–and 80 characters reads well when the description front-loads what the tool does; the description hint on the card and in the skills should say so.Everything else in the friction log is a prototype shortcut (a second
HttpApito sparedocs/API.md, the migration split in Runtime's replay test, the role-switch cookie, the seed's rate-limit pause) and does not reach the spec.Waiting on Allison
allisonmahmood commentedon Sep 14, 2026
Friction log, verbatim (the implementer's, kept per the ticket)
22 points: what the decision said, what the code forced, what was done
expires_atand the hourly sweep still hard-deletes expired rows, retired or not. The brief said leave it; the prototype carries expiry untouched, so a retired patch can still vanish when its 90-day clock runs out. The spec must say what retire does to the retention clock.docs/API.mdis a test.packages/api/src/api-md.test.tsasserts the committed markdown equals the render ofPatchyApi. Adding theportalPrototypegroup toPatchyApiwould force a docs change the brief forbids. I declared the group inapi.tsbut mounted it in a secondHttpApi(PortalPrototypeApi), served besidePatchyApion the same router; the CLI builds a second client for it. Same wire, no docs churn; theApiGuard414 table only seesPatchyApi, so an overlong:patchRefanswers 404 instead of 414./test.packages/serving/src/Pages.test.tslists/among the static routes that must answer 200 without a session. RemovingrenderHome's route makes Serving alone answer 404 there (the portal now owns/). I dropped/from that one assertion list and leftrenderHomeinrender.tsuntested-by-route.PatchesApi.test.ts("frees the name on deletion") published a fresh patch under a deleted patch's name and expected 201. The publish contract's own text still says "deletion frees all names". I changed the test to expect 409name_takenduring the 30-day window and did not touch the contract text (docs are off limits). The spec has to restate what deletion does to the name and when it is finally freed (the sweep, presumably, after the window).writablenow refuses retired patches everywhere. Addingretired_at IS NULLto the one "may write" predicate means publish,share, inventory reads and the old API delete all answer "Patch not found." for a retired patch. That is what "off is off" asks for, but the CLI'spatchy publishfrom a retired patch's repo now says "Patch is unavailable for update. Remove patch from patchy.json" which is the wrong advice. The spec needs a retired-specific refusal on publish./is decided by build order, not by the route table. Effect's router registers a/*catch-all at the root as well, and the root keeps the first handler added. With Serving'sPages.layerand the portal's layer merged, Serving's 404 won/and the portal answered 404 there. I build the portal layer as a dependency ofPages.layer(Layer.provide) so its routes register first. The real build needs/and the catch-all in one place, or the catch-all moved to the server.pageResponsehard-codes the auth-card shell. Every first-party page is<main class="auth-card">with the brand injected and an<h1>from the title. The portal needs a header bar with the brand inside it, so the page passesheading: "", widens.auth-cardand hides the injected brand with page CSS. Fine for a prototype; the real build wants a second shell body (app bar + two columns) beside the auth card, both throughhtmlPage.now()and reads "now" from Effect's clock (so tests can wind it). The stale-action line needs to compare the form's revision (SQL time) with the actor stamps to say "retired by Sam 2 minutes ago"; withTestClockat epoch zero those never line up. I put the actor stamps on the Effect clock likeexpires_at, keptupdated_aton SQLnow()as the brief says, and derive the 409 line first by diffing the row this request read against the row now, falling back to stamps. The test sets its clock ahead of the wall. The real build should pick one clock for everything the portal displays.last_changed_by/atpair, or an event table.PATCHY_PATCH_CREATE_RATE_LIMIT_PER_MINUTErefused the eleventh publish with 429. The seed now sleeps outretryAfterSecondsand resends the same publish key. Not a portal problem, but a reviewer runningpnpm proto:seedwaits about a minute in the middle; say so in the PR body.packages/runtime/src/migrations.test.tsreplays an upgrade from "everything before Runtime" by spreading the Patches record; with0008inside that record the ledger already sits at 8 and Runtime's0006never applies. I split the prototype migration out in that test and applied it after Integrations. The ledger rule ("ids in landing order, never backfill") means a capability's record is not a self-contained history once another capability has landed after it; the real build's migration belongs at the end of the global sequence, wherever its file lives.patchy list <patch>row carries a description per table and store; the manifest has no such field and neither does the inventory. Every primitive description is""on the wire and omitted in text. Needs a manifest field (and a publish path) before the CLI can say what a table is for.Patches.inventorylocks the row through the owner-onlywritablepredicate; a non-owner (and the owner of a retired patch) getsPatchUnavailable. The handler falls back to the current version's manifest, which is what the last publish declared, not the cumulative inventory: a table published earlier and omitted since is visible to the owner and invisible to everyone else. Seen live:patchy list expense-formas Dev Machine (Priya owns it after the seed's reassign) listsclaimsfrom the manifest. The spec needs a company-readable inventory read.patchy list <patch>says what a patch owns, not what it reads. The decided levels are patch → tables and stores; a patch that only declaresuses(office-map) prints "Tables: none", so an agent cannot see from the CLI that it depends on lunch-orders. The portal card shows the reverse edge ("Used by other patches"). One of the two views should showuses.--stateat the patch level. The brief says a flag on the wrong level is an error, and also asks forpatchy list --state all <deleted id>. I let--statethrough at the patch level as the gate for deleted (by id,--state allrequired) and retired (--state liverefuses) patches, and refuse it at the primitive level.--mineis top level only.deletedAt; the portal and the CLI each compute "N days left" from it against their own clock. If the window ever moves off 30 days the CLI drifts; the spec should putdaysLeft(orpurgeAt) on the wire..,;or–" cuts "Where everyone sits, by floor and desk number; searchable by name." at the semicolon and "Weekly pipeline and closed-won by rep, pasted in from the CRM export every Monday morning." at 80 characters with an ellipsis. Readable, but writers will learn to front-load; the spec should say so where the description is edited.brokenSourcestreats a retired source the same as a deleted or missing one, so restoring a dependant asks for the acknowledgement even though the source may come back tomorrow. That matches the runtime (a retired source failsshared.*reads withaccess_denied) but the copy says "deleted" and "gone" in places where "retired" is the truth; the restore page states the source's actual state./companystill treats the same session as admin. Good enough to see the member card, but it cannot show what a real member sees on/company/connectionsbeside the portal.Authorizationresolves machine tokens only, soGET /api/patchesfrom a signed-in browser is a 401 even though the same person can read/. The brief called both "bearers"; today only the token is. The CLI is unaffected.allisonmahmood commentedon Sep 14, 2026
Astra's evaluation, verbatim
Fresh session with tools over the branch, the friction log and the six decisions; the brief asked it to disagree where the evidence supports it.
Six sections: where the design broke, stale actions, authority, one inventory, how it expands, what the spec must settle
1. Where the design broke
Friction log, classified:
expires_at; the sweep still hard-deletes on the 90-day clock. Portallistdoes not even filter it, so an expired “live” row can list while the address 404s. Spec: drop the clock;deleted_at+30dis the only reclaim.name_taken. Spec restates: names free at gone, at the sweep.writable+resolveNamefold retire into “not found.” Hole, and a misread of “off is off.” That rule is consumeraccess_deniedon shared reads, not owner publish and not the address URL.patchy publishthen says “Remove patch from patchy.json” (fork). Signed-inGET /patchy-dev/vendor-listis 404; The patch lifecycle: retire, restore, delete with a recovery window, rollback #232 wants a colleague notice with Restore. The test encodes the 404 as intended./vs Serving/*. Hole in the route table. First-registered catch-all won until portal wasLayer.provided under Pages. Spec: one owner for/and the catch-all.updated_aton SQLnow().writable. Hole. Discovery for agents: patchy list and patchy inspect under the machine token #234 is cumulative inventory, company-readable. Non-ownerlist expense-formis the current manifest (claims); omitted-since tables exist only for the live owner.listdoes not showuses. Hole in the pair of decisions. Prototype: static mocks of the portal's patch list #239 dropped Uses from the card (“that is list’s job”); Discovery for agents: patchy list and patchy inspect under the machine token #234 never added them.office-mapprintsTables: nonewhile it readslunch-orders.--stateat patch level;--allvs--state all. Hole in the decisions (The patch lifecycle: retire, restore, delete with a recovery window, rollback #232--allvs Discovery for agents: patchy list and patchy inspect under the machine token #234--state). Prototype’s split is reasonable.daysLeftcomputed twice; 500 via.length; no primitive descriptions;connections: []. First two are spec; primitive descriptions and connections were already decided and just not built.setDescriptionwould allow retired.HttpApito sparedocs/API.md(overlong:patchRefis 404 not 414);/assertion; auth-card CSS hack; seed 429 sleep; migration0008split in Runtime’s replay; header only on new pages; proto role cookie; Copy address asuser-select:all.Missed:
patchy list vendor-listsucceeds with no--state(top-level defaults live; drill-down does not). Browser session cannotGET /api/patches(#234: both bearers).2. Stale actions
updated_atas a global revision is a fine OCC hammer and the wrong product rule. Description sits outside versions (#235); a description save and a rollback must not refuse each other. Same for description vs scope, reassign, restore, and (if retired stays editable) retire.Gate the precondition of the act:
currentVersionIddescription_updated_at(no-op must not stamp, as now)Do not gate on a sibling field. Keep recover-in-place (re-render with a fresh hidden field).
409 copy for a non-builder, no codes, no “revision”: “This patch changed while you had this page open: retired by Sam 2 minutes ago. Nothing was done.” Name person and act when an actor exists; otherwise the new state (“now version 7”, “now open to the company only”). Point them at the card they are already looking at.
3. Authority and visibility
GET /patches/<name>/versionsis unguarded by URL — unspecifiedcompany_idon every query → 404GET /api/patches200; HTML portal needs a session; no retire APIThe admin/member cookie only lowers portal
canManage. Own patches still show Manage (correct). It cannot show a real member on/companyor connections. That hides the deactivation/connections gap, not a card-permission bug.4. One inventory, two views
Same
PortalQueries.list, same descriptions, owners, deactivated marks, states. Live probe: 10 live rows, connections[],qa-signoffempty string, Jonasdeactivated: true.Divergence that matters to “do we already have a tool for this”:
--state; hidden on/until?all=1. An agent can conclude the tool exists while the skill says to pass--state retiredfirst.usesabsent; primitivedescriptionalways"";list connectionsstill points atcatalog.daysLeftis local to each clock.Names + descriptions agree. That is enough for a first pass, not for
add.5. How it expands
The seam that breaks first is Patches’ live-only predicates (
retired_at IS NULLonwritable,resolveName,find, inventory). Address notice, retired publish, and company-readable inventory all hit it.Then
listiscompany_id, not openability — personal/group sharing. ThenPatchList.connections: Never[](second integration), the facts<dl>(tier 2), no sticky card (100+), Company pages still on the auth-card shell (deactivation pick — the one place master-detail already cannot go).6. The spec
Must settle, not already closed:
deleted_at + 30d; names free then; publishname_takenduring the window.patchy.json. Same-company non-owner publish names the owner (Admin authority over patches and the deactivation of an owner #233).useson exactly one view; primitive descriptions as Discovery for agents: patchy list and patchy inspect under the machine token #234.GET /patches….{patches, connections}with a real connection row;purgeAtordaysLeft;PUT /patches/:id/description;--stateat patch level; default forlist <retired-name>.updated_at; actors on restore / rollback / scope, or accept “now …” copy.--clear./and/*;/patches/<name>/{retire,delete,restore,reassign,versions}; Company deactivation/reactivation; address notice vs signed-out door vs foreign 404; secondhtmlPageshell.:patchRef.;and 80 chars cut). Catalog removed.Build it with amendments, do not rethink. C (master-detail) and C (inline edits, destruction confirms) survived contact with a real inventory, stale POSTs, and
patchy list. The lifecycle three-state model held. What failed is the one live-only write predicate, the global revision, expiry left in place, and the unresolved #235/#240 retired-edit clash — all spec deltas, not a new shape.allisonmahmood commentedon Sep 14, 2026
Allison's first pass, and one amendment on the branch
Allison clicked through on 2026-09-15: "this is good", with one oversight: Company, Connections and Your machines still rendered in the sign-in card while the portal had its own header, so the product felt like two things. Her call: everything signed-in shares the portal's nav and base feel. That was spec delta 9 above; it is now a decision, not a delta.
Applied on
prototype/portal(commit3d622c5, PR #246 updated): the header and wide card moved out of the portal into the shared page shell as a second body beside the sign-in card. The portal, Company, Connections and Your machines all render through it, with the current section marked and sign-out in the header; the duplicate Connections link under the Company title went. The sign-in door, create-or-join, the device-login confirm page and error pages stay on the card, since they are doors, not the app. The prototype-only role switch shows only on portal pages, where it has effect. Typecheck, lint and the page suites pass; the dev instance athttp://127.0.0.1:28848is restarted on the new shell.For the spec: one
htmlPageapp body (header bar, four sections, viewer, sign-out) for every page a signed-in member reaches; the card only for doors. Still waiting on the picks by number (3, 6, 7, 8).allisonmahmood commentedon Sep 14, 2026
Decision from the first pass: one component set for everything Patchy renders
Allison, 2026-09-15, after the shared shell landed: sizing is now off where the pages are not consistent, and the fix is not per-page polish. Every first-party page composes one set of design components: buttons, inputs, selects, fact lists, notices, headings and spacing come from the shell and look and scale the same everywhere, so people always know what a button is and how a page behaves. Patches are exempt: inside a patch the author does what they want. Not applied to the prototype; it binds the real build and stays a standing rule after it.
What the prototype shows, as evidence for the spec:
.btnand Company's tall.auth-action. Same action, different height, weight and radius..f-inand the sign-in card's.auth-card inputrules, which the app shell had to re-declare for.app-pageto keep Company's forms styled..c-factsand the connection page's.connection-details, both adlin two columns with slightly different gaps and label colours.h1, the portal card's.c-h1, and the app page'sh1.For the spec (#242) and the build: the shell in
packages/core/src/html.tsgrows a named component set (button, quiet and danger variants; field, hint and error; fact list; notice; section heading; pill), every first-party page composes those classes and keeps only layout in page CSS, and theui-consistencyreview spec turns "prefer a shared class when a treatment repeats" into "a first-party page introduces no button, field, list or heading style of its own". The portal, Company, Connections, Your machines, the doors and the notices all move onto it in the build; a page-only override of a component's size, radius or colour is a review finding.allisonmahmood commentedon Sep 14, 2026
Resolution
The picked design holds when it is real. Allison clicked through the prototype on 2026-09-15 and accepted it with two amendments and the ten spec deltas as recommended ("the decs are good"). Astra's verdict was the same: build it with amendments, do not rethink. Prototype PR #246 (
prototype/portal) stays open, never merged; the friction log and astra's evaluation are in the comments above.What held
Master-detail at
/and/patches/<name>; the card with inline edits (description, who can open it, rollback) and confirmation pages (/retire,/deletewith the typed name,/restoreonly when sources are off,/reassignfor admins,/versions); the three-state lifecycle with names reserved through delete; stale actions answered with a 409 notice and nothing done; one inventory behind the portal andpatchy listwith drill-down.Decided here
expires_at, no top-ups, no visit extension. Reclaim happens only atdeleted_at+ 30 days; names free then; a publish under a reserved name answersname_takenduring the window.description_updated_at. A description save never refuses because of an unrelated rollback. The hidden field and the 409 re-render stay; the notice names the person and act when there is one, else the new state.last_changed_by/atbeside its own actor columns, so every stale notice can say who.list, so a non-owner'spatchy list <patch>shows every table the patch owns, not the last manifest.patchy list <patch>gains a "Reads" section (alias, source patch, table, source state). The card keeps only the reverse edge, "Used by other patches".purgeAton the wire, never a locally computed days-left.--stateallowed at the patch level (needed to reach a deleted id), refused at the primitive level.list <retired-name>follows the top-level default and says "retired; pass --state retired".GET /api/patches…stays machine-token only; Discovery for agents: patchy list and patchy inspect under the machine token #234's "one read path" means one query shared by the portal and the API, not one HTTP route./and the catch-all, in the server's wiring. The migration id goes at the end of the global sequence wherever its file lives. An overlong:patchRefis 414 like the other routes..,;or–and 80 characters; the description hint on the card and in the skills says to front-load what the tool does.htmlPageapp body with the header bar (brand, Patches, Company, Connections, Your machines, the viewer, sign-out) that the portal, Company, Connections and Your machines all render through; the sign-in door, create-or-join, device-login confirm and error pages keep the card.ui-consistencyreview spec tightens accordingly.Carried to the spec (#242)
Everything above, plus the route table as built (
/,/patches/<name>, its six sub-routes, the two Company pages for deactivation and reactivation), the wire shapes forGET /api/patchesand its two levels,PUT /patches/:id/description, the 409/422/403 copy from the prototype, delete-from-retired copy, and the doc lines #236 listed. Not built in the prototype and still to specify from the earlier tickets: the deactivation pick and confirmation pages, the CLI lifecycle verbs,list connections, the deletion sweep, primitive descriptions in the manifest.allisonmahmood commentedon Sep 14, 2026
Resolved above; the map's Decisions so far carries the pointer.