Repository navigation
Open the closed file a thread is about when the user reaches the thread - #6857
Conversation
Reaching a thread whose line sits in a closed diff file now opens the file, by every route that takes the user to the thread. The maintainer reported a thread card standing beside a collapsed `docs/cost-model.md` row, its head reading "Earlier data · § docs/cost-model.md · new line 17", after `t` reached it on a sparkjoy review page. - Travel asks the widget to draw a thread's part (`lfRevealDatum`) for a thread on earlier data too. `scrollToThread` skipped any anchor whose status was `outdated`, so every line thread on a patch that `leaf data set` had replaced stayed on its closed file. The thread still stands on the file, since an earlier line number may name another line now. - A press on a margin marker that stands in for a part its widget hasn't drawn (`standsIn`, beside `revealAnchor`) opens the thread by travel. Before, it opened a card beside the closed row. - Travel to a thread whose part is yet to be drawn (`awaitsDrawing`), or drawn where the page doesn't show it, has the widget show it before choosing which of the page's drawings shows the thread, so on a window with no room for the rail a line thread lands in its seat beside the line rather than in the floating panel. `lf-diff`'s `lfRevealDatum` does nothing for a step already done, since one trip can ask twice. - Such a trip leaves a Back entry. It counts as a move when it plans its departure, and the thread pass's carry of a user off the margin entry the thread left (`holdThreadPlace`) yields to a live travel heading for that thread (`travellingTo`). On main, `t` to line 280 of a closed file scrolled 5,345 px and added no entry: the departure was judged from the file's row, which showed, and the carry landed the user first and cancelled the trip. - Going Back or Forward counts as the user's input in the intent clock (`document-inputs.js`), so delayed work begun before it, such as a trip still waiting on its file, lands nowhere. That trip used to land when the file arrived and rewrite the entry Back had restored, discarding Forward. - `module-reading.md` tells package authors that `lfRevealDatum` also gets keys from earlier data. `test_reaching_a_line_thread_opens_the_closed_file_it_is_about` covers a walk and a press, each with Back, and a thread on earlier data; all three cases fail on main. `test_back_while_a_thread_s_file_loads_leaves_the_user_where_back_took_them` covers the traversal. The runtime fixture for a blocked primary destination gains `placedAt`, which a travelling route now reads.
leaf-agent
left a comment
There was a problem hiding this comment.
A trip to a thread on an undrawn part now asks the widget's lfRevealDatum twice: onPage in thread/destination.js calls revealThread, and then scrollToThread runs drawThread again. lf-diff had to stop re-running selectFile to survive the second call ("Leaf can ask again for a part it has shown"). A package author reads module-reading.md to learn what that hook must do, and the reference doesn't say it must be idempotent. So a third-party lazy widget that toggles or rebuilds in lfRevealDatum breaks the same way lf-diff did. The suggestion states the requirement where widget authors will see it. The alternative is to have travelToThread skip the draw once the route has already drawn it, which would also save the second thread-pass wait.
The two new browser tests, the margin-marker browser tests in the anchors, code-reading, options and widgets files, and pnpm run test:runtime all pass at this head.
Travel asks a widget to draw a thread's part on every trip, and a trip that draws the part before choosing where the thread shows asks twice. The reviewer of #6857 noted that module-reading.md didn't say a widget's lfRevealDatum must tolerate that, so a widget that toggled or rebuilt there would break as lf-diff's selectFile did.
A thread whose passage sits in a closed `<details>`, a tab not chosen or a diff file the user opened and closed again now shows its margin marker on what the page shows in its place: the summary, the tab set or the file row. A press on the marker opens the fold and the thread by the travel #6857 added, on a phone too, and pointing at it outlines the fold. Before, such a row was withheld as skipped content, so a closed diff file showed a marker until it was first opened (the diff widget's stand-in row) and none once opened and closed again, and a closed disclosure or tab never showed one. Only rows holding a thread stand on a fold. A row that offers an action, such as a suggestion's Accept, stays withheld until the fold opens, so nothing is decided on content the user can't see. So does a row marking only an obligation, such as a deck's ask, since the deck counts those itself. Core reads the fold from markup alone: `closedOver` (shadow-tree.js) names a `<details>` without `open` or a box `hidden="until-found"`. `faceOf` (margin-projection.js) is the one answer that layout, the trace, the keyboard walk and a press read, so no widget is named. What to weigh: - An until-found box's face is the nearest drawn box round it, so a thread in a run the detail dial folds stands at its section's top rather than by the dial's ⋯. - A thread anchored on a suggestion element itself shares its row with Accept, so inside a fold it stays withheld as on `main`. - On a phone the thread opens in the floating panel, which adds no history entry. The tab that the press opens then names the current entry, as the browser's find does, so Back doesn't return to the earlier tab. The maintainer chose this on a Leaf page, over keeping the markers as they were or dropping the diff's stand-in row. Three rounds of independent Codex review found defects in the earlier commits, among them a suggestion's Accept showing on a hidden deck card or a fold a stylesheet lays out unseen, and a phone press leaving the fold shut. The later commits fix them. `test_a_thread_a_closed_box_hides_stands_its_marker_on_the_box` covers each fold, the suggestion, a press after the fold closed round its card and a press on a phone; 4 of its subtests fail on the first commit. The neighbouring margin and anchor browser tests, `pnpm run test:runtime` and `pnpm run check:browser` pass. > _This was written by Claude Code on behalf of max-sixty_
Reaching a thread whose line sits in a closed
lf-difffile now opens the file, byt, Threads, Show on page and a press on the thread's marker. Core already had the reveal that keeps packages and core apart: HTML's find-in-page reveal for<details>,hidden="until-found"and popovers, and the widget's declaredlfRevealDatum(key)for a part it hasn't drawn. Two routes skipped it. Travel skipped threads on earlier data (status === "outdated"), which is every line thread onceleaf data setreplaces the patch, and a press on a marker that stands in for an undrawn line opened a card beside the closed row.Worth weighing: travel to a thread whose line is yet to be drawn now has the widget draw it before choosing which of the page's drawings shows the thread, so on a narrow window a line thread lands in its seat rather than the floating panel. The thread pass's carry of a user off a vanishing margin entry (
holdThreadPlace) now yields to a live travel heading for that thread (travellingTo), so the travel lands them and leaves its Back entry; onmain,tto line 280 of a closed file scrolled 5,345 px with no Back entry. Going Back or Forward now counts as an input in the intent clock every delayed landing reads (document-inputs.js), so a trip still waiting on its file lands nowhere after Back; that is the one change here outside travel and the margin. A trip that draws the part before choosing asks the widget'slfRevealDatumtwice, which is harmless:module-reading.mdnow says Leaf may ask again for a part that already shows, as every walk to a drawn datum already did onmain, andlf-diffleaves a shown file as it is rather than selecting it again. Still open for the maintainer: whether a folded<details>or tab holding a thread should show a marker at the fold, as a never-opened file does now.Asked for by the maintainer on a Leaf page. The two new browser tests fail on
main; neighbouring diff, marker, walk and Back browser tests,pnpm run test:runtimeandpnpm run check:browserpass.