Skip to content

feat(teams): store teams, and keep team data closed until teams ship - #1416

Merged
allisonmahmood merged 11 commits into
mainfrom
feat/teams-bridge
Nov 12, 2026
Merged

allisonmahmood merged 11 commits into
mainfrom
feat/teams-bridge

Conversation

@allisonmahmood

Copy link
Copy Markdown
Owner

What changed

Teams will let a patch be opened only by chosen teams, and a connection be built with only by chosen teams. That data can't be read by today's release. If the feature shipped on its own, rolling back would 500 every page listing a team patch, and team-only connections would quietly become company-wide.

This PR ships first, on its own. It adds the teams tables and makes every reader fail closed on team data:

  • A patch open to teams is opened by nobody and listed nowhere. Every attempt to change it answers 404.
  • A connection restricted to teams can't be built or called with. Admins see it tagged "Restricted to teams".
  • A publish or share that names an audience, which only the coming CLI sends, is refused with upgrade_required and never ignored.

It writes no team data, so nothing changes for anyone until the feature lands on top of it.

Part of #1192. The feature is the next PR in the stack.

Look at

  • The migrations (0039_company_teams, 0040_patch_audiences, 0041_connection_audiences) are byte-identical to the feature's, so the feature PR adds none.

  • Rollback onto this release, run by hand. On a throwaway instance, the feature created a Finance team, made a patch Finance-only with two outside guests, and restricted a Postgres connection to Finance. This release was then served on the same data, then the feature again:

    Feature This release Feature again
    Team patch, Finance members 200 404 200
    Team patch, member not on Finance 404 404 404
    Team patch, outside guests 200 404 200
    Restricted connection in discovery / detail listed / 200 absent / 404 listed / 200
    Team data in the database stored unchanged unchanged
    Server 500s 0 0 0

How it was verified

  • Tests. Each seeds team data directly and fails without its fix:
    • lists, cards, addresses, guest grants, shared sources, Home and the Calls tab hide team patches;
    • every writer refuses to change one;
    • connection publish and calls refuse a team-only connection;
    • audience-bearing requests are refused.
  • pnpm verify passed.
  • The four-step rollback rehearsal passed against production's live commit (live → this → live → this). The feature's rehearsal passed with this release as live.

Release impact

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

Additive tables and a widened scope check. Installed CLIs never send an audience, and no team data can exist yet.

  • What does a revert leave behind? Empty teams and audience tables, and the widened check.
  • Does the release before it still work with that? Yes. The release before it ignores the new tables, and no team rows exist until the feature ships. If this release misbehaves, roll back to the live release it was rehearsed against.

Taken over from Srikar's teams work (#1404, co-authored). Built by Claude Opus 5.5 in Claude Code, reviewed by GPT 6.1 Sol.

@github-actions github-actions Bot added area:server Touches the server area area:docs Touches the docs area area:integrations Company connections and integration implementations area:ui Portal and first-party browser pages, shared rendering and styles size:l 501-1,000 changed lines labels Nov 12, 2026
@github-actions github-actions Bot added size:xl Over 1,000 changed lines; review in multiple passes and removed size:l 501-1,000 changed lines labels Nov 12, 2026
allisonmahmood and others added 7 commits November 12, 2026 22:47
Migrations 0039 to 0041, as the release with team audiences writes them:
teams with their members and membership history, a patch's `teams` scope
with the teams it names and its owner history, and a connection's audience.
Every existing patch and connection keeps what it had. Nothing in this
release writes them yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A release that reads patches but not team audiences can't tell who may
open a `teams` patch. Every read now leaves one out, as it leaves out a
disabled patch: lists, cards, addresses, guest grants, shared sources,
lifecycle and sharing changes, and a connection's recent calls. Its
address answers 404 and nothing can change its audience.

Reclaiming a deleted patch also removes its owner-history admin additions,
which no foreign key cascades.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…teams

A connection whose audience is `teams` is used by nobody in a release that
can't check teams: publish refuses it, every call refuses it, and
discovery, agents' reads and SDK generation leave it out. Admins still see
it on Integrations, marked Restricted to teams, and its usage counts its
team patches without naming them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A CLI released with team audiences sends `audience`. Ignoring it would
make a team-only first publish company-wide, so a body that names one
answers 400 `upgrade_required`, after replay, which that CLI treats as a
definitive refusal.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eclaimed

A patch's calls stay in the log after reclamation removes its row, and
nothing then says whether it was open to teams. The Calls tab now shows
calls made from no patch or from one that exists and is not open to
teams, so a reclaimed team patch's calls, SQL included, never come back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e its replay

A later CLI that lost the answer to a team patch's first publish retries
the same payload. The replay answered with the stored response, naming a
patch this release opens for nobody. The audience refusal now runs first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The form's decode dropped an audience field and applied the scope, so a
form meant for teams could make the patch public or company-wide. It is
now refused before anything is decoded or changed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
allisonmahmood and others added 4 commits November 12, 2026 22:47
… grants

People lists a guest's grants without team patches, but its Remove ended
those too, so rolling forward restored a team patch with its guests
changed. The removal now ends only grants on patches this release opens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Integrations counted a team patch as disabled, so a member saw that a
hidden patch declared the connection. Usage now leaves team patches out
of every name and count; they still keep the connection from deletion.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ab hides

Integrations' Last call read the newest call of any patch, so a team or
reclaimed patch's activity showed even when the Calls tab was empty. It
now admits only the calls the Calls tab shows, before taking the newest.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t there

A publish retry returned its stored answer before any patch check, so a
patch later opened to teams was named, with its title and ids, to its
owner. A retry whose patch is now open to teams answers 404 and
publishes nothing, a create's retry included.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@allisonmahmood

Copy link
Copy Markdown
Owner Author

Acceptance: PASS with notes

Checked 39c4429fbc66f476ce51d680ee354e7872b3825e (base 8ed4d793471a5fb431e69f0a303fcd67b3d74009) on fresh team, by GPT-6.1 Sol in Codex through T3 Code. This replaces the verdict before the second rebase.

Done means

  • The rebase preserves the bridge: passed. Its patch against the new base is byte-identical to the previously accepted patch; all eleven commits match in range-diff. Main's eight intervening commits add no migrations.
  • Team data stays closed: passed. A real CLI-published page, made team-scoped transactionally in this throwaway database, returned 404 at its address and card for admin, member and nonmember; Home and CLI discovery omitted it. The focused suites reran the other readers/writers, audience-bearing requests and replays, guest handling, retained calls, connection admission and live/shared-source boundaries.
  • Ordinary publishing and sharing: passed. Installed CLI publish admitted a colleague (200), kept the signed-out door (401), Public admitted the signed-out reader (200), and Company restored the door (401). The ordinary page still opened after team data existed.
  • Main interactions: passed. Serving, trial/eval/scenario/publication, init and SDK suites passed. Desktop Chromium ran sharing, shell, switcher and focus; Firefox ran focus. The generated-client and Preact modal Tab checks passed in both browsers.

Golden journeys

  • Publish, open, share and unshare: passed locally as above. Find/open visibility: ordinary page present, team fixture hidden.
  • Shell/switcher navigation and patch keyboard focus: passed locally in desktop Chromium and Firefox.
  • Sign-in, machine login, invite/join/revoke, tier 2/live use and lifecycle: offline focused suites and current-head CI evidence; the complete prior direct journeys were reviewed, not all manually replayed.
  • CI: 26 checks succeeded; no pending or failed check. Reviews and inline review comments were empty at the final read.
Focused suites: 116 files passed; 1,285 tests passed.
Desktop Chromium: 39 passed. Firefox focus: 10 passed.
Ordinary page: colleague 200; signed out 401; Public 200; Company 401.
Team fixture: address/card 404 for every checked person; absent from Home/CLI.

Rollback answers: match the diff when this bridge ships before the feature. The head's rollback job ran all four steps, 7f93b91 → 44fd997 → 7f93b91 → 44fd997, passing in 71s, 42s, 34s and 33s. The CI test-merge tree equals the checked head's tree. Empty additive tables are compatible with the prior release; once the feature writes team data, this bridge is the rollback floor.

Not run

  • Another local full pnpm verify, real Clerk/device sign-in or invitation mail, successful live upstream query, agent trial/eval, or a fresh complete feature→bridge→feature manual rehearsal. Focused exact-head reruns, unchanged-patch comparison, previous independent transition evidence and CI support this delta verdict.

Notes

  • This smoke's team fixture was SQL-seeded; the prior acceptance supplied the feature-created-data rollback/roll-forward check. Conservative hiding of retained calls from reclaimed patches remains unchanged.

Normal installs used Node 24.20.0 without a minimumReleaseAge override. Heavy work used the shared lock; every installed CLI used this environment's own PATCHY_STATE_DIR, with inherited API URL/token unset. Both local environments were removed and tracked status stayed clean. No production access, subagents, source edits, pushes or merges.

@allisonmahmood
allisonmahmood merged commit 1cd6d12 into main Nov 12, 2026
26 checks passed
@allisonmahmood
allisonmahmood deleted the feat/teams-bridge branch November 12, 2026 22:16
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
…ey shortcuts (#1421)

## What changed

This adds release 42's What's new entry, written from `1cd6d12`. It
covers everything merged since release 41's `through` (`a25a9c5`), and
sets the `patchy` release to `0.42.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Tell Patchy what it's missing | #1217, #1218, #1219, #1227, #1228
|
| New: Turn off single-key shortcuts | #1276, #1279, #1301 |
| Fixed: Typing reaches the patch again | #1407, #1412 |
| Fixed: Dialogs in patches keep your place | #1420, #1255 |
| Behind the scenes: plainer facts for agents building patches | #1249,
#1256, #1297, #1418 |
| Behind the scenes: Patchy stores teams and audiences ahead of teams |
#1416 |
| Patch changes: Mod+/ and `client.close()` in patchy/hotkeys;
single-key shortcuts can be off; Tab wraps in plain modal dialogs |
#1279, #1301, #1420 |

#1376 is release 41's own entry. #1400, #1406, #1414, #1415, #1302,
#1413 and #1419 are test, CI and dev tooling and need no line.

The teams bridge (#1416) ships alone in this release so teams (#1417)
can follow in the next one with a release to roll back to that reads its
data closed.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `7f93b91` (release 41) to this
PR's merge.** No PR in the range is labelled `one-way`, and every
Release impact answer says release 41 still works:
- **#1217** adds migration `0037_feedback`, a schema release 41 never
reads. **#1227** and **#1228** write into it.
- **#1276** adds migration `0038_single_key_shortcuts`, a column with a
default that release 41 never selects.
- **#1416** adds migrations `0039_company_teams` to
`0041_connection_audiences`, which hold tables that stay empty until
teams ship, and widens one scope check. Its CI rehearsal ran `7f93b91 →
head → 7f93b91 → head` on one set of data, and all four steps passed.
- **#1279**, **#1301**, **#1255** and **#1420** change the SDK and the
shell. Patches built on this release carry a `shortcutSetting` manifest
field that release 41 reads without refusing, and its shell names no
frame, so every shortcut stays on.
- **#1218** and **#1219** add CLI commands and an optional
`feedbackHint` in `--json` failures. A CLI from this release refuses to
publish to an older instance before sending anything, as any mismatched
release does.
  - Everything else is skill text, docs, tests and CI.

If this release misbehaves, roll back to `7f93b91` (release 41).

Written by Claude Opus 5.5 in Claude Code, through T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
allisonmahmood added a commit that referenced this pull request Nov 12, 2026
…ctions (#1417)

## What changed

A company can now make teams, open a patch to chosen teams instead of
the whole company, and limit who builds with a connection. Roles stay
member and admin.

- **Teams.**
- Admins create, rename and delete teams and manage anyone's
memberships.
  - Members see every team and roster.
- A team can be deleted only when nothing uses it, and the refusal says
what does.
- The Teams page is a roster editor: tick people in or out, then review
who gains, loses or keeps what before saving.
- **Patch audiences.**
- Company (the default), one or more teams, or Public, plus named guests
as today. The owner must stay inside the audience.
- A team patch's first version and its audience commit together, so it
is never briefly company-wide.
- Removal takes effect on the next request and on open live queries, on
every surface: portal, serving URLs, API, CLI, MCP, tier 2 handlers and
shared tables.
- **Admins.**
- Admins manage every patch's owner, audience and sharing, but open its
content only through its audience.
- The owner sees every audience change someone else made, and every
admin added to one of the patch's teams.
  - Needs attention shows patches whose owner lost access.
- **Connections.**
- A connection's teams decide who builds with it: the patch's owner must
be on one, and a deactivated owner's patches keep working as before.
  - Anyone the patch is shared with can use it through the patch's code.
- Shared tables keep the per-viewer check, and publish warns when a
patch reaches people its sources don't.
- **CLI.**
- `--share company|public|teams --team <name>` on `publish` and `share`,
plus `patchy audiences`.
  - Installed CLIs keep working.
- A scope-only request on a team patch is refused with an upgrade
message instead of being ignored.

Closes #1285, #1286, #1287, #1288, #1289, #1290, #1291, #1365, #1367,
#1368, #1403, #1408, #1410. Supersedes #1284 and #1361: there is no
super admin, and team rules follow #1192's decisions. #1416, the
rollback bridge, shipped first, in release 42.

## Look at

**The Teams page.** Mock B was picked from three directions. The team
list sits beside the open team. Its access card shows what the team can
open and build with. The roster is the editor, and a sticky bar counts
the changes.

![Roster mid-edit: two people being added, one
removed](https://github.com/user-attachments/assets/af45cf29-2349-4e46-8fdb-1c2e4f50914e)

**Review before saving.** It says what added people will reach and what
removed people lose or keep, and warns about live patches that will stop
working.

![Review: Kudos will stop working, because its owner builds with
attio/crm through
Design](https://github.com/user-attachments/assets/b0faf7be-9e0a-4abf-a77d-cf07123102ef)

<details><summary>Delete refused while in use, the member view, the
phone screens, and the old page</summary>

![Delete refused, naming the patch and connection with links to change
their
audiences](https://github.com/user-attachments/assets/b2a846f7-a642-409a-8e11-e5b6f2e4d418)

![A member's read-only view, naming the
admins](https://github.com/user-attachments/assets/411bfbe9-35d3-450e-927f-aaad3edfb1c5)

| Phone, list | Phone, team (admin) | Phone, team (member) |
| --- | --- | --- |
| ![Phone: the list of
teams](https://github.com/user-attachments/assets/576d4ba3-eb12-4aae-9b56-3218b356984e)
| ![Phone: a
team](https://github.com/user-attachments/assets/c2ad758e-1a0a-4650-9484-686386ce2b6c)
| ![Phone: a member's team
view](https://github.com/user-attachments/assets/0081fb28-a07f-4e57-bf88-1ee08b9fb590)
|

Before (the previous Teams page):

![The previous Teams
page](https://github.com/user-attachments/assets/8c2877de-3120-4efc-ae06-33fc3d95e284)

</details>

**Also worth a look:**
- **One audience value in code.** The wire keeps the released two-valued
`scope` and adds `audience`. A test decodes the list, publish,
publish-replay and share responses with the released CLI's schema.
- **Concurrency in forced interleavings:**
  - a team deleted while a share adds it;
  - a connection narrowed while a publish uses it;
  - an admin added to a team while a guest is removed;
  - a stale roster review;
  - the last-admin guard.

## How it was verified

- **Tests.** Every behaviour fix has a focused test that fails without
it. In an earlier end-to-end run, 21 of 22 deliberate breaks of the
access checks were caught; the 22nd now has a test.
- **`pnpm verify`** passed on the final code. The new audience check
made two serving cache tests racy in the Bun lane; they now wait past
it, and a forced slow check fails the old tests and passes the new ones.
- **Rollback.** The full four-step rollback rehearsal, with release 42
(the bridge) as the live release, passed on this head: bridge, then
this, then the bridge, then this. CI's own rehearsal job passes at once
here, because the migrations live in the bridge (#1416), where CI
rehearsed all four steps. In a hand-run rollback onto the bridge with
real team data, team patches went hidden and team-only connections
unusable, with no 500s, and rolling forward restored both.
- **Acceptance (GPT 6.1 Sol, on throwaway instances): PASS with notes**
on this head. The first run failed on three Teams page defects, all
since fixed and re-checked with its own reproductions:
  - admin names were rendered as HTML;
  - an outdated roster review could still save;
  - a roster save could deadlock against a profile refresh.

It also checked every role, every surface an outsider must be refused
on, live revocation, admin oversight, stuck owners, connections, shared
tables, and the released CLI against this server.
- **Reviews.** Four GPT 6.1 Sol review passes; all findings are fixed.

## Release impact

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

Roles, `/api/me`, and existing patches and connections are unchanged:
patches stay Company, connections stay company-wide. Installed CLIs see
`company` or `public` for every patch, and get an upgrade message only
when changing a team patch's sharing with a scope alone.

- **What does a revert leave behind?** Teams, memberships, team
audiences, connection audiences and history rows.
- **Does the release before it still work with that?** Yes, if it is the
bridge (#1416). Team patches go hidden and team-only connections
unusable, nothing widens or 500s, and rolling forward restores both.
Deploy this only after the bridge is live, and never roll back past the
bridge once team data exists.

Taken over from Srikar's teams work (#1404, co-authored). Built by
Claude Opus 5.5 in Claude Code, reviewed by GPT 6.1 Sol.

---------

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 Nov 13, 2026
…onnections (#1422)

## What changed

This adds release 43's What's new entry, written from `1cbd39f`. It
covers everything merged since release 42's `through` (`1cd6d12`), and
sets the `patchy` release to `0.43.0` in `packages/patchy/package.json`
and `CURRENT_RELEASE`.

| Change | PRs |
| --- | --- |
| New: Teams | #1417 |
| New: Share a patch with just your team | #1417 |
| New: Choose who builds with a connection | #1417 |
| Improved: Admins look after every patch without opening it | #1417 |
| Behind the scenes: earlier agents and CLIs keep working, and are asked
to update before changing a team patch's audience | #1417 |
| Patch changes: shared-source reads can be refused per viewer, and
team-only connections follow the owner's teams | #1417 |

#1421 is release 42's own entry.

## Look at

- **The entry**, at the top of `releases` in
`packages/core/src/whatsNew.ts`.
- **Rollback safety, from the live commit `7028ec6` (release 42) to this
PR's merge.** The only PR in the range is #1417, which isn't labelled
`one-way`.
- Its migrations shipped with release 42, the bridge (#1416), and the
teams change adds none.
- Release 42 reads team data closed: team patches are hidden and
team-only connections unusable, with nothing widened and no 500s.
- The four-step rehearsal `7028ec6 → #1417 → 7028ec6 → #1417` passed on
#1417's head, run locally because CI's job skips when no migration
changes.
- Never roll back past release 42 once teams exist: earlier releases
don't read the audience tables, so nothing keeps team patches closed
there.

If this release misbehaves, roll back to `7028ec6` (release 42).

Written by Claude Opus 5.5 in Claude Code, through T3 Code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Touches the docs area area:integrations Company connections and integration implementations 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.

1 participant