Repository navigation
List Threads newest first, so each resolved row's place agrees with its age - #7258
Merged
Merged
Conversation
…ts age Threads listed its rows in the page's order, the order `t` walks, so the ages down Resolved read as noise: on the maintainer's page, 5h, 3h, 3h, 5h, 3h, 3h, 5h, 3h, 3h, 2m, 3h. He asked for recency order, by the most recent event. Both groups, and a search's matches, now read newest first by `lastChange` (state/thread/model.js): a resolved thread by its closing, the event its age dates, and an open one by its latest turn, a rewrite included. It reads the log position (`seq`) rather than the clock, so no two served changes tie; the user's own reply, rewrite or resolve still on its way is newest, and a reply still streaming counts once the log holds it. A reaction, a Reopen press and a message the agent sends into a resolved thread without reopening it are events too, but not a thread's last change: "the most recent event" taken literally would put a resolved row the agent wrote into above younger ones while it still says the older age. The standing list held each row's section while news arrived; it now holds each row's place too, since a reply would otherwise move its row to the top under the reader. A row the user's own gesture moves still moves at once. Resolving a thread opened from Threads moves on to the next open thread in the list's order. The `t` walk keeps the page's order, so the list and the walk no longer agree; `inPageOrder`, which only the list and resolve's landing used, goes, and the walk-order test reads `threadPlace` as the walk does. Alongside: `moved` gave a rewrite still being sent its message's old log position beside the rewrite's clock; it now gives none, as for a message still being sent. A search's notice called an existing thread that came to match "1 new thread"; it now says "1 new match", the fact it already had and never reached. The fold's comment drops its reason for rejecting "the newest three resolved with the rest behind a row" (a second order in a page-ordered list), which no longer holds. Tests: the row-lighting test expects newest first; the held-rows test adds a reply to the oldest open thread and checks no row moves until the notice's press, then the settled order; three preview tests start their threads in the order that keeps their first row. A Node test covers `lastChange`.
leaf-agent
reviewed
Nov 26, 2026
leaf-agent
left a comment
Collaborator
There was a problem hiding this comment.
One sentence in docs/how-it-works.html still says Resolve follows the page's order. In the "Search, replies, and undo" table, the "Resolve a thread found by search" row reads "Resolving a thread opened from that list still advances through open threads in page order." resolveLanding now takes its next thread from openThreads, which is newestFirst(..., lastChange), so the row now contradicts the navigation-resolve-rule paragraph this PR rewrites a few lines above it. The fix is to end that sentence with "…still advances through open threads in the order Threads lists them." Since the line is outside the diff, I can push that one-line edit if you'd like.
leaf-agent
approved these changes
Nov 26, 2026
This was referenced Nov 26, 2026
max-sixty
pushed a commit
that referenced
this pull request
Nov 26, 2026
…e Threads lists newest first (#7274) `test_a_thread_on_words_a_widget_renders_stands_where_the_widget_does` failed on main ([run 45789964594](https://github.com/max-sixty/leaf/actions/runs/45789964594)). It read the page's order of threads off the Threads list, and #7258 made that list newest first, so its three threads came back reversed. After #7258 the page's order governs only the `t` walk ([`placement.js`](https://github.com/max-sixty/leaf/blob/main/browser/runtime/records/thread/placement.js)), so the test now walks `t` from the page's top. It expects the lede's thread first, then the thread on the diff's words (which opens in the diff), then the one below. #7258's intent and the protected behavior both hold: Threads stays newest first, and a passage inside a widget's shadow tree still stands where the widget does. Verification: the test fails on main with the reversed list and passes on this branch. With `byRenderedOrder` temporarily changed to sort by a plain `compareDocumentPosition`, which can't order across shadow trees, the new test fails at the widget's thread, so it still guards the cross-tree ordering. `LIST_ORDER` lost its only caller, so it is removed. The same report's other failure, `test_a_stuck_sidebar_track_keeps_its_place_to_the_page_end`, waits on the maintainer's decision in #7245 and is untouched here. Refs #7271 — automated triage Co-authored-by: leaf-agent <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Threads listed its rows in the page's order (the
twalk's), so the ages down Resolved read out of order: on the maintainer's page, 5h, 3h, 3h, 5h, 3h, 3h, 5h, 3h, 3h, 2m, 3h. Both groups, and a search's matches, now read newest first bylastChange(state/thread/model.js): a resolved thread by its closing, the event its age dates, and an open one by its latest turn, by log position. On that page Resolved now reads 17m, then seven 3h rows, then three 5h rows, each in the order its resolve was logged.Worth weighing: a reaction, a Reopen press and an unannounced agent message into a resolved thread don't count as a thread's last change, so a resolved row's place always matches its age. The standing list now holds each row's place as well as its section while news arrives (
threadsListing), and resolve's move-on follows the list's order. Thetwalk keeps the page's order, so list and walk no longer agree;inPageOrderis gone. Also fixes a search notice that said "1 new thread" for an existing thread that came to match, andmovedgiving a pending rewrite its message's old log position.The maintainer asked for this on a Leaf page ("can we have them in recency order, I think by the most recent event?"). Tests: a Node test for
lastChange; the Threads browser tests for order and held rows, updated; the other browser tests that pick Threads rows by position pass, three after starting their threads in the order that keeps their first row.