Repository navigation
feat(j5): people a thread is shared with can search its messages - #808
Conversation
Cmd+K's "In messages" search was refused to narrowed connections. It now runs for them, held on the server to the threads the person can open (PersonAccess.reachableThreads) before upstream's search cuts its results, and ranked without the owner's opens. A narrowed Collaborator's visit no longer records opens or palette queries; it still moves the read marker. Closes #696 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
This review includes 13 billable files and costs up to $3.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 33 minutes for your next included review. View limit details
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5
left a comment
There was a problem hiding this comment.
Combined review of #808 at 26eacd211c, from Opus 5.5 (lead), Sol 6.1 and Fable 5.1 (security). The panel agreed these findings before posting. No security or functional findings. There are three small fixes, all in tests or docs.
What we verified in source
- Scoped on the server, not filtered after.
threadIdssits inmessageHitsQuery'seligibleCTE, ahead ofMESSAGE_HIT_LIMIT. Hit counts and snippets are computed only from rows that CTE admits. A match only in an unreachable thread returns{ matches: [] }. Upstream's global FTS candidate floor is unchanged, per the Captain's ruling; the PR body and the feature doc both state it. - Ranking without opens.
withoutOpensnulls the subject'sopens(ThreadSearch.ts:492), which removes both the picks and the open-count boost. The test flips the top result with an owner pick. - No wire control.
OrchestrationV2SearchThreadsInputis unchanged, and decoding stripsthreadIdsandwithoutOpens.ws.tsalso spreadsnarrowedafter the request, so a narrowed caller can't widen the search. - No older-settled rows for a narrowed session.
olderSettledBefore,projectIdsandenvironmentLabelare dropped for every narrowed session, the server-scope Viewer included, and the deliberately sent case is tested. - Reach.
reachableThreadssharesparentInChainwiththreadLeveland uses the same project rule ascoveringThread. Its test asserts that the two agree for every fixture thread: a cross-project seat, a grandchild seat,forked-from, a fork, a union, a revoked share, and a server Viewer (null). Reach is read on every search. An unclaimed device is refused at the gate (narrowedwithoutunknownToo) and again in the view, without running a query. - Visits. The strip runs after
requireLevel(…, "collaborator"), anddispatchCommanddispatches the strippedadmittedcommand. The integration test drives upstream's real orchestrator:opensstays byte-identical whilelastVisitedAtmoves, and an Owner visit still records the open. A Viewer's visit stays refused, and both web call sites usereportFailure: false, so the Viewer sees no error. - Owner path.
MEMBER_VIEW.searchThreadsis a strict pass-through, andisWidereturns early inCommandAdmission, so Owners, server-scope Collaborators and services are unchanged. - MCP.
t3_thread_searchhas no narrowed caller:mcp-clientis a service subject (PersonAccess.isServiceSubject), and/mcphas no session-cookie fallback. - FORK.md case 69. The case text, the "nine handlers" count, the pin-advance guidance and the file-table row are all accurate.
- Cost. We timed the reach query read-only against a real database (928 live threads): about 22 ms per narrowed search. That's acceptable, so it isn't a finding.
Findings
- [P2]
apps/server/src/j5/sharing/messageSearch.test.ts: two tests depend on run order. Only the first test callscreateProject(SHARED). The older-settled test and the ranking test seed threads inSHARED, andmessageHitsQueryinner-joinsprojection_projects. Run alone withvp test run apps/server/src/j5/sharing/messageSearch.test.ts -t 'ranks a narrowed search', the ranking test fails at :292 (expected[thread:search-picked], got[]). The full file passes 4/4. Fix: create the project in each test that needs it. - [nit]
docs/j5/product/features/shared-conversations.md: criteria order. The new### Searchsection (AC21, AC22) comes before### Scheduled runs(AC20), so the criteria read 19, 21, 22, 20. Move it after. - [nit] The same doc: wording. The "Thread state is shared" paragraph says "the server's Owners' and wide Collaborators'". "Wide" is code vocabulary. Use AC22's own wording, "a Collaborator at server scope".
Optional, not blocking: when the person holds no thread-level share, reachableThreads could skip the recursive half. The query is already cheap at real sizes.
Pending, and already marked unticked in the PR: the tester's before/after Cmd+K captures and the live-test report.
Claude Opus 5.5 (lead reviewer), with Sol 6.1 and Fable 5.1, in J5 Code
Search criteria follow Scheduled runs in the definition, the opens line names Collaborators at server scope, and reachableThreads walks ancestor lines only for someone who holds a thread. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Jacksondr5
left a comment
There was a problem hiding this comment.
Re-checked at 8f47737ced: all three findings are resolved.
- Each search test now seeds its own projects (
seedcreates them if they're missing), and every test passes when run alone. - AC20, AC21 and AC22 are in order.
- The doc now says "Collaborators at server scope".
The optional change is also in: reachableThreads walks ancestor lines only for someone who holds a thread-scope share. The project-only path is covered end to end by the project Viewer and project Collaborator cases in messageSearch.test.ts. Nothing is open from the panel. Live-test evidence is still pending.
Claude Opus 5.5 (lead reviewer), in J5 Code
Problem
People a thread or project is shared with (narrowed connections: Viewers, and Collaborators below server scope) got no "In messages" section in Cmd+K, because
orchestration.searchThreadswas refused to them. And a narrowed Collaborator's opens changed the thread's sharedopensrecord, which ranks the Owner's Cmd+K. Closes #696, per Jackson's 2026-10-31 decision.What changed
PersonAccess.reachableThreads(personId)lists every thread the person holds a level over, by the same parent rule asthreadLevel(the rule is now one shared SQL fragment), and returnsnullfor a level at server scope. A newGuestViewhook,searchThreads, wraps thews.tshandler. It passes the thread list into upstream's message query as a server-onlythreadIdscondition inside theeligibleCTE, ahead of the hit limit, so results aren't filtered after the cut. It also dropsolderSettledBefore,projectIdsandenvironmentLabel: a narrowed sidebar has no older-settled cut, and that path returns full shell rows from every settled thread. An unclaimed device, or someone who reaches nothing, gets{ matches: [] }and no query runs. Reach is read on each search, so a share that is taken away ends with the next search.opens. A server-onlywithoutOpensinput makes the ranking treat the thread'sopensas null: no picks and no open-count boost. The owner's palette queries therefore don't change which shared threads make the cut or how they are ordered. Owner ranking is unchanged.CommandAdmissionadmits a narrowed Collaborator'sthread.visitwithoutopenedandsearchQuery, so the read marker still moves,opensstays the same, and no error is shown. I chose this over refusing the visit, which would also have dropped the read marker. A Viewer's visit is refused today (every narrowed command needs Collaborator) and still is. Upstream's client sends visits withreportFailure: false, so the Viewer sees nothing.ACCESS_RPC_RULESlistssearchThreadsasnarrowed.MCP
t3_thread_searchis unchanged, because no MCP caller is ever narrowed.accessHttpRulestrips a narrowed session's permissions on every route except/ws, thread loads, preview streams and the artifact read, so/mcpis refused. MCP clients have subjectmcp-client, whichisServiceSubjecttreats as wide, and they are approved only by an Owner (FORK.md case 70). Agents' MCP sessions are service sessions.UI changes
There's no UI code change. Upstream's palette shows "In messages" once the RPC answers. Captures are from an isolated test server, 1280×800, with the same data before (
j5/main) and after (26eacd211c).The Viewer's result shows the Owner's message as "You:". Upstream's palette labels every hit from a person's message that way. An Owner searching already sees a Collaborator's messages as "You:", and this PR now shows the label to shared people too. Naming the author needs author data in the search result; that is tracked in #809, not fixed here.
Live testing
Verdict: pass for the web flows exercised. Tested at
26eacd211con an isolated test server (j5-live-test), with a second browser paired as the shared person. The head is nowd66e2fd489, which changes onlymessageSearch.test.ts(each test seeds its own projects), so it wasn't re-tested live.opensbyte-identical. An Owner opening the same thread records the query and raises the score.Not exercised live:
CommandAdmission.integration.test.tscovers it.Upstream impact
apps/server/src/orchestration-v2/ThreadSearch.ts: server-onlythreadIdsandwithoutOpensonsearch's input andSearchRequest, and one condition in theeligibleCTE (FORK.md case 69; file-table row updated).apps/server/src/orchestration-v2/ThreadSearch.test.ts: the query-plan test passesthreadIds: null(case 69; row added).apps/server/src/ws.ts: thesearchThreadshandler runs insidej5View.searchThreads(case 69, already in the table).What upstream's product does for wide sessions (Owners, server-scope Collaborators, services) is unchanged. The narrowing belongs to J5's sharing (case 69, register D33), and the decision is linked above.
Checklist
messageSearch.test.tscovers project-scope and thread-scope shares, Viewer and Collaborator, a server Viewer, a match only in an unreachable thread, unclaimed and empty reach (no query runs), a deliberately sentolderSettledBefore(no rows), and ranking that ignores picks.PersonAccess.test.tschecks thatreachableThreadsagrees withthreadLevelover every fixture thread: a subagent, a seat in another project, a grandchild seat, a fork and aforked-fromseat excluded, a thread + project union, and a revoked share.CommandAdmission.integration.test.tsruns a visit through upstream's real orchestrator: the Owner's visit records the open, and the Collaborator's leavesopensbyte-identical while the read marker moves. That test fails onj5/main.AccessGate.test.tsnow expectssearchThreadsto run.FORK.md(case text and file-table row) in this PRorchestration.searchThreadsthroughpackages/client-runtime, so it needs no code change, but it hasn't been checked on a device. Agents: MCP is unchanged (see above). Contracts: no wire change;threadIdsandwithoutOpensare server-only. Reverse states: removing a share drops its threads from the next search. Connection modes: scoping is keyed by session, not transport.docs/j5/product/features/shared-conversations.mdis rewritten for search and opens (AC21, AC22, a scenario and a History line). The user docs had no search passage to correct.Built by Claude Opus 5.5 in Claude Code (J5 Code crew seat).
🤖 Generated with Claude Code