Repository navigation
Remove deferred data fields, so lf-diff's patches arrive with page state - #5896
Merged
Merged
Conversation
Since #2742, `lf-diff` derives each row from its patch, so it loaded every deferred patch as soon as it showed: one `api/deferred` request per file right after the state answer, saving no bytes. It was the only widget with a deferred field. On leaf.page those per-file requests also passed the edge's stored state answer and started a passive viewer's container. This removes `records.deferred` from data contracts with its distinct-fields check (`contract-records`), the `/api/deferred` route and the server functions behind it (`data_manifest`, `deferred_fields`, `deferred_value`, `browser_data_from`), the browser's loader (`loadDeferred` in the portable API, `deferred-value.js`), the export's separate copy of deferred fields, the website's capture of their answers, and `lf-diff`'s Retry for a patch that failed to load. A manifest's patches are part of the value page state carries; a patch `lf-diff` cannot draw is refused as before. Tests of the deferred route, its stale-revision refusal, its offline reads and the load Retry are deleted, as is the disclosure test whose failure, a false error from a stale deferred read, can no longer happen. The rest read whole values. On pr-walkthrough (`leaf-dev probe`, base then head), the page first presents the server's state after 363 → 315 requests and 8.09 → 8.08 MB; the state answer now carries the 220 KB of patches the per-file requests fetched after it.
…e object With deferred loads gone, every lf-diff entry that isn't refused already holds its parsed file, so `readEntry` and the fallback that read a record's patch at open time were unreachable. `sourceRecords` now parses each manifest patch itself, keeping the per-file refusal, and an entry holds one `source` record with its file or its error. An export's data file held each value as a gzipped span so one deferred field could be decoded alone; the offline state read now decodes every value at once, so the file is one gzipped object keyed by source and the span offsets go. Tests: a disclosure opened while a newer revision draws now has a test of its own (with the wait on the source render removed, the older lines land after the newer ones and the test fails); the page-owned contract test again shows an old document judging data by its captured registry; the repeated-key refusal moves to the manifest model test, and its server copy, which also restated the state answer test, goes.
leaf-agent
approved these changes
Nov 12, 2026
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.
Leaf's data contracts could mark one field of each record as
deferred: the page received rows without it, and a widget fetched each field withloadDeferredthrough/api/deferred. Onlylf-diff'sunified-diffcontract used it, for each file's patch. Since #2742,lf-diffderives each row from its patch, so it fetched every patch as soon as it showed: one request per file right after the state answer, saving no bytes. On leaf.page those per-file requests also passed the edge's stored state answer, so viewing a diff page started the visitor's container.This removes the mechanism. A manifest's patches are part of the value page state carries, which the edge already answers for a visitor who hasn't written.
Removed
records.deferredin the registry schema, and thecontract-recordscheck, which only kept a deferred field from naming the key./api/deferredroute and the server functions behind it (data_manifest,deferred_fields,deferred_value,browser_data_from), with the two source-protocol methods only it read.loadDeferredin the portable API andruntime/deferred-value.js, andofflineDeferredin the export reader.lf-diff's Retry for a patch that failed to load, andreadEntry, which read a manifest patch when its file opened.sourceRecordsnow parses each manifest patch when the source arrives. A patch it can't draw refuses only its own file and is reported as before.Behaviour that changes for agents.
leaf page state <page> <message>reads a message's widgets with their inputs' values. For anlf-diffin a message bound to a manifest, that reading now carries every patch (220 KB on pr-walkthrough) instead of the rows without them, as a patch-text source always did.Kept.
page_memory.once(#5856) was justified by the 46 concurrent deferred loads on a cold container. It still makes any requests that reach a cold server together compose the layer once; only its docstring changes.Measured on pr-walkthrough with
leaf-dev probe --base: the page first presents the server's state after 315 requests instead of 363, and 8.08 MB instead of 8.09 MB. The state answer itself grows by the 220 KB of patches, which one deferred request per file used to fetch just after it; later state reads still leave out data the tab already holds.Tests
loadDeferred's guards, and the in-place and reopen Retry tests.test_a_file_opened_while_a_newer_source_draws_shows_the_newer_lines, holds the wait an opened file keeps on a newer revision's drawing. With that wait removed, it fails with the older lines shown.tests/browser/projection/test_code_review.py::test_call_diff_source_paths_do_not_alias_durable_rename_coordinatesfails locally on macOS (556.8 == 563.8 ± 0.5) identically on the merge base; this change doesn't cause it.Docs.
package-data.mdandmodule-state.mdlose the deferred paragraphs, andpackage-data.mdsays whatrecordsdoes now. The diff package's author instructions now say the manifest producer isolates a filelf-diffcan't draw, since size is no longer a reason to use it.