Skip to content

feat(guests): guests call the tier 2 handlers marked for them - #1110

Merged
allisonmahmood merged 1 commit into
mainfrom
guests/2-tier2-handlers
Oct 31, 2026
Merged

allisonmahmood merged 1 commit into
mainfrom
guests/2-tier2-handlers

Conversation

@allisonmahmood

@allisonmahmood allisonmahmood commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

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.
  • 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
  • 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]

@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:primitives Patch tables and files area:integrations Company connections and integration implementations size:xl Over 1,000 changed lines; review in multiple passes labels Oct 30, 2026
@allisonmahmood allisonmahmood added the one-way Rolling production back past this PR would break the release before it label Oct 30, 2026
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Sol review

Reviewed 3a425bd32067d8095c22536b4270f611189545f0 against guests/1-grants-tier1 at 57db588ddac2f3d210b737dc2fb06de4df909a55, using the three-dot diff. Refreshed both refs before posting.

No blocker, should-fix or nit findings on either axis.

  • Standards: The required Binding.reauthorize migration is mechanical across consumers and test bindings. The shared integration recheck preserves structured refusals and checks the same user and host company. New SQL results are decoded through Schema. No actionable TypeScript or Effect convention violations, needless service machinery or test slop found.
  • Spec: The top-level guest gate covers direct calls and live-query execution, regardless of handler kind; nested calls retain the existing rules. MCP remains company-only, and the dev guest mount has no agent door. Member worker payloads retain the omitted guest field. Attio and Pidgeon retain their post-wait check point through the shared helper. Shared tables/stores refuse eligibility while the member directory remains allowed. The two-company scenario uses the existing isolated CLI state; docs and skills describe the implemented behavior, including that scenario startup does not share patches yet.

Validation: 12 focused suites passed, 143 tests, covering the whole-server guest journeys, live queries, descriptors, inspection, member wire, runtime invocation/streams, queued Attio/Pidgeon checks, dev mount and scenario seeding. git diff --check passed, and the global skill hash matches its lock. No code changes or pushes; no full verification or acceptance run performed.

Verdict: PASS — no actionable standards or PR 2 contract findings.

@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked ab19f74f1347024fbf13fbaa575457857788a233 (base 75b60f90e224878daffea7226d639e1089c5a81f) on fresh guests and brightline instances, by gpt-6.1-sol in Codex (T3 Code).

Done means

  • Marked tier 2 entry handlers, real actor and host: passed in Chromium. Before grants Jo Rivera got 404 on both Harbor patches. With grants, Jo logged “Pine walkthrough, dock 3”, signed “Jo Rivera”; it appeared live on Ben's open page. me() named Jo in Harbor Works with guest: true, admin: false.
  • Unmarked entry and rechecks: passed. Jo's Clear log returned access_denied, displayed “Only Harbor Works can clear the log”, and retained the visit. Ben could clear it. Revoking also refused the marked list query with 403; regrant restored access.
  • Eligibility: passed. Published Site notes with its table shared, then Visit log with that shared-table declaration. Jo got Visit log 404, Site notes 200; Ben still got 200. Replacing the source with members and republishing restored Jo's 200.
  • Attribution: passed. The isolated CLI log and portal log both named Jo Rivera rather than a raw actor id.
  • Local guest preview: passed. dev --json supplied distinct guest/colleague URLs. The guest logged a visit as Dev Guest; unmarked clear was refused. With the daemon nonce, the guest agent door returned 404 and the colleague door 200. The daemon was stopped through its CLI.
  • Main's pull boundary: passed. Jo's machine credential got “Patch not found” for both pull visit-log and list visit-log; no source was downloaded.

Golden journeys

  • Brightline sign-in, live Kudos, New Business and Spend: passed. Anonymous company access returned the sign-in door. Jordan's Kudos appeared on Priya's open wall; Lead → Discovery → Lead followed on Allison's open board. Spend returned own_approval for Jordan's own submitted request. No browser page errors.
  • Member MCP: passed. Jordan found the patches and read New Business's sample deals through read_patch / listDeals.
  • Publishing and shared-source transitions: passed through the real environment CLI. Public/private grant retention and publish-surviving streams also passed in the whole-server guest suite.

Evidence

Focused suites: whole-server guests, descriptors, inspection, eligibility,
invocation, streams, live queries, Attio/Pidgeon queued rechecks,
dev mounts, SDK builders, scenario seeding
Test Files  12 passed (12)
Tests       143 passed (143)

Rollback answers: match the diff. Published descriptors retain guest: true, which the older strict reader refuses. one-way is present.

Not run

  • Rollback rehearsal and several CI suites were still pending. The displayed failed install (${{ matrix.os }}) belongs to a cancelled run; its job has no steps and conclusion cancelled, not an installation failure. Replacement platform jobs include passing macOS/Windows jobs.
  • Workerd startup-failure wording was inspected, not fault-injected. Live external integrations and Clerk were not run locally; queued rechecks passed against the offline integration doubles.

Notes

Base automatically changed from guests/1-grants-tier1 to main October 31, 2026 17:07
A guest of a tier 2 patch starts only the handlers marked `guest: true`,
queries, mutations, actions and live queries alike; nested calls follow
the usual rules. Tier 2 becomes open to guests, unless its version reads
another patch's shared table or store.

- `guest: true` in the SDK's handler options and the descriptor, read by
  the strict loader and inspection; agent tools never carry it.
- The worker wire still carries `guest` only for guests.
- `reauthorize` lives on the Binding, required, and Attio's and Pidgeon's
  post-wait rechecks share one helper over it.
- `patchy dev` serves a guest's view at `guestUrl`, with no agent door,
  and `pnpm dev up guests` brings up two companies.
- The CLI says workerd couldn't start during inspection, and to run
  `pnpm install`.

Closes #1079

Co-authored-by: Srikar Voleti <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood
allisonmahmood force-pushed the guests/2-tier2-handlers branch from ab19f74 to 21c941c Compare October 31, 2026 17:07
@allisonmahmood
allisonmahmood merged commit c69769b into main Oct 31, 2026
21 of 22 checks passed
@allisonmahmood
allisonmahmood deleted the guests/2-tier2-handlers branch October 31, 2026 17:17
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:docs Touches the docs area area:integrations Company connections and integration implementations area:primitives Patch tables and files area:server Touches the server area one-way Rolling production back past this PR would break the release before it 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(guests): run guest-marked tier 2 handlers with local guest testing

1 participant