Skip to content

Guest filter: read the person once per connection #579

Not planned

Description

@Jacksondr5

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.

Activity

  1. Jacksondr5 commented on Oct 12, 2026

    @Jacksondr5
    OwnerAuthor

    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.

  2. Jacksondr5 commented on Oct 13, 2026

    @Jacksondr5
    OwnerAuthor

    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.

  3. bryantderosier commented on Dec 1, 2026

    @bryantderosier
    Collaborator

    Closing this, the people and access rewrite (#638) took care of most of it.

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions