Skip to content

feat(server): record guests, their grants, and which person a session belongs to - #536

Merged
Jacksondr5 merged 6 commits into
j5/mainfrom
j5code/share-1-people-grants
Oct 13, 2026
Merged

Jacksondr5 merged 6 commits into
j5/mainfrom
j5code/share-1-people-grants

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

Share links need a server that knows who a guest is and what they were granted, before anything can enforce it. Today J5's person table holds one row, the server's own operator, and nothing ties a connection to a person. This is the first of four stacked pieces (#531, then #532, #535, #533).

What changed

Everything here is J5-owned. No upstream file is edited, and nothing a person or an agent can reach creates a guest yet: after this lands a guest exists only in a test.

  • Migration 34 in J5's own lane. People gain a kind (member or guest) and a display name; every existing person is a member. Two new tables: grants (person, project or thread, level), and the person each auth session belongs to.
  • PersonAccess service (apps/server/src/j5/sharing). It records guests, grants and session bindings, and answers what a connection may do with a thread or a project: member, collaborate, view or none.
  • A thread grant covers the agents beneath the thread (Shared server AC8): its Subagents, through upstream's lineage, and the Peer Agents placed under it, Crew seats among them, through J5's placement tree. It does not reach upward, and it does not cover a fork.
  • Agents cannot address a guest, and a guest has no inbox here (Shared server AC3, Inbox AC14). The person registry that the address book, the send path and the inbox read now lists members only.

Three decisions a reviewer should check:

  • The session binding is a J5 table keyed by upstream's session id, not a column on auth_sessions (Jackson, 2026-10-11, on Share links 1: people, grants, and recognising a guest connection #531). J5 migrations never run in upstream's lane, and upstream's migration 031 dropped and recreated its auth tables once already.
  • What marks a guest is the subject its pairing link carries (j5:guest), which upstream copies onto every session made from the link and which no client can change. The J5 table then says which guest. A marked session with no person recorded reaches nothing. A session without the mark is a member's own device and is never looked up, so a member's requests cost no extra query. Checked: a guest cannot create a session, because every path that issues one needs Manage access, a shell on the host, or the dev token.
  • A fork is not covered by its source's grant. A member who forks a shared thread to work privately would otherwise hand the fork to the guest. The definition says "the agents it spawned and its Crew seats"; a fork is neither.

Verified

  • vp test run apps/server/src/j5/sharing apps/server/src/j5/a2a/Migrations.test.ts: 31 pass. Also ran the send, roster, inbox and persistence tests that read the person registry: pass.
  • The migration was run against a VACUUM INTO snapshot of a real database at J5 migration 32 at the time (1 person, 180 memberships): it applied, the person stayed a member, and the registry still listed them. The snapshot was deleted afterwards.
  • Server typecheck and lint are clean for the changed files.

Not done here: the service is not yet provided in the server's runtime, because nothing calls it until #532.

Checklist

  • One concern: the description has no "also"
  • Tests cover the changed behavior (backend changes ship with focused tests)
  • UI changes: before/after screenshots above, and a video for motion or interaction: no UI changes
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR: none edited
  • Upstream product: any change to what upstream's product does has a human decision linked above and a register entry in docs/j5/product/upstream.md: nothing upstream does changes in this piece; the entries come with Share links 2: a guest views one thread, enforced by the server #532 and Share links 3: the Share action, the People page and the link #535
  • Surfaces: entry points, clients, providers, contracts, reverse states, connection modes (see AGENTS.md): server only; a grant can be put, changed and removed
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them: the definition merged in docs(j5): define members, guests, grants and shared conversations #529; nothing user-visible yet

Refs #531.

Opus 5.5, Claude Code in J5 Code.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
j5-code Ready Ready Preview Oct 12, 2026 10:15pm UTC

Request Review

The subject a guest link carries is what marks a guest. Sessions without
it skip the person lookup, so guests cost members nothing per request.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5 and others added 2 commits October 12, 2026 17:59
Main took 33 for outside agents. This migration has not run on any
database outside a test, so it is renumbered.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 effective changed lines (test files excluded in mixed PRs). labels Oct 12, 2026
@Jacksondr5
Jacksondr5 added this pull request to stack #575 October 12, 2026 22:02
@Jacksondr5
Jacksondr5 marked this pull request as ready for review October 13, 2026 01:11
@Jacksondr5
Jacksondr5 merged commit 8d77fd9 into j5/main Oct 13, 2026
37 checks passed
@Jacksondr5
Jacksondr5 deleted the j5code/share-1-people-grants branch October 13, 2026 01:11
Jacksondr5 added a commit that referenced this pull request Oct 13, 2026
Rebased onto guest sharing (#536, #561, #577). The guest gate refuses every
J5 read by default; the client now skips them for a connection it knows is a
guest's, as it did for the HTTP reads, and hides the playbook boards.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5 added a commit that referenced this pull request Oct 13, 2026
* feat(j5): J5's client reads run over WebSocket methods

J5's client reads called J5's own HTTP routes, each with its own
authentication, error shape and "is this route missing" probe. Upstream's
rule is that a small read is a socket query and a large, compressible
payload goes over HTTP.

Fourteen reads move to RPC methods: the Inbox list and open count, Crew
proposals, runtime requests and memberships, the Fleet, spawned children,
the archive preflight, participant identities, the peer list, the three
playbook reads and the artifact list. Their routes are removed. Reading
one artifact's content stays on HTTP, because it can be megabytes.

Part of #506 (step 3).

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

* fix(web): the Artifacts page waits for the socket before listing

The list is read over the socket now, which comes up after the prepared
connection the page waited for, so a direct visit to /artifacts failed as
"not connected" until Try again. Found in live testing.

Review fixes: FORK.md no longer names deleted route files, and says which
views skip an unsupported server.

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

* chore(server): drop an unused import

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

* fix(j5): a known guest is sent none of J5's socket reads

Rebased onto guest sharing (#536, #561, #577). The guest gate refuses every
J5 read by default; the client now skips them for a connection it knows is a
guest's, as it did for the HTTP reads, and hides the playbook boards.

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

* fix(mobile): the playbook board calls its hooks unconditionally

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

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — 9af7956e Deployed Oct 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 effective changed lines (test files excluded in mixed PRs). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant