Repository navigation
Take a live revision in place when its executable inputs are unchanged - #689
Conversation
`setChildren` answers for a list its caller already holds. Live revision activation asks the other shape of the same question: two trees written independently, where the live one holds a reader's caret, selection, parked pointer, focus and armed key routes. Those belong to nodes rather than to markup, so a patch that matches and mutates keeps them and a replacement cannot. `patchTree` matches children by id, then by position among authored siblings of the same type and tag. It writes a matched text node's `data` so the browser carries the Ranges inside it, syncs the page's share of a matched element's attributes, and recurses. An upgraded widget is atomic: kept whole, or swapped whole. Every judgement the DOM cannot make — which live nodes are the runtime's, which elements a controller owns, whether such an element's source still describes it, and which attributes are the page's — is the caller's, so this module keeps no registry, namespace or document. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A revision this document takes on in place installs an authored page the same way startup does, and retires only what that revision rewrote. So `installDocument` is exported; `captureWidgetDescriptors` accepts the reference boundary its markup is about to stand in, which activation alone has to state because it reads the incoming revision off an inert copy; and `forgetWidgetDescriptors` drops the id-keyed readings a replaced widget leaves behind, which until now there was no way to drop. `resetAuthoredPage` becomes `forgetAuthoredOwners`, which the same activation calls with the owners whose markup changed instead of every page owner on the page. It has been dead since #666 and was the publisher's only `forgetAuthored` caller. The sign-off declaration rides the head, so it is read from the document rather than cached beside it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A revision's delivery now states what it is as running code, and the state naming the next revision states the same digest for it. Where the two agree, `prepareActivation` patches the authored page onto the arriving source instead of reloading: the roots and the authored head swap, `patchTree` reconciles `main`, and `installDocument` recaptures from the result. Where they differ it reloads exactly as before, handoff and all, because a live document cannot re-evaluate a module graph or redefine a custom element. Nothing is carried across, because nothing crosses. A caret, a native selection, a parked pointer, focus and an armed key sequence belong to the nodes the reader is over, and a patch keeps them. So does every widget the revision left word-for-word alone, with the state the log gave it; only the widgets it rewrote lose their baselines and descriptors, compared on the two source documents because after upgrade neither element's authored markup is in the page any more. The served revision's own markup is therefore taken before the modules import. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The digest decided whether a reader keeps their open document, so what it reads has to be what that document would have to re-evaluate. It read the registry resource whole, and `$layer` travels inside it: a re-vendor's content fingerprint and the producer's commit and dirty flag were enough to send a reader to a fresh document, though neither says anything about what the browser runs. It now reads the vocabulary without that stamp, the captured JavaScript modules, the authored inline module bodies, and the layer generation, which is the epoch `sameLayer` refuses a write across. `implementations` is gone with the rest: `widget_sources` resolves a tag to `page/widgets/<tag>.js` or `widgets/<tag>.js`, so the map was already a reading of the modules and the vocabulary rather than a fact beside them. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Two mechanisms already carry it. Vendoring substitutes the epoch into `runtime/layer-client.js`, so a re-vendor moves a captured module and the digest's `modules` reads the change; `sameLayer` refuses a write across a generation it does not know and reloads the page itself. A third copy beside them decided nothing, and it was the only reason the digest had to reach into `$layer` for a key a capture is not guaranteed to have. The digest is now the widget vocabulary without its `$layer` stamp, the captured JavaScript modules, and the authored inline module bodies. The test restamps the whole of `$layer`, fingerprint, producer, and generation alike, and requires the digest to stand, then moves the module vendoring writes the epoch into and requires it to change. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The ownership table, the two module sentences, and the authoring reference all stated that every live revision opens a fresh document. They now state the one fact that decides it, and what an author gets on either side of it: a revision carrying the same code is patched onto the page the reader is standing in, and a widget they left alone keeps its element and everything done inside it. TODO.md loses the item. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Two ways the first cut took a retained widget's own actions away from the reader, both found in the browser rather than by reading. A descriptor is bound to the revision whose markup it was read from, so re-reading the whole arriving document published every retained widget a descriptor the controller holding that element does not carry, and the availability check that compares the two failed: every action on the page went unavailable on the second patch. The patch now reads only what it inserts, through an `adopt` hook, so a widget the reader keeps keeps its descriptor. And this document's revision and the server view of it are one reading. Published apart, every widget rendered once against a state holding no view of the revision now shown — for many, indistinguishable from their authored condition, so the adoption behind it changed nothing and never reached them: a roster row that had heard from its worker three hours ago said it had never heard anything at all. Renders are synchronous, so adjacency does not help. `adopt` therefore takes the revision a live activation installed, and the activation hands it back for state application to adopt with the answer that named it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The three invariants #666 dropped come back from their base bodies, now as claims about a patch rather than a replacement: `main` and the browser document survive a revision and a stamp, an armed `g` sequence goes on naming the page in front of the reader minus the link the revision took away, and a parked pointer moves its hover Range off the detached v1 node onto the connected v2 one. Two cases join them. A prose revision leaves an untouched selection reading what it read, over the same node, with the focus and the element where they were — reached the way a reader reaches it, by asking for the new page while their selection stands, since a standing selection is a composition the page waits on. And a revision that rewrites one question replaces that widget while the question beside it keeps its element and the reader's focus in it. Cases that are about a fresh document say so: `executable_revision` gives a fixture an inline module body no other revision has, because nothing else in these pages is executable and they would otherwise be testing the patch path under the old name. The Command Hub case turns over: its owners and listeners now survive the revision that leaves their code alone, and its widget still answers for itself afterwards. Two panel readings the reader had set — a Resolved narrowing and an expanded shortcut shelf — stand through the revision rather than starting over. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
A review's live probe put a selection in the second of four unided paragraphs, inserted one above them, and watched the reader's own text node have its words overwritten with the next paragraph's while the last paragraph went for want of a partner. Walking two child lists in step is right until something is inserted, and then it is wrong in the way that costs a reader most. So the siblings that did not change are found first, by an exact signature — node type, tag, and the authored words under it, skipping whatever the runtime put there — and pinned through `diffArrays`, the same vendored spine the text alignment runs on. Only the gaps between those pins are walked in step, which is what still pairs a paragraph with its own rewrite. A primitive may now import a vendored bundle: one initializes nothing and reaches no other module, which is what that rule is about, and the alternative was a second copy of an algorithm the layer already carries. Four more from the same review. A template's tree is its content fragment, so a patch that read `childNodes` left every template on a page frozen at the revision it arrived in. What the patch takes out is now said as it happens, through a `retire` rule, rather than predicted from the two sources, which got it wrong for a widget nobody touched inside a wrapper that was replaced. Widgets arriving with a revision are captured as that revision's rather than the departing one's. And an answer that could not be adopted no longer patches the document first: `canAdopt` asks the one definition `adopt` uses, before the install edits anything the reader is looking at. Co-Authored-By: Claude Fable 5.1 <[email protected]>
An anonymous preserving owner is identified by where it stands among the document's other preserving owners, which is a fact about all of them. A patch that inserts or drops one renumbers the rest, and reading the arriving copy alone left the standing owners on the numbers they arrived with, so two of them could answer to the same name. The owners are renumbered over the document the patch left. The interaction gallery writes the third `lf-revision` prelude in the tree and was the one without an executable identity beside it. The contained page never follows a revision, but a prelude that says what a document is has to say all of it wherever one is written. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Every delivered document reads the digest, so a revision saved before capture recorded one answered with a bare missing-key failure — and it took the page's whole version history with it, since every one of those addresses is a served document. The refusal now says the revision predates the field and that saving the page again records it, which is something a reader or an agent can act on. The active descriptor read that field through `read_artifact`, which on a cache miss materializes every captured byte of a revision to reach one line of its manifest, and the active descriptor answers every state read. It reads the manifest alone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
`page init` mints a fresh layer generation, and the generation is part of what a revision is as executable code. Re-vendoring on every save therefore made every preview revision a different program from the one before it, so the one surface where this is watched by eye could only ever show a revision arriving as a fresh document — never the patch, which is what a prose edit gets a reader. The watcher now re-vendors when the layer it watches changed, or when the source asked for different packages, and copies the source alone otherwise. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The template recursion had no case of its own. It has one now, over the shape an authored page may actually hold: `<template data-interaction-page>`, which static validation admits and every replay in the feature gallery instantiates. Reading the element alone leaves that markup at the revision it arrived in while the element and its attributes keep up, so the failure is silent, and the test goes red against a patch that reads `childNodes`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Which widgets a patch may keep was being answered in the browser, by holding a clone of the whole authored `main` for the document's lifetime and comparing serialized markup against a fetched revision's — with the delivery's own address normalized out of it, because the same media file is written differently under two revision roots. The capture already knows the answer and knows it about the markup before delivery touched it. So the manifest gains `widgets`, one digest per declared widget with an id in the authored page, taken from the parsed tree beside `executable`. Delivery states it in the head the way it states the revision and the executable digest, and the browser reads two of them: its own at boot, and the arriving revision's out of the document a patch already fetches. Neither costs a request. A resource of its own would put one on the activation path, and `/api/state` would repeat the map on every read of a page most of whose readers never see a revision — against which the bytes are noise, since the largest public example declares 49 widgets and this replaces a clone of the entire page. The browser loses `initialDocument.source`, `authoredSource`, `sourceMarkup`, `REVISION_ROOT` and `rewrittenWidgets`; `unchanged` is now a lookup. version.js is 18 lines shorter for it. `retire` still says what actually left the document, so structure changes are not predicted from either map. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # scripts/browser/generated/browser-runtime.js.map # scripts/browser/generated/browser-runtime.manifest.json # skills/leaf/assets/vendor/browser-runtime.js
Co-Authored-By: Claude Fable 5.1 <[email protected]>
A gap between pinned siblings holds insertions as well as rewrites, and a cursor meets an insertion in the two ways that cost a reader their node. A sibling of another kind above the paragraph they are reading — a heading, a list, an unnamed widget — is nothing the cursor can pair, so it spends the cursor and the paragraph is left with no partner and removed. A sibling of the same kind takes the pairing that belonged to the paragraph below it. So the gap is diffed too. Compared rather than keyed, because what may pair here is not an equality: two elements the source names differently are never each other, while an element named on one side only is that name being given or taken away. A key would have to make `p#a` equal `p` and unequal `p#b` at once, so the rule travels as the comparator it already is. Which exposed the claim next to it. Assigning a text node's `data` replaces the whole node, and the platform's replace-data step collapses every Range endpoint inside what it replaced — so the reader's selection went, in exactly the paragraph a revision rewrote while they were reading it. Only the differing run is spliced now, and a selection over words the revision kept survives the words beside it changing. The authoring reference said they keep their selection; it now says when, and names the one shape nothing can decide. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Four deliveries write a document's identity and three wrote their own copy of
it, so the export and the gallery's contained page each said less than the HTTP
boundary did — both missing the widget digests, and the gallery's comment
claiming the completeness its own block had just broken. `delivery_identity`
moves beside the rest of what delivery adds to a captured revision, and HTTP,
the live shell, the MCP app and the export all say it. The gallery writes the
same set from what its own document was served, since it cannot call Python.
Two defaults that answered a question nobody had asked. `runtime_document`'s
`widgets or {}` and the manifest's `.get("widgets", {})` both read an absent map
as an empty one, which is not "we do not know" but "no widget here was written
as anything" — and a patch reading that replaces every widget on the page. Both
are required now, as `supervised_document` already was.
`retire` could also run after `adopt` for one id: removals happen per parent, so
a widget the revision moved under an earlier parent is inserted and read there
before the later parent's removal reaches the element it left behind, and the
forget dropped the descriptor its arrival had just captured. An element going is
not the same as its name going, so the question is now whether anything on the
page still answers to that name.
`watch_paths` gained its layer reading two commits ago without its test caller
following; the export suite caught it, and that caller now asserts the split.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Page standing was a shape, not an identity: an owner's id, a tag, the control's first class, its index among siblings of that kind, and a string of its role, form attributes and words. Every part of that can be true of a control the revision put somewhere else, and what a wrong match wins is the reader's next press — on a button that now says Publish. A patch never needed it. A control the revision kept is the same element and still holds the focus, because nothing took it; one the revision replaced drops focus to `body`, where the page's own keys are live, which is the honest answer for a reader whose control is gone. A reload cannot do better than the guess, so it stops trying and lands on the page. What crosses is what is stated rather than inferred: the reading landmark, the comparison base, the pointer, and the margin's own retained standing, which is keyed by the entries and owners it names. `captureStanding`, `restoreStanding` and `controlMeaning` go, with the handoff field and both restores — 90 lines out of version.js for 17 in. The test that existed to prove the guess was revalidated goes with them; the fresh-document continuity journey keeps its subject and now says that focus is one of the things continuity does not include. Co-Authored-By: Claude Fable 5.1 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
Six defects on the patch path, five reproduced in a browser against 8572ae1b. The digest split, the delivery identity, and the head/root attribute handling all check out — these are all in the reconciliation itself and its error contract.
A top-level <template> with whitespace in it wedges activation for good
patchTree swaps in live.content / source.content, and patchChildren then calls rules.generated(node) on the fragment's direct children. generated is (node) => !isAuthored(node), and authored() routes a text node through elementOver, which throws when parentElement is null — which is every text node directly under a DocumentFragment. authoredText's node.content recursion hits the same wall.
test_a_revision_reaches_the_markup_held_inside_a_template passes only because its fixture writes <template id="tm-held" data-interaction-page><p class="tm-line">…</p></template> with no whitespace between the tags. Put the template on three lines the way examples/developer/feature-gallery.html writes it and the leading "\n " throws inside mount(): the page logs read failed: a module staged bare text into a shadow root: "" has no element over it on every heartbeat and never applies that revision or any later one. The gallery's own templates escape today only because they sit inside lf-tabs id="bg-interaction-tabs", which is x-upgrade and so atomic to the patch — but validation/markup.py permits a <template> anywhere.
The MCP App's direct probe cannot call runtime_document
scripts/mcp-app/direct.py passes active["version"] as the fourth positional argument, which is now widgets, and then passes widgets= as well. inspect.signature(runtime_document).bind(...) raises TypeError: multiple values for argument 'widgets', so scripts/mcp-app/run-direct-probe.sh dies at the first document request. Nothing under tests/ imports direct.py, which is why the suite is green. Inline suggestion below.
A declared widget without an id is destroyed and rebuilt by every revision
unchanged starts Boolean(element.id) && …, and the manifest map only digests elements carrying an id, so an x-upgrade widget written without one can never answer unchanged and always takes the retire-and-replace branch. Marking a live <lf-gloss tip="…"> with a probe attribute and then landing a revision that rewrites a different paragraph: the probe is gone, and the same page with an id on the gloss keeps it. examples/pr-walkthrough.html uses <lf-gloss> twice with no id, and page-authoring.md does not ask an author to name one — so a reader holding a gloss open, or standing on its Explain control, loses it to a revision that never touched the sentence.
Highlighted code blocks are reconciled as if the tokenizer's spans were page source
GENERATED is .lf-ui, [data-lf-gen], but highlightBlocks does code.replaceChildren(...synNodes(...)) on authored <pre><code class="language-*"> and synNodes marks its spans data-lf-syn only — deliberately, so the anchor pass reads them as page text. So generated() is false for them and the patch diffs N spans against the source's single text node. For an untouched block, signature still pins the <code> (its authoredText concatenates the spans back into the source string), patchTree recurses, and every span is removed and the text node rewritten. Reproduced: after a revision that changed only a sibling paragraph, the block's first child is detached. The words come back because dress re-highlights, but "the common revision moves nothing at all" is not true of any page with a code block on it.
patchAttributes retires attributes the browser owns, not the author
Its two sets come from authoredAttributes, which filters only data-lf-* and lf--prefixed classes. Anything else on the live element that the arriving source does not carry is removed — including state the user agent or the runtime wrote there. Two reachable cases, both reproduced:
A <details> the reader opened closes under them. open is a content attribute the UA writes on toggle, so it reads as authored: present in held, absent from the inert source's wanted, removed. The element survives by id and collapses. The reverse holds too — an authored <details open> the reader closed springs back open. examples/live-progress.html, pr-walkthrough.html and security-boundary.html all use <details> with ids, and the root CLAUDE.md names this case directly: "Focus, scroll, selection, disclosure, draft editing, drag, and layout remain with their mechanical browser owners until a gesture becomes a declared application fact."
And focus is lost wherever focus.js lent the tab stop. A reader who follows a Go-to hint to a paragraph is standing on a tabindex="-1" the runtime lent and removes on blur; the patch strips it as an authored attribute and the browser blurs. Driving g plus the hint for a link, then landing a content-only revision: document.activeElement is body and the paragraph's tabindex is gone. 8572ae1b's new comment — "focus the revision did not disturb was never lost, because the control is the same element" — is not true here: the element is the same, and the patch took away what made it focusable. This was the case restoreStanding used to catch on the patch path, and 8572ae1b removes it.
prepareActivation's new return shapes break its other caller
prepareActivation now returns a bare { stale: true }, and state-feed.js's heartbeat does const activation = await prepareActivation(runtime.state); if (activation?.activates()) … with no stale check — only receiveState has one. Before this branch every non-null return carried activates, so the shape was unreachable. Reach it (a deferred revision plus a re-vendored layer, so sameDelivery is false and revisionDocument resolves null) and every heartbeat throws activation.activates is not a function, reported as tick failed: … and clearing readAnswered, for as long as the deferral stands.
Same function, adjacent: the revisionDocument await sits in a try that reports and returns null, but await importWidgets(doc.querySelector("body > main")) on the next line is outside it. widget-loader.js caches the rejected module promise, so one 404 on a module the arriving revision introduces rejects receiveState permanently — no comments, status, activity or threads until a manual reload.
The pre-digest manifest guard
manifest_executable's ArtifactError is a ValueError, so _send_document turns it into a 500 naming the manifest. On the live root that is unreachable — adding executable/widgets moves the manifest digest, so activate_source mints a new revision first. The addresses where it is reachable are /versions/vN.html and /revisions/rN-….html, and those are exactly the ones "save the page again to record it" cannot repair: the old revision is immutable. test_a_revision_saved_before_the_executable_digest_says_so asserts only the exception text, while its docstring claims "A page whose history predates this field still serves its own version list" — which nothing exercises and the version documents contradict. Per CLAUDE.md's Stage ("Add a guard only for a reachable condition with a useful response"), either drop the guard and let stale state be regenerated, or make the historical addresses answer with something a reader can act on.
How the browser findings were reproduced, and what else was run
Each is a throwaway case under tests/, run with --run-nightly -n0 against 8572ae1b, arranged like test_a_prose_revision_takes_only_the_words_it_rewrote: serve v1, mark the node in question from page.evaluate, write v2 to index.html, told(page), read the mark back. The template case fails at told(page) itself, because the page stops applying state at all.
The existing suite is green here: tests/test_render_projection.py --run-nightly 127 passed, tests/test_render_startup.py --run-nightly 95 passed, and tests/test_interact_document.py tests/test_interact_server.py tests/test_website_server.py 332 passed. Note that test_render_* is nightly-marked, so CI's test job did not run the nine new browser cases this branch adds.
Happy to push the direct.py fix if you'd like it off your plate. The rest look like they want your call on where the boundary between page source and browser-owned state is drawn — generated and authoredAttributes are both answering that question today, and both answer it by namespace rather than by ownership.
A patch now diffs the revision the page is standing on against the arriving one and applies only that difference through a source-to-live map, so everything the browser, a reader, the runtime, or a page module changed in the page since it loaded is left alone: an open disclosure, a lent tab stop, a tokenizer's spans, a module's own output. Unnamed widgets are keyed by tag and ordinal in the capture so they survive a revision that left them alone; a template's content patches; a stale activation answers the heartbeat; a module that fails to import is reported rather than cached; a revision captured before the executable digest takes the reload path instead of a refusal. Co-Authored-By: Claude Fable 5.1 <[email protected]>
# Conflicts: # tests/test_interact_document.py # tests/test_render_projection.py
The browser now walks template content when numbering unnamed widgets, as the capture does, so a widget held inside a template no longer shifts the digest every unnamed widget after it is checked against. An element no capture digested is compared past the delivery root each revision wrote into its resource references, rather than on markup that differs by address alone. An element a page module moved elsewhere is patched where it stands instead of being rebuilt beside itself, and everything paired under a replaced element leaves with it. Two guards for unreachable conditions are gone, the prelude annotations admit the absent digest, and the docs state the contract for an element whose children a module took. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The fixture no longer carries a first revision, so the test creates one the way a save does before it rewrites that revision's manifest. Co-Authored-By: Claude Fable 5.1 <[email protected]>
leaf-agent
left a comment
There was a problem hiding this comment.
Five defects on the patch path, all reproduced in a browser against 77eb92f6. The
rewrite answers the earlier round: the template fence, the unnamed-widget key, the
<details>/tab-stop attribute rule, the tokenizer's spans, stale's shape, and the
pre-digest reading all check out, and test_render_projection.py --run-nightly is
131 passed here.
Four of the five come from one seam. arrive() now runs the pre-upgrade readings on a
single imported node instead of on the whole arriving main, and three of those
readings are about the node's place in a document it does not have yet; the fourth is
the dressing pass, which no longer covers an element the patch edited but did not
replace.
A widget the revision rewrote stops being quoted, so exhibit material becomes actionable
arrive calls captureWidgetDescriptors on the detached import, so quotedBy walks
parentOf from a root whose parentElement is null and answers false. Nothing
corrects it afterwards: rememberAuthoredParents has already recorded null and
guards on !authoredParents.has(element).
examples/developer/feature-gallery.html writes <lf-specimen id="bg-specimen">
around <lf-options id="bg-specimen-options" choose multiple>. The specimen is
x-exhibit, lf-options is x-upgrade, so a revision that edits the options markup
recurses through the specimen, finds the options atomic-and-changed, and arrives them
alone. Reading widgetController(options).read().actions across such a revision on
that shape: {choose: false, answer: false} before, {choose: true, answer: true}
after. application.ts gates both on !descriptor.quoted, so a reader can now record
a decision against material the page declares as evidence. declaredAncestors returns
[] the same way, so parent and ancestors are empty for any arriving widget nested
under a declared element.
The same widget loses its passage fence, and capture then accepts an anchor the file cannot confirm
rememberPassageParts finds its roots with scope.querySelectorAll(tag), which never
matches scope itself — unlike elementsIn, candidates, rememberAuthoredParents,
and the root.matches?.(BLOCK) line this branch adds to highlightBlocks. When the
arriving node is the widget, it never enters opaquePassageRoots, and pageText's
cellOf stops fencing it.
Driving test_browser_and_file_captures_stop_at_the_same_widget_fences with a revision
that rewrites the milestone rather than only the title: the browser captures
{section: gate-milestone, quote: "Build feeders", prefix: "Roadmap"} where the file
captures {section: gate-milestone, quote: "Build feeders"} — the prefix is the <h1>
outside the widget. That is the root CLAUDE.md rule under Validate once and share
readings: "File capture must never accept an anchor the rendered page cannot
resolve." Making both loops root-inclusive fixes it; the untouched-widget case still
passes.
An authored class written over two lines wedges activation for good
tokens splits on " " alone. It used to be fed authoredAttributes' output, which
came back through classList and so carried no whitespace; it is now fed raw source
text. One newline-wrapped class list is enough: the page logs read failed: Failed to execute 'remove' on 'DOMTokenList': The token provided ('note\n') contains HTML space characters on every heartbeat and applies no revision, this one or any later one. The
throw also escapes mid-patch, so authoredSource and sourcePairs are left describing
a document the DOM no longer matches. Suggestion inline.
A word the patch writes onto a surviving element never reaches the page
settle dresses arrived only, and an element the patch edited in place is not in it.
Four shipped tags declare x-says without x-upgrade — lf-metric,
lf-chronology-entry, lf-column, lf-specimen — so they are never atomic and
patchAttributes writes their attributes straight through. A revision that adds
delta="+3" to a live <lf-metric id="m" value="42">: the attribute lands, no
<span data-lf-said="delta"> is ever created, and the element's text is still 42.
The number is unreadable to a screen reader and unpointable for a comment, and
silentWords is the render gate that names it. renderQuiet self-heals through
projection/presentation.js; renderSaid has no second caller. The same gap runs the
other way through highlightBlocks: a <code> that gains language-python is not
atomic, so the class is written and the block stays plain until a reload.
Media the revision never mentioned is re-addressed and re-fetched
patchAttributes compares src/href/poster verbatim, and delivery writes each
revision's own root into them, so an <img> nobody touched always disagrees. Measured
on a two-revision page: src goes /revisions/r1-…/media/shot.png →
/revisions/r2-…/media/shot.png and one load fires. The element survives, the bytes
do not — a <video> or <iframe> loses its state outright, which is the class of
thing this branch exists to keep. sameAuthoredMarkup already does this reading for
kept; the same unrooting as a caller rule through patchAttributes makes the probe
pass, and keeping the older address is safe because revisions are immutable.
How these were reproduced, and what else was run
Each is a throwaway case under tests/, run with --run-nightly -n0 against
77eb92f6, arranged like test_a_prose_revision_takes_only_the_words_it_rewrote:
serve v1, read the fact in question from page.evaluate, write v2 to index.html,
told(page), read it back. The quoted case reads
widgetController(el).read().actions from an authored module; the fence case reuses
FENCED_CAPTURE_PAGE and compares the appended comment's anchor against
anchor_capture.capture_anchor over the same source, exactly as the existing case
does for revision == 1 and 2.
tests/test_render_projection.py --run-nightly: 131 passed on this tip.
Happy to push these. The class-attribute and docstring fixes are the inline suggestions
below; for the quoted, fence, and media ones I have patches that each turn their own
probe green — a root-inclusive rememberPassageParts, an arrive(node, liveParent)
that states the authored parent before the descriptor capture reads it, and a
sameValue caller rule beside same so patchAttributes reads past the delivery root
the way sameAuthoredMarkup already does. Say the word and I'll land them.
The dressing gap is the one I'd rather you decided: closing it means either re-dressing
what the patch edited or having arrive answer for in-place attribute writes too, and
which of those is the right altitude is a call about this module's grain.
A node a live revision brings arrives alone, so the readings taken off it before a controller owns its children are told the parent it will stand under: an exhibit still quotes a rewritten widget inside it, and its declared ancestors are the live ones. The passage fence reads the arriving root itself, as every other pre-upgrade pass does. An authored class list written over two lines tokenizes on any whitespace. A media address that differs only by the revision it was delivered under is the same address, so an untouched picture keeps the one it has and is not fetched again. An element whose attributes the patch rewrote in place is dressed again, with a said word following its attribute and a tokenized block keeping its spans. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Four nightly diff tests appended new `lf-diff` elements after page presentation, outside the immutable authored-widget descriptor capture. This authors the same inert-markup, malformed-hunk, rename, and final-empty-line specimens before serving the page, removing the dynamic DOM setup and frame polling. The stale construction had been latent since #666 and surfaced in the nightly run after #692. Runtime behavior and the patch-activation work in #689 are unchanged. The test guidance now describes the authored-lifecycle boundary directly instead of retaining the removed frame-poll exception. Validated with the repository pre-commit hooks and all nine `a_diff_` nightly cases. > _This was written by Codex on behalf of max-sixty_
leaf-agent
left a comment
There was a problem hiding this comment.
tests/test_render_widgets.py::test_notification_configuration_becomes_a_commentable_local_artifact
fails on this branch and passes on the merge base 7acc84b9 — same machine, same
selection, 4/4 against 2/2. It is not from f65c187a: reverting every runtime file that
commit touches back to 77eb92f6 leaves it failing. CI's test job cannot see it,
because test_render_* is nightly-marked.
A patch install that never settles takes the state feed with it
The page stops at revision 2 with the server on 3 and stays there. data-lf-reading
never moves again for the rest of that page's life, so no comment, status, thread, data
replacement or later revision reaches the reader. Nothing is said about it: no
pageerror, no console error, and the delivery ledger keeps counting answered reads
({"asked":13,"heard":13,"pending":[]}).
Instrumented, the last state turn reads
{rev: 3, activates: true, following: 3, canAdopt: true} and so takes
await activation.install(). The patch completes and brings no roots — this revision
rewrites one <h1>'s words — and settle then never returns:
presentation.present(scope, …) resolves, and the await whenApplicationPresented()
after it does not. Every later read queues behind that blocked runSerialized turn,
which is why the page goes quiet rather than noisy.
The trigger is the data replacement travelling in the same answer. Dropping the second
cmd_data_capture from the test — leaving the revision, the reply and the pickup where
they are — lets the revision land, and the test runs on to fail on its own artifact
assertion instead. The first revision in that test carries a capture too and installs
fine; the difference is that it brings lf-text-document into the page, while the
second leaves it standing and changes only its data.
That reads as a circular wait: the install waits for every required renderer to have
committed the current semantic epoch, and the renderer that owes this epoch is the one
whose data arrived in the same answer — which only reaches it once the state turn now
blocked on the install completes. Worth checking against the epoch and
notifyChangedData ordering rather than taking my reading of it.
It is worth more than one red case because the old order made a hang here unobservable.
install() was a reload returning a promise that never settles, so the old realm
stopping was the point. Now it returns into the same document, and a patch that does not
settle is a live page that has stopped answering with nothing said — the failure mode
this branch is least able to afford, since a patched page is the one that no longer
proves itself by reloading.
How this was established
Both halves ran with --run-nightly -n0 on the same host. Base is a worktree at
7acc84b9; uv.lock, pyproject.toml and examples/notification-playground.html are
untouched by the PR, so the environments are the same.
- PR head, alone: fails 4/4 at
wait_for_revision(page, refined["revision"])after the
full 30s oftold(). - Base, alone: passes 2/2 in 9s.
- Reverting
dom-children.js,presentation.js,projection/authored.js,syntax.js,
version.jsandwidget-loader.jsto77eb92f6together: still fails. - At the timeout the page reports
currentRevision: 2,runtime.versionsending at v2,
and/api/stateansweringactive.revision: 3withbrowser.viewsholding3alone. - Markers pushed from
activateRevision,patchDocumentandsettleend at
A:start 3,B:beforePatchDocument,P1:patchReturned 0,S1:presented— and no
S2:appPresented.
The five test_render_gate.py failures in the same nightly selection
(test_page_fixture_renders[data-explorer],
test_an_authored_project_widget_loads_through_the_real_layer,
test_the_render_gate_requires_a_declared_conversations_host,
test_a_wait_before_the_entry_is_released_names_only_the_page_s_own_request,
test_current_presentation_probe_reopens_and_ignores_superseded_work) reproduce
identically on 7acc84b9 and are not this branch's. tests/test_render_projection.py
is green here, its four new cases included.
The fence repair is the one in f65c187a with no case behind it
within makes both loops in rememberPassageParts root-inclusive, and nothing drives
it. test_browser_and_file_captures_stop_at_the_same_widget_fences is the case that
would: its revision == 2 branch replaces </title> alone, so the lf-milestone's
digest is unchanged, the widget is kept, and arrive never runs on it. Nothing else
captures an anchor across a revision — tests/test_render_projection.py calls
capture_anchor nowhere.
Its failure is the silent kind: a fence that stops fencing yields a quote the file
reading cannot confirm rather than an error, which is the rule the root CLAUDE.md
states under Validate once and share readings. It wants a case of its own rather than
an edit to that one, since the file side reads FENCED_CAPTURE_PAGE directly and a
revised source has to be threaded through. Happy to push it.
A patch install runs inside the state turn that carries the revision, and that answer may also carry a data replacement for a widget the revision left standing, which reaches the widget only after the turn adopts the answer. The install and the page-interface settlement now wait for the widgets and regions the patch itself brought rather than for the whole application, which was a wait on a renderer whose turn could not come until this one returned: a page that stopped there stopped answering with nothing said. The fence reading of an arriving widget root gains its case. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Five complete-suite render-gate cases had drifted from the current page contracts. The shipped data-explorer now gives each generated field a stable name and declares its horizontal table frame, while the tests mutate the current reactive widget fixture explicitly, republish changed package content instead of editing an immutable served revision, and consume the real revision-scoped request path. The superseded-presentation journey now asserts only its own contract; failure retention remains covered by the presentation coordinator's TypeScript unit suite. Runtime code and the live-revision work in #689 are unchanged. Validated with all five reproduced failures, the full 108-case render-gate file, the data-explorer interaction and generated-corpus checks, the repository pre-commit hooks, and the 1,115-test ordinary suite. > _This was written by Codex on behalf of max-sixty_
A live revision now reaches a reader through one door with two installs behind it, and one server fact decides which. Each revision's manifest records an
executabledigest over the inputs an open document cannot re-evaluate: the registry vocabulary without its$layerstamp, every captured JavaScript module, and the inline module bodies. When the arriving revision's digest matches the document's, the authored page is patched in place at text-node granularity, so caret, selection, hover, scroll, focus, element identity, and an armed key sequence survive because the nodes do. When it differs, the existing fresh-document path runs unchanged. Prose, markup, styling, and media never cost a reload; #666's reload-on-every-revision was the behavior this replaces, and the pre-#666 whole-mainswap never kept identity insidemaineither.Where to read
skills/leaf/scripts/leaf/revision_artifact.py: theexecutabledigest and the per-widgetwidgetsdigests (authored markup, pre-delivery), both computed once at capture.files.active_descriptorexposesactive.executable;revision_delivery.delivery_identitywriteslf-revision,lf-executable, andlf-widgetsinto every delivered document.skills/leaf/assets/runtime/dom-children.js:patchTree, besidesetChildren. A patch diffs the revision the page is standing on against the arriving one, both inert authored sources, and applies only that delta through a source-to-live map built at boot and kept by each patch, so anything the browser, a reader, the runtime, or a page module changed in the page (an open disclosure, a lent tab stop, a tokenizer's spans, a module's output) is left alone. Siblings are pinned by an exact signature through the vendored jsdiff and the edited stretches between pins are diffed again by kind; text is spliced by its differing run so ranges outside it survive; declared widgets are atomic (kept when their authored digest is unchanged, keyed by id or by tag and ordinal); an element whose children a module took is kept or replaced whole;retirereports what actually left the tree.skills/leaf/assets/runtime/version.js:prepareActivationdecides patch versus reload;activateRevisionis the patch install (roots, head,main, recapture throughinstallDocument, reading landmark restored); the reload path and its handoff are unchanged.scripts/browser/application.ts:adopt(state, revision)publishes the installed revision with the state that has a view of it, andcanAdoptis asked before the install edits anything.scripts/preview.py: re-vendors only when the runtime changed, so a prose edit in a preview takes the patch path.What is proven
Restored from before #666: the same document and
mainsurvive a revision and a stamp; a parked pointer's hover Range rebinds onto the new node; an armedgsequence survives a revision. New: a prose-only edit keeps an untouched native selection and the focused element; a reader-opened<details>, a lent tab stop, highlight spans, and page-module output survive an edit elsewhere; an unnamed widget survives a revision that left it alone, including one held in a template; a paragraph a module moved is patched where it stands; a selection over kept words survives the words beside it changing; an insertion above an unided paragraph (same or different tag) keeps the reader's node; a rewritten widget is replaced while an untouched one keeps its element; template contents patch; an executable change still reloads exactly once; the digest is pinned by an eight-fault planted sweep. Live check onexamples/log-retention.html: with a selection standing, pressing the newest-version chip keeps the selection, node, and document on this branch and reloads on main.On the final tip, locally: the everyday suite passes (1,118), and the seven nightly-marked browser modules the branch touches (
projection,navigation,application_boundary,startup,export,anchors,widgets, with--run-nightly -n0) pass (678) except fourlf-diffcases intest_render_anchors.pythat fail identically on current main (<lf-diff>has no captured widget descriptor at a version address), so they are not this branch's.npm run check:browserandtest:browsergreen; pre-commit green over every changed file.Left as it is
The reload handoff now carries only what has a stable identity: the reading landmark, the comparison base, the pointer, and the margin's retained standing. The page-control focus restore (owner id, tag, first class, index, and a meaning string) was a heuristic and is deleted, so focus falls to
bodyacross a code change or a replaced control. Revisions saved before this change carry no digest: the live root regenerates on its next state read, but their historical addresses answer with a named error until then. Per-revision layer copying is unchanged and remains the TODO item on sharing resources by digest.🤖 Generated with Claude Code