Owner-requested round. WorkspaceIndex::update_file/remove_file replace one file's contribution without reading or parsing anything else; Server::reindex_one takes the fast path for a didSave of one held file or a one-file watcher event (33 ms vs 1.5 s on the corpus, 45x), with everything else — settings, scope, filelist, multi-file events — keeping the full rebuild, pinned by a trigger-table test. FileIds stay sorted positions by deliberate deviation: renumbering through the one merge both finish and update_file end in makes build(W) byte-identical to build(W minus F).update_file(F) — fingerprint equality, attacked by QA across long interleaved sequences, disambiguation flips, define shadowing and the ghost hunt (the affected-keys union reads old and new records both). The per-file FileFacts the index retains are the documented memory cost (~1.4 MB on the corpus). The two oldest filed Handshakes land: instantiation and inheritance edge tables, built by the byte-for-byte moved census walks, turn codeLens counts (92 ms to 0.26 ms), incomingCalls and typeHierarchy subtypes into lookups — census policies pinned unchanged at both the consumers and now the source. Counts are as of the index, not of unsaved keystrokes: the freshness delta is documented and pinned from both sides. Saves no longer raise a progress bar; generation and lens refresh still ride. Round 18's three inherited scope obligations are pinned permanent. 36 tests added (dev 27 + QA 9). Left open, filed: wholesale republish, Candidates re-derivation cost, incremental removal vs include re-resolution. docs/features/incremental-index/README.md Co-Authored-By: Claude Fable 5 <[email protected]>
work-done-progress
Goal
A workspace rescan is the one thing this server does that a user can feel.
Server::reindex() is a synchronous full re-walk of the roots — 0.68 s for the
860-file corpus, seconds for a real filelist — and it runs on every save, on
every watched-file notification, and whenever lucisv.exclude/lucisv.filelist
changes. Until now it happened in total silence: the editor's status bar said
nothing, the server simply stopped answering for a while, and a user with a
large project had no way to tell a slow index from a hung server. This round
wraps every rescan — the startup build included — in server-initiated work-done
progress: one window/workDoneProgress/create, one $/progress begin, the
scan, one $/progress end naming the file count. Gated on the client's own
window.workDoneProgress capability, because the spec forbids creating
progress a client never asked for (TODO.md §9b).
Amended (incremental-index, 2026-08-27): a save is no longer a rescan.
When a trigger names exactly one file the index already holds — a didSave, a
one-file watcher event — only that file's contribution is replaced, in ~33 ms
over the corpus, and no bar goes up: the bar exists because a whole scan
takes perceptible seconds, and one parse is not something a user can feel. Every
whole rescan below is unchanged, and a save of a file the index does not hold
is still one of them. The tests that used a save as their rescan trigger now use
one that still rescans; see docs/features/incremental-index/README.md.
Assumptions
window.workDoneProgressis the gate, and there is no fallback. A client that did not advertise it is sent nocreateand no$/progress— not a degraded bar, not ashowMessage. The spec is explicit that a server may only initiate progress against a client that asked; and a popup per save would be worse than the silence it replaced.beginis sent without waiting for thecreate's answer. The spec permits it ("the server is allowed to report progress before the create request is answered"), and here it is not merely permitted but necessary: the rescan blocks the single-threaded loop the momentbegin_indexingreturns, so waiting for the answer would mean the loop never processes it and the bar appears only after the work it describes is over. A client that errors the create is required to ignore the$/progressnotifications carrying that token, so the worst case is a client that renders nothing — which is exactly what it rendered before this feature existed.- The create's answer is ignored. It goes through
Server::response's existing "not in theapplyingmap, fall through" path, the same one the file-watcher (un)registrations use. Nothing is retried and nothing is remembered: the ids are minted from the one sharedrequest_idscounter, so a progress answer can never be mistaken for anapplyEditanswer. No percentage, and no intermediateSuperseded 2026-08-27 byreport.docs/features/indexing-ux/README.md. The original reasoning stands as written and is kept here:Workspace::rebuild_indexwas one opaque call — it walked the roots, read every file, built the index, the completion tables and the include graph, and returned — so there was no progress to observe, and an invented percentage ("it is probably about half done") would have been a lie the user learned to distrust. The indeterminate bar was the honest shape for a build nobody could see inside. What changed is the premise, not the principle:vlog_semanticnow exposesIndexBuilder/index_order,rebuild_index_withdrives that loop, and the bar reportsn/total file.svwith a percentage that is counted, not guessed. Thebeginstill carries no percentage — the first honest one is the first file's — and the completion tables and include graph, which are still built opaquely after the index, are still outside the count.- The end message is the index's own file count, read from
WorkspaceIndex::files().len()after the scan. That number was already public and already computed; nothing was plumbed to obtain it. It counts the files the index was built from — in-scope files that read successfully, with open buffers overriding disk — which is what "indexed" means everywhere else in this server. - The bar covers the scan, not the republish.
endis sent the instantrebuild_indexreturns, beforereport_scope's warnings and before the per-buffer republishes that follow. Either order is defensible; this one is pinned by a test (the_bar_is_down_before_the_republish) because the bar names the scan, and the republish is per-open-buffer work the user already pays on every keystroke without a bar. - The startup build gets a bar too, and that is legal.
Server::newruns aftermain'sinitialize_finish, which returns only once the client'sinitializednotification has arrived — the same fact that makes the existing watcher registration legal there, and it is already stated in that code's comment. So the first index build, which is the slowest of the session, is wrapped like every other. Determined by readingmain.rs:59-79andserver.rs'sServer::new, not assumed. - No cancellation.
cancellable: Some(false)is stated rather than left unset: the loop is one thread, a rescan runs to completion, and there is nowindow/workDoneProgress/cancelhandler. A cancel button the user could press and that did nothing would be worse than no button. - One bar at a time, in practice. The loop is synchronous, so a rescan
cannot overlap another rescan; every
beginis followed by its ownendbefore the nextbegincan be minted. The token counter guarantees uniqueness regardless.
Handshakes
lucisv_server::server
ClientAbilitiesgainswork_done_progress: bool, filled bymain.rsfromInitializeParams.capabilities.window.work_done_progress(absent → false), in the style of the three fields already there. Every existing test that buildsClientAbilities { ..Default::default() }is unaffected.Servergainsindexings: u32— the progress-token counter. It is deliberately not the request-id counter: a token is not a request id, andlucisv-index-3reads as the fourth rescan rather than as an unrelated ordinal.- Two new private methods,
begin_indexing() -> Option<ProgressToken>andend_indexing(Option<ProgressToken>), plus a one-lineprogress()sender.Noneis the whole of the "this client cannot show a bar" path, so neither caller branches on the ability itself. Server::newis restructured: theServeris built around aWorkspace::default()andopen_rootsis then called through it, so the startup build can sit between abegin_indexing/end_indexingpair. Same work, same order relative toreport_scopeandregister_watchers.Server::response's doc comment now names three things asked of the client rather than two. Its code is unchanged — the create's answer already fell through theapplyinglookup.
state::Workspace, and every engine crate
Untouched. The file count comes from Workspace::index() and
WorkspaceIndex::files(), both of which were already public and already
called from this crate. No signature moved, rebuild_index still returns just
its scope warnings, and nothing was plumbed for the sake of the end message.
editors/vscode
No extension change. vscode-languageclient advertises
window.workDoneProgress itself and renders server-initiated progress in the
status bar with no help from extension.js. smoke.js sends
capabilities: {}, so it takes the no-progress path and passes untouched —
verified by running it.
Status / TODO
window.workDoneProgressread intoClientAbilitiesat initializebegin_indexing/end_indexingaroundrebuild_index()inreindex()- The startup index build wrapped in the same pair (legal:
Server::newruns afterinitialize_finish) - A fresh
lucisv-index-Ntoken per rescan, never reused endcarries the indexed file count, singular and plural- A client without the capability is sent zero progress messages
- The create's answer stays ignored and cannot disturb
applyEditrouting - Tests: 8 unit (7 in
server.rs, 1 inmain.rs), 2 e2e over the wire - TODO.md §9b checkbox,
docs/features/lucisv-server/README.mdstaleness section - Superseded 2026-08-27: the "no percentage, no report" line above.
The counting reports, the size cap and the per-file log are
docs/features/indexing-ux/README.md; the create/begin/end skeleton, the capability gate, the token scheme and the ordering against the republish are all unchanged by it. - Not done, deliberately: no
$/progresson anything else. Formatting, a rename across the workspace andcallHierarchy/incomingCallsare the other candidates; all three are request-scoped, so they would use the client-suppliedworkDoneTokenrather than a created one, which is a different mechanism with a different gate. Filed here, not built. - Not done, deliberately: no
window/workDoneProgress/cancelhandler. There is nothing in this server to cancel — see Assumptions.
Work log
2026-08-26 — dev agent, §9b
- Read the code before deciding about the startup build, as the brief asked.
main.rscallsconnection.initialize_finish(...)on line 74 andServer::new(...)on line 76, andinitialize_finishreturns only after the client'sinitializednotification has been received and consumed. So the startup build happens at a moment when server-initiated requests are legal — the existingregister_watchers()call inServer::newalready relies on exactly that, and says so in a comment. Verdict: wrapped. It is the slowest rescan of the session and the one most worth a bar. - The one structural change is in
Server::new: the struct is now built first andopen_rootscalled through it, becausebegin_indexingneeds&mut self. Nothing else about that function moved —report_scopestill runs on the warningsopen_rootsreturned, andregister_watchersstill runs last. Option<ProgressToken>is the ability check.begin_indexingreturnsNonefor a client that cannot show a bar andend_indexingreturns onNone, so neitherreindexnorServer::newmentions the capability. That also makes "a bar that went up came down" structural rather than a discipline: there is exactly one value that ends it and exactly one place it is produced.- Tokens are strings,
lucisv-index-N, off their own counter. A number token would collide conceptually with thelucisv-Nrequest ids in a log, and the string says what the bar is for. The counter starts at the startup build, solucisv-index-0is always the first index and the first save is alwayslucisv-index-1— pinned by tests at both the unit and the wire level. - The end message reads
WorkspaceIndex::files().len(), which was already public and already reachable throughWorkspace::index(). The brief's fallback ("end with no message if no count is cheaply available") was not needed; nothing was plumbed. The singular case has its own assertion, because "1 files indexed" is the kind of thing that ships. report_scopestill shows its popup after the bar comes down. A filelist warning and a progress bar are unrelated; sequencing them the other way would have meant holding the bar up across a modal in some clients.- Files touched:
crates/lucisv_server/src/server.rs,crates/lucisv_server/src/main.rs,crates/lucisv_server/tests/e2e.rs,TODO.md,docs/features/lucisv-server/README.md, this README. No engine crate, noeditors/, no new dependency, no version bump.
Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets: zero warnings. cargo test --workspace: 1812 passed, 0
failed (1802 on HEAD, measured — 7 new unit tests in server.rs, 1 in
main.rs, 2 new e2e sessions). cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: OK, exit 0. No commits.
The ten tests, and what each is for:
| test | pins |
|---|---|
the_startup_index_build_runs_under_the_first_bar |
the startup determination above, as observable traffic |
a_whole_rescan_puts_a_bar_up_and_takes_it_down_again (was a_save_puts_a_bar_up_and_takes_it_down_again, 2026-08-27) |
create → begin → end, one token, on a trigger that still rescans |
the_bar_says_how_many_files_were_indexed |
the end message, plural and singular |
the_bar_is_down_before_the_republish |
the documented ordering against publishDiagnostics |
a_client_that_did_not_ask_for_a_bar_is_sent_no_progress_at_all |
zero messages of any kind, at startup and on save |
every_rescan_path_gets_its_own_bar_and_its_own_token |
the watched-file and config-change paths, three distinct tokens, no leaked begin, no report |
a_progress_create_answer_is_ignored_and_never_disturbs_an_apply_edit |
an Ok and an Err create answer arriving between an applyEdit push and its answer; the refusal still reported exactly once |
work_done_progress_support_is_read_from_the_clients_own_capabilities (main.rs) |
absent/false/true, and no panic on InitializeParams::default() |
indexing_reports_its_progress_over_the_wire + a_client_that_never_asked_for_progress_is_sent_none_over_the_wire (e2e) |
the whole sequence against the real binary, both gate states, including title, cancellable: false and the absence of percentage |
QA log
2026-08-26 — QA agent, §9b
Gates re-run, on the working tree as handed off (commit 00c03ec +
uncommitted): cargo fmt --all -- --check clean. cargo clippy --all-targets --workspace zero warnings. cargo test --workspace: 1812 passed, 0
failed — matches the dev log exactly. cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK. After the
four tests added below: 1816 passed, 0 failed, gates re-checked and still
clean.
Per attack surface (lead's numbering):
-
Server::newrestructuring — verified clean, structurally rather than just empirically.Workspace::default()thenopen_roots(roots)is the same value undergoing the same two operations in the same order whether the mutation happens on a local binding before it moves into theServerliteral (old,server.rspre-00c03ec-diff) or on&mut self.workspaceafter it is already a field (new) — a move is bitwise and Rust invokes noDrop/observer between them, so there is no fieldopen_rootscould leave stale that the old order would have filled: every field ofWorkspace(docs,roots,index,candidates,includes,client) gets the identical value either way. Every otherServerfield's initializer (connection,config_warnings,abilities,watchers,registrations,request_ids,applying,generation,tokens,token_results, and the newindexings: 0) is inert and side-effect-free, so field-initializer order carries no risk.report_scopestill receivesopen_roots's warnings (server.rs:109-111);register_watchersstill runs last (server.rs:116). Gap found and fixed: the ordering the lead flagged as the actual risk — whetherregister_watchers's request lands before or after the startup bar comes down — was not observable in any existing test, because every dev test usingwatching_progress()(work_done_progress: true) leavesfile_watchingat itsDefault::default()offalse, soregister_watchersis a no-op in all of them; conversely every test that turnsfile_watchingon (Session::new(_, true)) leaveswork_done_progressoff. No test ever ran both abilities together. Addedthe_startup_watcher_registration_arrives_after_the_indexing_bar_comes_down(server.rs, inmod tests, right aftera_progress_create_answer_is_ignored_and_never_disturbs_an_apply_edit), which turns both abilities on and pins the wire ordercreate, begin, end, register. -
Protocol conformance — verified clean. The e2e test
indexing_reports_its_progress_over_the_wiredecodes the actual JSON (not the Rust struct) off the real binary and asserts, in one orderedVec:createprecedesbeginfor the same token, for both the startup rescan (lucisv-index-0) and the save-triggered one (lucisv-index-1) — i.e., create-before-begin holds across consecutive rescans, not just once. The token is read with.as_str().expect("a string token"), which fails the test if the wire ever sends a JSON number instead — so the string-typed-token requirement is pinned, not assumed.title,cancellable: false(explicitfalse, not absent), and the absence ofpercentageare asserted off the decodedbegin; theend'smessageis asserted off the decodedend. No gap. -
Pairing is structural — verified clean. Read
reindex()(server.rs:887-897) andServer::new(server.rs:140-169): in both, nothing sits betweenbegin_indexing()andend_indexing()but a call that returns a plainVec<String>(rebuild_index/open_roots), never aResult— there is no?and no early-return expression available to write between them even by accident.end_indexingis therefore unconditionally reached in every existing and reachable call site. Multiple rapid reindexes: the server is single-threaded andreindex()is fully synchronous (begin, scan, end, all before the call returns), so two rescans provably cannot interleave regardless of how close together their triggers arrive — confirmed observably byevery_rescan_path_gets_its_own_bar_and_its_own_token, which fires a save, a watched-file change and a config change back-to-back and gets three strictly-paired, strictly-increasing tokens. No gap. -
Capability gating — mostly verified clean, one gap fixed. Startup and save, both gated correctly, per
a_client_that_did_not_ask_for_a_bar_is_ sent_no_progress_at_all.window: {}andwindow: { workDoneProgress: false }are both covered bywork_done_progress_support_is_read_from_the_clients_own_capabilities(main.rs) viasaying(None)andsaying(Some(false))respectively —ClientCapabilities::default()'swindowfield is itselfNone, andsaying(None)still wraps aSome(WindowClientCapabilities{ .. }), which is exactly thewindow: {}shape; neither panics onInitializeParams::default(). Gap found and fixed: the watched-file andlucisv.exclude/filelistreindex triggers were never driven with the capability off — only proven off by reading that they sharereindex()'s singlebegin_indexingcall with the save path. Addeda_client_without_the_bar_gets_none_on_the_watcher_or_config_paths_either(server.rs), which drives both and assertssession.progress()empty after each. -
Response routing under interleaving — one direction existing, the reverse was missing; fixed. The dev's
a_progress_create_answer_is_ignored_and_never_disturbs_an_apply_editanswers the create (Okthen, for the same id,Err) while theapplyEditis still outstanding, then answers the edit — this is a real interleaving (create resolved first), and both answer shapes are exercised. The reverse ordering the lead asked for —applyEditresolved first, then a late create answer — was not present. Addeda_late_create_answer_after_the_apply_edit_already_answered_is_ignored_too(server.rs): answers the edit as accepted, confirms nothing is shown, then feeds a lateResponse::new_okfor the create's id and confirms it is still silently dropped. This same test doubles as "a create answer arriving for a token the server already Ended": by the time the edit is answered, the watched-file reindex that minted the create has already run itsbegin/endpair synchronously (per point 3), so the create answer that follows is necessarily late-for-an-ended-bar. It is ignored cleanly becauseresponse()keys offRequestId, never offProgressToken— the two are different namespaces andrequest_idsnever repeats, so there is no representable state where a create's id could collide with anything a still-outstanding request cares about. No further scenario to test here. -
End-message count — verified clean, one gap fixed.
end_indexingreadsself.workspace.index().files().len()(server.rs:192), which is the index's own file list, computed byrebuild_indeximmediately beforeend_indexingruns — not open-buffer count, not scope-file count before filtering. Singular/plural pinned bythe_bar_says_how_many_files_were_ indexed("2 files indexed" / "1 file indexed", explicitly asserting"not1 files"). Gap found and fixed: no test drove a rootless workspace with zero open buffers through startup. Traceddefault_files()→sibling_files()(state.rs:308-328) for that case: no roots and no docs means no directories to walk, so the index is empty andfiles == 0; the plural branch (files == 1is false for 0) correctly renders"s". Addeda_rootless_workspace_with_no_open_files_says_zero_at_startup_without_ crashing(server.rs), asserting"0 files indexed"and, by not panicking, non-crashing. Confirmed passing. -
CLAUDE.md compliance — verified clean. Grepped every non-
#[cfg(test)]line ofserver.rsandmain.rs(i.e., everything before theirmod tests) forunwrap(,expect(,panic!(: zero hits. Every new item (ClientAbilities::work_done_progress,Server::indexings,INDEXING_TITLE,begin_indexing,end_indexing,progress,work_done_progress_support) carries a doc comment. This README's seven required sections (Goal,Assumptions,Handshakes,Status / TODO,Work log,QA log,Review) each appear exactly once (grep -n "^## ").TODO.md's §9b item text is untouched — only its checkbox flipped to[x]and an indented→note appended below, per the existing convention elsewhere in that file.
Beyond the list. One thing noted for the record, not a defect in this
diff: Workspace::collect_sources (state.rs, untouched by this round) folds
in every open buffer's path unconditionally, even one outside the walked
scope, so in principle an open buffer for a file the workspace walk would not
have found could nudge the "N file(s) indexed" count up by one beyond what a
disk-only scan would report. This is pre-existing behavior this feature did
not introduce and does not change (state.rs has no diff against 00c03ec),
so it is not filed as a finding against this round — just flagged in case a
future change to the end message's wording ever needs it.
Fixes made (all additive; no dev code changed): four new tests in
crates/lucisv_server/src/server.rs's mod tests, inserted after
a_progress_create_answer_is_ignored_and_never_disturbs_an_apply_edit:
a_late_create_answer_after_the_apply_edit_already_answered_is_ignored_too,
the_startup_watcher_registration_arrives_after_the_indexing_bar_comes_down,
a_client_without_the_bar_gets_none_on_the_watcher_or_config_paths_either,
a_rootless_workspace_with_no_open_files_says_zero_at_startup_without_ crashing. All four pass; full workspace suite is green at 1816; cargo fmt
and cargo clippy --all-targets stay clean.
Verdict: committable as-is. No corruption risk, no idempotency risk (this
feature touches only the LSP transport, never formatted output), no dropped
comments, no widened verify.rs forgiveness (that file has no diff in this
round). The one structurally risky change — Server::new's construction
order — is provably equivalent to the old order and now has its
previously-unpinned watcher-vs-bar ordering under test. No dev follow-up
required.
Review
2026-08-26 — lead
Reviewed the diff, the work log and the QA log; re-ran all gates myself
(1816 workspace tests, 0 failed), clean. The Option<ProgressToken>-as-
capability-gate design is the kind of structural guarantee this repo
prefers over discipline: neither caller can put a bar up for a client
that cannot show one, and nothing between begin and end can return
early — I read the two call sites and confirm QA's finding that the
pairing is unconditional. The startup-build determination was done the
right way (read from initialize_finish's contract and the existing
register_watchers comment, not guessed), and the restructured
Server::new is provably equivalent — same value, same two operations,
different borrow spelling — with the previously-unpinned
watcher-after-bar ordering now under test thanks to QA. Honesty calls
all correct: no invented percentage, cancellable: false because
nothing here can cancel, and the end message costing nothing because the
index already knew its file count. QA's four gap-closing tests (both
interleaving directions, capability-off on all trigger paths, the
rootless zero-count startup) complete the surface. Accepted as shipped.