Repository navigation
feat(sharing): share a patch from its menu - #1114
Conversation
Sol reviewReviewed
The 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. |
bb32bad to
0a524a1
Compare
|
Fixes for the Sol review in
Checks: Log tab, before (
|
Sol re-checkRechecked Findings: blocker: none; should fix: none; nit: none.
#1113 docs: 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. |
0a524a1 to
673c601
Compare
9647ccd to
4c7387b
Compare
Acceptance: PASS with notesChecked Done means
Rebased main interactions
Golden journeys: passed
Focused tests 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 Not run / notes
|
4c7387b to
fa0ef51
Compare
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]>
673c601 to
b1008ce
Compare
## 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**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company?show=guests#guest-usr_env_pine_jo` **1280px, after**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | ##### `/company/guests/usr_env_pine_jo/remove` **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)`. <!-- /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**  <details><summary>1280px, before</summary>  </details> | Width | Before | After | | --- | --- | --- | | 390px |  |  | <!-- /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]>
## 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]>




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,--removeand--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.
Phones.
The menu on All patches, desktop
Settings loses its sharing section. Who can open a patch now changes in one place, the dialog.
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.
Phone
Decisions worth checking
?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 sendsconfirm=public. On a tier 2 patch the public choice isdisabled, and a forged post is stilltier2_not_public.not_on_patchycovers both unknown and deactivated accounts, so Share never reveals another company's state. Next arealready_memberandguests_unavailablewithreason. A retired or deleted patch answerswrong_state, through the existing owner check (Patches.manage, the lifecycle acts'manageable), never 404.GuestReasonmoved to@patchy/apiand is keyed bycode, not_tag. It now rides on the wire, and wire refusals carry no_tag.guestReasonTextis the one place its words come from; the CLI and the portal format from the code.GuestGrantsowns the share act.share,removeandlisteach check the actor throughPatches.managein one transaction, so the API and the portal can't drift. That makesGuestGrantsdepend onPatchesandUsers, wired inapps/server.Server.layernow exposesGuestGrantsbesideRuntime, so the server's guest tests use the real one.How it was verified
New and changed tests:
removed: false), shares again with a newgrantedAt, and getswrong_stateon the retired patch, which keeps its guests. The publish test adds theguests_unavailablerefusal withreason: { code: "connection_blocked", … }.disabled, there's no Make public, and both an unasked and a confirmed post answer 422.pnpm dev up brightlineshares Kudos with Taylor throughpatchy share --add. The environment's CLI then lists Taylor, and refuses an unknown email with exit 2.e5eb486: typecheck is clean, and the portal,PatchesApi,GuestGrantsand server guest suites pass (170 tests).docs/API.mdre-renders unchanged.pnpm verify: format, lint, typecheck, synth, postgres-concurrency, cli-smoke, install, tier2-smoke and browser (75 specs) pass.testfails only suites that record a strayGET /this machine's T3 app sends to local ports: the CLI stub suites,RequestEventsandLocalTaskProvider. A different test fails each run.cliRepoRecovery's "uses the repo identity for share and delete" andcliPublish'spatchy shareblock, pass when rerun alone.Release impact
Tick exactly one.
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.
patch_guest_grants, plus agents that learnedpatchy share --add.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]