Skip to content

feat(sharing): share a patch from its menu - #1114

Merged
allisonmahmood merged 2 commits into
mainfrom
guests/5-share-dialog
Oct 31, 2026
Merged

allisonmahmood merged 2 commits into
mainfrom
guests/5-share-dialog

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What changed

There was no way to share a patch with someone at another company: grants existed, but nothing wrote them. Now Share… in a patch's three-dots menu, on All patches rows, Home and the patch's own card, opens the Share dialog over the page. The owner or an admin adds a guest by email, sees and removes guests, and picks who can open the patch. The guest is in at once and finds it under Shared with you on their Home, where they can open it or remove it. Owners' agents do the same with patchy share --add, --remove and --list.

This is the fifth of six stacked PRs, on #1113.

Closes #1080

Look at

The flow, on PR 4's head (left, which has no Share…) and this PR's (right):

share-flow.mp4
How to read the film

As Allison, brightline's admin, on All patches: the kickoff brief's menu, then Share…. An email with no Patchy account is refused under the field; Taylor, at Cedar Works, is added. Picking Anyone on the internet asks in the dialog, and Make public applies it.

The dialog, desktop. It reuses the Final step's modal panel, and on a phone it's a bottom sheet.

Opened Refused With a guest, tier 2
Share dialog, empty Share dialog with a refusal under the field Kudos shared with Taylor; Anyone on the internet is disabled for tier 2
Going public Public
Make public, confirmed in the dialog The patch is public; its guests stay listed and adding waits

Phones.

Menu Refused Going public Public
Menu at 390px Refused at 390px Going public at 390px Public at 390px
The menu on All patches, desktop

Share… in the row's menu

Settings loses its sharing section. Who can open a patch now changes in one place, the dialog.

Before After
Settings before Settings after
Settings before, phone Settings after, phone

Shared with you, on Taylor's Home. Cedar Works' own empty state and Connect your agent stay; the shelf follows them and isn't shown under search results.

Shared with you on a guest's Home

Phone

Shared with you at 390px

Decisions worth checking

  • The dialog is server-drawn, with no script. ?share=<name> opens it over Home, All patches or a card. Each add, remove or scope change is a form post that comes back to the same page with the dialog open and its receipt inside it. A refusal re-renders that page with the dialog, the email kept and the callout under the field. Going public shows its confirmation once the radio is picked, through CSS :has(); Cancel is a reset button, and only Make public sends confirm=public. On a tier 2 patch the public choice is disabled, and a forged post is still tier2_not_public.
  • Refusals are codes. not_on_patchy covers both unknown and deactivated accounts, so Share never reveals another company's state. Next are already_member and guests_unavailable with reason. A retired or deleted patch answers wrong_state, through the existing owner check (Patches.manage, the lifecycle acts' manageable), never 404.
  • GuestReason moved to @patchy/api and is keyed by code, not _tag. It now rides on the wire, and wire refusals carry no _tag. guestReasonText is the one place its words come from; the CLI and the portal format from the code.
  • GuestGrants owns the share act. share, remove and list each check the actor through Patches.manage in one transaction, so the API and the portal can't drift. That makes GuestGrants depend on Patches and Users, wired in apps/server. Server.layer now exposes GuestGrants beside Runtime, so the server's guest tests use the real one.

How it was verified

New and changed tests:

✓ test/browser-tier1/sharing.spec.ts › an owner shares a page from its menu, and the guest opens it from Home and removes it
✓ packages/patches/src/PatchesApi.test.ts › shares an owned patch with someone at another company, and says why it won't
✓ packages/patches/src/PatchesApi.test.ts › publishes a version its guests can't open, and says why only when it has guests
✓ packages/portal/src/PortalPages.test.ts › adds and removes guests in the Share dialog over the page it opened from
✓ packages/portal/src/PortalPages.test.ts › lists what's shared with a guest on their Home, and removes one after asking
✓ packages/portal/src/PortalPages.test.ts › asks in the Share dialog before a patch goes public, without publishing a version
✓ packages/portal/src/PortalPages.test.ts › refuses public sharing while tier 2 is served and allows it after rollback
✓ packages/patchy/src/cliPublish.test.ts › patchy share › adds, lists and removes a patch's guests, one JSON document each
✓ packages/patchy/src/cliPublish.test.ts › patchy share › keeps $code and its source when sharing is refused
✓ packages/patchy/src/cliPublish.test.ts › patchy share › rejects invalid targets, scopes or operations locally
✓ scripts/dev/src/scenario.test.ts › refuses a guest from the scenario's own company
  • API refusals and re-sharing: the API test refuses an unknown email, a deactivated account, a member of the company and a non-owner, each by code. It shares, shares again unchanged, removes by email, removes again (removed: false), shares again with a new grantedAt, and gets wrong_state on the retired patch, which keeps its guests. The publish test adds the guests_unavailable refusal with reason: { code: "connection_blocked", … }.
  • Tier 2 can't go public from the dialog: its radio is disabled, there's no Make public, and both an unasked and a confirmed post answer 422.
  • The scenarios: pnpm dev up brightline shares Kudos with Taylor through patchy share --add. The environment's CLI then lists Taylor, and refuses an unknown email with exit 2.
  • Rebased onto PR 4's e5eb486: typecheck is clean, and the portal, PatchesApi, GuestGrants and server guest suites pass (170 tests). docs/API.md re-renders unchanged.
  • pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser (75 specs) pass.
    • test fails only suites that record a stray GET / this machine's T3 app sends to local ports: the CLI stub suites, RequestEvents and LocalTaskProvider. A different test fails each run.
    • The two that touch sharing, cliRepoRecovery's "uses the repo identity for share and delete" and cliPublish's patchy share block, pass when rerun alone.

Release impact

Tick exactly one.

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

It adds API routes and CLI flags, and moves the portal's scope control from Settings into the Share dialog. It adds no migration and no descriptor field, so this PR on its own isn't one-way. The stack ships as one deploy and is fix-forward.

  • What does a revert leave behind? Grants made through Share, in PR 1's patch_guest_grants, plus agents that learned patchy share --add.
  • Does the release before it still work with that? Yes, with PRs 1–4 deployed: they read and admit those grants. Without Share, nothing new writes them.

Built by Claude Opus 5.5 in Claude Code (T3 Code), rebuilding Srikar Voleti's original guest stack (#1082–#1103).

Co-authored-by: Srikar Voleti [email protected]

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling 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 Oct 31, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review

Reviewed bb32bad against guests/4-member-columns (e5eb486), the rewrite brief and notes, repo standards, picked mock A, and the attached film and desktop/phone screenshots.

  1. Should fix · Spec/UX — Share disappears on Log. packages/portal/src/PortalPages.ts:801: logPage calls renderCardFrame without menu; only the other tabs construct the new header menu at line 397. An owner/admin on Log therefore has no Share entry, so the stated Overview fallback never happens. Fix: supply the same header menu on Log, pointing Share to Overview with ?share=<name> if preserving Log is deliberately out of scope.

  2. Should fix · Standards/AX — The repo skill misses the new workflow. packages/sdk/skills/patchy-loop/SKILL.md:230: the generated, release-bound skill still omits guest sharing and the new reason refusal field. Only the global single-file skill was updated, while the CLI now supports these operations from patchy.json. This misses CLAUDE.md’s “Hit every surface” requirement for repo workflows. Fix: document pnpm patchy share --add/--remove/--list, owner-only authority and the refusal codes/source in the project skill, including reason? in its failure envelope.

  3. Nit · Standards — SQL results depart from the documented row convention. packages/patches/src/GuestGrants.ts:112: Person and Guest are now Schema.Structs used directly as SqlSchema results, whereas packages/sql/README.md specifies Schema.Class results. Fix: retain class-based decoded rows and apply the display-name fallback when constructing the returned person/guest.

  4. Nit · Standards/UI — Guest rows override shared component styling. packages/portal/src/share.ts:22: .share-guest replaces list-row padding and removes its final border in page CSS. The UI consistency spec explicitly reserves component padding/treatment for the shared shell. Fix: express the required row treatment in core’s shared list contract and leave Share CSS responsible for layout.

The GuestReason move to the API with a code discriminator is sound: it keeps one structured union and one prose formatter. Putting share checks in GuestGrants, with dependencies acquired through Effect and wired in Server, also keeps portal/API policy together. Returning from Log to Overview is a reasonable simplification once its menu is wired.

Verification: 207 focused tests passed across portal, API, CLI, scenarios, eligibility, API-doc freshness and skill-lock suites. API Markdown and the global skill hash are current. I found no authorization/CSRF blocker or suggestion-scope leak; Home’s empty state/search handling and the public/tier-2 controls follow the brief. No source changes or commits.

Verdict: Changes requested — fix findings 1–2 before acceptance; findings 3–4 are standards nits.

@github-actions github-actions Bot added the area:core Touches the core area label Oct 31, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Fixes for the Sol review in 0a524a1, rebased onto #1113's 9647ccd (its email-visibility docs nit).

  1. Share is missing on Log: Log's header now has the card's menu (Open in a new tab, Copy link, Share…). Share opens over Overview (/patches/<name>?share=<name>), because the dialog's forms only return to the pages behind keeps. One helper, cardMenu, builds the menu for every tab. New test: "offers Share in the Log tab's menu, opening over Overview". The portal glossary and docs/product.md say where it opens.
  2. The repo skill is missing guests: patchy-loop now documents pnpm patchy share --add/--remove/--list. That covers the list shape, idempotent add and removed: false, one operation per call, owner-only (admins in the portal), the refusals (not_on_patchy, already_member, wrong_state, guests_unavailable) and reason's three codes with their source fields. reason? is in the failure envelope. Generation serves the skill from source, so there are no copies to refresh. The SDK skill suites pass.
  3. Person and Guest rows: both are Schema.Class rows again, with Guest extending Person. named(Row) rebuilds each decoded row with Users.displayName.
  4. .share-guest overriding list-row: core has a new list-snug list modifier (tighter rows, ruled only between them), and the ui-consistency spec lists it. The guest list uses list list-snug; .share-guest keeps only its flex layout.

Checks: pnpm typecheck and pnpm lint are clean. These suites pass: portal (112), patches GuestGrants/PatchesApi (67), api (64, including API-doc freshness), core (66), SDK skills (34), skillLock/initProject, and the server's Guests.test.ts (9). cliPublish.test.ts fails a different test on each run, every time from a stray GET / (or once a load-timing ENOENT) in the stub instance's request log, the same local noise as before; this commit doesn't touch the CLI.

Log tab, before (bb32bad) and after, as Allison (admin) on brightline:

After: /patches/kudos/log at 1280px

1280px, before

Before: /patches/kudos/log at 1280px

Width Before After
390px Before: /patches/kudos/log at 390px After: /patches/kudos/log at 390px

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol re-check

Rechecked 0a524a1 on #1113's 9647ccd, including the builder's reply and all four original findings.

Findings: blocker: none; should fix: none; nit: none.

  • Log menu fixed — packages/portal/src/PortalPages.ts:836: every card tab uses cardMenu; Log's Share opens over Overview. The new socket test checks the menu and destination.
  • Project skill fixed — packages/sdk/skills/patchy-loop/SKILL.md:230: guest commands, owner-only authority, idempotency, exit codes, refusal codes/source fields and reason? agree with the CLI/API. Generation reads this canonical source; no project-skill lock/copy needs refreshing. Distribution and global hash tests pass.
  • Decoded rows fixed — packages/patches/src/GuestGrants.ts:112: Person and Guest are Schema classes; reconstruction preserves the display-name fallback and grantedAt.
  • Shared styling fixed — packages/core/src/html.ts:739, packages/portal/src/share.ts:22: list-snug is a small, additive list variant with generic selectors and a documented contract. Share keeps layout only. Chromium checks at 390/1280px confirm spacing/separators, unchanged ordinary/compact lists and 44px button targets.

#1113 docs: docs/product.md:850 and its API, glossary, README and member-skill mirrors correctly distinguish email visibility (active grant on this patch) from active (grant and account). This matches packages/companies/src/Directory.ts:77; deactivation alone retains email there.

Verification: 275 tests across 14 focused suites passed; typecheck, lint and diff checks passed. API Markdown and skill lock are current. No source edits or pushes.

Verdict: PASS — all four findings resolved; no regressions found in this re-check.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 673c6017730bd718852a4e871916be3147b2d504 (base 4c7387bd56fb619e32be053184991a436021e4fe) on fresh brightline and guests instances, sequentially, by gpt-6.1-sol in Codex (T3 Code). Frozen install passed; the checkout was clean. Both instances are down.

Done means

  • Owners/admins share and revoke; guests open and leave: passed. All patches → Actions for Kudos → Share opened with Add guests focused and Taylor's seeded share listed. Owner removal ended access. Home's menu refused an unknown address and Jordan's same-company address with the input retained, then added Taylor. Taylor opened Kudos from Shared with you and sent kudos that appeared on Priya's open wall. Remove asked for confirmation, returned “Removed Kudos”, removed the shelf and made the address return 404. Owner re-sharing restored 200. The patch-header and Log-tab menus both opened Share; the Log entry landed over Overview.
  • CLI contracts: passed. share --list, --add and --remove returned one JSON document. Repeated add preserved grantedAt; repeated remove returned removed: true, then false. Unknown/deactivated addresses returned exit 2 / not_on_patchy; Jordan returned already_member. Retiring the brief made add return wrong_state while list retained its share; restore worked. Conflicting operations returned exit 1. Guest and non-owner CLI list attempts were refused. These are the documented flags in this PR; feat(sharing): share patches with outside people in the portal and CLI #1080's original flag spelling predates the accepted implementation.
  • Scope changes retain shares: passed. The tier 1 brief asked before becoming public; anonymous access became 200, guests stayed listed and the add field disappeared. Returning to company scope gave anonymous 401 and Taylor 200. Tier 2's public radio was disabled; a forged confirmed post returned 422 and did not open Kudos publicly. Jordan had no Share dialog/menu entry. Settings no longer contains the scope controls.
  • Eligibility and scenario mirrors: passed. Fresh guests startup shared Site notes and Visit log with Jo through the real CLI. Both appeared on Home; search hid the shelf. Adding a shared-table declaration to Visit log produced the same srcNotes reason in publish warnings, CLI guests_unavailable, the dialog and Jo's shelf; Jo got 404 while Ada retained access. Removing the declaration restored Jo's 200 without regranting.

Rebased main interactions

  • Taylor could neither pull nor inspect the host patch through list, by name or host patch ID: each returned exit 2, “Patch not found.”
  • Host pull downloaded the repo. With a disposable blocked-connection fixture and a newer company look, publish succeeded with both look and guest warnings in its JSON document and empty stderr. Publishing the older pulled copy returned exit 2 / behind. Removing the declaration and publishing succeeded.
  • The Share dialog rendered and worked at desktop and 390 px; the phone sheet was full width and bottom anchored. Hosted Kudos rendered and updated live with the rebased Preact 11 runtime. No page errors were observed. Share itself remains server-rendered.

Golden journeys: passed

  • Signed-out sign-in door and signed-in patch access; find/open Kudos; CLI public/company round trip.
  • Jordan → Priya live Kudos; New Business moved Lead → Discovery → Lead on Allison's open board; Spend refused self-approval with own_approval.
  • Publish, retire and restore remained usable during the checks above.

Focused tests

GuestGrants, PatchesApi, PortalPages, cliPublish, scenario:
  5 files, 207 tests passed
API documentation and global skill lock:
  2 files, 2 tests passed

Rollback answers: match the diff. This slice adds no migration, descriptor or infrastructure change. The preceding stack reads grants created by Share; this slice does not independently require one-way. The head's rollback check passed and explicitly reported no migration/descriptor change to rehearse. Wire/API docs, CLI/skills/hash, dev scenario and served-page mirrors were exercised; no new vocabulary or migration mechanism was introduced here.

Not run / notes

  • Clipboard contents after Copy link were not checked; the button was present. No live integration calls were made.
  • CI's browser, Clerk, Node 22/24/26 tests, tier 2, CLI smoke, platform installs and rollback checks passed. pidgeon-suite was still pending; attio-live was skipped. The displayed failing install (${{ matrix.os }}) is a cancelled job with zero steps; the concrete Linux/macOS/Windows install jobs passed.
  • The existing public response cache is still max-age=60: anonymous network access was refused immediately after returning to company scope, but this run does not claim previously cached public content disappears immediately.

@allisonmahmood
allisonmahmood force-pushed the guests/4-member-columns branch from 4c7387b to fa0ef51 Compare October 31, 2026 17:28
Base automatically changed from guests/4-member-columns to main October 31, 2026 17:42
allisonmahmood and others added 2 commits October 31, 2026 18:42
The owner or an admin shares a live patch with someone at another company
from Share… in its three-dots menu, on All patches, Home and the patch's
card. The Share dialog adds guests by email, lists and removes them, and
holds who can open the patch, going public confirmed in place; Settings
loses its sharing section. Guests find what's shared with them on Home,
and can remove it.

The API adds list, add and remove of a patch's guests, with stable
refusals (not_on_patchy, already_member, guests_unavailable with its
reason) beside the existing owner and lifecycle checks. The CLI's owners
use them as patchy share --add, --remove and --list. The guests and
brightline scenarios share their patches through the CLI.

Co-authored-by: Srikar Voleti <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Log tab's header had no menu, so its owner couldn't Share from it.
It now has the card's menu, with Share opening over Overview.

The patchy-loop project skill documents `patchy share --add/--remove/
--list`, owner-only authority, the refusal codes with `reason` and its
source, and `reason?` in the failure envelope.

GuestGrants' Person and Guest are Schema.Class rows again, rebuilt with
the display-name fallback. The Share dialog's guest rows use core's new
`list-snug` instead of overriding list-row padding and borders.

Co-authored-by: Srikar Voleti <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood merged commit 77cf450 into main Oct 31, 2026
22 checks passed
@allisonmahmood
allisonmahmood deleted the guests/5-share-dialog branch October 31, 2026 17:54
allisonmahmood added a commit that referenced this pull request Oct 31, 2026
## What changed

A company could share patches with guests one patch at a time, but
nobody could see who outside the company holds which of its patches, or
cut one person off everywhere at once. People now has a **Guests** tab,
visible to every member once the company has guests. Each row is one
person at another company with their own company, and opens to the
patches shared with them, who shared each and when. Admins get **Remove
from all patches…**, a confirmation page listing those patches, which
ends every grant the person holds in this company and leaves their
grants elsewhere alone.

This is the last of six stacked PRs, on #1114.

Closes #1081

## Look at

**As Ada, the admin.** The Guests tab, a row opened (`#guest-<id>` opens
it), and the confirmation. Before is PR 5's head, which has no Guests
tab and answers 404 for the confirmation.

<!-- patchy-dev:compare:ada -->

#### Before and after, as Ada Park (admin)

Before is `0a524a1` (--base origin/guests/5-share-dialog) and after is
`0f802ee` (guests/6-people-guests), both on the `guests` scenario, from
`pnpm dev compare`.

##### `/company?show=guests`

**1280px, after**

![After: /company?show=guests at
1280px](https://github.com/user-attachments/assets/26b80036-4239-4dcc-9c4f-b6d40bf9113a)

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

![Before: /company?show=guests at
1280px](https://github.com/user-attachments/assets/391c346b-bcad-410e-b94e-cdbd3545b79c)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company?show=guests at
390px](https://github.com/user-attachments/assets/9a6f5abc-0062-4725-aa98-11c06956a7a3)
| ![After: /company?show=guests at
390px](https://github.com/user-attachments/assets/d9a5e96a-4547-4b7b-9c2f-29a472d6a15d)
|

##### `/company?show=guests#guest-usr_env_pine_jo`

**1280px, after**

![After: /company?show=guests#guest-usr_env_pine_jo at
1280px](https://github.com/user-attachments/assets/d9a6c551-a8fe-49f2-8c08-5108117adbce)

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

![Before: /company?show=guests#guest-usr_env_pine_jo at
1280px](https://github.com/user-attachments/assets/9fcae212-a3ef-46ca-93d1-d177e13c671d)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company?show=guests#guest-usr_env_pine_jo at
390px](https://github.com/user-attachments/assets/22678ef0-2626-48a0-9876-404961959f18)
| ![After: /company?show=guests#guest-usr_env_pine_jo at
390px](https://github.com/user-attachments/assets/88e63e02-4375-4990-a7d1-82276a1697ed)
|

##### `/company/guests/usr_env_pine_jo/remove`

**1280px, after**

![After: /company/guests/usr_env_pine_jo/remove at
1280px](https://github.com/user-attachments/assets/16ffb6c5-aec6-4b80-acbb-e878b686a0b7)

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

![Before: /company/guests/usr_env_pine_jo/remove at
1280px](https://github.com/user-attachments/assets/cde0fa65-674f-44f7-823e-bdf04549947f)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company/guests/usr_env_pine_jo/remove at
390px](https://github.com/user-attachments/assets/7bcb64e8-70ce-43b0-b4d5-f28417e39be1)
| ![After: /company/guests/usr_env_pine_jo/remove at
390px](https://github.com/user-attachments/assets/4bd5ea3f-c3dd-4629-9f8d-55ad9af3306e)
|

- 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)`.

<!-- /patchy-dev:compare:ada -->

**As Ben, a member.** The same row, without Remove.

<!-- patchy-dev:compare:ben -->

#### Before and after, as Ben Ortiz (member)

Before is `0a524a1` (--base origin/guests/5-share-dialog) and after is
`0f802ee` (guests/6-people-guests), both on the `guests` scenario, from
`pnpm dev compare`.

Every page answered 200 with no browser errors.

##### `/company?show=guests#guest-usr_env_pine_jo`

**1280px, after**

![After: /company?show=guests#guest-usr_env_pine_jo at
1280px](https://github.com/user-attachments/assets/04b32199-3e27-436d-8d0a-5969652248f4)

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

![Before: /company?show=guests#guest-usr_env_pine_jo at
1280px](https://github.com/user-attachments/assets/68aa39a2-a915-465c-896d-09cffb5be761)

</details>

| Width | Before | After |
| --- | --- | --- |
| 390px | ![Before: /company?show=guests#guest-usr_env_pine_jo at
390px](https://github.com/user-attachments/assets/fbbae602-3133-4773-8d04-866480f9f81c)
| ![After: /company?show=guests#guest-usr_env_pine_jo at
390px](https://github.com/user-attachments/assets/36b244b1-e05e-4648-a94e-dfe3e4cf4479)
|

<!-- /patchy-dev:compare:ben -->

### Decisions worth checking

- **Guests are People's own rows.** Guests is one more tab, and each
guest is a third kind of entry in the same table, search, counts and
empty state. The tab appears once the company has guests, as Invited and
Deactivated do. Its table has two columns, Person and Company, so it
fits a phone without scrolling.
- **The shell's expandable row, not the mock's chevron.** A guest's
patches open in the shell's existing `table-expand` row, a native
`<details>` whose summary says "2 patches". Matching the mock's
whole-row summary with a drawn chevron would have needed a component
style that People's own CSS shouldn't own. People adds layout CSS only.
Remove from all patches… sits inside the opened row, as in the mock.
- **Companies reads grants through a port.** Companies can't depend on
Patches, so `CompanyPage.Guests` (`list`, `removeAll`) is filled in
`apps/server` from `GuestGrants`, as `OwnedPatches` already is. It's
filled by `companyGuests`, one query decoded through a Schema class and
grouped per person, and by `revokeAll`, one `UPDATE` that sets
`revoked_at` for that person in that company.
- **Ended grants:** someone whose grants here have all ended isn't
listed at all. The records stay, so member columns still name them,
inactive, and sharing again brings them back. Retired and deleted
patches' active grants are listed, marked with a pill, because restoring
the patch would let the guest back in, and remove-all ends those grants
too. Disabled patches' grants are listed too, marked Unavailable, so
they can still be removed.
- **A deactivated guest account isn't marked.** Showing it would reveal
another company's state, which Share also avoids.
- **Remove-all ends whatever they hold when it's confirmed**, including
a patch shared after the confirmation page loaded. Like Share's add and
remove, it sends no analytics event.
- **Members** see the tab and every row, but not Remove. A member's GET
of the confirmation or POST of the form re-renders People with 403 and
changes nothing.

## How it was verified

New tests, in `apps/server/src/Guests.test.ts` over the whole server.
Gina, from another company, holds two of the dev company's patches and
one of a third company's:

```
✓ People's guests › lists each guest's patches here to every member, with Remove for admins only
✓ People's guests › removes a guest from all of this company's patches once an admin confirms
```

- **The first test:** a member's Guests tab lists Gina's two patches
here, with "Shared by" the dev admin, and not the third company's patch.
It has no Remove link, which the admin's tab has. The member's GET and
POST of the confirmation answer 403, and all three grants are still
active.
- **The second test:** the admin's confirmation lists the two patches
and "Remove from 2 patches". Posting it lands back on Guests without
her. Both patches lose her as a guest. Her ended grant is still a record
the dev company's directory resolves, `holders` → `false`. The third
company's patch is still shared with her.
- **The scoping is tested.** Dropping the `company_id` filter from
`revokeAll` fails the second test.
- **Rebased onto PR 5's `0a524a1`:** typecheck and lint are clean. The
server guest suite (11), the auth `CompanyPage` suite (24) and
`GuestGrants` (5) pass.
- **`pnpm check`:** format, lint, typecheck and synth pass. `test` fails
only in the suites that record the stray `GET /` this machine's T3 app
sends to local ports: the CLI stub suites (`cliPublish`, `cliLifecycle`,
`cliLook`, `cliRepoPublish`, `cli`) and execution's `LocalTaskProvider`
and `Supervisor`. None of them touches People.
- **`pnpm verify`:** format, lint, typecheck, synth,
postgres-concurrency, cli-smoke, install and tier2-smoke pass.
- `test` fails only in the same stray-`GET /` suites, plus `cliRepo`,
`cliRepoRecovery` and `RequestEvents`.
- `browser` stopped after its first failure, on that stray `/` in
`tier1.spec.ts` "hostile navigation" (`foreignRequests` held `"/"`). 21
specs passed and 53 didn't run. No browser spec covers People.

## Release impact

Tick exactly one.

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

It adds a People tab and two routes, `GET` and `POST
/company/guests/<id>/remove`. It adds no migration and no API or CLI
change, so this PR alone isn't one-way. The stack ships as one deploy
and is fix-forward.

- **What does a revert leave behind?** Grants that remove-all ended stay
ended, as if each had been removed in the Share dialog.
- **Does the release before it still work with that?** Yes. PR 5 reads
ended grants as it always does, and sharing again restores them.

Built by Claude Opus 5.5 in Claude Code (T3 Code), rebuilding Srikar
Voleti's original guest stack (#1082–#1103).

Co-authored-by: Srikar Voleti <[email protected]>

---------

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

This adds release 31's What's new entry, written from `5888411`. It
covers everything merged since release 30's `through` (`e3d50f0`). It
also sets the `patchy` release to `0.31.0` in
`packages/patchy/package.json` and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: share a patch with someone at another company from Share… in its
menu. They open it as themselves, find it under Shared with you, can be
picked wherever the patch asks for a person, and on a server-code patch
reach only what its builder opened to guests. The company-or-internet
choice moved into the same dialog, and agents can share too | #1108,
#1110, #1113, #1114 |
| New: People has a Guests tab, with each guest's patches, and admins
can remove a guest from all of them at once | #1115 |
| New: admins can block guests from a connection, and owners see why on
the patch's card | #1112 |

#1118 is release 30's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`. The four PRs that make sharing work are
one change, since nobody can share before Share… exists.
- **Rollback safety, from the live commit `54438fa` (release 30) to
`5888411`:** the same six PRs. #1108, #1110, #1112 and #1113 are
labelled `one-way`, and their answers agree:
- #1108 adds `patch_guest_grants` (migration `0031`). Release 30 starts
with it but ignores grants, so every guest loses access.
- #1110 adds the `guest: true` handler mark to tier 2 descriptors.
Release 30's schema refuses it, so it can't load tier 2 versions
published with it.
- #1112 adds `block_guests` (`0032`), and #1113 adds a directory trigger
(`0033`). Release 30 runs with both but would ignore admins' blocks and
resolve guests picked in member columns as nobody.
  - #1114 and #1115 add no migration or descriptor field.

**Rollback line:** Rolling back past #1110 would leave tier 2 versions
published with handlers marked for guests unloadable, because release
30's descriptor schema refuses `guest: true`, and past #1108 would cut
every guest off; fix forward instead.

## How it was verified

- **Tests.** `whatsNew.test.ts`, `schemas.test.ts` and
`WhatsNewPages.test.ts` pass (21 tests), and prettier passes on the
changed files.
- **The range.** Each of the six PRs was reviewed by GPT 6.1 Sol with
every finding resolved, and got a fresh acceptance PASS with notes at
its rebased head. Each landed with all 12 required checks green,
`rollback-rehearsal` included, and its squash tree matched the accepted
head.
- **Deploy state.** The live commit, pinned from `/healthz/deep`, is
`54438fa` (release 30). The Deploy run updated last succeeded, and none
is unfinished.

## Release impact

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

Text and version numbers only. The `0.31.0` bump tells CLIs and patch
repos installed before this deploy to upgrade, as every release does.

- **What does a revert leave behind?** Nothing.
- **Does the release before it still work with that?** Yes.

Built by Claude Opus 5.5 (`claude-opus-5-5`) in Claude Code, through 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:ci CI, shared testing infrastructure, development scripts and tooling area:cli Touches the cli area area:core Touches the core 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.

feat(sharing): share patches with outside people in the portal and CLI

1 participant