Skip to content

fix(j5): a guest who opens a second open link joins as themselves - #615

Merged
Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/reuse-known-share-name
Oct 14, 2026
Merged

Jacksondr5 merged 3 commits into
j5/mainfrom
j5code/reuse-known-share-name

Conversation

@Jacksondr5

@Jacksondr5 Jacksondr5 commented Oct 14, 2026 •

Copy link
Copy Markdown
Owner

Problem

A guest who joined thread A through an open link, then opened another open link for thread B in the same browser, was asked for a name again. Their own name was then refused as already in use. Closes #614.

What changed

  • Joining as an existing guest. The join route now passes the browser's session to OpenLinks.join.
    • No name given: a guest's own browser joins as that guest. They get View on the link's thread, unless they already hold a grant on it, so Collaborate is never lowered. Nothing is paired again.
    • A name given: a new person joins as before. This keeps two people able to share one browser, and the existing test for that still passes.
    • No name and no guest session: refused with a 400.
    • A full link: still lets in, and describes itself to, a guest it already counts.
  • Describe route. For an open link opened in a guest's own browser, it adds joiningAs: <name>.
  • Join page.
    • That browser sees "You are signed in here as Bob", with Join as Bob and Not Bob? (which brings back the name form). A failed join as oneself also brings back the name form.
    • On success the page saves the thread in the tab's sessionStorage and goes to /. The guest's first screen then opens the thread once the live thread list holds it.
    • Going straight to the thread's address doesn't work, because the app first draws from a cached thread list taken before the grant, and upstream's thread page leaves an address its list doesn't hold.
  • Name taken. A name is not a credential, so a device with no session that types a name someone already has is still refused. The message now says to open the link on the device you joined with, or to ask for a link for this device.
  • Joins table (migration 038). j5_a2a_open_link_join(link_id, person_id, joined_at) records each person who joins through each link. It feeds each link's joined list and its 50-person cap. Existing joins are copied in from joined_open_link_id, and removing a guest clears their rows.
    • joined_open_link_id stays, as the link a person first joined the server through, which is what makes their name self-given.
    • Unchanged: the "joined by link" tag, nameSelfGiven, confirming a self-given name before Collaborate, and the person contract.
  • Definition. AC26 and the summary paragraph in docs/j5/product/features/shared-server.md now describe a guest who is already signed in.

The Multiplayer agent signed off on this design. It is holding the collaborate stack (#598–#602) until this merges, and will renumber that stack's migrations to 39–41.

UI changes

Before After
A signed-in guest opens a second join link before after
An existing name typed on a device with no session before after

Joining a second thread as Bob opens that thread:

Joining a second thread as Bob opens that thread

Live testing

Pass on the head, 10ff79ab30. The tester was a GPT-6 Astra peer agent; the report is test-reports/j5code-reuse-known-share-name.md. The full run was on 3db8a0a2b5. The paths that changed after it were re-tested at 4867673762 and 10ff79ab30.

  • Ran live:
    • Bob joins A. In the same tab he joins B, then C, as himself, and lands on each one.
    • Joining B again adds no second join, so each link still counts him once.
    • Dana, who holds Collaborate on C (set up with the rig's guest --level collaborate), joins C's link and keeps Collaborate.
    • Not Bob? with a new name (Carol, Heidi) makes a new guest.
    • A device with no session gets the new name-taken message.
    • Removing a guest clears them from the links' joined lists.
    • A lapsed session: Bob is removed while "Join as Bob" is on screen, and pressing it brings back the name form.
    • A restart at rest keeps grants and joins.
    • One Claude Haiku turn through the UI.
    • A --fresh run.
  • Found and fixed during the test: the second thread landed on the "Shared with you" list instead of the thread. That's the cached-list issue above, fixed in 10ff79ab30, and the A → B → C regression passes at that head.
  • Migration 038: rehearsed on a copy of a test home made by the base build, with a real join made through the UI before the migration. The join was copied into the new table.
  • Not exercised live:
    • The rehearsal on a copy of real data. vp run migrate-dev-db fails in its snapshot step with FOREIGN KEY constraint failed, before 038 runs, and does the same with a fixture source.
    • Describing a full link (50 joins) for a guest it already counts. That's covered by a unit test.
    • Raising someone to Collaborate from the owner's UI, which is marked "coming soon" there; the rig set it up instead.
    • Desktop, mobile, relay, and real data volume.
  • Re-test decisions:
    • The provider turn and the stored-state restart weren't repeated after 3db8a0a2b5: later commits changed only the join page and the landing, not the turn path or storage.
    • Migration 038 didn't change after its rehearsal.

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
  • Live testing: the section above says what ran live and what did not
  • Upstream-owned files: each one is recorded in FORK.md (case text and file-table row) in this PR — no upstream-owned files are 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 — not applicable
  • Surfaces:
    • Entry points: the open-link join page.
    • Clients: web; mobile has no join page.
    • Providers: none.
    • Contracts: SharingLinkDescription.joiningAs, and SharingJoinRequest.displayName is now optional.
    • Reverse states: Not Bob?, and a failed join brings back the name form.
    • Connection modes: unchanged; the route already served every mode.
  • Docs: definitions under docs/j5/product/ and user docs rewritten where this changes them (AC26; there is no user page for sharing yet, see Share links: the access model as its own definition, and a user docs page for sharing #608)

Built with Claude Opus 5.5 in Claude Code (J5 Code). Review: a Claude Opus 5.5 peer reviewer, three rounds. Live test: a GPT-6 Astra peer agent.

🤖 Generated with Claude Code

A guest already signed in on a browser who opened another open link was
asked for a name again, and their own name was then refused as taken.

The join route now passes the browser's session. With no name given, a
guest's browser is given the link's thread as that guest: View, unless a
grant on the thread is already held, and nothing is paired again. With a
name, a new person joins as before, so two people can still share one
browser. The describe route tells the page whom the browser can join as.

Who joined through each link is now a table of joins, so one person can be
counted on several links. joined_open_link_id stays as the link a person
first came in by, which is what marks their name as self-given.

Closes #614

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 14, 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 14, 2026 5:31pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR 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 14, 2026
Jacksondr5 added a commit that referenced this pull request Oct 14, 2026
…ounts

From review of #615: describe now skips the cap for a guest the link
already counts, as join does; a failed join as oneself brings back the
name form; the decode refusal no longer demands a name; the new person's
name is carried out of the guard instead of defaulted; AC26's summary
sentence reads unambiguously.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Found in the live test of #615: the join page sent the browser straight to
the new thread's address, and the app first drew from a cached thread
list that predated the grant. Upstream's thread page leaves an address its
list does not hold, so the guest landed on their list instead.

The join page now keeps the thread in the tab's storage and goes to the
first screen, which opens it once the server's list holds it. The route
answers with the thread alone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 0a91b108-7ec4-4b5c-8eb2-07371348f75e
📥 Commits

Reviewing files that changed from the base of the PR and between 79e53e8 and 10ff79a.

📒 Files selected for processing: 14
  • apps/server/src/j5/a2a/Migrations.test.ts
  • apps/server/src/j5/a2a/Migrations.ts
  • apps/server/src/j5/a2a/migrations/038_OpenLinkJoins.test.ts
  • apps/server/src/j5/a2a/migrations/038_OpenLinkJoins.ts
  • apps/server/src/j5/sharing/GuestProjectIcons.test.ts
  • apps/server/src/j5/sharing/OpenLinkHttp.ts
  • apps/server/src/j5/sharing/OpenLinks.test.ts
  • apps/server/src/j5/sharing/OpenLinks.ts
  • apps/server/src/j5/sharing/PersonAccess.ts
  • apps/web/src/j5/sharing/GuestAwarePairingSurface.tsx
  • apps/web/src/j5/sharing/GuestLanding.tsx
  • apps/web/src/j5/sharing/landingThread.ts
  • docs/j5/product/features/shared-server.md
  • packages/contracts/src/j5/sharing.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

📝 Walkthrough

Guests who are already signed in can join another open link as themselves. The server records membership per link, preserves existing thread access, and returns the joined thread ID. The browser uses that ID to open the thread.

Changes: Guest open-link joining

Layer / File(s) Summary
Persist open-link membership
apps/server/src/j5/a2a/migrations/038_OpenLinkJoins.ts, apps/server/src/j5/a2a/Migrations.ts, apps/server/src/j5/a2a/Migrations.test.ts, apps/server/src/j5/a2a/migrations/038_OpenLinkJoins.test.ts
Migration 38 creates j5_a2a_open_link_join with a composite primary key, indexes person_id, and backfills existing joined guests. The migration registry and migration tests include version 38.
Identify and admit signed-in guests
packages/contracts/src/j5/sharing.ts, apps/server/src/j5/sharing/OpenLinkHttp.ts, apps/server/src/j5/sharing/OpenLinks.ts, apps/server/src/j5/sharing/PersonAccess.ts, apps/server/src/j5/sharing/OpenLinks.test.ts, apps/server/src/j5/sharing/GuestProjectIcons.test.ts
Link descriptions can identify the guest in the current session. Joining as that guest does not create another person or credential, preserves existing thread access, and records the guest once per link. Guest removal deletes the membership records. Tests cover these behaviors and update capacity fixtures.
Join and open the selected thread
apps/web/src/j5/sharing/landingThread.ts, apps/web/src/j5/sharing/GuestAwarePairingSurface.tsx, apps/web/src/j5/sharing/GuestLanding.tsx, docs/j5/product/features/shared-server.md
The join page offers the signed-in guest identity or name entry. For an existing guest, the browser stores the returned thread ID and opens it from the guest landing page. The feature definition documents the behavior.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Browser
  participant OpenLinkHttp
  participant OpenLinks
  participant SharingStorage
  participant GuestHome
  Browser->>OpenLinkHttp: Describe link with browser session
  OpenLinkHttp->>OpenLinks: describe(link, session)
  OpenLinks->>SharingStorage: Read link membership and guest identity
  OpenLinks-->>OpenLinkHttp: Description with joiningAs
  OpenLinkHttp-->>Browser: Return link description
  Browser->>OpenLinkHttp: Join with token and session
  OpenLinkHttp->>OpenLinks: join(token, undefined, session)
  OpenLinks->>SharingStorage: Record membership and preserve or add thread grant
  OpenLinks-->>OpenLinkHttp: Existing outcome with threadId
  OpenLinkHttp-->>Browser: Return threadId
  Browser->>GuestHome: Remember landing thread
  GuestHome->>Browser: Navigate to joined thread
Loading
Merge Risk: ⚪ Minimal · up to 10ff7

Guests who are already signed in can join another open link as themselves. No concrete merge-blocking risk was identified. The migration has not been rehearsed on real data, so check it before deploying.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: allowing a guest to open a second open link and join as themselves.
Description check Passed The description is complete and matches the repository template. It documents the problem, implementation, UI changes, live testing, limitations, checklist items, documentation updates, and the tools …
Linked Issues check Passed The PR implements the coding requirements in #614. OpenLinks accepts the browser session, identifies an existing guest, grants View without lowering an existing grant, avoids re-pairing, records one…
Out of Scope Changes check Passed The changed files stay within #614. The migration registry and migration test support migration 038. Server tests cover session recognition, access preservation, capacity, duplicate joins, name refusa…
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch was successfully deployed

1 active deployment
Preview — 10ff79ab Deployed Oct 14, 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 PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sharing: a guest who opens a second open link is asked for a name, then told it is taken

1 participant