Skip to content

fix(guests): allow directory use through marked handlers - #1103

Closed
vsrikar08 wants to merge 4 commits into
feat/1081-people-guestsfrom
fix/1101-guest-directory
Closed

vsrikar08 wants to merge 4 commits into
feat/1081-people-guestsfrom
fix/1101-guest-directory

Conversation

@vsrikar08

@vsrikar08 vsrikar08 commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

A tier 2 patch can be shared with an outside account even when it declares the host member directory or has member columns. Guests still enter only deliberately marked handlers; blocked connections and other patches' shared sources still make the whole patch unavailable.

Kudos is the working Brightline example: its page reads and writes are guest-marked, while sample-data loading stays unmarked. Its sender and reaction actor IDs use text columns so an outside viewer can write with their real user ID; their display names are recorded with contributions so the wall and reaction tooltips name outside authors. The recipient remains a member column and is checked through the directory. Brightline now includes Taylor from Cedar Works for the normal share/open flow.

Closes #1101. Uses #1076 as the guest-access contract. Corrected #1078's stale directory rule.

Look at

  • GuestGrants.test.ts: a directory declaration remains eligible, while a shared source and blocked connection are refused by the same policy used by Share, admission, lists and warnings.
  • Members.test.ts and Invocation.test.ts: an admitted guest's directory callback uses the host company, and only marked entry handlers start.
  • Isolated Brightline browser flow at d616835: Allison shared Kudos with [email protected]; Taylor opened the patch, found Priya through the directory-backed picker, sent kudos, and reacted. Allison then saw Taylor named on the wall and in the reaction tooltip. The flow finished in 10.9 seconds. The sample-data handler remains unmarked.

How it was verified

  • Focused Vitest: 5 files, 93 tests passed, including scenario seeding, guest admission, directory callbacks and publish warnings. The test typecheck passed.
  • Isolated pnpm dev film Brightline flow completed on d616835: share → Taylor opens → directory search → guest write and reaction → Allison sees Taylor named. The installed gh (2.98) cannot attach the local recording to this PR.
  • pnpm verify: format, lint, typecheck, synth, Postgres concurrency, install and tier 2 smoke passed. Offline tests, CLI smoke and browser failed in local workerd/CLI suites (missing workerd binary, stale dev records and a /proc expectation on macOS). The offline suite also ran the old publish-warning assertion before its correction; its focused rerun passed.
  • This worktree's existing team dev environment was left intact; the browser flow used an isolated instance.

Release impact

  • Not breaking — this relaxes guest eligibility; the Brightline scenario schema is local demo data, with no production migration or API change.
  • What does a revert leave behind? Existing grants stay stored; directory-backed patches become unavailable to guests again.
  • Does the release before it still work with that? Yes.

Built with GPT-6 Codex in the Codex API harness.

@github-actions github-actions Bot added area:server Touches the server area area:ci CI, shared testing infrastructure, development scripts and tooling area:docs Touches the docs area area:primitives Patch tables and files size:s Under 100 changed lines labels Oct 30, 2026
@github-actions github-actions Bot added size:m 100-500 changed lines and removed size:s Under 100 changed lines labels Oct 30, 2026
@vsrikar08
vsrikar08 marked this pull request as ready for review October 30, 2026 18:30
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T18:41:36.857269Z d616835 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eca6cd2a5f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@allisonmahmood

Copy link
Copy Markdown
Owner

Rebuilt from current main in #1113, part of the stack #1108 → #1110 → #1112 → #1113 → #1114 → #1115. Srikar is credited as co-author on every PR in it. Closing in favour of that stack. Thanks for the groundwork.

allisonmahmood added a commit that referenced this pull request Oct 31, 2026
…mpany (#1108)

## What changed

A private patch could only be opened by its own company. Now a company
can grant one patch to someone who already has a Patchy account at
another company. That **guest** opens the patch's current version as
themselves, inside the patch's company, never as its admin, and reads
and writes the patch's own tables and files as a colleague does.
Revoking ends the grant but keeps its record, and sharing again restores
it. Going public and retiring keep grants; permanent reclamation removes
them.

This is the first of six stacked PRs. There is no way to share yet: the
share dialog and CLI arrive later in the stack, so the tests grant
through the domain service.

Closes #1077

## Look at

- **One extra case at both browser doors.** `GrantedGuests.viewerOf` in
`packages/runtime/src/GrantedGuests.ts` is the only place someone from
another company becomes a viewer, as `{ user, company: <patch's
company>, admin: false, guest: true }`.
- The call door (`RuntimeProduction`) and the live-query door
(`StreamAdmission`) both use it, and `reauthorize`/`recheck` ask it
again.
- The patches adapter marks a loaded version `admitsGuests`, so
admission never reloads the patch. A non-member costs one indexed grant
lookup.
- A guest's recheck follows the patch's current version, so their stream
survives a publish the way a member's does.
- **Eligibility is one function.**
- `GuestGrants.unavailable(patch, version)` returns a typed `Reason`:
`Retired`, `Deleted` or `Tier { tier }`. Today only tier 1 is eligible;
tier 2 arrives with its handler gate.
- `admitsGuests` adds "current version". The serving door and the loaded
version both use it.
- **Wire.**
- `RuntimeMe` and the worker `viewer` gain `guest` as an optional
`true`. Members' `me()` and the worker payload are unchanged byte for
byte, and older stored bundles never see the key.
  - The SDK's `Me` type gains `guest?: true`.
- **Stream control signs in before reading anything about the patch.**
Documents are now keyed by patch id and document id; patch ids are
global, so the company prefix was redundant. That lets control find a
guest's document without loading the patch.
- **Guest names in every log reader.** The portal log and its person
filter, `patchy logs` and a connection's recent calls now resolve actors
through `Users.names(ids)`.

```
✓ apps/server/src/Guests.test.ts > a patch's guest > uses the patch's own table until the grant ends, and again once shared again
✓ apps/server/src/Guests.test.ts > a patch's guest > keeps a guest's live stream through a publish, as a member's
✓ packages/patches/src/GuestGrants.test.ts (3 tests)
✓ packages/patches/src/PatchesApi.test.ts > names a guest from another company who called the patch
✓ packages/portal/src/PortalPages.test.ts > names a guest from another company in the log, its filter and the card
✓ packages/integrations/src/ConnectionPages.test.ts > names a patch's guest from another company in recent calls
```

## How it was verified

- **The journey, over the whole server.**
  - A person at a second company gets a 404, and is granted.
- They open the page and see `me()` with `guest: true`, `admin: false`
and the host company. They insert into and list the patch's own table.
- After a revoke they get a 404 and `access_denied`. After being shared
again, they're back with their row.
  - The patch goes public and back, and they still read the table.
- A second test opens a guest's live stream and publishes a new version:
the stream gets `served` for the new version, not `access_denied`.
- The three log-reader tests resolve a guest from another company.
Without this change, each shows the raw id.
- **Existing suites over the changed doors pass:**
  - Runtime: stream, production, API, admission, events.
- Serving pages, portal, connection pages, PatchesApi, primitives files.
  - Server, stream lifecycle, members and migrations.
- `pnpm check`: format, lint, typecheck and synth pass.
- The offline tests had 20 failures, all in `packages/patchy` CLI
stub-server suites and `packages/execution` (`LocalTaskProvider`,
`Supervisor`). The CLI and `LocalTaskProvider` failures are a stray `GET
/` reaching local stub servers from the dev machine, and a rerun failed
a different set.
- A clean `origin/main` checkout fails the same `Supervisor` test and a
CLI stub test on this machine. CI is the judge here.
- `pnpm verify`: format, lint, typecheck, synth, postgres-concurrency,
cli-smoke, install and tier2-smoke pass. `test` failed 14 CLI
stub-server tests and `LocalTaskProvider`, all on the same stray `GET
/`. `browser` stopped at its first failure, a stray `/` on the test's
foreign-origin server; a rerun of `pnpm test:browser` passed all 74.
- **Not checked:** a guest in a real browser shell. The dev guest mount
and the two-company scenario come with tier 2 later in the stack.

## Release impact

Tick exactly one.

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

The change is additive: one new table, and a wire key only guests carry.
Members see no difference.

- **What does a revert leave behind?** The `patch_guest_grants` table,
any grants written, and migration `0031` in the ledger.
- **Does the release before it still work with that?** It starts, since
the migrator accepts ledger ids above its own record, but it ignores
grants: every guest loses access. The whole guest stack ships as one
deploy and later PRs add a descriptor field older releases refuse, so
this is **one-way: fix forward**.

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

Guests could open tier 1 patches only: a tier 2 patch has handlers, and
without a way to choose which ones a guest may run, letting a guest in
would have let them run all of them. Now a builder marks the handlers
guests may start with `guest: true`. A guest of a tier 2 patch starts
those and no others, queries, mutations, actions and live queries alike.
A tier 2 patch that reads another patch's shared table or store stays
closed to guests.

This is the second of six stacked PRs. Sharing still has no surface
(that's PR 5), so the tests grant through the domain service.

Closes #1079

## Look at

- **One gate, where every entry passes.** `Invocation.call` refuses a
guest's top-level call to an unmarked handler, next to the agent-tool
rule (`packages/runtime/src/Invocation.ts`). Browser calls, live-query
reruns and agent calls all enter there; `ctx.run` inside a marked
handler follows the usual rules. The mark travels from the SDK builders
through the descriptor schema, the strict loader, inspection and
publish's `sameHandlers`. Agent tools drop it, since they're for agents
only.
- **`reauthorize` now lives on the `Binding`, and it's required.** It
replaces the separate parameter on `Invocation.call`,
`InvocationCapabilities.Issue` and the optional field on
`SubscriptionReads.Input`. Every door that builds a binding says how to
ask about its viewer again. Attio's and Pidgeon's post-wait rechecks are
now one helper, `viewerRecheck(binding)` in
`packages/integrations/src/definition.ts`, instead of a `Directory`
lookup that would have refused every guest. Most of the line count is
tests building a binding with the new field.
- **Eligibility.** `GuestGrants.unavailable` admits tier 2 and gains
`SharedSource { kind: "table" | "store", alias }`. The member directory
doesn't count against a patch.
- **The member wire is unchanged.** The worker's `viewer` carries
`guest` only for a guest, so bundles stored before guests keep serving
members:

```
✓ packages/runtime/src/Invocation.test.ts > Invocation > sends a member's viewer to the worker as it did before guests
```

- **The dev loop.**
- `patchy dev` returns a `guestUrl`: the patch's guest from another
company, with `guest: true` and no `/~dev/agent` door.
- `pnpm dev up guests` seeds Harbor Works plus Jo at Pine Studio, with
Site notes (tier 1) and Visit log (tier 2). Visit log has marked
`list`/`create` and an unmarked `clear`.
  - Scenarios gain `companies` and a person's `company`.
- When workerd can't start during inspection, the CLI says so and
suggests `pnpm install`, keeping `invalid_manifest`.

## How it was verified

The two-company journey over the whole server, with real workerd. Both
tests fail with the gate removed:

```
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > starts only the handlers marked for guests, until the grant ends
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > subscribes live only to the queries marked for guests
✓ packages/patchy/src/devServer.test.ts > (guest mount: guest `me`, and the agent door 404s)
```

- **The journey.** A guest's marked mutation runs as them (`by: <their
id>`, the patch's company, `guest: true`) and the marked query lists the
row. The unmarked query is `access_denied`. After a soft revoke, the
marked query is `access_denied` too.
- **The live-query test.** A marked live query answers a snapshot, and
an unmarked one answers an `access_denied` error frame.
- **`pnpm dev up guests`** on a local instance published both patches
through the real CLI, so `guest: true` survived the build, inspection
and publish. In Visit log's `patchy dev`:
- The Guest URL's `me` is Dev Guest in Harbor Works with `guest: true`.
- `notes.create` and `notes.list` work, signed "Dev Guest", and
`notes.clear` is `access_denied`.
- `/~dev/agent` answers 404, and the colleague's `notes.clear` works.
The environment was taken down afterwards.
- **Focused suites pass:** descriptor round-trip and `guest: false`
refusal, SDK agent-area fold, inspection, eligibility, invocation, Attio
and Pidgeon operations (the queued-caller recheck now uses the door's
check), scenarios.
- **`pnpm check`:** format, lint, typecheck and synth pass.
- The offline tests fail only CLI stub-server suites (`cliPublish`,
`cliLook`, `cliLifecycle`, `cliRepo`, `cli`), `LocalTaskProvider` and
`RequestEvents`. All of them come from stray `GET /` requests reaching
local test servers on this machine, and the set changes between runs.
- `RequestEvents` and `PatchesApi` (a 5 s timeout under load) pass when
rerun alone.
- `pnpm verify`: format, lint, typecheck, synth, postgres-concurrency,
cli-smoke, install and tier2-smoke pass.
- `test` failed the same stray-`GET /` CLI suites and `Supervisor`,
which fails on clean `main` here too.
- `browser` stopped at `tier1.spec.ts` "hostile navigation…", where a
stray `/` reached its foreign-origin server. A rerun of `pnpm
test:browser` hit the same thing. CI's `browser` job passed on this
commit.
- **CI on `3a425bd`:** every required suite passed, `test` on Node
22/24/26 and `browser` included.
- `rollback-rehearsal` can't run while Deploy run #30 waits for
approval.
- `attio-live` failed one live read on an `AttioUnavailable` 503 from
Attio, with the other 8 passing. It's rerunning.
- **Not checked:** a guest in a real browser shell against the instance,
since sharing has no surface until PR 5.

## Release impact

Tick exactly one.

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

New descriptor field and a new reason; members see no difference, and
`patchy dev --json` only gains `guestUrl`.

- **What does a revert leave behind?** Published tier 2 versions whose
descriptors carry `guest: true`, and grants on tier 2 patches.
- **Does the release before it still work with that?** No. Its
descriptor schema refuses `guest: true`, so it can't load those
versions. This is **one-way: fix forward**, and the whole guest stack
ships as one deploy.

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

Admins had no way to keep a sensitive connection away from a patch's
guests. A connection's page now has **Block guests**: only admins can
use it, and members see whether it's on. While it's on, any patch whose
current version declares that connection turns its guests away from
their next call. Their grants stay, so they're back once the block is
off or the patch stops declaring the connection. Members are unaffected.

The owner and admins see why on the patch's card and in Needs attention.
A publish that turns guests away still succeeds, and its `warnings` say
why. Warnings only appear for a patch with active grants.

This is the third of six stacked PRs. Sharing has no surface until PR 5,
so the tests and screenshots write grants directly.

Closes #1078

## Look at

- **One rule, one wording.** `GuestGrants.unavailable(patch, version,
blocked)` gains `ConnectionBlocked { integration, handle }`.
`GuestGrants.describe` is the only place a reason becomes words, and the
card, Needs attention and publish all use it.
- **Who pays for the block read.**
- `ConnectionStore.blockingGuests(ids)` reads any number of connections'
flags in one query, so `patches` never reads the `connections` table.
- Only a grant holder's admission reads the flags. `GuestGrants.host`
takes the version the door already holds and reads the grant, with the
patch's state and current version, in one query. It goes on to the flags
only when a grant is found.
- Members' calls do no new reads. `LoadedVersion.admitsGuests` is gone:
the runtime port asks `host(loaded, userId)` for anyone outside the
company and fails with `SourceUnavailable`.
- **Warnings without an N+1.**
- `unavailableToGuests(companyId)` makes one query for the company's
live, company-only patches with active grants and their current
declarations, plus one block read. Only an owner's or admin's pages run
it.
- Publish uses `unavailableAfterPublish`. It's silent for a new patch, a
patch without grants, or one going public.
- **The control** follows the connection page's existing post buttons.
Everyone sees a **Guests: Allowed / Blocked** fact. Admins also get
**Block guests** or **Allow guests**, and a member's POST answers 403.

### Screenshots

These follow `pnpm dev compare`'s method: full page at 1280 and 390 px,
scale 2, signed in as Allison (admin) on two fresh `attio` instances,
base `9f487c1` and head `27e0a14`. Compare itself can't reach this
state, because the connection page is addressed by a per-instance id and
the grant needs sharing (PR 5). So both sides first got the same state:
a guest from Pine Studio with a grant on Deal desk, written directly. On
head, `attio/crm` was then blocked through the page's own POST.

**Connection page**, desktop. Head shows **Guests: Blocked** and **Allow
guests**.


![after](https://github.com/user-attachments/assets/d0b2b432-7251-4800-8554-8492594363cb)

<details><summary>Before</summary>


![before](https://github.com/user-attachments/assets/750dd490-8031-4355-abd2-2f53890e7051)

</details>

| Before, phone | After, phone |
| --- | --- |
|
![](https://github.com/user-attachments/assets/3aa82443-22a8-4486-a80a-230690bea6fc)
|
![](https://github.com/user-attachments/assets/91583936-3bba-49c2-8f62-0745cdffe40c)
|

**Deal desk's card**, desktop.


![after](https://github.com/user-attachments/assets/af4952b1-4bd4-44d0-89c4-d5275dd41718)

<details><summary>Before</summary>


![before](https://github.com/user-attachments/assets/61a0ade5-c427-4698-b363-e877c310570c)

</details>

| Before, phone | After, phone |
| --- | --- |
|
![](https://github.com/user-attachments/assets/33fa70f4-db63-47a3-8d47-1c0455644c4f)
|
![](https://github.com/user-attachments/assets/32daa464-820a-4098-a5cf-3733958076b6)
|

**Needs attention**, desktop.


![after](https://github.com/user-attachments/assets/c172088a-d0ef-4f70-8226-b9a473837f3a)

<details><summary>Before</summary>


![before](https://github.com/user-attachments/assets/c0e6603a-376a-437d-b300-1f7ae43f617a)

</details>

## How it was verified

New focused tests:

```
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > turns guests away while a connection the patch uses blocks them, and lets them back after
✓ packages/integrations/src/ConnectionPages.test.ts > company connection pages > lets only an admin block guests from a connection, and shows everyone which
✓ packages/portal/src/PortalPages.test.ts > warns its owner when a patch with guests uses a connection that blocks them
✓ packages/patches/src/PatchesApi.test.ts > Postgres declaration publishing > publishes a version its guests can't open, and says why only when it has guests
✓ packages/patches/src/GuestGrants.test.ts > turns guests away from a version using a connection that blocks them, and only then
```

- **The server journey** runs over the whole server with real workerd:
- A guest's call to a marked handler of a tier 2 patch that declares a
connection succeeds.
- The admin then posts Block guests on the connection's page. The
guest's next call is `access_denied`, while the admin's own call still
answers.
- After Allow guests, the same guest is back without being shared again.
- **The publish test** checks that a publish to a patch with no guests
carries no guest warning. With a guest it's still a `PublishUpdated`
success, and its `warnings` hold `GuestGrants.warning(ConnectionBlocked
…)`. The CLI exits 0 on a successful publish whatever its warnings say
(ADR-0004).
- **The migration test** now reads the connections-per-integration
upgrade with today's store on today's schema. A connection made before
this column reads `blockGuests: false`.
- **Full suites pass** for `integrations`, `runtime`, `serving`,
`patches`, `portal`, `primitives`, `mcp` and `apps/server`.
- **`pnpm check`:** format, lint, typecheck and synth pass.
- The offline tests fail only suites this PR doesn't touch:
`cliPublish`, `cliLook`, `cliLifecycle`, `cli`, `Engine` and
`RequestEvents`. They come from stray `GET /` requests reaching local
test servers on this machine.
  - `RequestEvents` and `Engine` pass when rerun alone.
- **`pnpm verify`:** postgres-concurrency, cli-smoke, install and
tier2-smoke pass.
- `test` failed the same stray-request CLI suites, plus
`LocalTaskProvider`, a `Supervisor` timeout and `RequestEvents`, none of
which this PR touches.
- `browser` stopped at `tier1.spec.ts` "hostile navigation…", where a
stray `/` reached its foreign-origin server, as on PR 2.
- **`docs/API.md`** is unchanged: the wire doesn't change, and
`blockGuests` stays off the public connections API because nothing reads
it there.

## Release impact

Tick exactly one.

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

The migration adds a column whose default allows guests, so every
existing connection behaves as before.

- **What does a revert leave behind?** The `block_guests` column
(`0032_connections_block_guests`) and any blocks admins have set.
- **Does the release before it still work with that?** It runs, since it
never reads the column. But it would let guests back into patches whose
connections an admin blocked, and the rest of the guest stack is
one-way. **One-way: fix forward**, with the whole stack shipping as one
deploy.

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

A guest couldn't be the person in a `t.member()` column. Assigning them
was refused, pickers never offered them and resolution returned null, so
a patch like Kudos needed a text-column workaround. Now a patch's member
columns and pickers take anyone who can open it: the company's members
plus the patch's active guests.

Resolution covers anyone holding one of the company's grants, active or
ended, so another patch reading a shared table resolves them too. A
guest carries `guest: true`, is never `admin`, and shows `active: false`
once their grant is revoked or their account is deactivated. Rows keep
their name, and sharing again makes them active. Grant changes advance
the company's directory revision, so live pickers update.

Kudos goes back to member columns. The handlers its page needs are
marked `guest: true`, and its people handlers return only what the page
shows. Taylor of Cedar Works joins the brightline scenario as the guest
to be; the share step comes with PR 5's `patchy share`.

This is the fourth of six stacked PRs. Sharing has no surface until PR
5, so the tests write grants through `GuestGrants`.

Closes #1101

## Look at

- **`guest` is present only on guests, not `guest: boolean` on
everyone.** This deviates from the plan. The host decodes handler
results strictly. A required key on every member broke brightline's
Spend immediately: its `requests.list` returns members through
`t.object({ id, name, email, admin, active })`. It would break every
published tier 2 version that does the same. With `guest?: true` (wire,
`Directory.Member` and the SDK's `Member`), members are byte-identical
to before, the same choice PR 1 made for `me().guest`. A result schema
that passes members through whole fails only once it returns a guest,
and the members skill states that fact.
- **Companies never reads grants.** `Directory` takes a `Scope {
companyId, guests: Map<userId, active> }` as plain data. The server's
`MemberDirectory` adapter, which already bridged companies and
primitives, fills it from Patches' `GuestGrants`:
- pickers and assignment checks use `guests(patchId)`, so they're per
patch;
- resolution uses the new `holders(companyId, ids)`, so it's
company-wide.
- `memberOf(scope, row)` is the one rule: a guest is never admin, and is
active only while both their account and a grant are.
- **Live updates use the existing mechanism.** Migration
`0033_guest_grants_directory` adds a trigger on `patch_guest_grants`
that bumps `companies_directory` and notifies `members:<company>`, as
the users trigger does. It fires when a grant starts, ends, restarts or
goes with its patch. Re-sharing an active grant changes nothing, so it
doesn't fire.
- **Members pay almost nothing.** Each directory read adds one indexed
grants read. With no guests, the users query keeps its old plan, because
`sql.in` over an empty list renders `1=0`, which Postgres folds away.

### Kudos, with Taylor of Cedar Works shared on it

These come from a local `pnpm dev up brightline` with Taylor's grant
written directly, driven in Chromium.

Taylor, the guest, thanked Priya through the guest-marked `give`. Every
name on the wall resolves for them.

![Taylor's kudos on the
wall](https://github.com/user-attachments/assets/ba9b8bdb-4a3a-4661-bbf0-30e0cf510f8c)

<details><summary>Allison's picker offers Taylor, marked Guest</summary>

The picker no longer shows emails, because its handler doesn't return
them.

![Allison's
picker](https://github.com/user-attachments/assets/60e87e0f-649f-41b3-9e92-b85aa55b098a)

</details>

No before shots: Kudos is a scenario patch, and on the base every call
Taylor made was refused.

## How it was verified

New focused tests:

```
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > can be the person in a member column while their grant stands
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > is resolved by another of the company's patches, through the table it shares
✓ apps/server/src/Guests.test.ts > a tier 2 patch's guest > joins and leaves a member's live picker as the grant starts and ends
✓ packages/companies/src/Directory.test.ts > company directory > offers and checks a scope's active guests, and resolves every guest in it
✓ packages/patchy/src/devMembers.test.ts > lists the local person, the colleague and the guest by name, searched by name or email prefix
```

- **The member-column journey** runs over the whole server with real
workerd:
- A guest claims a task through a marked mutation, and a member assigns
them another.
- The patch's picker lists and searches them with `guest: true` and
`admin: false`. Gina is her own company's admin, which makes `admin:
false` meaningful. Another patch's picker doesn't offer them.
- After a revoke they resolve `active: false`, and assigning them is
`invalid_row`.
  - After sharing again they're active and assignable.
- **The shared-table test** publishes a second patch that reads the
first's tasks and resolves its owners with `getMany`.
- **The live test** subscribes a member to the picker query. The guest
appears on grant and disappears on revoke. With the trigger disabled it
times out, so it tests the trigger.
- **Focused suites:**
- `companies` Directory, all of `primitives`, `sdk` and `devMembers`
pass.
- So do these `apps/server` suites: Guests, Members, StreamLifecycle and
migrations. Also `GuestGrants` and the scenario loader: 143 tests.
- **Brightline:** `pnpm dev up brightline` builds and loads all three
tier 2 patches. Kudos' generated repo passes its own `pnpm typecheck`
and `pnpm lint`.
- **`pnpm check`:** format, lint, typecheck and synth pass.
- The offline tests fail only the suites that record stray `GET /`
requests from this machine: `cliPublish`, `cliLifecycle`, `cliLook`,
`cliRepo`, `cliRepoRecovery`, `RequestEvents` and `LocalTaskProvider`.
Their logs show `{ method: 'GET', url: '/' }`.
- `RequestEvents`, `LocalTaskProvider` and `devExecution` pass when
rerun alone.
- **`pnpm verify`:** format, lint, typecheck, synth,
postgres-concurrency, cli-smoke, install and browser pass.
- `tier2-smoke` failed first on this PR: the packed e2e expected the dev
directory's two candidates, and the dev guest makes three. Its
expectation is updated, and it passes rerun alone.
- `test` failed only the stray-request suites above, plus `cli.test` and
`LocalTaskProvider`.
- **After rebasing onto PR 3's `b27c9bb`:** typecheck and lint pass, and
the guest, directory, primitives, serving and migration suites pass (165
tests).
- **`docs/API.md`** is unchanged: `render-docs` produced no diff.

## Release impact

Tick exactly one.

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

Members read exactly as before, since only guests carry `guest`. The
migration adds a trigger and no columns.

- **What does a revert leave behind?** The
`patch_guest_grants_directory_changed` trigger
(`0033_guest_grants_directory`). Rows written while it ran may hold
guests' ids in member columns.
- **Does the release before it still work with that?** It runs, since it
never writes grants, so the trigger never fires. But it would resolve
those guests as null and refuse them again, and the rest of the guest
stack is one-way. **One-way: fix forward**, with the whole stack
shipping as one deploy.

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

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):


https://github.com/user-attachments/assets/4906327c-0de8-46a3-8000-8e502a33ca74

<details><summary>How to read the film</summary>

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.

</details>

**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](https://github.com/user-attachments/assets/009b1dcc-03ca-4ede-8f7e-55a3ec27fe86)
| ![Share dialog with a refusal under the
field](https://github.com/user-attachments/assets/5c5cab34-70a0-4a66-add6-45a339b8387c)
| ![Kudos shared with Taylor; Anyone on the internet is disabled for
tier
2](https://github.com/user-attachments/assets/073973de-c84e-4c30-aac0-70f58a6eb399)
|

| Going public | Public |
| --- | --- |
| ![Make public, confirmed in the
dialog](https://github.com/user-attachments/assets/45f29cc4-7f77-4242-90a5-1572e9a9169e)
| ![The patch is public; its guests stay listed and adding
waits](https://github.com/user-attachments/assets/c4a471c0-10fb-437e-a8b3-50d23f035f55)
|

**Phones.**

| Menu | Refused | Going public | Public |
| --- | --- | --- | --- |
| ![Menu at
390px](https://github.com/user-attachments/assets/174abee3-8963-4aaa-81ac-bccf1cd7ea1e)
| ![Refused at
390px](https://github.com/user-attachments/assets/cacad84f-421c-4685-92f0-415ff3651e0f)
| ![Going public at
390px](https://github.com/user-attachments/assets/add01bdf-d474-4bb5-a596-b5370a24d7ef)
| ![Public at
390px](https://github.com/user-attachments/assets/4a5f5c0b-1281-4f06-b030-6a753e5b108b)
|

<details><summary>The menu on All patches, desktop</summary>

![Share… in the row's
menu](https://github.com/user-attachments/assets/cd0f3dcf-9fe5-4b99-870c-e68270645db3)

</details>

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

| Before | After |
| --- | --- |
| ![Settings
before](https://github.com/user-attachments/assets/8e15feaa-9bef-411b-afeb-336cbe66a6ee)
| ![Settings
after](https://github.com/user-attachments/assets/9ea68fdd-a80c-438c-972f-336290543607)
|
| ![Settings before,
phone](https://github.com/user-attachments/assets/805e22a9-a51d-47a3-88c0-1a49cb76dc80)
| ![Settings after,
phone](https://github.com/user-attachments/assets/474291e0-259a-4916-821b-c2a0971f4f6a)
|

**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](https://github.com/user-attachments/assets/b4c5699a-1e59-4431-be2d-14e54aa8425e)

<details><summary>Phone</summary>

![Shared with you at
390px](https://github.com/user-attachments/assets/929a22bf-09f2-490d-b65c-5e03f23b5061)

</details>

### 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
- [x] **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]>

---------

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

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]>
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:docs Touches the docs area area:primitives Patch tables and files area:server Touches the server area size:m 100-500 changed lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants