Repository navigation
feat(messages): let a plugin sort, filter and page a reader's rows - #3818
LordMelkor wants to merge 34 commits into
Conversation
joahg
left a comment
There was a problem hiding this comment.
🤖 This needs a human maintainer's review: it comes from outside the core maintainer group, and it changes what readers see. A design or core-team reviewer should look at it.
I looked at the relay and session core and at the reader and plugin contract. I found no P0 or P1 issues. retain().set checks access on set and again on every access purge. Holds need admission proof. Newer-direction pages and 39006/39007 window bounds are verified. foldRows matches the reader's fold. The snapshotRead priority passes through. With no reader accessory, the default reader path is unchanged as far as I traced it.
Inline: two P2s (hold evidence reaching unread's structural lookups, and the hold memory/slot bound) and one P3 (Back/Forward saving a presented row as the anchor).
Two more P3s:
unread.ts(~2500):requireMessageaccepts held-only evidence, butprepareThreadReadandmarkCapturedMessagesReadstill validate withevents.get(...). Those mark-read actions never apply to held-only rows.ChannelTimeline.tsx(~382): presented rows skipwithoutStartingAgentsbeforemembershipRows. In a Solo chat, the owner's starting-agent join and remove notices come back if a plugin includes them.
Not covered: I ran no tests or visual checks. I only skimmed the test bodies and the reference plugin fixture. I didn't measure the per-frame refold cost.
|
🤖 Head b8a3fad merges main 078aaaa (#3993, #4270, #4253) into 34d57a4 and changes no PR code: resolved the single conflict in Checked on a separate Linux machine at b8a3fad (on main 078aaaa): Earlier, head 34d57a4 merges main e5a9b4f (#4211, #2953, #2920, #4222, #4213) into e944bdf and changes no PR code: outside Checked on a separate Linux machine at 34d57a4 (on main e5a9b4f): Earlier, head e944bdf adds one commit ("fix(messages): keep ReplyBranch messageRef focus target for existing navigation") on e1527f2. It restores main's focus target for the existing reply and thread-line handoffs in Checked on a separate Linux machine at e944bdf (on main 352f46e): Earlier, head e1527f2 adds one commit ("fix(messages): preserve deletion candidates and recover focus in presentations") on ed88f57, addressing both blocking findings from review 6009665684 and clarifying
Checked on a separate Linux machine at e1527f2 (on main 352f46e): Earlier, head ed88f57 rebased onto main 352f46e and separated the presentation functional core ( Earlier, head 3edff25 adds one commit on 91aa4d2, "test(arranger): discard a channel page with a surplus bound or extra tags", which answers the second review of the reference fixture. It changes only the reference fixture and its tests (2 files, +35 / −9), with no production lines. A channel page is now taken only when the answer holds exactly one bound per requested lane and no others, and each channel bound carries exactly its Checked on a separate Linux machine at 3edff25: Current main: 22 commits on main since this PR's base e901df9 change 15 of its files, among them Earlier, head 91aa4d2 adds one commit on 674efc4, "test(arranger): check each channel page's bounds before taking the page", which answers the review of 674efc4. It changes only the reference fixture and its tests (3 files, +157 / −26), with no production lines. The reference plugin now takes a channel page only when exactly one relay-signed bound answers each requested lane, with Checked on a separate Linux machine at 91aa4d2: Earlier, head 674efc4 was this change rebased onto main e901df9, plus one fix. GitHub showed conflicts with two PRs that merged today. #3730 (task branch views, The new commit, "fix(reader): leave an invocation branch's rows to the host", starts no arrangement in a branch view. That view's root is the invocation message, and the reader bar can't tell a plugin it is in a branch, so a presentation there could show rows from outside it. A branch view now has no reader bar and shows main's rows. The new test "leaves an invocation branch to the host's rows, with no bar" ( Verified on a separate Linux machine at 674efc4: Earlier, head b635ad6 was the same change on main 6ba83fa, before #3876 merged. It passed the same checks on a separate Linux machine. CI: 76 checks pass, 1 skipped; the one failure was a repeat of a plugin settings browser test in the flake check (1 of 10 WebKit runs), which this PR does not change. Both required checks passed. Earlier, head c44c517 was the same change rebased onto main d9c4672, for a conflict with #4116 in Earlier, head 2339eb8 was one test-only commit on cf121aa (
Verified at 2339eb8: Earlier, head cf121aa rebased onto main 418d0c0 (GitHub showed conflicts with main), plus two small changes and two test cleanups.
Verified on a separate Linux machine at cf121aa (on main 418d0c0): Earlier, head 620c02a rebased onto main 23e1dee with #3908 and #3987. Earlier, head 6de6e46 answered the review of 11f4a8c (5 inline findings fixed, each replied to on its thread; core-fit answer in its own comment).
Earlier, on the two P3s in the ea81886 review body:
|
joahg
left a comment
There was a problem hiding this comment.
🤖 Follow-up on ea81886: no findings.
- Holds and unread:
structuralis back to counted and fetched events only. The newplacinglookup reaches held events only on the paths that place a named read or unread mark:requireMessage, viewed rows, captured reads and thread reads.markCapturedMessagesReadandprepareThreadReadnow validate withknownEvent, so held-only rows can be marked. - Back/Forward: both readers skip the saved place while a presentation shows, and each has a test for it.
- Hold bound: agreed. It has the same contract as
observeon main: the same 64 slots, the same per-view 8 MiB bound, and no owner scoping. A shared budget belongs in a separate change that covers both. Listing it as a known limit in the description is enough here. - Starting-agent notices: the reasoning holds. A presentation shows exactly the rows the plugin picked.
- 3858e11 (one reader accessory at a time, nothing kept while held): the docs and
PresentResultnow say a held accessory has to present again oncepresentationisnone. That matchesfree().
This still needs a human maintainer's review: it comes from outside the core maintainer group, and it changes what readers see.
joahg
left a comment
There was a problem hiding this comment.
🤖 Follow-up on e43abec, which only changes tests. Both changes hold up. hostRows now waits on the panel's aria-busy={positioning} on "Thread messages", replacing the 300 ms quiet-read loop. The withdraw test now states the fixture's case outright, that the host doesn't show the reading row, instead of recomputing nearestShown. If no row below is shown, near is undefined and the assertion fails rather than passing vacuously. I have no new findings.
This is a comment, not an approval. The PR comes from outside the core maintainer group and changes what users see, so a human maintainer from the core or design team needs to review it.
0a38477 to
a088b93
Compare
joahg
left a comment
There was a problem hiding this comment.
🤖 Follow-up on e43abec. My last review left nothing open. The feature commit was rebased onto main with no content change, and three test and cleanup commits were added:
- 8192149 drops comments and redundant return types. Its
retain()docs note matches the JSDoc it removed. - 31ba35d drops the raised test timeouts.
- a088b93 finds thread rows by tag name.
None of them change behavior. In a clean worktree the touched suites pass without the raised timeouts: 11 files, 559 tests. The touched directories have no tsc errors, and biome reports only infos.
This needs approval from a human maintainer.
joahg
left a comment
There was a problem hiding this comment.
🤖 Follow-up on a088b93. My last review left nothing open. Five new commits since then, with no rebase. They touch only:
- the reference arranger plugin fixture and the fixture relay;
- the plugin guide and tests;
- the
root_auxremoval in relay types and thread binding.
No new problems. The new 503 fallback, the paged #e aux reads and the 9005 handling match fold.ts and threads.ts. A new test fails if the fallback is skipped. The messages, relay and tests suites pass locally (281 files, 7,414 tests), the touched directories have no tsc errors, and biome reports only infos.
This needs approval from a human maintainer.
wesbillman
left a comment
There was a problem hiding this comment.
🤖 Star Lord reviewed 11f4a8c from source. Please fix the live-reply and unread regressions inline. The arranger is a test fixture, and the core team should decide whether in-place arrangement warrants the proposed reader and relay-session APIs.
|
🤖 Carl, an automated reviewer, commenting via Wes's GitHub account. Reviewed at On the core-fit question: I don't think the reader presentation belongs in core in this shape.
The general pieces ( |
11f4a8c to
6de6e46
Compare
|
🤖 @wesbillman — following up on your core-fit comment for a yes/no from the core maintainers: Someone reading a 2,000-reply thread sorts the replies by reactions or filters to one author, reads the result in the thread itself, and stays at the same reply when they clear the filter. Will core take in-place reader placement (
On your three points, at 6de6e46:
A host sort of loaded rows or a host-rendered relay-ranked query puts the sorting feature in core. Keeping policy in the plugin (which sorts exist, what filters match, paging, and wording) lets core render only the rows the plugin chose. The PR body lists each hook and why a plugin cannot replace it today. |
joahg
left a comment
There was a problem hiding this comment.
🤖 This follows up my last review. Of the three earlier threads, two are fixed in code: hold evidence moved into structural, and ChannelTimeline and ThreadPanel now guard against saving a Back/Forward place while a presentation is open. The third, the per-handle hold budget, was agreed to be shared with observe and left for a separate change.
The ten new commits remove the window-admission gate. threads.ts now only extracts growAux, and the aux-closure result matches the old loop. The commits also:
- withdraw a presentation so a link target it omits can be shown
- treat collapsed branches as partial for reading
- catch up through
catchUpMessageId - keep the reading visit when a list becomes partial
I found no new issues. The messages, relay, conversation, tests and plugins suites pass (7,923 tests). One failure, in src/plugins/author.test.mjs, came from my local environment: its inner pnpm install aborts without a TTY. The touched directories have no tsc errors.
Notes for maintainers:
- This adds a plugin API for reader rows and touches FOUNDATION files (
conversation/contracts.ts,conversation/service.tsx,relay/session.ts,plugins/author.ts), so it needs core-team review. Your question about whether this fits core is still waiting for an answer from them. - It conflicts with main in
src/features/messages/ThreadPanel.tsx, so it needs a rebase. - It comes from outside the core maintainer group, so a human maintainer still needs to review it.
6de6e46 to
620c02a
Compare
joahg
left a comment
There was a problem hiding this comment.
🤖 This head is a rebase onto main. The only changes to the PR's own diff are one line in ThreadPanel.tsx, where main's lineRow replaces unreadBoundary in the !presented && !parent guard, and the withdraw test, which now holds the reads after withdraw to allow for main's background paging. That test passed 5 of 5 runs, and the ThreadPanel tests pass (182). My earlier review still applies. This needs core-team review for the FOUNDATION files and an answer on whether it fits core. It comes from outside the core maintainer group, so a human maintainer still needs to review it.
|
🤖 A real plugin now uses the reader hooks raised in comment 7016004596: Thread Sort, an internal plugin that uses
|
b635ad6 to
674efc4
Compare
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Client relay contract: NIP-11 buzz-window-newer enables direction:"newer"/after window reads; check the desktop reader and mobile compatibility against a capable relay and a pre-capability relay (block/buzz#9641).
Verdict: COMMENT — recommend request changes for the concrete finding below. This repository reserves the Request Changes review action for human reviewers.
Reviewed: 94a4f42e89ec7dca6bf1f18495796a4136ecb604..674efc4c13af3e1566e56b8f6a50150f323f3e01 (exact head 674efc4c13af3e1566e56b8f6a50150f323f3e01).
Risk: high — signed window bounds drive whole-thread/channel completeness and the presented read state.
Blocking finding — validate each channel-window bound before accepting its page. In tests/fixtures/conversation-arranger/plugin.ts:245–276, pages() filters signed kind-39006 events by author and then chooses the first body matching the requested direction. It does not bind that event to the channel and the exact requested head/cursor (h and d), enforce one bound per requested lane, validate cursor shape and forward progress, or check that has_more agrees with next_cursor. A stale or mixed signed bound can end a scan early (pages() returns null and scanAll() marks it complete) or repeatedly request a page. The existing host channel reader rejects these cases in src/features/relay/window.ts:54–101; the reference plugin should uphold the same window contract. Author action: check each bound's tags and response cardinality against the corresponding request, reject malformed/contradictory/non-advancing cursors before keep() or advancing, and add regression tests for swapped/duplicate bounds, contradictory has_more, and a stalled cursor.
Product/UI evidence: Source tests at this head cover 2,000-reply Top ranking, pagination beyond 460 rows, edited-text filtering, older-only fallback, and reader-place restoration (src/features/messages/arranger-plugin.test.tsx:328,612,640,800,818; ThreadPanel.presentation.test.tsx:721; ChannelTimeline.presentation.test.tsx:623). No separate source-proven UI blocker. These are inspected tests, not an independently witnessed native journey.
Validation: Hosted checks for this head reported success for JavaScript/Rust, Chromium/WebKit browser journeys, and required CI; Windows native validation was skipped. The PR author reports a Linux/browser local-relay oracle at this head; that is author evidence, not independent validation. An independent full package run was not completed in this review. No native desktop/mobile behavior was independently exercised.
Verification owner: author for the bound-validation fix and adversarial tests; reviewer/tooling for re-review and independent full package validation at the next head; desktop/mobile release verification for the relay compatibility gate. For desktop, exercise the actual installed Thread Sort plugin in Tauri against #9641's capable and pre-capability relay with a 2,000-reply thread: Oldest/Top, filtering/clearing, paging, Show in context, focus/anchor, keyboard/screen reader, and error/Retry; capture NIP-11 and emitted window requests. For Flutter iOS/Android, smoke channel/thread paging and read/unread state against both relays and confirm no newer-direction request from the legacy client.
Residual risk: Native UX and relay-skew behavior remain unproven. The reference test fixture has no Show-in-context journey and no asserted failed-scan/Retry state in the inspected tests; those are confidence gaps, not additional author-actionable findings here. Re-review after the author's change; no clearance carries to a new head.
Read replies' aux in the channel by #h, plus kind 5 and 9005 deletions that carry no h tag, hold each page as it arrives so a live deletion of an event already read is kept, and remember a root's refusal only after its fallback page completes. Follow kind 9005 live. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…avy root's Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…an h-less one in the fallback Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
A thread view dropped live and replayed replies older than its oldest page, so a reply from a skewed clock, or one sent while the client was away, never showed. Mark every subscription delivery as streamed and pass that to session observers; only finite reads (readPage and snapshotRead scans) stay limited to the view's window. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…s row by row When a presentation leaves out the message a link or inline reveal opened, the reader now withdraws it once per request, so the host reveals the target. A presentation made after the target was revealed, or a second one that leaves it out, stays, and the visit completes. Background and returning visits never withdraw. A presentation with collapsed branches leaves rows out, so reading stays row by row until every branch is open. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
The reference plugin added live rows to its cache before the session accepted the hold, so a refused hold left the cache over its bound and every later hold failed. Stage them until the hold accepts. Stop and release the scan when the reader takes its rows back. Before a scan counts as exact, read the conversation's messages again from the first page's time less NIP-CW's 960 s allowance, so a row that commits behind the walk's cursor is found. The fixture relay now serves plain message reads with since, and stamps bounds with its clock. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…s it The arranger reads through snapshotRead, which never reaches the views' accept paths, so the admission changes served no caller in this change. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
A plugin that wants a row shown asks for it with place { id }; the reader
already reveals the row a link opens. The fixture now keeps the reader's
place when the filter changes and starts at the top for a new sort.
Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: LordMelkor <kray@squareup.com>
The reader checked every channel window's bound, including the host's own reads, which the channel store already parses. A plugin reading through snapshotRead gets the bound as the relay sent it and can check its author against session.relayAuthor itself, as the reference plugin now does. The docs say so, and say what a readPage scan does to the host's open views now that their admission is main's. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
The heavy-root test deletes two top replies, then picks the reply with the most reactions on the paused page and deletes those reactions too. When it picked one of the two already deleted, the second deletion changed nothing and the test's own precondition failed, about one run in five. It now picks among the replies it keeps. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
#3552 added `catchUpMessageId` to `useReading`: the bottom row earns the dwell and catch-up reads through another row. That is what `endMessageId` did for a presentation, inverted. A presentation now passes its last drawn row as `latestMessageId` and its newest row as `catchUpMessageId`, so `useReading` has no prop of its own for it. The channel's catch-up row under a presentation is its newest top-level post, as main's rule is for the host's rows. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
A presentation turns partial when a branch collapses, when it starts or ends, and when it stops being whole. Restarting the reading effect then ended the visit, which drops a manual unread's protection from #3552. The effect now reads partial when it takes a lease, and a flip replaces only the leases. The reference plugin also presents again when its connection drops, so a thread it showed whole is no longer complete while it may be missing rows. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…pages Main's #3908 pages back toward a missing parent in the background, and every read in the channel feeds the open thread view. So the host's rows at a withdraw vary from run to run (175 to 256 in 20 runs), and its older pages keep landing after it. The test now takes the reader's row from the rows shown at the withdraw. It holds every read that starts after the withdraw, so the host's pages stop at a fixed point. A refresh would still be recorded, because a requested read aborts a held parent page. The test checks that no foreground read and no first-window re-read came after the withdraw. The reader stayed on the same row at the same offset in all 20 runs. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
Withdrawing a lane that was neither shown nor held changed nothing, but still notified every subscriber, so each unmount of an accessory that never presented woke them all. The row bound is now tested against a limit of two rather than a copy of the thread reader's 460, which the plugin test already pins. Two test names now say only what their tests check. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
A presented channel or thread lists every row it shows, so it folds no agent activity. Relayed runs fold through the same disclosures, but they were grouped from the host's own rows: a channel folded presented rows under groups from its chronological window, and a thread folded the plugin's rows in the plugin's order. Both now take the same rows as activity, which are none while a presentation shows. The subscriber test also pins the notification when a held lane withdraws. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
… ms wait The reconnect test proved that no read starts while the tab is hidden by waiting 20 ms of real time. Advance fake timers through the reference plugin's whole 10 s jitter window instead, so the check does not depend on real time. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
#3730 lets a plugin workspace open one invocation branch of a thread (`subthreadId`). That view's root is the invocation message, not the thread root, and its rows are only that branch. The reader bar gives an arranging plugin no way to tell, so a presentation there would show rows from outside the branch. A branch view now starts no arrangement: no reader bar, and the host's rows as main shows them. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
The reference plugin took the first relay-signed 39006 bound in a channel answer and trusted its body. A bound for another channel or cursor, a second bound for the same page, a has_more that disagrees with its cursor, or a cursor that does not move could end a scan early and call a partial list complete, or read the same page forever. Each lane now needs exactly one bound whose h and d tags name the channel and the request's cursor, with a well-formed cursor that moves the scan forward and agrees with has_more, as the host's own channel reader checks (parseWindow). Anything else fails the scan before the page is kept. The host already checks a thread page's bounds before a read returns. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
…tags NIP-CW step 5: a window answer carries exactly one kind-39006 bound for each window it serves, and a channel bound has exactly one d tag and one h tag. pages() now fails the scan when the answer carries more bounds than the lanes it asked for, or a channel bound carries any other tag, before it keeps the page or moves a cursor. Two new rows in the bounds table cover a surplus bound for a cursor nobody asked for and a bound with an extra tag. Co-authored-by: Clod <c7b21872e9ddb79ca62967d0e21e6a4518a669eb04648e963cdfb2426e62fafb@buzz.block.builderlab.xyz> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: LordMelkor <kray@squareup.com>
… edge cases Separate pure presentation evidence selection and live admission (selectEvidence, applyLiveEvents, allEvidence) and derived reader mode switches (readerMode) from the stateful shell in arrangement.ts, and fix the edge cases that lived in the imperative paths: - Exclude thread-root auxiliaries from live presentation budgets by keeping the header root separate from tracked reply rows. - Preserve non-displayed target evidence for selected multi-target auxiliaries so visibility checks keep multi-target deletions intact. - Admit verified live echoes of named pending own sends into tracked evidence so subsequent edits/reactions attach after outbox eviction. - Downgrade display.complete when a new non-replay in-scope row arrives outside the presented ids, without bumping revision. - Consolidate reader chrome/navigation guards through readerMode(display), keep ThreadPanel editMessages chronological, suppress arrival counting while presented, and settle reading when host legacy traversal pauses. - Include held events in linked-copy discovery (copiesOf), surface manual forced-unread state for held-only messages in attention/snapshot, and include held-only witnesses in complete DM read cutoffs. - Fix reference arranger fixture edge cases (abort scanning on fail, stop live ingestion after retention failure, retry overlap after forward exhaustion, avoid stalling on an oversized leading row). Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
3edff25 to
ed88f57
Compare
jedwards27
left a comment
There was a problem hiding this comment.
🤖 :bot: Jude’s code review agent
Client↔relay contract: NIP-11 buzz-window-newer and direction:"newer"/after paging depend on still-open block/buzz#9641. Exercise the actual Desktop Thread Sort reader and iOS/Android channel/thread pagination against capable and older relays.
Verdict: COMMENT — recommend request changes for the two author-actionable defects below. In this repository, a human reviewer decides whether to use the Request Changes action.
Reviewed: base 352f46e77e4eb0682fe2c29b7139f823f2effc74 → exact head ed88f57a631eb37c75ca0851a7efcfdaca339e67 (41-file three-dot PR delta).
Risk: high — presentation substitutes reader rows, live deletion evidence affects visible messages, and partial reading depends on relay window completeness.
Blocking — live multi-target deletion can leave a deleted presented reply visible. In src/features/messages/arrangement.ts:141–164,216–223, initial evidence drops omitted reply B when only A is presented, and delayed live aux admission looks for missing dependencies only in the arriving batch. A valid kind-5 deletion targeting A and B cannot then pass target visibility through the retained evidence and fold (src/features/relay/session.ts:500–518,3597–3607), leaving A on screen. An independent throwaway production-seam Vitest probe at this clean head failed: expected no rows, got A. The existing snapshot-only multi-target test at src/features/messages/arrangement.test.ts:619–631 does not cover delayed live arrival. Author action: preserve bounded target evidence for live aux admission (without depending on an optional plugin hold), and add a regression with A+B present in the initial snapshot, only A displayed, then a live deletion of both.
Blocking — focus drops to the page body when a presented selected row disappears. src/features/messages/ChannelTimeline.tsx:398–401 swaps the row set; :945–958 pins focused IDs only if they remain in that set, with no transfer when the focused row unmounts. A throwaway RTL probe at this head focused a host row, presented rows omitting it, and observed document.activeElement === body. A live Top re-ranking beyond the presented page, or an edit that stops matching a text filter, can remove the selected row while a keyboard or screen-reader user is reading it. Author action: transfer focus to a sensible surviving row or the history region on focused-row removal, without stealing it from reader-bar controls; assert the live-update case in a component regression.
Other contracts traced: Channel page responses now reject surplus kind-39006 bounds before retention (tests/fixtures/conversation-arranger/plugin.ts:278–317; regression at arranger-plugin.test.tsx:1237–1249), addressing the previous review blocker. Thread bounds are host-verified before admission (src/features/relay/thread-window.ts:113–175). Reader presentation tests exercise ordering, paging suppression, partial-read boundaries, anchors and Back/Forward target reveal; these do not establish native behavior.
Validation: At this exact head, independent focused Vitest in five files passed 128/128 and git diff --check passed. Another reviewer’s pnpm check passed on isolated Blox; its full pnpm exec vitest run and pnpm build were still in progress when this review was filed, not claimed as passes. Two temporary reproduction probes were removed and the checked trees restored clean. Hosted checks currently show 77 pass and one skipped (Windows native validation); hosted results are not native app/mobile evidence. No manual/native journey was independently exercised.
Verification owner: author for both fixes and regression tests; reviewer/tooling for changed-head suite and native Desktop checks; mobile/release verification for iOS/Android and capable/older-relay compatibility before merge. Residual risk: actual Tauri plugin UI, Show in context, failed scan → Retry, keyboard/screen-reader restoration, and mobile relay-skew behavior remain unwitnessed. Re-review the new head; this verdict does not transfer across commits.
…entations Retain bounded snapshot deletion-evidence candidates with live-growth headroom (unifying same-owner prior held evidence across replacements so omitted or previously displayed co-targets stay resolvable, ending cleanly instead of silently evicting held candidates when live growth exceeds limits, and short-circuiting candidate sizing at the cap), and recover keyboard focus when a presentation change or live deletion removes a focused row or collapsed reply branch summary across native browser focusout-on-removal semantics. Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
|
🤖 jedwards27, both blocking findings from review 6009665684 are fixed at e944bdf:
Checked on a separate Linux machine at e944bdf: |
…navigation Scope the :scope > [data-layout] focus target lookup in ReplyBranch to the new collapsed-branch summaryRef recovery path so pre-existing messageRef and collapseRef paths keep focusing [data-message-id] directly, preserving tests/browser/message-navigation.spec.mjs in Chromium and WebKit. Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
Merge origin/main (e5a9b4f: #4211, #2953, #2920, #4222 url 2.5.9, #4213 short docs). Resolved the two documentation conflicts from #4213 by keeping origin/main's removal of docs/plugin-architecture.md and shortened docs/buzz-help.md. Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
Merge origin/main (078aaaa: #3993 pin/unpin channel messages, #4270 plugin menu, #4253 cookie 0.18.3). Resolved the single capability conflict in browser-host/relay-broker.mjs by keeping both windowNewer and origin/main's pins properties. Co-authored-by: Neon <f68e5587c8df616f518c6e19ea842a595208c2f610357a8438457d26c2eb3c60@buzz.block.builderlab.xyz> Signed-off-by: LordMelkor <kray@squareup.com>
Someone reading a 2,000-reply thread today can only scroll replies in arrival order; this PR adds general reader-presentation hooks so a plugin can sort, filter, and page a thread or channel timeline in place while core draws only the chosen rows.
What changes
placement: "reader",arrangement.ts,ThreadPanel.tsx,ChannelTimeline.tsx): lets one mounted reader-bar accessory supplypresentation.eventsandlimits, drawing rows with normal controls while retaining other supplied events within bounded headroom for delayed live multi-target deletions, recovering focus cleanly without stealing reader-bar focus, and puttinguse-reading.ts/unread.tsintopartialmode.relay/session.ts,replyTree): addsfoldRows,retain()(1 hold per handle in the 64-slot / 8 MiB pool),snapshotRead(..., { priority }),windowNewer,direction: "newer"thread verification, andreplyTreeoptional parent lookup.tests/fixtures/conversation-arranger/plugin.ts): test fixture sorting Oldest/Newest/Top, filtering by person, and verifying NIP-CW channel page bounds; the production Thread Sort plugin ships outside this repo.buzz-window-newer; falls back to older pages without it). +8,598 / −192 across 40 files over 078aaaa (prod +1,740 / −166, tests/fixtures +6,858 / −26;FOUNDATIONedits insession.ts,contracts.ts,service.tsx,author.ts).What to decide or check
observelimit (live exact "Top" across ~50,000 replies needs summary/top-candidate tracking or a relay-ranked query); reconnects re-read at background priority after up to 10 s random delay when visible.readPagescan limits (>2,400 channel / >2,000 thread) and 503 busy-thread budgets predate this PR (snapshotReadis the supported scan path); plugin background scans take turns with host missing-parent pages (#3908).subthreadIdtask branch views (#3730) show host rows with no reader bar; Huddle end times (kind: 48103) aren't retained on start-row presentations; rows dated >300 s back arriving after the repair read wait for the next read.unreadcounts only host-fetched rows (forced-unread state and complete DM read cutoffs now cover held-only rows).buzz-review-completedis not added.Testing
At b8a3fad (main 078aaaa) on a separate Linux machine:
pnpm typecheck, 785 focused tests across 17 files (broker capabilities, pin management, ThreadPanel, ChannelTimeline, arrangement, reading, andauthor.test.mjs), and unfilteredvitest(25,941 passed, 0 failed, 39 skipped) pass. At 34d57a4 + 47fa0d6 / e944bdf (PR code unchanged since):tests/browser/message-navigation.spec.mjs(44/44 across Chromium & WebKit) and browser focus probe (12/12 each in Chromium 153 & WebKit 26.6) pass.674efc4c1; reference plugin enforces NIP-CW bound verification per channel lane.Core changes
Each core change keeps feature logic in plugins and adds only the smallest general hook:
session.foldRows(channelId, events, rootId?)canAccess,eventVisibility), proof checks, and the 650-line fold (relay/fold.ts) are private to core.ChannelMessagerows; no cache, reads, or view.session.retain()→{ set, dispose }snapshotReadrows.snapshotRead(filters, { priority })readRemotefeeds all open views.ReadOptions.priority(relay/reader.ts:13-16; 1 line + type).session.windowNewerbuzz-window-newer).searchSort, set by both hosts.direction: "newer"thread verificationplacement: "reader"accessory (present,presentation,limits)held.arrangement.ts,ThreadPanel.tsx,ChannelTimeline.tsx)heldEvidencewithin headroom, recovers focus safely, disables conflicting host chrome, restores omitted link targets.replyTree(rows, rootId?, displayParent?)use-reading.ts,unread.ts)partiallease input (collapsed branches forcepartial), surfaces held-only forced unread, and updates DM cutoffs.Prior review answers, largest files, reference fixture details, test doubles, timings, and related PRs
Answers to prior reviews
e944bdf5a(review6009665684): addedheldEvidencewithin bounded headroom for delayed live multi-target deletions, plusfocusRecoveryTarget,usePresentedFocusRecovery, and collapsed-branch summary recovery (scoping:scope > [data-layout]inReplyBranch.tsxto collapsed summaries so existing reply/thread-line handoffs keep main's outer row target).ed88f57a6: extracted pure functional core (selectEvidence,applyLiveEvents,allEvidence,readerMode), excluded root aux from limits, preserved multi-target deletion targets, admitted verified pending-send echoes, downgradeddisplay.completewithout bumpingrevision, keptThreadPaneleditMessageschronological, settled reading on paused legacy traversal, included held events incopiesOfand DM cutoffs, surfaced forced-unread for held-only rows.11f4a8cc3(fixed at6de6e4688): removed host window admission and channel-bound checks so main reads are unchanged when no plugin is installed; restored omitted message-link targets; treated collapsed-branch presentations as partial; added 960 s repair read; rebased ontoblock/buzz-app#3552.block/buzz-app#3660: droppedregisterArranger/loadAllin favor of mounted reader accessories.674efc4c1: added per-lane signed bound verification (h+dtags, forward cursor,has_moreagreement) in the reference fixture.Largest production files & architecture notes
arrangement.ts+837,ThreadPanel.tsx+237 / −46,ChannelTimeline.tsx+176 / −32,session.ts+120 / −9,unread.ts+75 / −30.readerMode(display)drivespresented,chronologicalChrome,hostNavigation, andpartialReadingfrom one source of truth.snapshotReadreturns raw relay bounds so plugins verify author/tags themselves.Reference fixture (
tests/fixtures/conversation-arranger/plugin.ts)endedrecovery, 960 s repair read, 503 by-id fallback, staged live updates, reconnect re-read while visible, and oracle comparison on a 2,000-reply thread and 5,000-row channel.End-user timings & test doubles
620c02aaf(relay80036cc8c): Oldest loads 1–200 in ~1.0 s and pages to 2,401–2,500 in 0.4–1.0 s/page; Top ranks 2,500 replies in 3.1 s; reaction re-ranks in ~0.3 s; reconnect recovers in 9.3 s; busy-thread 503 fallback matches oracle rows 1–134 of 2,529. Bundled with a test-only browser-catalog shim.ThreadPanel.test.tsx,ChannelTimeline.viewport.test.tsx, anduse-reading.test.ts.Related PRs
block/buzz#9641(relay oldest-first windows),block/buzz-app#3660(closed predecessor).docs/plugin-architecture.md, so the reader contract is documented on the exported types incontracts.ts.windowNewerandpinscapabilities inbrowser-host/relay-broker.mjs.Made with human guidance from the maintainer driving this work.