You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Guest filter: read the person once per connection #579
A cost note from the review panel on #536, #561 and #577 (Opus measured it; Astra and Fable saw the same shape). Not a correctness problem and not needed for the first version.
The guest filter reads the session's person again on every access check. Building a guest's filtered sidebar runs sessionPerson plus the recursive grant walk once per thread (apps/server/src/j5/sharing/GuestView.ts, PersonAccess.ts). Measured with a throwaway test: 2,000 threads take about 100 to 160 ms of synchronous SQLite, per guest connect and per grant change for each connected guest.
Each thread.updated on an ungranted thread costs each connected guest two queries.
A grant change wakes every guest's open thread requests and access watchers, not only the guest whose grant changed (GuestGate.ts, PersonAccess.watchThreadAccess); GuestView already filters by person.
What would fix it: read the person once per guest connection and pass it down, which halves the queries and lets every wakeup be filtered by person. A member's connection is unaffected either way, since none of this runs for one.
Do it when a server has enough guests or threads for it to show, or when the multi-person link (#541) makes many guests on one thread likely.
Also (#577): a guest's attachment request scans the message projection to find which message carries the attachment, since nothing indexes attachment id to message. It runs only for a guest's attachment request.
Also, from the Opus review of the Share UI layers (#592, #594, #596), 2026-10-13: a member's client sends one listThreadPeople and holds one subscribeThreadPeopleChanges stream for each server thread it opens, kept about five minutes after leaving. Each watcher re-reads on any grant or link change on the server, the stream sends only a counter, and the client then asks again. Not noticeable today. The simplification is one stream that carries the people (deduplicated), which removes the query and the refresh; it is a contract change beneath the UI layers, so it was left for after the first version.
Closing this, the people and access rewrite (#638) took care of most of it.
Read the person once per connection: done. GuestView.ts reads the session's reach once (access.sessionReach(session), around line 625) and passes it down into the sidebar filter. It no longer looks the person up again on every check.
Wake only the person whose access changed: done. Watchers filter changes by person now (Stream.filter((changed) => changed === personId) in GuestView.ts), so a change to one person's access doesn't wake everyone else's.
What's left is that a narrowed sidebar still checks access once per thread (threadLevel), and the attachment lookup still scans for the message. Nobody has measured either one against a real server since the rewrite. If a server with a lot of threads ever feels slow for a narrowed person, we'll open a fresh issue with numbers.
Activity
Jacksondr5 commentedon Oct 12, 2026
Also (#577): a guest's attachment request scans the message projection to find which message carries the attachment, since nothing indexes attachment id to message. It runs only for a guest's attachment request.
Jacksondr5 commentedon Oct 13, 2026
Also, from the Opus review of the Share UI layers (#592, #594, #596), 2026-10-13: a member's client sends one
listThreadPeopleand holds onesubscribeThreadPeopleChangesstream for each server thread it opens, kept about five minutes after leaving. Each watcher re-reads on any grant or link change on the server, the stream sends only a counter, and the client then asks again. Not noticeable today. The simplification is one stream that carries the people (deduplicated), which removes the query and the refresh; it is a contract change beneath the UI layers, so it was left for after the first version.bryantderosier commentedon Dec 1, 2026
Closing this, the people and access rewrite (#638) took care of most of it.
GuestView.tsreads the session's reach once (access.sessionReach(session), around line 625) and passes it down into the sidebar filter. It no longer looks the person up again on every check.Stream.filter((changed) => changed === personId)inGuestView.ts), so a change to one person's access doesn't wake everyone else's.listThreadPeopleandsubscribeThreadPeopleChangesno longer exist onj5/main.What's left is that a narrowed sidebar still checks access once per thread (
threadLevel), and the attachment lookup still scans for the message. Nobody has measured either one against a real server since the rewrite. If a server with a lot of threads ever feels slow for a narrowed person, we'll open a fresh issue with numbers.