Repository navigation
feat(patches): Patchy remembers what each person opens - #713
Merged
Merged
Conversation
Owner
Author
|
Review: GPT 6.1 Sol, xhigh, round 1. Three findings, all fixed in 734108e.
|
This was referenced Oct 15, 2026
One row per member and patch in patch_opens: when they last opened the patch's current version at its address, and a score where each open counts 1 and halves every week. Serving records it beside the visit count; content URLs, older versions and public pages record nothing, and a failed write never denies the page. Only the member reads their own rows, to build their Home (#710). ReadPatch gains the visit count. Part of #707. Closes #708. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ever moves back A read of v1 that finished after v2 was published stamped an open that marked v2 seen; recordOpen now takes the served version and writes only while it is current. An open stamped earlier than the last one replaced last_opened_at; both now decay to the later instant. A decade-old row underflowed float8 and failed the whole read; the decay's exponent is clamped at 1000 half-lives. Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood
force-pushed
the
portal/708-opens
branch
from
October 16, 2026 00:38
734108e to
cc67060
Compare
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
Stacked on #713 (it reads the visit count #713 adds to `ReadPatch`). It can ship once #713 is in. Home (#707) moves managing off `/`, and it needs somewhere to go: one list of every patch an owner or admin can act on, and one place a member can browse everything. Today the only list is the index beside the card: alphabetical, with no search, and with retired and deleted patches behind a toggle. ## Fix - **`/patches`, All patches.** A table of every patch the viewer can open, in tabs over `?show=` like the Company page's: - All (live), Tools (tier 1 and 2), Pages (tier 0), Yours, Needs attention, Retired and deleted; - Needs attention and Retired and deleted appear only when they hold something. `?q=` searches the current tab by name, title, description and owner. Columns: the patch's mark, name, first clause and You/New tags; owner; `vN · ago`; visits; who can open it; and a row menu. Pages and Retired and deleted sort newest first, the rest by visits. - **Row menus.** Members get Open, Copy link and About this patch. Owners also get Settings (the card until #711) and Retire… and Delete… on live rows, or Restore and Delete… on off ones. Admins also get Reassign…, deleted rows included. Every item goes to the route that already does it. Restore posts the same form as the card's inline Restore. An expired deletion the sweep hasn't reclaimed yet says "Recovery ended" and offers no Restore. - **Needs attention** lists a patch only to its owner and to admins, with the act that resolves it: - admins see every patch whose owner is deactivated, in any state, with Reassign…; - both see deletions with `now < purgeAt ≤ now + 7 days`, with Restore. A member who owns nothing never sees the tab, and `?show=attention` shows them nothing. - **Components.** The portal is the Company page's second user of `avatar`, the row `menu` and the search field. These move into `@patchy/core` as `avatar`, `rowMenu`, `menuLink`, `menuPost` and `searchField`, plus `menuCopy`, a Copy item the existing copy script reveals. New marks: `mono`, a tool's two letters tinted from its name, and `page-mark`, a tier 0 page's ruled sheet, both via `patchMark(name, tier)`. - The old index links to All patches, so it's reachable before Home lands (#710). `/patches` is served by the existing `/patches/*` wildcard, which FindMyWay would not let a separate route share. - `patches` joins the reserved company handles: `/patches/<name>` already shadowed a company with that handle. ## Verified - `PortalPages.test.ts`, new "all patches" block: - tabs list exactly their patches, in visits order; - search narrows within a tab (and by owner name), and tab links keep it; - a description holding `<script>` renders escaped; - the off tab says who retired it and how long a deletion has left; - row menus hold exactly each role's acts; - Needs attention appears for an owner's deleted-soon patch and an admin's orphaned one, never for a member of another company, and loses Restore once recovery ends. - In the browser, `pnpm dev up brightline` as Allison: tabs, marks, page mark, avatars and menus render with no console errors. - `pnpm check`: format, lint, typecheck and synth pass. Three unrelated suites (`PgliteCompanyDatabases`, `cliRepoBuild`, `SdkApi`) timed out under a machine load average of about 25 and passed when rerun alone. ## Release impact - [ ] **Breaking** - [x] **Not breaking**: a new page and a link to it. Reserving `patches` refuses that handle only for new companies. ## Surfaces - **Served pages.** A new app-shell page composing shell components; page CSS is layout only. `ui-consistency` lists the moved and new components. - **Vocabulary.** Portal glossary: **All patches**. `GLOSSARY-MAP.md`'s Portal line. - **Reverse states.** Every act in the menus leads to its existing way back (Restore, Reassign). - Wire contract, CLI, dev loop, migrations and repo layout: not touched. Part of #707. Closes #709. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
Stacked on #715. It can ship once #713 and #715 are in. The signed-in landing at `/` was an alphabetical index beside one patch's whole management card, so the page people visit most was laid out for managing one patch. Opening a tool meant finding its row and then pressing Open. Tier 0 reports buried the tools people use daily. Anyone who owned no patch landed on the first-patch guide on every visit. ## Fix `/` is now **Home**, for opening patches rather than managing them (`packages/portal/src/home.ts`): - **Search** over every live patch's name, title, description and owner, applied before any shelf limit. Matches are marked, with totals and "All N matching" links to All patches that carry the query. A search that matches nothing offers `Build us a Patchy tool for <query>` as a copy line for an agent, a link to the guide for someone who owns nothing, and a link to search retired and deleted patches. - **Your usual**: the four live patches the viewer opened in the last 30 days with the highest opens score (#713), ties by name. Missing slots are padded from the company's most-visited patches, each saying "Popular at …". With no opens yet, the shelf is titled "Popular at …". A tile opens the patch itself; its menu holds About this patch, Open in a new tab and Copy link. - **Tools** (tiers 1 and 2): the viewer's own first, then by the viewer's score and the company's visits, up to twelve. While the viewer owns no patch, a dashed **Make your own** row leads to the guide. - **Pages** (tier 0): up to three **New to you** and three **Latest**. New to you is a colleague's company-scope page published in the last week that the viewer hasn't opened since. A public page never claims to be unread, since opening it records nothing. - The guide moves to **`/guide`**, which redirects an owner Home. With nothing live and nothing of the viewer's own, Home is the guide, as before. An owner whose patches are all off sees "Nothing is live" and a link to them. "Your first patch is live" sits at the top of Home for its day. The guide's copy now says "It shows up on your Home". - **The card** at `/patches/<name>` renders alone, full width. The index, its toggle and the guide's index row are gone. #711 splits the card into tabs. - **Shell components**: `tile` (a card to open, with its corner menu), `tile-row` (compact), `tile-row-plain` (in a list), `tile-row-placeholder`, `mono-placeholder` and `mark`. The What's new dot marks a page new to you. ## Verified - `PortalPages.test.ts`: the five tests that pinned the index are rewritten for Home, and new ones cover: - Your usual comes only from the viewer's own opens in 30 days, ordered by score, and another member's opens never move it; - a rename keeps the opens, and a retired patch leaves every shelf; - the viewer's own tools come first, and a republish at tier 1 moves a page into Tools; - New to you lists only a colleague's company page published this week, and drops it once opened or rolled back; - search counts and lists past the shelf limits, finds by title and owner, and escapes a miss in its text, its copy line and its links; - Make your own lasts until the first publish, `/guide` then redirects, and the first-patch note lasts a day; - empty company and off-only owner; - `/?all=1` still answers. - In the browser, `pnpm dev up brightline` with five extra pages and Sofia's opens recorded by `pnpm dev shot`: Home, a search with no match and All patches render with no console errors. - `pnpm check`: format, lint, typecheck and synth pass. `cliRepoBuild.test.ts` timed out once under load from other worktrees (load average about 18) and passes alone. ## Release impact - [ ] **Breaking** - [x] **Not breaking**: the portal's own pages change; `/patches/<name>` and every form keep their routes and fields, and `?all=1` links still answer. ## Surfaces - **Served pages.** Home, `/guide` and the card compose shell components; page CSS is layout only. `ui-consistency` lists the new tile components. - **Vocabulary.** Portal glossary: **Portal** rewritten; **Home**, **Your usual**, **Tools** and **Pages** added; **Guide** updated; **Index** retired. `GLOSSARY-MAP.md`'s Portal line. `docs/product.md`'s portal paragraph. - **Dev loop.** `docs/DEVELOPMENT.md`'s portal exercise now covers Home, search, `/patches` and `/guide`, and how `pnpm dev shot` records an open. - **Reverse states.** Retired and deleted patches stay one link from Home. The guide stays reachable at `/guide` until the first publish. - Wire contract, CLI, skills, migrations and repo layout: not touched. Part of #707. Closes #710. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
…gs (#717) Stacked on #716. It can ship once #713, #715 and #716 are in. With the index gone (#716), the card at `/patches/<name>` was still today's single long page: facts, a Manage section with the description and sharing forms, a four-row versions table, and Retire and Delete at the bottom. Open was one button among many, and tier 3's triggers block (#640) would have crowded it further. ## Fix - **Header.** Breadcrumb Home / All patches / name, the patch's mark, name, title line and tags (Tool or Page, Company only or Public, `vN`, Retired or Deleted). Then the one act that matters most: Open on a live patch, or the existing Restore control for a manager while an off patch can be restored. The copyable address sits under it. - **Tabs.** Everyone gets **Overview** and **Versions**. The owner and admins also get **Log** and **Settings**. - **Overview:** the description and editor, the facts (now with visits), an off patch's note and restore hint, the admin's deactivated-owner warning, and recent activity. - **Versions** (`/versions`): every version, with rollback for managers. It replaces the card's four-row table. - **Log** (`/log`): the existing log, inside the frame. - **Settings** (`/settings`, new): the old Manage section. Owner with admin-only Reassign…, the description and who-can-open forms, then Stop serving (Retire…, Delete…) or, for a retired patch, Delete…. - **Forms keep their routes, fields and checks.** A success redirects to the tab the form sits on: description and scope to Settings, rollback to Versions, the confirmation acts to Overview. Refusals: - a member's POST, or a missing or mismatched `expectedPatchId` (including a name that now names another patch), renders Overview with the notice and never another patch's forms; - a permitted description, scope or rollback refused as stale, invalid or wrong-state renders that form's tab, keeping the submitted description; - confirmation acts behave as before. A member's GET of Settings renders Overview with a 403 notice, as the log already did. - The Settings items in All patches' menus and on Home's tiles now link to `/settings`. - **`?all=1` is gone.** It only toggled the index's retired rows. Links no longer carry it, and requests that do are answered as if they didn't. ## Verified - `PortalPages.test.ts`: - the card tests now check each role's tabs, a member's 403 on Settings, the forms on Settings and Versions (every non-current version is offered for rollback), and Restore leading an off card; - redirects land on Settings or Versions; - the stale, invalid and name-moved refusal tests read their forms from the right tab and still answer the same status and notice; - 88 portal tests pass. - In the browser, `pnpm dev up brightline` as Allison: Overview, Settings and Log for `new-business` render with no console errors. - `pnpm check`: format, lint, typecheck and synth pass. `cliRepoBuild.test.ts` timed out once under load and passes in CI on #715 and #716 and alone. ## Release impact - [ ] **Breaking** - [x] **Not breaking**: every route and form field is unchanged, plus one new GET route (`/settings`). Old `?all=1` links still answer. ## Surfaces - **Served pages.** The card composes shell components (`tabs`, `tag`, the mark, `note`, fields). Page CSS is layout only. - **Vocabulary.** Portal glossary: **Card** (its tabs), **Log** (a tab), **Settings** replaces **Manage**. `GLOSSARY-MAP.md`'s Portal line. `docs/product.md`'s card sentences. - **Reverse states.** Restore leads every restorable off card, and Retire, Delete and Reassign keep their confirmation pages. - Wire contract, CLI, migrations and repo layout: not touched. Off-address notices still link to the card and its restore route. Part of #707. Closes #711. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
Stacked on #717. It can ship once #713, #715, #716 and #717 are in; the rest of the stack is complete without it. When an owner's tier 2 tool starts failing, they don't find out unless they open its log. An admin tidying the company can't see which tools are broken either. ## Fix - **`InvocationLog.failures({ companyId, since })`.** Per patch, the number of top-level entries started since `since` whose effective outcome is one the log's **Failed** filter shows. It reuses the filter's own outcome expression, now named `failed`: commit proof reads as success, an overdue pending entry reads as unknown, and unknown isn't a failure. One grouped query over a new partial index, `runtime_invocations_top_level_recent (company_id, started_at) WHERE parent_id IS NULL` (migration `0018`, after #713's `0017`). - **Who sees it.** Only the tier 2 patches the viewer manages (the owner, or any patch for admins). A member who manages none never queries the log. - **All patches.** A **Health** column (`OK`, or `N failed` linking to the log filtered to Failed), and the Needs attention reason "N calls failed in the last day" with a See the log button. A deletion near reclamation and a deactivated owner still come first. - **Home.** An owner's own failing tools are named at the top, each with its count and a link to its failed entries. Admins see everyone's in All patches, not on Home. - `patchy dev`'s stub `InvocationLog` answers `failures` with nothing, like its other reads. ## Verified - `InvocationLog.test.ts`: two failed top-level entries of the last day count. An entry 25 hours old, an overdue pending one, a nested failure and a success don't. The Failed filter lists the same entries plus the older one. - `PortalPages.test.ts`, "patch health": three failures today and one two days ago show as 3 in the owner's Home warning, linked to `log?outcome=failed`, and not on a member's or an admin's Home. Owner and admin see Health (`3 failed`, `OK`) and the Needs attention reason. A member sees no Health column, no counts and no Needs attention tab. - `pnpm check`: format, lint, typecheck and synth pass. `cliRepoBuild.test.ts` timed out under local load, as on the PRs below, where CI passes it. ## Release impact - [ ] **Breaking** - [x] **Not breaking**: one read added to the log service and to the portal's pages, plus one additive index; no wire or CLI change. ## Surfaces - **Migrations.** `0018_invocations_top_level_recent` in Runtime's migrations. It takes the next id after #713's `0017`; if another migration lands first, renumber it. - **Vocabulary.** Portal glossary: **All patches** (Health) and **Home** (the owner's warning). `docs/product.md`'s portal paragraph. - **Served pages.** Composes `note`, `pill` and `list`; no new component. - Wire contract, CLI, migrations, dev loop and repo layout: not touched. Part of #707. Closes #712. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood
added a commit
that referenced
this pull request
Oct 16, 2026
…u when they fail (#720) Release 13's What's new entry, written from `c9b8fc4`, ahead of deploying it. `patchy` and `CURRENT_RELEASE` move to `0.13.0`, so CLIs and patch repos installed before this deploy are told to upgrade. | Change | PRs | | --- | --- | | New: Home puts the patches you use first | #713, #716, #719 | | New: Every patch in one list | #715 | | Improved: Each patch's page leads with Open | #717 | | New: See when your tools are failing | #718 | | Fixed: Everyone has a name | #687 | | Improved: Your company's look is easier to get right | #697, #696, #703, #688 | | Improved: Forms follow your look's error states | #691, #692 | | Improved: Clearer answers when a publish goes wrong | #686, #685, #689 | | Fixed: Your agent's Patchy commands are steadier | #695, #704, #680, #681 | | Behind the scenes: stricter checks on static pages and tools' database requests; malformed requests are logged | #682, #693, #683 | | Behind the scenes: usage numbers count every publish, sharing change and restore | #698, #699, #700, #690 | | Test and tooling only, no line | #705, #702, #701, #694, #684, #607 | Made by Claude Opus 5.5 in Claude Code, running in T3 Code. Co-authored-by: Claude Opus 5.5 <[email protected]>
1 of 2 tasks
allisonmahmood
added a commit
that referenced
this pull request
Oct 19, 2026
…803) ## What changed A reviewer can't see a UI or flow change without checking out the branch and running it. Now two `pnpm dev` commands put the change in the PR body, before and after: - **`pnpm dev compare <person> <path>...`** takes full-page PNGs of each page at each width on both sides. Patch frames grow to their content. - **`pnpm dev film <person> <flow>`** records a Playwright flow on both sides and joins the takes side by side. - **`--pr <number>`** puts the section in the PR body and uploads its files. A re-run replaces only its own section. Both sides run on **evidence instances**: throwaway clones at the base and at `HEAD`, each on fresh scenario data, never the developer's own instance. So the uploads only ever hold scenario data, and a flow that writes runs the same every time. This builds on the prototype in #726. Closes #725 ## Look at **1. This PR's own evidence, published with `--pr`.** This branch changes no page, so both runs use `--base df65c5b`, the commit before the Home redesign (#713–#719). <!-- patchy-dev:compare:allison --> #### Before and after, as Allison Mahmood (admin) Before is `df65c5b` (--base) and after is `ae4fe0f` (dev/725-compare-film), both on the `brightline` scenario, from `pnpm dev compare`. ##### `/` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/patches` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | - Before at 1280px answered 404; 1 browser error(s): `Failed to load resource: the server responded with a status of 404 (Not Found)`. - Before at 390px answered 404; 1 browser error(s): `Failed to load resource: the server responded with a status of 404 (Not Found)`. ##### `/brightline/kudos` **1280px, after**  No visible change at 1280px. | Width | Before | After | | --- | --- | --- | | 390px | No visible change |  | <!-- /patchy-dev:compare:allison --> <!-- patchy-dev:film:find-a-patch --> #### Flow `find-a-patch`, as Allison Mahmood (admin) Before is `df65c5b` (--base) and after is `ae4fe0f` (dev/725-compare-film), both on the `brightline` scenario, from `pnpm dev film`. - Before: stopped at "Search Home for kudos" after 10.2s: `locator.fill: Timeout 5000ms exceeded.` - After: finished in 6.9s Before is on the left, after on the right. https://github.com/user-attachments/assets/63035395-64f3-4985-b633-94a351979f5c <!-- /patchy-dev:film:find-a-patch --> **2. Cleanup holds however a run ends.** Each run takes both instances down and deletes their data on success, on failure and on Ctrl-C. Before this branch, Ctrl-C skipped that: Playwright and embedded-postgres each hook SIGINT and exit the process before Effect's finalizers run. Browsers now launch with Playwright's handlers off and close with their scope, and the supervisor (with embedded-postgres) only loads in `supervise`. Details are under How it was verified. ## How it was verified - **Focused tests**, `pnpm exec vitest run scripts/dev` (10 files, 48 tests). The new ones cover: - the section's insert and replace: before a final "Made by" paragraph, at the end when there is none, in place among other keys, ignoring markers and "Made by" inside code fences, and refusing duplicate or unclosed markers; - the layout per width, what each section attaches (an identical "before" is left out), and page errors quoted so their text can't name a file; - attachments only from the run's own folder, and which references a partial publication left as local paths, read from the real section rather than a fenced example of one; - the lock: a second run refused and the lock freed afterwards, six runs starting together never giving two holders, a dead run's entry deleted, and `down` refused while a run holds it; - the reuse-or-move decision for a clone, and shot filenames for paths that slug alike. - **Real runs** on a shared Linux machine: | Run | Took | What it showed | | --- | --- | --- | | `compare ada /` on `team`, from cold (clone, install, up, both sides) | 44 s | both instances down afterwards, nothing left running | | `compare` on five `brightline` pages at two widths | 1 min 59 s | patch frames grown to their content (the tier 0 brief to 3,398 px, tier 1 Kudos to 2,594 px); the four patch pages said "No visible change" | | `compare … --pr 803`, above | 1 min 21 s | 10 files attached, section replaced in place | | `film … --pr 803`, above | 1 min 3 s | 0.25 MB side by side, the base take stopping in red | | both again after the last push, from cold (`pnpm dev down` had deleted the checkouts) | 1 min 54 s and 1 min 5 s | each replaced only its own section, now naming `ce97595`; again at `ae4fe0f` after round 3 | - **Failure paths, run for real:** - **A base before `pnpm dev up` existed** (`--base af2aead`): before unavailable, with "Bringing the before instance up failed (exit 1)." in the section, after only, exit 0. - **A flow broken on this branch:** footage kept, nothing published, exit 1. - **A second `compare` while one ran, and `pnpm dev down`:** both refused at once, naming the running pid. Once the run ended, `pnpm dev down` printed "Removed the evidence checkouts" and deleted them; it keeps the empty lock folder beside them, since deleting it could cost a starting run its entry. In a worktree that never ran one, it still prints "Nothing to take down." and creates nothing. - **Ctrl-C during setup and during capture:** both instances taken down; no state dir, environment, lock entry or process left. Before the fix in this PR, both exited 130 and left both instances running. - **`--pr` checks**, before anything starts: ``` $ pnpm --silent dev compare allison / --pr 803 # with an uncommitted edit Evidence shows commits, and this worktree has uncommitted changes. Commit and push them first, so the PR shows what the evidence shows. exit 1 $ pnpm --silent dev compare allison / --pr 803 # one local commit past the PR PR #803's head is bbe4fe5, but HEAD here is 5bfbf35. Push this branch (or check out the PR's head) so the evidence is of the commit the PR shows. exit 1 ``` The head check also caught GitHub's lag for real: run straight after a push, it refused until the PR showed the new head a few seconds later. - **Partial publication, as far as it goes from here.** gh 2.102 refuses an empty file and an 11 MB one itself, before uploading anything. Through the publishing code, that left the body unchanged, passed gh's error through and exited 1 saying nothing was published. GitHub accepted random bytes named `.png` and `.mp4`, so I couldn't make one upload fail and another succeed. What a partial publication leaves behind is covered by the `notUploaded` test; gh's help says it updates the body with the uploads that succeeded and exits non-zero. That test section was removed from this body afterwards. - **What was uploaded:** only `brightline` scenario data. I read every PNG from an identical run without `--pr` before publishing. Pages show the instance's local hostname. - **`pnpm verify --changed`:** all passed (format, lint, typecheck, synth and 1,967 tests). It skipped the acceptance suites, since only the runner and docs changed. - **Hit every surface:** - **The dev loop:** `docs/DEVELOPMENT.md` (the command table and "Showing a change in a PR") and the `patchy-dev-loop` skill. The seed and the vitest template are unchanged. - **The evidence skill:** `pr-evidence` gains `compare` and `film` and loses the `shot` caveat. The throwaway-checkout recipe moved to Command output until `transcript` (#792) lands. - **Vocabulary:** "evidence instance" is defined in DEVELOPMENT, beside the runner's other terms; no context glossary covers the runner. - **Reverse states:** `compare` and `film` make the evidence checkouts, and `pnpm dev down` deletes them. A run's lock entry goes when it ends, and the next run deletes a dead run's entry. - **Doesn't apply:** the wire contract, the CLI in `packages/patchy`, migrations, company resources, served pages and the repo layout. - **Reviewed by GPT 6.1 Sol** over three rounds. Round 1 had 1 blocking and 4 should-fix findings; rounds 2 and 3 had no blocking ones, with 2 and 1 should-fix. All are fixed; the summaries are in the comments. - **Not checked:** macOS; a real partial upload; a non-Claude harness reading the skills. - **Done means:** #725 has no Done means section. Its spec's tests and docs are covered above, and this body's two sections show both commands working. ## Release impact Tick exactly one. - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — dev tooling and docs; nothing ships to production - **What does a revert leave behind?** Evidence checkouts under `$XDG_DATA_HOME/patchy-dev/<label>.evidence/`, which the older `pnpm dev down` doesn't know to delete (`rm -rf` them), and evidence sections already in PR bodies. - **Does the release before it still work with that?** Yes. Nothing here runs in production. Made by Claude Opus 5.5 in Claude Code, running in T3 Code. --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
1 of 2 tasks
allisonmahmood
added a commit
that referenced
this pull request
Nov 10, 2026
…#1370) Stacked on #1354; part of #1315. Merge the stack together, not alone. ## What changed Nothing showed someone which of their colleagues' patches they had never looked at. Now a blue dot after a patch's name marks a colleague's live patch you have never opened, like unread mail. Opening the patch clears it. - **Where it shows.** All patches, under every filter and in search results, and Home's New, From colleagues and Shared with you. Never on your own patches or on retired or deleted ones. Not on Yours, Your usual or the ⌘⇧K switcher. - **What it reads.** `patch_opens`, which `Patches.recordOpen` writes when someone opens a patch at its address. Home and All patches already read the viewer's opens once per page (`patches.opens`), so the dot adds no query. Opens have been recorded since #713 (16 Oct), so at release every colleague's patch a person hasn't opened since then gets a dot. - **One rule.** `unopened` in the portal's `shared/presentation.ts` checks three things: the patch is live, someone else owns it, and the viewer has no open of it. It replaces `isNew`, which dotted only patches made in the last week. Home's New keeps its own rule (made in the last week, not opened, not public), and its rows now carry the dot too. - **Shared with you.** A guest's open wasn't recorded: serving recorded opens for members only. Recording one is the same `recordOpen` call, on the patch the guest was just let into, and only the guest's own Home reads the row. So this PR records it and dots those rows. `patch.first_opened` still fires for members only, so activation is unchanged. A shared patch that went public never gets a dot, since a guest reads its public page like anyone and that records nothing. A shared patch the guest can't open now has no link and no dot. - **A colleague's public patch** does get the dot. A member who opens it signed in records an open, as before, so opening it from Patchy clears the dot. New still leaves public pages out (spec §10). - **Look.** The existing `.unseen` blue dot after the name, inside the patch's link, so the link reads "Client onboarding Not opened yet" to someone moving between links. The name's last character and the dot are one no-wrap group: a long name still wraps, and on a phone the dot always goes with its last letter, never onto a line alone. ## Look at <!-- patchy-dev:compare:allison --> #### Before and after, as Allison Mahmood (admin) Before is `e99dc00` (where this branch left ui/g2-governance) and after is `751cf83` (ui/unopened-dot), both on the `dense` scenario, from `pnpm dev compare`. Every page answered 200 with no browser errors. ##### `/` **1440px, after**  <details><summary>1440px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/patches` **1440px, after**  <details><summary>1440px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /patchy-dev:compare:allison --> <!-- patchy-dev:compare:priya --> #### Before and after, as Priya Shah (member) Before is `e99dc00` (where this branch left ui/g2-governance) and after is `751cf83` (ui/unopened-dot), both on the `dense` scenario, from `pnpm dev compare`. Every page answered 200 with no browser errors. ##### `/patches` **1440px, after**  <details><summary>1440px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /patchy-dev:compare:priya --> ## How it was verified - **Tests.** - `HomePages.test.ts`, new test: a colleague's patches carry the dot on All patches under All, Tools, Pages, Yours, Retired and deleted and a search, and Home's From colleagues marks the same ones. Never on the viewer's own (nor on Yours), on an opened one or on a retired one. `recordOpen` clears the dot on both pages, and the owner sees no dot on their own patches. - `HomePages.test.ts`, the New test rewritten: New still lists last week's unopened patches, now each with the dot. From colleagues now dots older and public patches too, and opening one clears it. The Shared with you test now checks the dot and that the guest's `recordOpen` clears it. - `Pages.test.ts` (serving), new test: a guest opening a shared patch at its address records an open, the frame's content request doesn't, and nothing is reported to analytics. It fails without the serving change (`expected false to be true`). - `test/browser-tier1/all-patches.spec.ts`, new test, run alone locally: at 320px a colleague's unopened patch's link reads "Client onboarding Not opened yet". Narrowing the name a pixel at a time around where the dot stops fitting, the dot never leaves its last letter's line. On the earlier no-break-space markup it stranded the dot at 8 widths. Opening the patch from that link clears the dot. - `ui.test.ts` (core): `unopenedName` groups the last character, a multi-code-point emoji whole, and escapes; `row` without `unopened` is unchanged. - **`pnpm check`.** Format, lint, typecheck and synth pass. Under load on this shared machine, the offline run had 16 files fail, in `packages/patchy`'s CLI tests, PGlite, `execution` and `csv`, none touched here. The ones re-run alone pass (`csv`, `Tables`, `PgliteCompanyDatabases`). The portal, core UI, patches and serving suites pass in full. CI runs everything. - **Pages.** The comparisons above ran on `dense` against `ui/g2-governance`: Allison on Home and All patches, Priya on All patches. Priya's Home is left out because, with no agent connected, the Final step dialog covers it. Her opened Moodboard under Shared with you is covered by the Home test and the scenario. ### Hit every surface - **Wire, CLI, dev loop, migrations, company resources:** untouched. - **Vocabulary and product shape:** the portal glossary gains **Not opened yet**, and its New, From colleagues, Shared with you and All patches entries name the dot. The patches glossary's **Open** now covers a guest's own open, never reported. `docs/product.md` covers the portal and guests. - **Served pages:** `ui-consistency` says what the dot means. The `/~ui` Status table draws `unopenedName` in place of the hand-written span. - **Dev scenario:** in `dense`, Priya has now opened Moodboard, so Shared with you shows both states (Priya opened it, Allison didn't). `scenarios/README.md` has a row for it. - **Reverse states:** opening the patch clears the dot. Nothing else to undo. ### Core additions - `unopenedName` (`ui/feedback.ts`): a patch's name, escaped, with its last character and the labelled dot in one `unopened` no-wrap group, to go inside the patch's link. - `row`'s optional `unopened` (`ui/structure.ts`) draws its name with `unopenedName`. Without it, a row renders exactly as before. - Two CSS rules in the status chunk: `.unopened` keeps the group on one line, and `.unopened > .unseen` puts 4px before the dot and raises it 1px, as the mock has it. The served subset is unchanged (its pin test passes). ### Shared changes - `shared/presentation.ts`: `unopened` added. `isNew` removed: Home was its last user, and New's one-week window moved into `home.ts`. ## Release impact - [ ] **Breaking** — requires action from anyone already running this - [x] **Not breaking** — no action required A page addition. Serving now also writes a guest's open into the existing `patch_opens` table. - **What does a revert leave behind?** Guests' rows in `patch_opens`, keyed to the guest and another company's patch. - **Does the release before it still work with that?** Yes. It reads opens only through `opens(userId)` for the viewer themself, and only looks them up from its own company's patches (Your usual, prewarm, the switcher), so a guest's row is never shown or counted. Built by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated by Fermy. Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Home (#707) puts each person's usual patches first and marks pages they haven't read. Patchy can't do either today:
visit_countis one total per patch with nobody's name on it, and the only per-person traces are analytics events in PostHog, which a page must not read.Fix
patch_opens(migration0017_patch_opens): one row per member and patch, holdinglast_opened_atand ascore. Each open counts 1 and halves every 7 days, soscore = score · 2^(−Δt/7d) + 1on open, and reads decay it the same way. Both foreign keys cascade, so reclaiming a patch forgets its opens.Patches.recordOpen(userId, patchId, versionId)upserts against serving patches only, and only whileversionIdis still current, using the service clock. An open stamped earlier than the last one decays to the later instant, solast_opened_atnever moves back. The decay's exponent is clamped at 1000 half-lives, so a very old row reads as nearly nothing instead of underflowing.Patches.opens(userId)returns one member's rows, decayed to now.ReadPatchgainsvisits, which All patches and Home (feat(portal): All patches lists every patch, with tabs and search #709, feat(portal): Home replaces the index #710) sort by.Nobody but the member reads their rows: there is no API and no owner or admin view.
docs/product.mdnow says so beside "The host knows who opened a company page".Verified
Patches.test.ts: two opens give a score of 2; another member has no row; seven days on (TestClock) it reads 1, and opening again makes 2; an earlier-stamped open adds its decayed share without moving the last open; a superseded version and a retired patch record nothing; a 2000-01-01 row reads as nearly nothing; reclamation removes the rows;readcarriesvisits.Pages.test.ts: the current address records an open, while the content URL, a signed-out request, a public page and~v/1after a v2 don't; a forced insert failure still serves the page.pnpm checkpasses.Release impact
Surfaces
0017, the next free id; no open PR holds one.docs/product.md: the serving-guarantees paragraph.Part of #707. Closes #708.
Made by Claude Opus 5.5 in Claude Code, running in T3 Code.