Skip to content

fix(patches): reopens within 10 minutes count once - #1295

Merged
allisonmahmood merged 1 commit into
mainfrom
fix/patches-open-dedupe
Nov 8, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
fix/patches-open-dedupe

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

Every open of a patch added a full point to that person's score for it, and Home's Your usual sorts by that score. The coming switcher (#1091) makes it easy to flip between two patches all day, and each flip would add another point, so those two would crowd everything else off the shelf. Now an open adds its point only when it comes at least 10 minutes after the person's last open of that patch. An open inside the window still moves the last-open time, so a patch reopened every few minutes counts about once. The score now counts separate returns, not raw opens.

Closes #1267

Look at

The conflict branch of upsertOpen (packages/patches/src/Patches.ts). Only the incoming open's term is gated, on abs(EXCLUDED.last_opened_at − patch_opens.last_opened_at) ≥ 10 minutes. GREATEST, both decay terms, the current-version and serving predicate and the xmax = 0 first-open check are unchanged:

score = patch_opens.score * halving(latest - patch_opens.last_opened_at)
  + CASE WHEN abs(extract(epoch FROM EXCLUDED.last_opened_at - patch_opens.last_opened_at)) >= 600
    THEN halving(latest - EXCLUDED.last_opened_at) ELSE 0 END,
last_opened_at = latest

The abs keeps the existing late-arrival case working: an open stamped a week earlier that arrives late still adds its age-correct half point. The rule goes by arrival order, as the issue accepts. Opens at minutes 0, 18 and 9, arriving in that order, count twice, because the row keeps only the last open.

The new and changed tests, red then green. I put origin/main's Patches.ts back under the new tests (git restore --source=origin/main -- packages/patches/src/Patches.ts):

× remembers each member's opens of live patches, halving every week
    AssertionError: expected 2 to be close to 1 +/- 1e-9
× counts reopens within 10 minutes of the last open once
    AssertionError: expected 1.9993137356513948 to be close to 0.9993137356513948 +/- 1e-9
× lets exactly one of a member's racing opens be their first
    AssertionError: expected 3 to be close to 1 +/- 1e-9

With the change:

✓ remembers each member's opens of live patches, halving every week
✓ counts reopens within 10 minutes of the last open once
✓ reads a decade-old open as nearly nothing and still counts the next one
✓ lets exactly one of a member's racing opens be their first

The new test covers four things:

  • An open 9:59 after the last adds nothing and still moves last_opened_at.
  • A second open 9:59 after that one also adds nothing, because the window is measured from the last open, not the last one that counted.
  • An open exactly 10:00 after the last counts.
  • An earlier open that arrives late inside the window adds nothing and leaves the last open where it was.

The week-late case, first-open attribution and the simultaneous-insert race keep their tests. Their expected scores drop where their opens land in one instant: the racers now total 1, not 3. Two mutations are also caught: > in place of >= fails the exact-10:00 step, and dropping abs fails the week-late case.

How it was verified

  • pnpm exec vitest run over packages/patches/src/Patches.test.ts, packages/portal/src/PortalPages.test.ts and packages/serving/src/Pages.test.ts (the suites that record or read opens): 173 passed.
  • pnpm check: format, lint, typecheck and synth pass.
  • pnpm verify (on the previous base, before the docs-only feat(integrations): patches save IMAP attachments into their files #1264 and docs(whats-new): patches read a company mailbox and keep its attachments #1293): postgres-concurrency, tier2-smoke and browser (85 Playwright tests) pass.
  • Failing locally, and failing the same on origin/main:
    • The test, test (bun), cli-smoke and install steps hit two known causes on this machine. CLI stub servers get a stray GET /, and npm is missing beside /usr/bin/node, which stops the installer tests and the install line in the packed e2e.
    • Supervisor and PatchesApi each timed out once under load and pass when run alone.
    • CI is the arbiter for these.
  • Not checked: Home visibly reordering with real usage. This change only alters scores; no page's markup changes, so there are no screenshots. The new test shows the "Done means" behaviour at the score: reopening every few minutes counts once, and an open 10 minutes or more after the last, including a late one, still counts.

Hit every surface: only Vocabulary and product shape applied. The Open entry in the Patches glossary and the Your usual entry in the Portal glossary say how reopens count, and so do the Open.score, recordOpen and REOPEN_WINDOW comments. docs/product.md still holds ("opened most in the last 30 days"). Nothing changes in the API, the CLI, the dev loop, migrations, company resources, the markup of served pages, or the repo layout.

Release impact

  • Breaking — requires action from anyone already running this
  • Not breaking — no action required

This changes how a score is computed. There is no schema change, and no API or CLI change.

  • What does a revert leave behind? Scores already written under the new rule, lower for patches reopened in quick succession. They stay as written, in the same columns and shape.
  • Does the release before it still work with that? Yes. It reads and writes the same patch_opens rows. During a rollout, old servers still count every open, which only inflates scores the way they did before.

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

@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area area:ui Portal and first-party browser pages, shared rendering and styles size:s Under 100 changed lines labels Nov 7, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review (round 1)

APPROVE

No findings.

Validation: all 43 Patches tests and six targeted Portal/Serving tests passed. The tests pin the 9:59/10:00 boundary, suppressed timestamp advance, week-late contribution and simultaneous first-open race. I checked the non-null timestamp and score columns, epoch arithmetic, previous-row references in DO UPDATE, all score readers, glossary changes and rollback answers against the agreed arrival-order rule.

Reviewed by GPT 6.1 Sol (xhigh) in Codex, orchestrated from T3 Code.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 5da5ad97cde0fe6b78dd43f0466a3e2581b41830 (base 64ce90784350341fc2f60fe4f4161a78444f243e) on brightline, by Claude Opus 5.5 (xhigh) in Claude Code, orchestrated from T3 Code.

Setup, the same on both commits: Allison published four extra pages (flip-a, flip-b, roster, style-guide), so the studio has more patches than Your usual's four slots. Priya opened New Business, Kudos, the kickoff brief and roster through their addresses. Those rows were then set to past visits (scores 3, 2.5, 2 and 1.5, last opened a day ago), since a server's clock can't be moved. After that, she opened flip-a and flip-b alternately, 10 times each, through their addresses: real opens through serving.

Done means

  • Flipping between two patches counts each about once, and Your usual isn't taken over by them: passed. On main, the flip pair score 10 each and push the kickoff brief and roster off the shelf. On the head they score 1 each, and the shelf keeps Priya's four usual patches.

    main head
    flip-a / flip-b after 10 opens each 10.000 / 10.000 1.000 / 1.000
    Your usual flip-b, flip-a, New Business, Kudos New Business, Kudos, Kickoff brief, roster

    Main, after the flip:

    Your usual on main after the flip

    Head, after the flip:

    Your usual on the head after the flip

    A suppressed reopen still moves the last open (head, flip-b, from 15:19:43.548 to 15:19:44.658), so Home's "new to you" and its 30-day window keep seeing it.

  • An open more than 10 minutes after the last still counts, including one that arrives late: passed.

    • On a head instance, Jordan's flip-a (score 1.000) had its last open moved back 11 minutes. One more open through its address took it to 1.999, and it moved into Your usual in third place, ahead of the kickoff brief (1.811):

      Your usual on the head after a return

    • The 9:59 and exact-10:00 boundaries, a chain of 9:59 reopens and a late-arriving open rest on the PR's tests, since a dev server stamps opens with its own clock. Over main's Patches.ts, three of them fail on the assertion; on the head, all four pass:

      Red on main's code, green on the head
      # main's Patches.ts under the head's tests
      × remembers each member's opens of live patches, halving every week
          AssertionError: expected 2 to be close to 1 +/- 1e-9
      × counts reopens within 10 minutes of the last open once
          AssertionError: expected 1.9993137356513948 to be close to 0.9993137356513948 +/- 1e-9
      × lets exactly one of a member's racing opens be their first
          AssertionError: expected 3 to be close to 1 +/- 1e-9
      
      # head: Patches, PortalPages and serving Pages suites
      Test Files  3 passed (3)
           Tests  173 passed (173)
      

Beyond Done means

  • Home's ordering for ordinary use: passed. Patches opened on separate days keep their order on the head (New Business 2.717 > Kudos 2.264 > kickoff brief 1.811 > roster 1.359), and a return after 10 minutes still moves a patch up, as above. A first open still scores 1, and the racing-opens test still gives exactly one first open (CI postgres-concurrency is green).

Golden journeys

  • Find and open a tool (brightline, Jordan): passed. Home lists New Business, Spend, Kudos and the kickoff brief. Searching "kudos" finds it, and /brightline/kudos opens with the Kudos heading in its frame (Playwright on the head instance).
  • No other journey is touched: the diff changes only how an open's score is written.

Rollback answers: they match the diff. The PR changes upsertOpen's SQL, a new REOPEN_WINDOW constant, comments, tests and two glossaries. There's no migration and no change to packages/api, the CLI or apps/infra. A revert leaves lower scores in the same patch_opens columns, which the release before reads and writes unchanged, so no one-way label is needed. rollback-rehearsal is green. CI: 23 checks pass on the head; attio-live, imap-live and pidgeon-suite were skipped.

Not run

Notes

  • This fills the gap the PR body names under "Not checked", Home visibly reordering with real usage: the shelves above show it on both commits.

An open now adds its point to a member's score for a patch only when it
is at least 10 minutes from their last open of it, on either side. A
suppressed open still moves the last open, so flipping between two
patches every few minutes counts each about once and Home's Your usual
measures separate returns rather than raw opens. No schema change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the fix/patches-open-dedupe branch from 5da5ad9 to 5100ffd Compare November 8, 2026 00:16
@allisonmahmood
allisonmahmood merged commit e1f4e3b into main Nov 8, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the fix/patches-open-dedupe branch November 8, 2026 00:28
allisonmahmood added a commit that referenced this pull request Nov 8, 2026
## What changed

Moving between patches meant the back button, the address bar or a trip
through Home, and inside a patch Patchy showed nothing at all. Now
Mod+Shift+K (⌘⇧K on a Mac) opens Patchy's **Go to…** menu over any
company patch a person can open, a guest's view of a shared patch
included, and over every signed-in portal page. With nothing typed, the
patch they were last in comes first and lit, so ⌘⇧K then ↵ flips back to
it. Escape or the key again closes it and puts the cursor back where it
was, inside the patch's own field too. The look is mock direction 2,
"Quiet list".

How:

- **`/~shell/switcher.js`** is core's second generated script
(`scripts/build-core-scripts.mjs`), plain DOM code with no Preact,
Effect or schema library. The generator now refuses any bundled input
from outside core. Every host serves it like the broker, immutable under
its digest. App pages load it from `htmlPage` when they pass `app`, and
company shells from `renderPatchWrapper`, ahead of Clerk's and the
session's scripts. The tag names the viewer and company the page was
rendered for. Doors, public shells and `patchy dev` don't load it, so
they only claim the key. The script is 14.9 KB raw and 5.6 KB brotli.
- **The menu** is a command list in a modal `<dialog>` with the starting
cover's flat `shell-scrim`, and no animation or blur. It installs `{
open, toggle }` as `window.patchySwitcher`, the contract from #1298, and
opens at once if a press came before it loaded.
- **Nothing typed:** the flip target, then the next five by last open,
then **This patch**, then **Patchy**. Patch slots that opens leave fill
with patches the viewer has never opened, the company's live ones before
those shared with them, each by title, then id, six patch rows in all
(decided by Allison on 2026-11-08). So a new member or a guest sees
patches straight away. With nothing to flip back to, no patch is lit:
the first row after them is, so ⌘⇧K ↵ never opens a patch the person
hasn't been to. An unopened company patch shows no detail; a shared one
shows its company's name. This patch is the card's Overview and
Versions, plus Log and Settings for the owner and admins, shown only
once the list confirms membership. Patchy is the places, minus the
page's own, plus What's new with its dot.
- **Typing** goes through a pure ranking module (`switcher/rank.ts`):
word starts in any order, then initials, then a match inside a word from
three letters. Ties go by open score, then title, then id.
- **The list in the browser** (`switcher/client.ts` over
`switcher/cache.ts`) is one versioned sessionStorage entry keyed to the
page's viewer and company. It holds row metadata and the tab's `{
current, previous }` patch ids.
- It fetches `/switcher.json` on load, and again on open once the copy
is a minute old.
- A stale session is refreshed once through `window.patchySession`, then
the list is fetched once more.
- Signed out, a refusal, someone else's list or a non-list response
clears everything. So does signing out on the page: posting the form to
`/logout` forgets the list and pointers before the browser leaves for
the door, which has no switcher, and an answer still on its way is
dropped (`forgetOnSignOut`).
- A stored entry that is someone else's, an older version's, or doesn't
read back whole is removed, pointers and all. Pointers alone, as before
a first list lands, still read back.
- A list that lands after the menu opened, before the person typed,
moved the selection or pointed at any row (the lit one included), is
drawn as if it had been there at open: the flip first and lit. After any
of those, and on later refreshes, the rows already shown keep their
order and the selection stays put.
  - It takes its inputs as options, so #1271's notices can reuse it.
- **Keys around the chord.** A company shell's switcher tells the
patch's relay it is there with a new shell message, `available`. It
answers each validated `hello` from its frame itself, so this never
depends on the broker's release; it runs before the broker gives the
frame its address, so it hears every `hello`. From then on, an
activating press makes the relay hold every keydown, keypress and keyup
in the frame. The hold lasts until the browser blurs the frame and it
has really lost focus to the menu, `closed` arrives, or a second passes;
a blur the page dispatches itself ends nothing. So the patch never hears
a key meant for the menu. An Enter pressed in the few milliseconds
before the menu has focus is dropped, not flipped; a person's ⌘⇧K ↵ is
slower than that. Without `available` (a public shell, `patchy dev`, an
older shell) nothing is held, and typing goes on as before. The relay
accepts `available` and `closed` only as trusted messages from its real
parent. Nothing is replayed, and the frame never gives up focus. The
menu takes focus before it draws its rows.
- **The field keeps focus.** It is a `<label>`, and a press anywhere in
the dialog but its text, the glyph and panel included, leaves focus in
it.
- **Closing** puts focus back where the menu opened from. Over a patch
that is the frame, then `closed` so the relay restores the field and
selection, once the frame has focus again (Firefox returns it only after
the key event that closed the menu). Focus leaving the open menu, to the
patch, another window or the browser, closes it the same way, so Go to
never shows while typing goes elsewhere. It can also be the shell
control or the starting cover. On app pages it is the element that held
focus. The cover waits while the menu is open, and clearing it never
takes the menu's focus (`stream-status.ts`).
- **Components:** core gains `kbd` and the command-list contract
(`command-list.ts`: field, listbox, lit row, group label, empty line),
with its own scoped reset. `mono`, `page-mark`, `mark`, `tag`,
`shelf-label`, the What's new dot and the `field`/`field-group` rules
moved into `shellStyles`, so a served shell draws them as an app page
does. Escaping, patch marks and the sidebar's places moved into
dependency-free modules (`escape.ts`, `patch-marks.ts`, `places.ts`)
that the browser bundle can carry. Their old exports are unchanged.
- **Smaller changes:** the switcher list's type moved from Portal into
`@patchy/core/switcher`, as #1294 suggested. The shell's console line on
`open` is gone at company scope; `patchy dev` keeps it.

Closes #1270

**This PR changes code from #1298.** The commit `fix(core): the relay
holds the keys after the chord only where a switcher will take them`
changes `packages/core/src/switcher/relay.ts` and `messages.ts`, with
their cases in `switcher-relay.spec.ts` and ADR-0010. Of #1298's
`broker.ts`, this PR changes only the console line on `open`. Without
it, a fast ⌘⇧K ↵ from a patch's field sent the Enter into the patch,
since the browser delivered it inside the frame before the shell had
handled the relay's `open`. The fix needs the shell's switcher to say a
menu exists (`available`), and the relay to hold keys only then and to
accept only its real parent's messages and the browser's own focus and
blur. That only matters once there is a menu, so it lands here rather
than in #1298.

## Look at

**The flip**, filmed on `brightline` as Allison: Spend Requests, then
New Business, then ⌘⇧K ↵ back to Spend Requests, typing to filter, and
the menu on Home.


https://github.com/user-attachments/assets/117eb293-cae5-4fe6-931c-0c391df522cc

**Over a patch**, nothing typed. Spend Requests is lit as the flip
target, and New Business, the patch on screen, isn't a row:

![The switcher over New
Business](https://github.com/user-attachments/assets/b45a9f2f-da83-4d8e-97a3-58a69b89dee4)

**A new member** (Jordan on `brightline`, who hasn't opened anything)
with nothing typed: the company's patches by title, none lit, and the
first place lit:

![The switcher for a new member on
Home](https://github.com/user-attachments/assets/6d6510f6-046f-46aa-a526-5849e0003a3b)

**Typed** ("ku" over Spend Requests), and **on Home**, where Home isn't
offered:

| Typed | On Home |
| --- | --- |
| ![The switcher with ku
typed](https://github.com/user-attachments/assets/a51a9ead-c07c-431f-9491-f9410fb2a731)
| ![The switcher on
Home](https://github.com/user-attachments/assets/069b7972-7257-417c-85fd-7819d1ba8fe3)
|

**Pages with the menu closed don't change.** `pnpm dev compare` as
Allison on `brightline`, before at `66997dd` (#1298's head) and after at
`ab55b42`:

| Page | 1280px | 390px |
| --- | --- | --- |
| `/` | No visible change | No visible change |
| `/brightline/new-business` | No visible change | No visible change |

<details><summary>After, 1280px</summary>

![Home
after](https://github.com/user-attachments/assets/f8972e01-7ba9-4a70-bd3e-f3ac8d6dbd15)

![New Business
after](https://github.com/user-attachments/assets/f0be0e61-a42c-4189-b559-05ba2aaddf8a)

</details>

**The spec caught a real race.** `dialog.close()` queues its `close`
event, and Chrome can handle a fast key press first. Without a guard,
the stale event from an Escape closed a menu reopened straight
afterwards. The menu now acts on its dialog's `close` event only while
the dialog is actually closed. The cover spec reopens it immediately
after Escape to hold that.

## How it was verified

- **`test/browser-tier1/switcher.spec.ts`**, 16 cases, all pass twice
over with `--repeat-each=2` in Chromium, and once more after the rebase
onto `main`. The 14 that aren't Chromium-only (all but the starting
cover's two) also pass twice over in Firefox.
- Someone who has opened nothing: a new colleague's menu on All patches
lists the company's patches by title with Home lit; a guest's lists the
patch shared with them, named with its company's name, with Home lit.
- ⌘⇧K, then ↵ once the menu has focus, three flips in a row from the
patch's field: each lands. Then ⌘⇧K ↵ with no pause: the patch's own
listeners and its form never hear the Enter.
- A menu slow to open (600 ms after the relay asks, the shell otherwise
free) over a patch that forges blur events every 20 ms: the Enter
pressed straight after the chord never reaches the patch, and nothing
flips. The broker never answers `hello`, as #1298's doesn't, so
readiness comes from the switcher alone. With the switcher's answer
disabled, the patch hears the Enter: the case bites.
- A patch that grabs focus back 400 ms after losing it, never leaves Go
to up while typing goes to the patch. In Chromium the menu closes and
"private" lands in the patch. In Firefox the inert frame can't take
focus, and the keys stay in the menu.
- A fresh tab whose list is held back: the menu opens on the places with
Home lit; once the list lands the flip is first and lit. Pressing ↓
first keeps All patches lit instead, and so does pointing at Home, the
lit row.
- A click on a group label, then on the glyph: the field keeps focus,
typing filters and ↵ opens.
- Sign out from the account menu: the tab's entry is gone on the page
the form leads to.
- Over a patch with the cursor in a field: the flip is lit, typing
filters, no match offers All patches, Escape restores the field's
selection (typing replaces it), ⌘⇧K ↵ flips both ways, the arrows wrap,
the key again closes, hover lights a row, the scrim closes and a click
opens.
- On All patches and Home: the flip to the patch the tab left, no own
place, no This patch, and focus back in the sidebar search.
- A guest: shared rows named with their company's name and no This
patch. Revoking the grant drops the row when the held `/switcher.json`
lands, while the menu stays open.
- Another viewer's planted entry is ignored and removed, while the same
entry as the viewer paints from cache. Denied `sessionStorage` still
lists.
- Sessions: stale gets the list back (401, refresh, 200), an exhausted
retry keeps the copy (401, 401), and signed out clears the list and the
entry.
- A host with no `switcher.js`: the key is claimed and `patchySwitcher`
stays `true`. With `/switcher.json` answering a 404 page: places only.
- A public shell loads neither file, and a key typed straight after the
chord lands in the patch's field.
- Over the starting cover: the menu opens over it, Escape returns focus
to the cover, and a cover clearing behind the reopened menu leaves focus
in it. A cover due while the menu is open waits, then takes focus once
it closes.
- **`switcher-relay.spec.ts`** now runs the relay alone on a host
without `switcher.js`, since a loaded menu answers its pending requests.
A new case shows that a page dispatching `available` itself is ignored
and the key after the chord stays the page's. The shell's own
`available` holds the next key, a blur the page forges releases nothing,
and `closed` ends the hold. All 11 pass, as do the 4 `focus.spec.ts` and
7 `starting.spec.ts` cases, twice over in Chromium.
- **Unit tests:**
- `rank.test.ts`: the mock's "sa" order, any-order words, initials,
inside-a-word from three letters, no typos, deterministic ties.
- `cache.test.ts`: round trip, metadata only, removal of another
viewer's or company's entry, of a bad list, bad pointers or an old
version, pointers on their own kept, full or denied storage, pointer
moves.
- `rows.test.ts`: every nothing-typed and typed case above, member vs
admin cards, the hold on refresh, the "4 min" … "Oct 2, 2025" labels.
Never-opened patches: a new member's six of eight by title and none lit,
a guest's shared patches named with their company, the mix (the flip,
then opened, then the company's unopened, then shared, capped at six),
and the patch on screen left out.
- `client.test.ts`: adopt, freshness, refresh once, keep, forget,
pointers, and sign-out forgetting for good with an answer still on its
way.
- `command-list.test.ts`: structure, escaping and the CSS in
`shellStyles`.
- `html.test.ts` and `render.test.ts`: the tag on app pages and company
shells only, ahead of Clerk, with escaped ids.
  - `Pages.test.ts`: `switcher.js` is immutable only under its digest.
- **`pnpm check`** (rerun after the round-three fixes): format, lint,
typecheck and synth pass. Its tests fail only in this machine's known
places, which fail the same on `origin/main` here: a stray `GET /`
reaching CLI stub servers (cli, cliPublish, cliLifecycle, cliLook,
cliRepoRecovery) and npm missing beside `/usr/bin/node` (install).
- **`pnpm verify`** under the shared lock, run before the round-one
fixes, with mise's Node 24 first on PATH: format, lint, typecheck,
synth, postgres-concurrency, cli-smoke, install and tier2-smoke pass.
test and test (bun) fail only on the same stray `GET /` and on load.
RequestEvents, Engine and Supervisor pass alone; Supervisor's case had
hit its 20 s timeout at a load average of 15. The browser job stopped at
its first failure, so I reran the whole tier 1 suite: 103 of 104 pass.
The one failure is `tier1.spec.ts` "hostile navigation", whose
foreign-origin stub heard a bare `GET /` from the local port probe.
#1294 documented it failing the same way on `origin/main`.
- **Not checked:** the hand test on a Mac in Safari, Chrome, Firefox and
Zen. That covers focus and cursor restore, the first moments after a
patch opens, and whether initials matches read clearly without
highlighting. WebKit isn't runnable here, so Safari is unverified. CI
runs Chromium only; the Firefox run was local.

Hit every surface:

- **Served pages:** the `ui-consistency` spec now covers the switcher as
the one shell UI a person opens over a running patch, the command list
and `kbd`, the components `shellStyles` now shares, the switcher script
on app and company shells, and how the starting cover yields to it.
- **Vocabulary and product shape:** Portal's glossary gains
**Switcher**, Serving's **Switcher relay** says what the menu does with
its messages, `docs/product.md` describes the switcher, and GLOSSARY-MAP
and the README layout mention it. ADR-0010 already states the final `{
open, toggle }` contract from #1298.
- **Dev loop:** `pnpm dev` already runs core's generator, which now
emits two scripts. No runner change.
- **Not touched:** the wire contract (`/switcher.json` is Portal's,
browser-only), the CLI (no command, flag or exit code; `patchy dev`
stays claim-only), migrations, company resources, reverse states
(opening and closing are the pair) and the repo layout.

Where this departs from the issue, each a gap the issue left open:

- A shared patch's detail is its company's name: guests record no opens,
so there is no time to show.
- Typed results are one ranked list without group labels, as the mock's
typed state is. Card and place rows keep their icons.
- The place a page belongs to isn't offered, as on the mock's Home.

## Release impact

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

A new browser script and its route; no API, CLI, schema or configuration
change. #1267 (reopens within 10 minutes count once, PR #1295, now on
main) ships in the same release, so flips don't inflate Your usual.

- **What does a revert leave behind?** A `patchy.switcher` entry in
`sessionStorage` in tabs that loaded the menu. It holds row metadata
only and lasts until the tab closes. Pages already open keep the script
they loaded.
- **Does the release before it still work with that?** Yes. It never
reads the entry. A page from this release asking an older host for
`switcher.js` gets nothing, so the relay claims the key and nothing
opens. An older host without `/switcher.json` gives the menu places
only.

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 8, 2026
## What changed

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

| Change | PRs |
| --- | --- |
| New: Jump anywhere with ⌘⇧K | #1294, #1298, #1304, #1307 |
| Improved: Your usual stays yours | #1295 |
| Patch changes: Mod+Shift+K no longer reaches patch code; Patchy serves
one script first in every patch document | #1298 |

#1293 is release 39's own entry. The range is exactly the switcher stack
(#1091), which ships as one release. #1295 had to ship no later than the
menu, and it does.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `64ce907` (release 39) to this
PR's merge:**
- **No PR in the range is `one-way`.** There are no migrations, no API
or CLI contract changes, and no infrastructure changes.
- **#1295** changes only how new opens add to a person's score. Scores
written under the new rule stay valid for release 39, which keeps
counting every open.
- **#1298** inserts the relay into served patch bytes at serve time.
Stored files and digests are unchanged, so release 39 serves them as
before.
- **#1304 and #1307** add a `sessionStorage` entry that release 39 never
reads. #1307's new `claims` field on a completed Clerk handshake exists
only in memory.

**Rollback line:** If this release misbehaves, roll back to
`64ce90784350341fc2f60fe4f4161a78444f243e` (release 39).

## 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 #1294, #1298, #1295, #1304 and #1307 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 on a branch up to date with main.

## 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.40.0` and are told to match the server, as at every
release.
- **Does the release before it still work with that?** Yes.

Written by Claude Opus 5.5 in Claude Code, orchestrated from 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:docs Touches the docs area area:server Touches the server area area:ui Portal and first-party browser pages, shared rendering and styles size:s Under 100 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(patches): reopens within 10 minutes count once

1 participant