Skip to content

refactor(portal): each portal surface gets its own routes module - #1340

Merged
allisonmahmood merged 1 commit into
mainfrom
ui/r-portal-routes
Nov 10, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
ui/r-portal-routes

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

Stacked on #1334; part of #1315. Merge the stack together, not alone.

What changed

PortalPages.ts held every portal route and handler, so the five page rebuilds that come next would all have edited one file. Each portal surface now has its own routes module, registered from one list. The portal also gets a call summary: calls and failed calls per patch over the last 24 hours. Before this, a patch nobody called looked the same as one called all day without a failure. People see no change.

Closes #1319

Look at

One module per surface, registered from one list. PortalPages.ts is now only that list:

Surface Routes module Renders with Tests
Home and the guide HomePages.ts home.ts, guide.ts HomePages.test.ts
All patches AllPatchesPages.ts allPatches.ts AllPatchesPages.test.ts
A patch's card: tabs, log, confirmations, forms PatchPages.ts render.ts, log.ts PatchPages.test.ts
Share dialog forms, Remove… on a shared patch SharePages.ts share.ts SharePages.test.ts
People lifecycle (deactivate, reactivate) UserLifecyclePage.ts (gains its layer) itself UserLifecyclePage.test.ts
What's new WhatsNewPages.ts (now in the list) itself WhatsNewPages.test.ts
Core's scripts under /assets/ Assets.ts none Assets.test.ts
Switcher list SwitcherList.ts (now in the list) itself SwitcherList.test.ts

Each module starts with a two-line comment saying what it owns. Modules share code only through shared/:

  • shared/presentation.ts holds pure helpers: patch paths, menus, search, isNew, confirmation parts (hidden, refusal, the acknowledgement) and the old page layout CSS every portal page still carries. It moved byte for byte from render.ts and allPatches.ts.
  • shared/handlers.ts holds the request context, error wiring (errors, pageErrors, errorPage), patch-name guards, staleNotice, the Share dialog over a page and its way back (Sharing, asked, behind, pagePath, shareOverlay), and reads that several pages make (callSummary, turnedAway, prewarm). It also defines the shared types: PortalServices (the requirement list PortalPages.layer spelled out before), Routes (the layer type each surface declares, so an unhandled failure or an unprovided service is a type error in that module), and Page.
  • This is two files rather than one. A single module would form an import cycle with share.ts: the overlay needs that renderer, and the renderer needs the pure helpers.
  • A refused Share form draws the page it opened over again (Home, All patches or the card). SharePages gets those pages as a PagesBehind argument from the list instead of importing three other surfaces.

The call summary (second commit). InvocationLog.calls replaces InvocationLog.failures. For each patch it returns the top-level calls since a time and how many of them failed (as the log's Failed filter counts them). It is one query over the same runtime_invocations_top_level_recent index. In shared/handlers.ts, callSummary gives each live tier 2 patch the viewer manages { calls, failures } for the last 24 hours, { 0, 0 } when nobody called it, and nothing for a member who manages none. Home and All patches read their failure counts from it, so their output is unchanged. The new glossary entry is in packages/portal/GLOSSARY.md.

Reviewing the move: git show --color-moved=dimmed-zebra --color-moved-ws=allow-indentation-change 8b795204. Almost everything shows as moved. The changes are in imports, span names, SharePages taking pages, and the Routes/Page annotations.

How it was verified

No screenshots: no page changes, and the response comparison below is stricter than a picture.

  • Same responses, before and after. I recorded every response the portal suite requests (528 requests across 97 tests) on the base and on the move commit, and compared them per test after normalising per-file id counters, the avatar colour derived from those ids, and random setup-line tokens and device codes. All 97 match exactly (status, Location and body). Three tests asserted on several surfaces. Each is now split so its assertions sit with their surface, and every response in the new tests appears in the original test's.
  • pnpm --filter @patchy/portal test: 11 files, 121 tests (the 99 portal tests, plus four from the splits, the call summary test, What's new and the renderer tests). packages/runtime/src/InvocationLog.test.ts covers calls: pending and overdue calls count as calls but not failures; nested calls and calls older than the window are left out; a patch whose only calls are old is absent.
  • pnpm check: format, lint, typecheck and synth pass for this change. Format fails on packages/core/src/html.test.ts, which this PR doesn't touch: it is already unformatted on the base, so CI's lint job fails here exactly as it does on feat(portal): Your agents and Settings get their own addresses #1334. The fix belongs on feat(portal): Your agents and Settings get their own addresses #1334, the branch that introduced it. The offline tests had 52 failures across 23 files: CLI tests that see a stray GET / on this machine's local ports, and timeouts under shared-machine load. The non-CLI failures (InvocationLocal, PatchesApi, SdkApi, DevReads) pass when run alone. CI runs the full suite.
  • Not run locally, per the lane brief: pnpm verify and the browser suites. CI runs them.

Release impact

  • Breaking — requires action from anyone already running this

  • Not breaking — internal refactor. The one service method renamed (InvocationLog.failures → calls) is read only by the portal; the CLI's patchy dev stub, which answers it with nothing, follows

  • What does a revert leave behind? Nothing: no schema, data or contract change. One comment in a migration's source changed, not its DDL.

  • Does the release before it still work with that? Yes.

Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated by Fermy.

@github-actions github-actions Bot added area:server Touches the server area area:cli Touches the cli area area:docs Touches the docs area area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes labels Nov 8, 2026
@allisonmahmood
allisonmahmood force-pushed the ui/r-portal-routes branch 2 times, most recently from 8a40067 to f509ba7 Compare November 8, 2026 11:46
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked f509ba7c8d1b7dd9805f1ad9240a27ab341ae019 (base 1f9f23403479b6bd82b83d0cccebc954eb5f6ffc) on fresh brightline data and isolated test fixtures, by GPT-6.1 Sol (xhigh) in the Codex harness through T3 Code.

Round 2 scope: git range-diff d8f9cf1b..8a400677 1f9f2340..f509ba7c maps both commits with =. The PR's own changes are unchanged apart from the rebase. I carry forward round 1's PASS with notes on 8a40067, including its 52 base/head response-and-image comparisons and declaration comparison, and rechecked Done means on this head.

Done means

  • Portal behavior stays identical, with independent surface modules: passed. The registry still wires each routes module once; shared presentation/request helpers remain under shared/ and Share receives its background pages from the registry. All portal suites pass on this head. A fresh 52-navigation admin/member sweep at 1280px/390px covers Home, search/no-results, guide, All patches/Yours, card, Log, Versions, Settings, Retire, Delete and What's new. There are 44 successful pages and eight expected member 403 refusals (Log, Settings, Retire and Delete at both widths), with zero browser errors or document overflow. Inspected desktop/phone captures; wide Log tables scroll within their wrapper.
  • Pages can tell no calls from no failures: passed. The rerun real-log and portal suites distinguish {calls:0,failures:0}, {calls:1,failures:0} and {calls:3,failures:2}; exclude old/nested calls; count pending/unknown calls without making them failures; and restrict summaries to live tier-2 patches the viewer manages. Existing UI failure-count behavior is unchanged.

Golden journeys

  • Find/open: passed again. After choosing the fresh member's onboarding Later action, Jordan searches Home for Kudos and opens the live patch frame at phone width; its Kudos heading renders.
  • Live kudos, publish/share/unshare, retire/restore/delete/restore, guest removal and people lifecycle: passed in round 1, carried forward for unchanged implementations. The rerun portal suites cover the corresponding authority, stale-action and rollback guards.
  • New Business move/back and Spend self-approval were not manually repeated in either acceptance round; unchanged runtime behavior and CI's tier-2 suite remain the supporting coverage.
vitest run packages/portal packages/runtime/src/InvocationLog.test.ts
Test Files  12 passed (12)
Tests       133 passed (133)

Fresh portal sweep: 52 navigations
44 x 200; 8 x expected member 403
Browser errors / document overflow: 0 / 0
Jordan: onboarding Later -> Home search -> Kudos frame: passed

Rollback answers: match the diff. No DDL, row-shape or public-contract change; the migration-source diff changes only a comment. Round 1's rollback check passed; the new head's check was queued at the CI snapshot.

Not run

  • dense is absent at this early stack head; fresh brightline used.
  • Full local verify, live Clerk and repeat publish/live-sync journeys were not rerun locally; unchanged round 1 evidence is carried forward as stated.

Notes

  • CI is incomplete: multiple test/browser/release/rollback jobs remain queued or running. Lint, concurrency, live Clerk, server-image and Node 26 CLI smoke passed; no red check at this snapshot.
  • The PR body's formatting-failure note remains stale: the base's formatting fix is retained and lint is green.

All instances from this check are down. Text evidence only; no PR code, branch, body or labels changed.

@vsrikar08

Copy link
Copy Markdown
Collaborator

So from what i understand its basically in preparation for the ui ovehall and condenses everything into a much smaller registry . It looks good to me

Base automatically changed from ui/u-addresses to main November 10, 2026 17:04
@allisonmahmood
allisonmahmood merged commit 796e0a1 into main Nov 10, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the ui/r-portal-routes branch November 10, 2026 17:17
allisonmahmood added a commit that referenced this pull request Nov 10, 2026
…d once (#1376)

## What changed

This adds release 41's What's new entry, written from `a25a9c5`. It
covers everything merged since release 40's `through` (`08e1fd9`), and
sets the `patchy` release to `0.41.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

It ships the UI overhaul together with #1204, the terms prompt, as one
release, at Allison's word.

| Change | PRs |
| --- | --- |
| Improved: Patchy has a new look | #1332, #1336, #1338, #1343, #1353,
#1354, #1369, #1372 |
| New: Accept updated terms once | #1204 |
| Improved: Settings holds People, Integrations and Agent access |
#1334, #1341 |
| Improved: Home starts with what needs you | #1344, #1353 |
| New: A blue dot marks patches you haven't opened | #1370 |
| Improved: A patch's page has one header and tabs | #1345 |
| Improved: Search lands on All patches | #1346, #1353 |
| Improved: Inviting and deactivating people is clearer | #1349 |
| Improved: Your agents shows what's connected | #1352 |
| Improved: Integrations use plain words | #1347, #1351 |
| Improved: Agents and integrations show their own logos | #1371 |
| Improved: What's new goes by month | #1350 |
| Fixed: ⌘⇧K works on your company's public patches | #1339 |
| Fixed: Saving works after a patch stops being public | #1339, #1375 |
| Behind the scenes: every page built from one set of parts, with a
check | #1338, #1354 |
| Behind the scenes: agents know a once-public page's refusals mean
reload, and retries wait and stop | #1374 |
| Patch changes: a kept public page reloads into the company page; check
retries wait and stop | #1375, #1374 |

#1337 is release 40's own entry. #1340 (routes split, plus the call
summary Home and All patches show) and #1342 (the `dense` dev scenario)
need no line of their own: the call summary is part of the Home and All
patches changes, and the scenario is tooling. The overhaul makes no
patch changes. Running patches keep their own styles, which #1332 pins,
and the only SDK change is the wording of two error messages' admin
addresses.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `d3d32da` (release 40) to this
PR's merge:**
- **#1334 is `one-way`.** Your agents and Settings moved to `/agents`
and `/settings/…`. Old addresses redirect forward, but release 40 serves
none of the new ones. This release's CLI hints, the `patchy` skill on
`main`, and the API, MCP and publish hints all name the new addresses,
so on release 40 they'd answer 404.
- **#1372 needs the private font bucket**, and that's done. Its deploy
step fetches the pinned Cabinet Grotesk file and checks it before
recording anything. The bucket was created on 2026-11-10 and holds the
pinned bytes. A rollback to a commit from before #1372 pins no font and
builds as before.
- **#1204** adds migration `0036_terms_acceptances`, an additive table
that release 40 never reads. Release 40 doesn't prompt, and coming
forward again asks only people who hadn't accepted. Not `one-way`.
- **#1375** changes only the public shell's script, and #1374 is skill
text. Release 40 renders its own shell and serves its own skills.
- **#1370 and #1339** add rows to the existing `patch_opens` table (a
guest's opens, and members' opens of public patches). Release 40 reads
them like any other open.
- **Everything else** is pages, styles, copy and docs: no migrations,
and no API, `--json` or configuration changes.
- **patchy-web #53**, the website line #1371's logos needed, is merged
(771e6d9).

**Rollback line:** Rolling back past #1334 would break every `/agents`
and `/settings/…` link that this release's CLI, skill and hints hand
out, because release 40 answers them with 404. Fix forward instead.

## How it was verified

- **Tests:** the `packages/core` What's new test passes (5), the
`packages/api` suites pass (64), and the three files are formatted.
- **The range.** Each of the 22 overhaul PRs was:
- reviewed by GPT 6.1 Sol at xhigh, with every finding fixed or declined
in writing on the PR;
  - accepted on its final head by an agent that didn't write it;
- merged green, by a merge train that rebuilt each PR's accepted tree on
main's tip and checked that main's tree matched it after every merge.
- **#1339, #1375, #1374 and #1204** were each Sol-reviewed and accepted,
and merged on their own: #1339 before the train, the other three after
it. #1204's acceptance was rerun on the new sign-in pages.

## Release impact

- [ ] **Breaking** — requires action from anyone already running this
- [x] **Not breaking** — no action required

The changelog entry and the release version only.

- **What does a revert leave behind?** Nothing. CLIs installed from this
release report `0.41.0` and are told to match the server, as at every
release.
- **Does the release before it still work with that?** Yes.

Changes made by Claude Opus 5.5 in Claude Code, running in T3 Code.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:cli Touches the cli area area:docs Touches the docs area area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles size:xl Over 1,000 changed lines; review in multiple passes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UI overhaul R: each portal surface gets its own routes module

2 participants