Repository navigation
Read markHere by name, not out of whichever module holds it today - #55
leaf-agent wants to merge 1 commit into
Conversation
3b9ea44 pointed the ask-marker assertion at runtime/asks/view.js after the split moved markHere there. That is the second path this reading has been pinned to and the second time a split reddened `ci` at it — the function came out of leaf.js in 9664448 and changed no behaviour either time. Which module holds a writer is a fact about the runtime's own composition, and the test is asking whether markHere still writes PAGE_PAINT_ATTRIBUTE.ask, because the theme's exclusions answer for a mark nothing would otherwise leave on the page. Pinning the path asserts both, so the reading breaks for the one thing it does not mean to hold still, and main is mid-way through a series of these splits. `_runtime_function(name)` walks leaf.js and runtime/**/*.js, requires exactly one module to define the name, and returns that function's source. The bound is the other half: the regex it replaces had no end, so any later writer in the same file could answer for markHere. The walk stops at the closing brace standing at the declaration's own indentation, which prettier guarantees and a brace count over strings, comments, and template holes does not. Bug-backs, each reverted after: markHere moved to runtime/asks/model.js — the new reading passes where the pinned regex fails, which is the red this removes; the paint moved out of markHere with a later writer in the same file keeping it — the new reading fails where the unbounded regex still matches; a second definition — reported as such rather than answered by whichever file the walk reached first.
|
Superseded — main landed both halves of this itself, minutes before this branch was pushed. d07de1e ("A box that scrolls contains what it scrolls") carries the repair in its own message: the reading now walks whichever runtime file defines The run that dispatched me, 33007893779 on 8ba3077 ("Split presence and banner runtimes"), is one of the two reds predicted on #51 — a stale commit, now two behind main, failing for the coupling d07de1e removed. No fix PR for it. Verified at main's head (d07de1e): Closing without deleting the branch, the way #51 was left, in case the |
…jection paint is reported once (#2552) A widget fed by `watchQuestions`, `watchReports`, `watchHistory` or `watchThreads` no longer reads its projection again each time it returns to the page. Before this change, a paint that failed was reported once more on every return. #2531 had already fixed this for `watchData`, using its own copy of the rule. Both watchers now use one helper. This is item #55 of the Lit survey follow-up review, numbered in that review rather than as a GitHub issue. ## Behaviour that changed (#55) - **One return rule, `readingPaint` (arrivals.js).** A paint is keyed by its reading. It draws only when the key has changed, or when the promise its last draw returned did not settle while the owner stood. That covers a departure in the middle of a paint, and a paint that settled after removal but before the departure reached the arrival batch. A finished paint stays, failed or not. The helper also pauses and resumes the paint's clock across a departure. A `refresh()` asked for while the owner is away now runs on the return; before, the unconditional re-read covered it, as when lf-activity's Markdown parser lands while the feed is away. `watchData` and `watchProjection` both use it, and data.js drops its `delivered`/`painting` bookkeeping. - **What a projection reading depends on.** `watchProjection` builds both its key and its subscriptions from one list of the three inputs it already listened to: the semantic epoch, the projection deferral, and the number of `PRESENTATION` announcements. The re-read on return came from #1929, where it was the way to catch up on changes missed while the widget was away. No reading depends on anything outside those three inputs. A reading withheld by `watchReports`' readiness proof is still owed. This replaces the separate `blocked` flag. - **Thread mirrors.** `mountThreadViews` returns its reconcile promise to the watcher, so a departure that cuts a reconcile short is owed on return. - **`HeldReading` takes its owner** (`new HeldReading(this, region, changed)`) and keeps its wait for unseen growth across a departure. Five widgets disposed it on departure and relied on the unconditional re-read to re-arm it: lf-activity, the Atlas plan, worker and tree, and the conversation workspace. With only the core change, a held reading in that pattern never showed after a return. The test below failed that way before this change. Those widgets no longer dispose or re-arm it, and lf-atlas-tree's re-arm from #2531 is gone. - **The lf-test-worker fixture** paints through its watcher's clock, not through a per-connection `clocked` paint that only a re-read re-armed. - **module-authoring.md** states the return rule once, under "Connection lifetimes", for data and projection subscriptions. The `widget-controller-lifetime` eval prompt no longer asks for a catch-up when nothing changed. ## Measured | Item | Hand-written source (excl. tests, Markdown, eval YAML, generated corpus copies) | Tests | |---|---|---| | #55 | +171 / −115 (net +56) | +164 / −11 (net +153) | The source total breaks down as the runtime (+167 / −103) and the example widgets (+4 / −12). `readingPaint` itself is +64 / −1 in arrivals.js, including its contract comment. ## Validation - `test_a_returning_projection_subscriber_reads_again_only_where_its_departure_cut_the_paint` failed on `main`: each of the three watchers called its failing callback twice and reported the failure twice. It passes here. It also checks that a projection paint cut short by a departure is drawn again. - `test_a_held_reading_shows_once_unseen_after_its_owner_returns`: with the core change alone and the old dispose-on-departure pattern, the held reading stayed on `first`. With `HeldReading` owning its lifetime, it shows `second`. - A Node runtime test covers `readingPaint`: a refusal stands, a cut-short paint is owed, and a paint that settles after removal but before departure delivery is owed. With the settle-while-detached line removed, that test fails. - The projection lifecycle test now expects no read on an unchanged return, and a clock tick after the return. - Focused browser runs pass: data and projection subscription lifecycles, the activity feed's held and print tests, the Atlas report hold, work roles, package thread mirrors, the PR brief clock, and the report narration proof. `test_primary_reader_revision_replaces_owner_without_losing_thread_draft` fails ("The page already has a Thread presentation") with or without this change. ## Not changed `widget-controller.js` (around line 254) clears `renderedReading` on departure, so a return re-runs `renderState` and the widget's subscriptions on an unchanged reading. This is a third return rule, and this PR does not test whether a `renderState` failure is shown again on return. Moving the controller onto `readingPaint` would also mean presenting its presentation ticket without a repaint, so it is left for a follow-up. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
test_the_ancestor_exclusions_ask_for_a_marker_and_not_a_tagreadsmarkHereout of a spelled path. 3b9ea44 repointed it atruntime/asks/view.jsafter the ask split moved the function there. That is the second path it has been pinned to and the second time a split reddenedciat this assertion — the function came out ofleaf.jsin 9664448, and changed no behaviour either time.The test asks whether
markHerestill writesPAGE_PAINT_ATTRIBUTE.ask, because the theme's:not(:where([data-lf-ask]) *)exclusions answer for a mark nothing would otherwise leave on the page. Which module holds the writer is a separate fact, about the runtime's own composition. A path spelled here asserts both, so the reading breaks for the one thing it does not mean to hold still — and main is mid-way through a series of these splits (Split navigation runtime,Split ask model and view runtimes,Split version comparison runtime,Split presence and banner runtimes,Split selection comment runtime, all within the last few days).Solution
_runtime_function(name)ininteract_support.pywalksleaf.jsandruntime/**/*.js, requires exactly one module to define the name, and returns that function's source.The bound is the other half, and it makes the reading stricter than the one it replaces.
function markHere\(\)(?:.|\n)*?PAGE_PAINT_ATTRIBUTE\.askhas no end, so any later writer in the same file can answer formarkHere. The walk stops at the closing brace standing at the declaration's own indentation — which prettier guarantees, and which a brace count over strings, comments, and${}holes does not.The walk reads a
functiondeclaration and no other form.runtime/asks/view.jsalready mixes both —readingBlocksits three lines undermarkHereas aconst … = () =>— so the failure message names what was actually looked for, which keeps that red self-diagnosing rather than sending the reader after a writer that left the layer.Testing
uv run pytest tests -q— 585 passed, 6 skipped; the one error is this sandbox having no Chromium (test_smoke.pybrowser gate), unrelated to a file-side change.ruff checkandruff format --checkpass. This touches no runtime, theme, or registry source, so the nightlytest_render_*modules are unaffected.Bug-backs, each reverted after
markHeremoved to a sibling module. Relocated the function intoruntime/asks/model.js. The new reading passes; the pinned regex returns no match onview.js— this is exactly the red the change removes, and the one that has now hitcitwice.markHere, a later writer in the same file keeps it. Rewrote the body toPAGE_PAINT_ATTRIBUTE.exhibitand appended adecoyPaintwritingPAGE_PAINT_ATTRIBUTE.askafter it. The new reading fails; the unbounded regex still matches, which is the vacuity the bound closes.function markHere()toruntime/asks/model.js— fails withthe runtime defines markHere() 2 times, rather than reporting on whichever file the walk reached first.const markHere = (fails withnone is no \function` declaration of that name under leaf.js or runtime/ — it left the layer, or it was rewritten into a form this walk does not read`.Supersedes #51, which was opened against the red on run 33003757211 and closed once 3b9ea44 fixed that particular red. The premise it was closed on is right —
ciis green — but the coupling that produced the red twice is still there, so this carries the path-independent reading onto main on its own.