Expand description
D.0a.1 (2026-05-29) — Virtual-rows worker.
Sibling of cells_worker. Owns the rebuild path for the
displacing-virtual-row primitive landed in D.0a
(lattice_cells::VirtualRowMatrix) and publishes the
result via the shared virtual_rows_matrix_cell: Arc<ArcSwap<VirtualRowMatrix>> on Editor.
§Why this exists
Per paramount goal #1 (CLAUDE.md): UI thread does no I/O,
no parsing, no shaping. Virtual rows are the renderer’s
input for inline diff deletion blocks (D.3), multibuffer
excerpt headers (M.2), and future inlay-hint /
signature-preview consumers. Each consumer registers a
VirtualRowProvider; the worker polls them off-thread
and publishes a fresh VirtualRowMatrix via RCU.
§D.0a.1 scope — minimal
VirtualRowProviderRegistry—BufferId-keyed (as of D.4.d.2.1.a). Each visible buffer owns its ownProviderId → providermap so baseline + current panes’ filler providers (D.4.c) coexist without colliding onProviderId, and the worker (post-D.4.d.2.1.b) can iterate panes and poll each one’s scope independently. This slice keeps the worker single-pane:recomputereadsactive_document.document_buffer_idand snapshots only that buffer’s providers. Today’s sole producer (the D.3.a inline diff overlay) registers against the same buffer the worker reads, so behaviour is identical for single-pane flows.recompute— sync decision function. Tests call this directly to assert each branch.run— async loop.wake.notified().awaits theVirtualRowsWakesignal, then callsrecompute.- Cache-hit fingerprinting via a stable hash of
[(provider_id, provider_version)]+source_line_count. The worker holds its own monotonic publish counter; the matrix’sversiononly bumps when the fingerprint changes, so downstream consumers compare versions to invalidate their derived state cheaply.
§What this slice does NOT do
- No production provider yet. The first one lands with D.3 (inline diff overlay’s deletion-block provider) or M.2 (multibuffer excerpt-header provider), whichever ships first.
- No per-pane matrices. v1 uses one global matrix tied to the active document. Multi-pane diff (D.4) and project-wide diff (multibuffer M.6) will introduce per-pane or per-document indexing then.
- No paint-debounce inside the worker.
Notify-permit coalescing (mirrorscells_worker) handles bursts — the worker rebuilds once per quiescent burst regardless of how many wakes arrived.
Structs§
- Virtual
RowProvider Registry - Process-wide registry of
VirtualRowProviderinstances, scoped perBufferId(D.4.d.2.1.a). - Virtual
Rows Worker State - Worker-local state held across recompute calls.
Enums§
- Worker
Decision - Recompute decision the worker takes on a wake. Visible for
testing; the production loop calls
recomputedirectly.
Functions§
- recompute
- Pure sync recompute. Iterates
rs.cells.panes, dispatches each torecompute_pane, and aggregates the per-pane decisions into a single one for the async loop. Returns the aggregate so tests can assert behaviour without drivingrun. - recompute_
pane - D.4.d.2.1.c (2026-05-30): per-pane recompute. Same shape
as
cells_worker::recompute_pane. Visible for tests that want to assert per-pane decisions without driving the aggregate. - run
- Worker entry point spawned at boot. Loops forever, awaiting
the wake
Notify. Each wake re-reads the latestRenderState+ provider registry and callsrecompute.