index-scope
Goal
Open-file-first indexing for a project too big to scan. Until this round the
server had two answers to "which files exist": a filelist, or every file
under every workspace folder — and on a large codebase the second one costs
minutes on every save, to answer questions about the handful of folders the
user is actually in. This round makes the walk follow the open buffers
instead: lucisv.index.scope ("folder" by default) scopes the index to the
folders the open files live in, lucisv.index.scopeDepth says how far above
each one to start looking for relative files, and opening a file in a folder
the scope does not cover widens it and reindexes. A filelist still outranks
everything — it is the project file — and "workspace" restores the old walk
for anyone who wants it. The same round closes the ordering footgun the
previous round's QA found in vlog_semantic::IndexBuilder, which is what makes
the second half of the change safe: the open buffers' files are fed to the
builder first, so the progress bar completes the user's own files first, and
that is provably a reporting decision with no effect on the index.
Assumptions
-
The scope ladder is one ladder with a new rung 3. Highest first: (1) a filelist —
lucisv.filelist, else afilelistkey in a root's config — defines the scope exactly, unchanged and whole-project; (2)lucisv.index.scope: "workspace"walks every workspace folder, which is what every session did before this round; (3) the default: the folders the open buffers live in, each raisedlucisv.index.scopeDepthlevels, walked. Rung 2 needs a root to mean anything, so a rootless session is folder-scoped whatever it says. -
The default depth is 2, changed from 0 on 2026-08-28. This is a behaviour change and it is in the release notes. The measurement that forced it is
performance.md§4: on the shipped default, openinghw/ip/aes/dv/tb/tb.svin opentitan gave an index of exactly one file —dv/tb/holds onlytb.sv— sodefinition,typeDefinition,hover,references,workspace/symbolandsignatureHelpall answered nothing until some later jump widened the scope. The narrow rung's sub-0.1 ms timings were not a speed result; they were the cost of answering nothing, and the user's first experience of the server was silence.Two levels is the smallest raise that turns a
dv/tbor anrtlfile into the IP block it belongs to (hw/ip/aes— rtl and dv together, a few hundred files), which is the unit an engineer actually works in. Three would be the whole ofhw/ip. Measured on an opentitan-shaped tree byperf::what_the_scope_depth_default_costs: depth 0 indexes 1 file, depth 2 indexes 21 for 15 ms of scan, depth 3 indexes 252 for 185 ms. What keeps 2 bounded is everything this feature already has — the size cap, the persistent cache, the interleaved scan and the incremental widen — and the root clamp, which is why the rootless case is treated separately below.scopeDepth: 0still means exactly what it always meant, and is the way back to the old behaviour for anyone who wants it (e2e::the_shipped_scope_depth_reaches_the_block_a_file_belongs_to). -
This is a behaviour change for every workspace user, and the honest statement of it is that cross-file answers are scope-relative. A symbol in a folder the scope has not reached does not exist as far as this server is concerned:
textDocument/definition,workspace/symbol, the call and type hierarchies,find_referencesand a workspace rename all answer within the active scope, exactly as they already did within a filelist's. The migration line is"lucisv.index.scope": "workspace", which restores the old behaviour exactly (pinned bythe_workspace_scope_setting_restores_the_walk_of_every_root). -
The scope only ever grows within a session. It is derived from every directory a buffer has been opened from (
Workspace::opened_dirs), not from the buffers currently open, sodidClosenarrows nothing and costs no rescan. The alternative — recomputing from the open set — would take a working answer away at the next unrelated save, which is a worse surprise than an index that is slightly larger than the editor's tab bar. It is also the cheap choice: no reindex on close, and no reindex-on-close churn while a user cycles through files. -
didOpenrebuilds exactly when it widened the scope. The rule is one comparison of the scope directories acrossset_document, and it replaces the oldhas_roots()branch (rootless reindexed, rooted published) with the question that branch was really asking. Consequences, both deliberate: a rootless session opening a second file in an already-scanned directory no longer rebuilds (it used to, always), and a session on the filelist or workspace rung never rebuilds ondidOpen, because no open buffer can widen those scopes. Amended 2026-08-28: the comparison is unchanged and still the whole rule, but its answer is now three-way rather than two — the same two directory lists go towiden_of, which indexes only what was added when the move was a pure add. When adidOpenindexes is exactly what it was; only how much changed. -
The
didOpencheck costs twoscope_dirs()calls, and each one asksfilelist_path()whether rung 1 is in force. That is aDiscoverywalk up from each root looking for a config — a handful ofexists()calls, on an event that is already about to reanalyze a whole buffer, and orders of magnitude cheaper than the rebuild it decides against. Named here because it is the one new per-notification cost this round adds. -
A workspace folder is a clamp on the folder rung, not a work list. Adding one mid-session changes which files exist only once a buffer in it makes it a scope directory; what it does change immediately is how far the climb may go (see below). Removing one likewise only loosens the clamp. The rescan
didChangeWorkspaceFoldersalready triggers is unchanged. -
The shipped
scopeDepthis 2 (2026-08-28), and the climb is clamped at the deepest workspace root containing the directory — that is what keepsscopeDepth: 5in a two-deep project from indexing a home directory, and it is what makes a non-zero default safe at all. See The default depth below for why it moved off 0. -
With no workspace folder there is no climb. The clamp is the whole reason a raise is safe, and a rootless session has nothing to clamp against. Until 2026-08-28 the climb ran with
/as its only floor, which was survivable while the shipped depth was 0 and nobody climbed by accident; at depth 2 a lone file opened from~/work/chip/hw/ip/aes/rtl/would raise into~/work/chip/hw/ip/and walk a tree the user never named. Soraisedreturns the directory unchanged whenrootsis empty, whatever the depth says. Pinned bya_rootless_session_does_not_climb_at_allat depths 0, 1 and 99. This removes a capability: a rootless session can no longer widen by raisingscopeDepth. The way to widen is to open the folder, which is also what gives the climb a floor. -
The rootless case still reads flat at depth 0. A file opened on its own, at
scopeDepth: 0, gets a flat one-level read of its directory — no walk, no.gitignore(with_no_workspace_root_the_open_files_own_directory_is_indexed). At any higher depth the directory is the same one (no climb, above) but it is walked rather than read flat, so the subtree under the file's own folder is indexed. That is the one behaviour a rootless user sees change with the new default, it is bounded by the directory they opened a file from, and it is pinned bya_rootless_session_reads_its_own_directory_flat_until_the_depth_is_raised. -
One honest filter gap: a root's
.gitignoredoes not reach a walk that starts below it.lucisv_core::walkreads ignore files from the walk's own starting directory downwards, so a rule written at the workspace root is not applied when the folder scope starts atrtl/. Everyexcludepattern — the config's and the pushed one — is matched against whole paths and is unaffected. Pinned both ways inthe_folder_scope_honours_every_exclude_and_the_gitignores_below_it, rather than left to be discovered. The fix belongs inlucisv_core's walk (parent ignore files, as theignorecrate does it) and is filed, not done: it is a change to the CLI's walk semantics too, which is not this round's scope. -
The startup index is empty, and that is the point. No buffer is open at
initialize, so the folder scope has no folder yet; the firstdidOpenwidens it and rebuilds. On a huge project this is the whole saving. It also means a client whose settings say"workspace"still gets one empty startup scan and then a rescan when its settings land — the same one extra rescanlucisv.excludeandlucisv.filelisthave always cost, for the same reason (neither settings door can deliver beforeinitialized). -
Open buffers still overlay every rung. A buffer's text beats disk and a buffer outside the scope still contributes itself, exactly as with a filelist. Nothing about diagnostics, formatting or any single-file feature depends on the scope: the per-buffer analysis is bottom-up and instant, and this round does not touch it.
-
A widen indexes what it added and trusts what it already has (2026-08-28). Since this round a
didOpenthat only adds folders to the scope indexes those folders' files alone and folds them into the live index, the completion tables and the include graph. The equivalence it claims is exact and is worth stating in full: the widened tables are the tables a whole rescan would have produced, given that the disk files already indexed have not changed since they were indexed. Two halves make that hold rather than one — every open buffer is re-indexed from the analysis it holds, so unsaved edits land exactly as a whole rescan's overlay would; and a buffer that has grown past the large-file threshold is taken back out, which is the one thing a widen removes. -
What "already indexed" means is the index's own file list, and that is the whole of the rule (2026-08-29).
begin_widenwalks the added directories and skips every pathself.index.files()already holds. Three things follow, and all three are why the diff is by file rather than by folder:- a folder that contains one already in scope costs only its own new files. The two walks overlap completely over the old folder, and the overlap is skipped file by file.
.gitignoreandexcludedifferences between the old walk and the new one cannot make it wrong. A file the new root's walk finds and the old one did not is simply not in the index, so it is indexed now; a file the new walk stops finding is not taken out, because a widen removes nothing it did not walk — which is the same trust in what is already indexed the round above states, not a new gap.- the size cap keeps its meaning. A capped file is not in the index, so
it is never "already there": every widen that walks it checks its size
again, skips it again, reports it again and counts it again. That is what
keeps the skip counts and the
size > caplog honest on a widen, and it is asserted ina_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds.
-
The residual staleness, stated honestly — and it is a narrowing, not a new window. A whole rescan re-reads every in-scope file, so until this round a widening
didOpenincidentally caught anything that had changed on disk behind the server's back. It no longer does. What covers that instead:- a client that advertised
workspace.didChangeWatchedFiles.dynamicRegistration— VS Code and Neovim both do — is registered for**/*.{v,vh,sv,svh}withkindunset, so create, change and delete of any source file anywhere in the workspace already reach the server as their own notification and rescan (docs/features/file-watching/README.md). For such a client nothing is lost: the widen never was the mechanism. - a client that did not keeps the save-only model that feature already
documents, and this round narrows what that model catches: an external
change in a folder already in scope used to be picked up by the next
scope-widening
didOpenand is now picked up by the next whole rescan (a save of a file the index does not hold, a settings change, a folder change, adidRenameFiles/didDeleteFiles). Lead: this is the one behaviour this round takes away, and it is named here rather than left to be found. It is the same class as the windowfile-watchingalready owns — "this server is not told, so it does not know" — and it is not a new kind of staleness; a save has taken the one-file incremental path since 2026-08-27, so a watcher-less session already had no reliable whole-tree re-read. - an externally edited
lucisv.tomlis unchanged in kind and narrowed in the same way: a widen reads the config governing the folders it adds, so a changedexcludereaches an already-scoped folder at the next whole rescan rather than possibly at the next jump.lucisv.tomlis not watched either way, which that README already says.
- a client that advertised
-
A widen does not re-open the persistent store, and that is most of what it saves on a big project.
begin_scanre-opensIndexCacheon every whole rescan, which reads and decodes every record in it — ~90 ms over opentitan's 3 979 — and a widen keeps the handle the last whole rescan left. New files still hit the store (they are looked up in the entries already in hand); what a widen cannot see is a record another session wrote since this session's last whole rescan, which costs a re-parse and never a wrong answer. -
Wrong-typed settings fall back to the narrow default, the same direction
maxFileSizefalls back to the cap: a misparse must not silently buy a whole-workspace scan."scope"is matched exactly —"Workspace"is junk — because the enum inpackage.jsonis what a settings UI offers and forgiving it here would make a typo mean different things on different clients. -
The progress denominator, the cap counts and the output log follow the active scope for free. They all read the same work list (
index_order's length, known before the first parse), so nothing was re-plumbed; verified bythe_bar_names_the_open_file_before_the_rest_of_the_scopeand by the e2e transcript, whose startup bar honestly ends0 files indexed.
Handshakes
vlog_semantic — IndexBuilder is order-insensitive
The previous round shipped IndexBuilder as a dumb accumulator whose ordering
contract was a doc comment ("feed it index_order's list"), and its QA proved
that a caller who did not got different FileIds and a different winner for a
name two files declare (indexing-ux README, QA log 2026-08-27, MEDIUM). That is
closed by construction:
pub fn add_file(&mut self, path: PathBuf, src: &str); // parses, keeps FileFacts
pub fn finish(mut self) -> WorkspaceIndex; // sorts by path, dedups, merges
add_fileparses its file and reads off what it declares into a private per-file record (FileFacts: the path, the`definetable, the file-scope declarations in declaration order, the members in traversal order). The parse still happens inadd_file, so a caller reporting progress between calls is reporting work that has really been done.finishsorts those records by path —sort_byis stable,dedup_bykeeps the first of a run, which is exactlyindex_order's rule — and only then hands outFileIds and merges the declarations into theunits/memberstables. No insertion order can reach the result.WorkspaceIndex::buildis byte-identical for every existing caller, and the proof is that all 31 pre-existingvlog_semantictests are unchanged and green, includingfile_ids_follow_the_sorted_paths_whatever_order_they_arrive_in,a_module_declared_in_two_files_is_ambiguous_in_path_orderandthe_incremental_builder_is_what_build_is_made_of.buildstill callsindex_orderfirst — not for correctness now, but so a duplicate path is not parsed twice.- Why this shape and not a type-enforced two-phase API. The alternative the
brief allowed was a builder that cannot be misused because the types forbid
it — an
UnsortedBuilderthat only aSortedFilesvalue can be fed. That is a second type, a second constructor and a conversion, to protect an invariant that a five-linesort_by/dedup_byinfinishremoves outright. Making the wrong call impossible beats making it a compile error when it costs less. The cost is memory: the per-file records for the whole workspace are held untilfinish, which is the same data the finished index holds (names, spans, kinds), partitioned rather than merged — noSemanticsand no source text is retained. - Permanent re-attack:
no_insertion_order_can_change_what_the_builder_produces(the QA pair plus a nested-class/defines fixture, in three orders, compared by a full fingerprint of files, ids, disambiguation order, member tables and define counts) anda_path_added_twice_is_one_file_whichever_end_the_duplicate_is_at. index_orderstays public and unchanged: the server needs the work list's length before the first parse for the progress denominator.
vlog_semantic — facts from an analysis the caller already has (2026-08-28)
Two additions, both "the same thing with the parse already done", in the shape
IndexBuilder::add_facts already had:
impl FileFacts {
pub fn from_analysis(path: PathBuf, tree: &SourceFile,
defines: &DefineTable, sem: &Semantics) -> FileFacts;
}
impl WorkspaceIndex {
pub fn update_facts(&mut self, facts: FileFacts); // update_file, no parse
}
FileFacts::ofis now literallyparse_and_collect+analyze+from_analysis. The fact walk moved into the new function andofcalls it, so there is one implementation and not two: the equivalence the reuse needs holds by construction, not by care. What a caller promises is only thattree,definesandsemreally are the analysis of the text atpath.update_factsisupdate_file's body, with the same contract: what is left is the index a whole build over the same file set would have produced.update_fileis nowself.update_facts(facts_of(path, src)).- No
FACTS_FORMATchange, no new field, no new dependency: this round adds a second door to the record, never a second shape of it.
lucisv_server::state — a Document can hand over its own facts
Document::facts(path) -> FileFactsandDocument::words() -> Vec<String>are new and public: what an open buffer contributes to the index and to the completion word table, read off thetree/defines/semanticsand thetokensit already holds. Never called for a fast-path buffer, whose analysis is the analysis of the empty file and which contributes nothing anyway.IndexEvent::Analyzed { done, total, path }is a new variant — one file went into the index from an open buffer's own analysis. Its own variant rather thanCachedso that "from cache" keeps meaning the persistent store and nothing else;server.rslogsanalyzed: <path>and, deliberately, adds no clause to the progress bar's end message (see the work log).collect_sourcestakes aHeldAnalysesargument, because it has two callers with different needs: an index rebuild wants the buffers' records, a refactoring reads the texts and nothing else and would be paying for records nothing looks at.collect_sourcesno longer reads a file from disk when an open buffer speaks for it. The text was read and then thrown away; the size cap is still consulted first, so an oversized file still reports itselfSkippedexactly as before.
lucisv_server::state — a scan that only adds (2026-08-28)
impl Workspace {
/// The files `added` brings into scope that the index does not hold,
/// plus every open buffer's own analysis.
pub fn begin_widen(&mut self, added: &[PathBuf], watch: &mut dyn FnMut(IndexEvent)) -> Scan;
}
Scangained a privatekindand a privategone, andfinish_scanis still the one way to land a scan: it branches on the kind, so a caller cannot pair a widen with a whole scan's ending.begin_scan,scan_stepandpublish_scanare untouched and are the same code for both shapes — which is what makes the widen's per-file behaviour (the cache, the open-buffer reuse, the events) identical by construction rather than by care.- The widen does not compact the persistent store (it does not know the
live set of entries; the next whole rescan rewrites the log) and does not
re-open it (see Assumptions). It drops the closed-file view cache for exactly
the files it reads rather than dropping it whole, which is what a scan that
names its own files can honestly do —
Workspace::file_view's invalidation list names it. - Test-only
widen_index/widen_index_withare the one-shot spelling, asrebuild_indexis for a whole scan.
lucisv_server::includes — an edge holds what the disk answered
IncludeGraph now keeps each edge twice: raw, the path the filesystem
resolved the `include to, and edges, that path re-spelled the way the
index spells the file (as_the_index_spells_it). relearn is followed by a
respell everywhere, so every held edge's spelling is re-derived from the
current in-scope file list — no filesystem call, no re-read of any file.
That is what lets a widen match a rebuild exactly: a file that is in scope for
the first time can lend its own spelling to an edge resolved before it arrived,
which IncludeGraph::absorb could not do while edges were stored already
spelled. update_file's documented limit narrows accordingly: an edge of a
different file is still not re-resolved against the disk, but it is
re-spelled.
lucisv_server::server — the chooser
enum Widen { Nothing, Added(Vec<PathBuf>), Whole }
fn widen_of(before: &[PathBuf], after: &[PathBuf]) -> Widen;
didOpen compares scope_dirs() across set_document as it always did, and
widen_of turns the two lists into one of three answers: unmoved → publish;
grew and lost nothing → reindex_widened; anything else → the whole rescan.
Nothing takes a directory out of the folder scope today, so the third arm is a
rule kept rather than a case reached. reindex_widened defers to
rescan_wanted — one whole rescan — when a scan is already running.
A directory that subsumes one already in scope is an add, and always was
(2026-08-29). At scopeDepth: 2 the routine second jump raises to a parent
of the directory the first one raised to — opentitan's hw/ip/aes then hw/ip.
That is a pure add here because scope_dirs raises each opened directory on
its own and keeps every answer: the contained directory is still in after,
beside the containing one, and nothing was lost. The rule as written is exactly
right for it, and the round that went looking for a bug here found the code
already correct and measured it to prove so
(widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else, subsumption
row).
lucisv_server::candidates — a batch of words is merged once (2026-08-29)
Candidates::absorb is unchanged in signature and in answer, and changed in
cost: the workspace word table is a sorted Vec, and folding a batch in used to
insert each new word into it on its own — one memmove of the table's tail per
word, quadratic in the batch. It now counts the whole batch (count_words) and
brings the table back in step in one merge pass (merge_words).
set_words — the single-file door update_words/remove_file use — is those
same two calls, so there is one implementation and not two.
The equivalence is by construction: word_cmp is a total order on distinct
words, so merging a sorted run into a sorted table is the sort a whole
Candidates::build would have run over the same counts. Pinned anyway by
a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted, whose
one batch carries every case the bookkeeping can get wrong — a word only one
file still holds, a word the batch takes from one file and gives back through
another, a word nothing holds afterwards, and case variants. This is a file
outside this feature's usual set (candidates.rs belongs to
completion-core); it is flagged in the work log as the round's one deviation,
and it is where the measured cost was.
lucisv_server::candidates — words from a token stream
Candidates::build(index, sources, known: HashMap<PathBuf, Vec<String>>)takes a third argument: the words of the files whose token stream the caller already has. A file listed there is not lexed again; a file absent from it is lexed exactly as every file used to be.Candidates::update_words(index, path, words)isupdate_filewith the lex already done, andupdate_filedelegates to it.words_of_tokens(tokens)ispub(crate): the whole ofwords_inafter the lex, so the two roads to a file's words are one function over one token stream.
lucisv_server::settings
- Two new fields,
index_scope: IndexScope(Folder|Workspace, defaultFolder) andindex_scope_depth: u64(defaultsettings::DEFAULT_SCOPE_DEPTH), parsed fromlucisv.index.scope/lucisv.index.scopeDepth. Nested underindexlike the other two, so both settings doors — push and pull — carry them with no new code (the_index_settings_come_through_the_pull_door_too). IndexScopeis public;state.rsmatches on it.DEFAULT_SCOPE_DEPTHis the single source of the shipped depth (2026-08-28), used byClientSettings::defaultand by theunwrap_orinfrom_payload, so an unreadable value falls back to the shipped default like every other setting here rather than to zero.the_extensions_declared_defaults_are_the_ones_this_module_shipsreadseditors/vscode/package.jsonand asserts the settings UI declares the same number, so the two cannot drift.
lucisv_server::state
Workspace::scope_dirs() -> Vec<PathBuf>is new and public: the directories the folder scope walks, or empty when the folder rung is not in force.server.rscompares it across adidOpen.Workspace::set_documentnow also records the buffer's directory. It is the one place a directory enters the scope.walked_filestakes the directories to walk instead of readingself.roots;sibling_filesis a free function taking the same list.has_roots()is#[cfg(test)]now —didOpenwas its only production caller.- Test-only
open_whole_workspace/open_whole_workspace_withare the one-line spelling of "this test wants the pre-round scope", used by the dozens of tests across the crate whose subject is a hover or a rename rather than the scope.
lucisv_server::server
didOpenreindexes whenscope_dirs()moved, else publishes. One rule for rootless and rooted; the rebuild rides the existing bar, generation bump, code-lens refresh and republish.Server::started(connection, roots, abilities, ClientSettings)is the real constructor andServer::newdelegates to it with the defaults. The parameter exists for the tests, which is stated where it is written: a test whose subject is not the scope starts from the wide scope rather than driving adidChangeConfigurationand then reasoning about the extra rescan.
editors/vscode
- Two new
contributes.configurationproperties, both carrying the honesty notes: what stops being answered, that the scope grows and never shrinks, the migration line, and that a filelist overrides both. Noextension.jschange — the wholelucisvsection including the nestedindexobject is already synchronized.
Status / TODO
lucisv.index.scope("folder"default,"workspace"opt-in), both settings doors, junk → the narrow defaultlucisv.index.scopeDepth, clamped at the deepest containing workspace root — default 2 since 2026-08-28, and no climb at all with no root- Filelist still outranks both;
scope/scopeDepthignored on rungs 1–2 didOpenwidens the scope and reindexes; the rootless branch unified into the same rule- Scope only grows within a session;
didClosecosts no rescan - Both settings join the rescan condition;
logFilesstill does not - Open buffers' files fed to the builder first; progress reports name them first
IndexBuilderorder-insensitive, with the QA attack as a permanent testpackage.jsondescriptions carry the scope-relative-answers warning and the migration line- 19 new tests (12 state, 2 server, 1 e2e, 2 vlog_semantic, 2 settings), 3 existing ones extended, 1 superseded test rewritten; every other test in the crate that wanted the whole workspace now says so
Round 21 — the shipped scopeDepth moves 0 → 2 (2026-08-28)
settings::DEFAULT_SCOPE_DEPTH, used byClientSettings::defaultand byfrom_payload's fallbackeditors/vscode/package.json: the declared default and a rewrittenmarkdownDescription, with the single-file advice correctedthe_extensions_declared_defaults_are_the_ones_this_module_ships— the manifest and the server are asserted to agree, so they cannot drift- Ladder tests: the shipped depth reaches the block, the climb clamps at
the workspace root and goes no further, an explicit
0is unchanged (e2e::the_shipped_scope_depth_reaches_the_block_a_file_belongs_to) - The rootless climb removed, with its own two tests
(
a_rootless_session_does_not_climb_at_all,a_rootless_session_reads_its_own_directory_flat_until_the_depth_is_raised) - Cost delta measured rung by rung on a synthetic opentitan-shaped tree
(
perf::what_the_scope_depth_default_costs): 1 / 1 / 21 / 252 files at depths 0 / 1 / 2 / 3 - Every test in the crate whose subject is the depth-0 rung now asks for
it out loud (
state::tests::own_folder_only) instead of riding the default
Round 22 — the first RTL open at the shipped depth (2026-08-29)
- Reproduced
performance_take2.md§5b against the real checkout before writing anything, and corrected its diagnosis: the jump takes the widen path, the chooser'sWholearm is unreachable, and the widen reads 1 685 files rather than 1 807 when the old block is inside the new root - The subsumption rule written down where it is decided (
widen_of's doc) and pinned as a chooser row plusa_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds, which is the only test in the crate that fails when the file diff is removed - The file diff's three consequences stated in Assumptions: the overlap, the ignore-file differences, and the size cap
- The measured cost fixed:
Candidates::absorbmerges a batch into the word table once instead of inserting each word on its own — 403 → 43 ms of the jump, warm 935 / 881 → 555 / 564 ms, cold 1 529 → 1 175 ms - Synthetic probe for the shape, no checkout needed
(
perf::what_a_widen_that_subsumes_the_old_scope_costs), asserting the widened index fingerprints identically to the whole rescan's - Filed, not done: 325 ms of what is left is re-lexing the new files
for the completion word table. The persistent store holds a file's facts
and not its words; storing them is a
FACTS_FORMATchange and belongs toindex-persistence(TODO.md§10) - Not done, deliberately: the widen still does not interleave. It is
one bar per session per big widen, and
must_waitholds requests behind it either way — the same reasoning round 20 gave, restated now that the bar is half a second rather than 20 ms
Round 19 — a rescan stops re-parsing what is already analyzed (2026-08-28)
- Traced where a scope-widening
didOpen's 213 ms actually goes, per stage, and wrote it down (work log) - An open buffer's index facts come from the analysis it already holds
(
FileFacts::from_analysis), on the whole-rebuild path and onupdate_one's incremental one - An open buffer's completion words come from the tokens it was analyzed
from (
words_of_tokens), on both paths - The disk copy of a file an open buffer speaks for is no longer read
IndexEvent::Analyzed, logged asanalyzed: <path>, so "from cache" still means the persistent store- Equivalence pinned six ways: encoded-record equality across 860 corpus
files and 13 crafted shapes, index fingerprint equality at workspace
scale,
update_facts==update_file, and the server-level "same index and same completion tables as the same bytes on disk" - ~228 ms → ~23 ms on the same probe, with the closed-buffer floor unmoved at ~12 ms
- Done in round 20 instead (see below): the objection below was right about the shape it was aimed at, and is answered by refreshing every open buffer's facts from its held analysis as part of the widen's batch.
Not done, deliberately: no incremental widen (index only the newly in-scope files and keep the rest). See the work log — it cannot hold the brief's own fingerprint-equivalence test while other buffers carry unsaved edits, and it would not have touched the 68 ms re-lex or any rescan that adidOpendid not trigger.
Round 20 — a widen indexes what is new, not everything again (2026-08-28)
-
Workspace::begin_widen: only the files the added folders bring in, plus every open buffer refreshed from the analysis it holds -
finish_scanbranches on the scan's own kind, so a widen cannot be landed as a whole scan;begin_scan/scan_step/publish_scanunchanged -
IncludeGraphholds each edge as the filesystem answered it and re-spells on everyrelearn, so a widened graph is a rebuilt graph byte for byte -
The chooser (
server.rs'swiden_of): a pure add takes the cheap path, anything else falls back to the whole rescan, tested as a table -
A widen asked for mid-scan defers to one whole rescan behind it — the same
rescan_wantedflag every other mid-scan trigger sets -
The progress bar counts the widen's own work list, never the whole scope; the per-file log names only the files it read
-
The persistent store still answers for the files a widen brings in
-
Equivalence pinned seven ways (index fingerprint, all three completion tables, include-graph fingerprint) including unsaved edits at widen time, a folder that contains one already in scope, an include spelled by a file the widen brought in, and a buffer over the large-file threshold
-
opentitan, 3 979 files, warm store: 120 / 132 / 137 / 169 ms → 22 / 18 / 12 / 44 ms per jump, and no longer growing with the browsing history
-
Flagged for the lead, not a bug: a widening
didOpenused to re-read the whole scope and so incidentally caught external disk changes. It no longer does. Fully covered by the file watcher for a client that has one; a client without one keeps the save-only modelfile-watchingdocuments, slightly narrowed. Written out in Assumptions. -
Not done, deliberately: a widen does not interleave. It is a rescan, so
must_waitholds requests queued behind it either way, and the round's point is that there is no longer a wait worth breaking up. -
Not done, deliberately: no incremental shrink. Nothing shrinks the folder scope today;
widen_of's third arm is where one would land. -
Not done, deliberately: the remaining ~11 ms an open 1.4 MB buffer adds to a rescan is the fact walk (1.7 ms), the word set (3.1 ms) and the workspace-wide word table taking 40 000 identifiers back in. It is real work over real content, not a repeat of work already done.
-
Not done, deliberately: no
lucisv.tomlkey for either setting. They are editor-session resource settings — how much of this machine's time to spend — not project style, the same reasonmaxFileSizehas none. -
Not done, deliberately: no shrink-on-close, no LRU on the scope, no time-based eviction. All three are guesses at a problem nobody has reported; the escape hatch for a session that grew too wide is to restart it or set a filelist.
-
Filed, not done:
lucisv_core::walkdoes not read.gitignorefiles above its starting directory, so a root-level ignore rule does not apply to a folder-scoped walk. Fixing it changes the CLI's walk too. -
Filed, not done: the folder scope makes the write-path honesty gap the previous round's QA found sharper — a workspace rename now rewrites only what is in scope, and says nothing about what is not. The follow-up task the lead filed for the size cap covers exactly this and should name the scope too.
Work log
2026-09-08 — §61.3: the workspace rung is discovered in two goes
The scope is unchanged; when it is resolved is not. A rung-2 session with a
buffer already open now walks the folders that buffer raises to first,
indexes and publishes them, and walks the rest of the workspace afterwards —
one scan, one work list, every file stepped once, gone computed against the
whole of it (docs/features/perf5r-first-answer/README.md). The first useful
definition went from 301 ms warm / 266 cold to 115 / 78.
Three things in this README's territory, and all three are "the same rule, asked earlier":
- The rung is unchanged. The split is taken only when rung 2 is in force,
so a filelist and the folder rung resolve exactly as they did.
scopes, eight requests × three scopes × both binaries: 24 of 24 result counts equal, and the persistent store is byte-identical. - The head obeys the root's rules. A walk starting at
hw/ip/aesreads no.gitignoreabove itself, and this README's own note — "a rule written in a root's.gitignoredoes not apply to a rung-3 walk that starts below it" — is a statement about rung 3, where the folder is the scope. Under rung 2 the root is the scope, so the folder half of one scan must obey the root's rules or the two halves disagree about which files exist.lucisv_core::walk::collect_files_belowcarries the ancestor ignore stack down and refuses an ancestor the root walk would not have entered;the_split_head_obeys_a_gitignore_written_at_the_workspace_rootis the wire test. - The bound is
worth_waiting's own, asked without the total. A scan that has not walked the workspace cannot ask whether its head is a minority of it, so the split is refused unless every raised folder is a strict descendant of a workspace root — the case that rule exists for — and again if the walk finds more than 512 files there. Refused, the scan is byte-for-byte the one before this round.
The size cap now reads the length the walk already stat'd
(lucisv_core::walk::collect_files_with): 3 979 metadata calls per scan
became 0, worth a measured 6.9 ms of a 165 ms discovery. A filelist entry
is not walked and still stats once, exactly as before.
2026-09-08 — §P4b3: the read moment, and the order the walk is indexed in
Two documented behaviours moved. The scope ladder itself — precedence, the
rungs, raised, the widen chooser, rootless — is unchanged, and no test of it
was touched (docs/features/perf5-p4/README.md §P4b3).
1. When a file's text is read. collect_sources resolved the scope and
read every in-scope file before a scan's first step: 34 MiB and ~293 ms on
opentitan, held for the whole life of the scan. It now resolves the scope and
reads nothing off disk; Workspace::scan_step reads a file's text when its
step comes and drops it at the end of that step. What follows for this feature:
- The size cap is where it was.
oversizeis still afs::metadatacall incollect_sources, still ahead of any read, so an oversized file is still never read and itsIndexEvent::Skippedand its place inScan::skippedare reported before the first step — which is what the progress bar's denominator and the end message depend on. - An open buffer's text is still taken with the work list, beside the
analysis that describes the same bytes, so a
didChangemid-scan cannot make the two disagree. That is the rule this README's widen section already states, unchanged. - A closed file's text is now the text it has when the scan reaches it,
not the text it had when the work list was taken. Nothing is incoherent: the
facts, the words and the
`includelines of a file all come out of one read, so a file's contribution is internally consistent either way. A file that has left the disk by then contributes nothing and is taken out of the index by the whole scan that could not read it, which is what dropping it before the work list existed used to achieve. sources()— what a refactoring reads — is the one caller that still wants every file's text at once, and it is where that read now happens.
2. What order the walk is indexed in. Workspace::open_first put the open
buffers' own files at the front. It now ranks three groups
(crate::scan_order): the open buffers' own files, then everything under the
directories those buffers raise to, then the rest in path order. The raised
directory is this feature's own Workspace::raised, asked whichever rung is
in force — under a filelist or an explicit workspace scope it is not a
scope question but the only thing that says which part of a 4 000-file walk
to index first, so Workspace::raised_dirs answers it where
Workspace::scope_dirs (a scope question) still answers [].
It remains a latency and reporting decision and nothing more: index_order
sorts and dedups first, IndexBuilder::finish sorts by path, and the finished
index, the completion tables and the include graph are equal to a scan with
nothing open — measured on opentitan as 24 of 24 identical scope answers
and a byte-identical persistent store, and pinned by
the_open_buffers_folder_is_indexed_before_the_rest_and_the_index_cannot_tell.
2026-09-08 — dev (Opus), §P4b2: the startup scan now runs at the answered scope
The ladder is unchanged. What moved is when the first scan reads it.
Server::started used to build the index at the default rung — the folder
scope, which with no buffer open resolves to nothing at all — and only then ask
the client for its settings; a client that wanted index.scope: "workspace",
a scopeDepth, an exclude or a filelist therefore paid a second, whole
rescan when its answer landed. Since today the settings pull goes out first and
the startup scan waits up to two seconds for the answer, so a session runs
one scan, at the rung the answer selected (server/startup.rs,
docs/features/perf5-p4/README.md §P4b2).
Nothing about the ladder itself changed:
- precedence is untouched.
lucisv.fileliststill beatslucisv.index.scope, which still beatsscopeDepth, which still beats the default folder scope; the sameClientSettingsgoes into the sameset_client_settings, only earlier. Measured across all eight (scope × cache state) cells oftools/perf/bench.py scan, which answer with identical file and cache-hit counts. - the rootless rule is untouched. A session with no roots resolves its
scope from the directories a
didOpenraised, exactly as before; adidOpenarriving during the configuration window installs its buffer and the one scan that follows sees it, withopen_firstputting that file at the head of the work list. - the widen chooser is untouched.
widen_ofstill decides Nothing / Added / Whole; what changed is only that a widen asked for before the first scan has run is folded into that scan instead of being run as a scan of its own — the same deferralreindex_widenedhas always applied mid-scan, now also applying in the window before the first scan starts. - a client that cannot be asked, or that never answers, is exactly as it was: the scan runs at the defaults immediately (or after the bound), and a late answer costs the one rescan a changed scope has always cost.
The one visible consequence for this feature: the empty default-scope startup
scan a workspace-scoped client used to pay is gone, and with it the widen the
first didOpen used to trigger behind it. A session that gets its answer runs
one scan; a session that does not runs the two it always ran. Pinned by
server/tests/startup.rs and by this feature's own ladder tests, green
unmodified.
2026-08-29 — dev agent (the first RTL open at the shipped depth)
The brief's diagnosis did not survive the first measurement, and that is the
round's first result. The brief — from performance_take2.md §5b — was that
opening hw/ip/aes/rtl/aes.sv raises the scope to a root that contains the
folders already in it, that widen_of reads that as directories removed and
answers Whole, and that the resulting 1 807-file rescan re-indexes the 124
files the old scope already held. Driven over stdio against
/Users/guoliangchen/repo/opentitan with the HEAD binary, --verbose, none
of that is what happens:
timing: widen started: 1 folder added: /Users/guoliangchen/repo/opentitan/hw/ip
timing: widen finished: 1685 files (0 skipped, 1683 from cache) in 933.73 ms
1 685, not 1 807 — the 124 files of hw/ip/aes are not re-read — and it is
a widen, not a rescan. Both halves were already right, for reasons worth
writing down rather than rediscovering:
scope_dirsraises every opened directory on its own and keeps every answer. Opening the RTL file addshw/ipto a list that still containshw/ip/aes, sobefore ⊆ afterand the chooser sees an add. Under the folder rungbefore ⊆ afterin fact always holds —opened_dirsonly grows andraisedis a pure function of one directory — soWiden::Wholeis unreachable bydidOpen, exactly as round 20 said it was.begin_widenhas diffed by file againstself.index.files()since round 20. The overlap between the two walks is skipped path by path.
So there was nothing to fix in the chooser. What this round did instead is pin both facts (they were true by accident of two separate decisions, and nothing failed if either moved) and then find where the second actually goes.
Where the second goes, warm store, stage by stage. hw/ip, 1 807 files, all
of them cache hits:
| stage | before | after |
|---|---|---|
| walk the added folder, read the new files | 100 ms | 100 ms |
| the scan loop (hash, decode, lex for words) | 405 ms | 405 ms |
index.absorb |
31 ms | 31 ms |
candidates.absorb |
403 ms | 43 ms |
includes.absorb |
20 ms | 20 ms |
The 403 ms was the round's real find, and it is a quadratic. Candidates
keeps the workspace word table as a sorted Vec<String>, and set_words
inserted each newly-seen word into it with Vec::insert — a memmove of the
table's tail, once per word. One file's worth of words is nothing; a widen's
tens of thousands of new words against a table of a hundred thousand is
O(new × held). absorb now counts the whole batch first and brings the table
back in step in a single merge pass, which is the same answer for the reason
merging is: word_cmp is a total order on distinct words, so a sorted run
merged into a sorted table is the sequence Candidates::build's own sort would
have produced. set_words is the same two calls, so the single-file door and
the batch door are one implementation.
Deviation from the brief's file list, flagged for the lead. The brief scoped
this round to state.rs and server.rs. The fix is in candidates.rs, which
belongs to completion-core. It is here because that is where the measurement
led, it is one function split into two, and nothing else in the tree was in
flight — but it is a file this feature does not own, and the Handshakes section
above says so. No signature changed and no caller moved.
End to end, --release over stdio, the HEAD binary and this one
alternated in one session on one machine:
didOpen at the shipped depth |
before | after |
|---|---|---|
hw/ip/aes/dv/tb/tb.sv → hw/ip/aes, 124 files |
51 / 60 ms | 52 / 55 ms |
hw/ip/aes/rtl/aes.sv → hw/ip, 1 685 new |
935 / 881 ms | 555 / 564 ms |
| the same jump, cold store (1 683 real parses) | 1 529 ms | 1 175 ms |
kmac / hmac / spi_device after it |
3–6 ms | 3–6 ms |
The cold row is take 2's 1.4–1.7 s reproduced; take 2's figures were cold-store
ones. The target was "low hundreds of ms warm" and this does not reach it,
and the honest statement of why is that the rest is work rather than waste: 1 683
files this index has never seen, 325 ms of which is lexing them for the word
table. The persistent store answers for a file's facts and not for its words,
so a cache hit still pays a full lex. Putting the word list beside the facts is
the next lever, it is a FACTS_FORMAT change, and it is filed in TODO.md §10
rather than smuggled into this round.
Tests added (3), and what each is for.
| test | where | pins |
|---|---|---|
a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds |
state.rs |
the round's subject, in opentitan's own shape at depth 2: the added directory contains the old scope; only the other blocks are parsed; both open buffers refresh (one carrying an unsaved edit); the over-cap file is walked, skipped and reported again; the bar counts four; and the tables equal a whole rebuild's |
the subsumption row of widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else |
server.rs |
the chooser's answer for a containing directory, stated rather than inferred |
a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted |
candidates.rs |
the merge == the sort, over one batch carrying a word only one file still holds, a word taken and given back inside the batch, a word nothing holds after it, and case variants |
Attacked before believing. Two mutations, each run and each caught: deleting
begin_widen's held.contains skip fails the new state test and no other
test in the crate — which is exactly why it was written; and turning
merge_words' first-touch bookkeeping into a plain insert (so a word given
back inside one batch is counted as new) fails the new candidates test with a
duplicated word. One #[ignore]d probe added,
perf::what_a_widen_that_subsumes_the_old_scope_costs, which asserts the
widened index fingerprints identically to the whole rescan's at the same scope.
The one path that could have paid for it was measured too. set_words — the
single-file door update_one takes on every save — now runs the same merge
rather than one insert, so a save patches the word table with a pass over it
instead of a memmove inside it. Over opentitan with hw/ip in scope, four saves
of spi_device.sv each: 44–46 ms before, 40–41 ms after. No regression, and
one implementation rather than a fast path and a slow one.
Files touched: crates/lucisv_server/src/candidates.rs,
crates/lucisv_server/src/state.rs (test only),
crates/lucisv_server/src/server.rs (doc + test only),
crates/lucisv_server/src/perf.rs, this README, docs/perf/README.md,
TODO.md. No new dependency, no unsafe, no #[allow], no signature change,
no scope-semantics change, no version bump, no commits.
Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings. cargo test --workspace: 2 542
passed, 0 failed (2 540 on HEAD, measured in a checkout of it — 2 new).
cargo build && node editors/vscode/smoke.js target/debug/lucisv-server:
smoke: OK. node editors/vscode/restart_test.js target/debug/lucisv-server:
restart: OK — 44 checks over the restart chain.
How the opentitan pair was taken, so it can be re-taken. git archive HEAD | tar -x -C /tmp/lucisv-before && cargo build --release -p lucisv_server there
gives the "before" binary; a stdio probe (in the session scratchpad — nothing in
the tree may depend on that checkout) drives each binary with --verbose,
opens the four files in order and times the request sent straight after each
didOpen, reading the timing: widen … lines back off window/logMessage. The
cold rows were taken by moving ~/Library/Caches/lucisv/index aside for one run
of each binary and restoring it afterwards. Both binaries were run twice,
alternated, in one session on one machine.
2026-08-28 — dev agent (the shipped scopeDepth moves 0 → 2)
A behaviour change, lead-decided, and it belongs in the release notes. The rationale and the numbers are in Assumptions → The default depth; this is what was done and what it cost.
The default lives in one place, settings::DEFAULT_SCOPE_DEPTH, read by
ClientSettings::default and by from_payload's unwrap_or — so a
wrong-typed scopeDepth now falls back to the shipped default rather than to
zero, which is the same direction every other setting in that function already
falls. editors/vscode/package.json declares the same number, and
the_extensions_declared_defaults_are_the_ones_this_module_ships reads the
manifest and asserts it, because a hand-written mirror that drifts proves
nothing.
The one thing that had to change beyond a constant: the rootless climb.
raised() had no floor without a workspace root — the loop stopped at /.
That was defensible while the shipped depth was 0 (nobody climbed unless they
asked), and indefensible at 2: opening one loose file would have raised two
levels into a tree the user never named and walked it. raised() now returns
the directory unchanged when roots is empty. This removes a capability —
a rootless session can no longer widen by raising the depth — and the two
tests that pinned the old climb were rewritten rather than deleted, so the new
rule is asserted at depths 0, 1 and 99 instead of assumed. The setting's
description already told single-file users to leave it at 0; now the server
does that for them.
Consequence, stated rather than discovered: a rootless session at the new
default still finds its own directory, but walks it instead of reading it
flat, because folder_files's flat-read exception is still keyed on depth 0.
Bounded by the one directory the user opened a file from, so it was left as
the simpler rule; e2e::with_no_workspace_folder_the_open_files_own_directory_is_indexed
carries the new expectation and says why.
Test fallout, and how it was handled. Nineteen tests across state.rs,
server.rs and e2e.rs asserted the depth-0 rung while spelling only
ClientSettings::default(). Every one of them is about the narrow rung rather
than about whatever the default happens to be, so each now says 0 out loud —
state::tests::own_folder_only for the unit tests, a didChangeConfiguration
push for the two wire tests. That is a better test either way: none of them
now moves when a default moves. The one test that really was about the default
was renamed (the_folder_scope_at_depth_zero_is_...) and a new one written for
the shipped depth.
Files touched outside this feature's usual set, flagged for the merge:
state.rs (one production line in raised, plus the test-fixture updates
above) and server.rs (two test premises). Both are test-shaped except that
one line.
2026-08-27 — dev agent (open-file-first indexing, folder-scoped walk)
- The builder was hardened first, because the ordering change depends on
it. Feeding the open files first is only free if insertion order provably
cannot reach the index, so
IndexBuilderwas rewritten to accumulateFileFactsand sort infinishbefore anything in the server was reordered. The five-line sort beat the type-enforced two-phase alternative on every axis that matters here (one type instead of three, no conversion, and the misuse becomes impossible rather than merely uncompilable); the price is that the per-file records live untilfinish, which is the index's own data partitioned rather than merged.WorkspaceIndex::add_file/add_membersbecame the freefacts_of/collect_memberswith the same traversal, so the merged tables come out in the same order they always did — which is why all 31 existing tests are byte-identical and green. - The scope ladder went in
source_files's rung 3, not beside it. The filelist rung and the walk are untouched;default_filesnow chooses betweenwalked_files(&self.roots)andfolder_files(), andfolder_filesiswalked_files(&scope_dirs())with the one rootless exception. That kept the exclude/gitignore/cap plumbing literally the same function, which is what makes "every filter still applies" a fact rather than a claim. opened_dirs, notdocs, is what the scope is derived from. This is the close-shrink decision: the scope grows within a session and never narrows. Deriving from the open documents would have been one less field, but it makesdidClosesilently change what the next save indexes, which is a worse surprise than a scope that is a few folders wider than the tab bar. It also keepsdidClosefree of any rebuild.didOpen's branch is now one comparison, and it subsumes the rootless rule.has_roots()was answering "can an open buffer widen the scope?" by proxy;scope_dirs()answers it directly and correctly on all three rungs. Two deliberate deltas fell out and are documented: a rootless session opening a second file in a directory it already read no longer rebuilds, and a rootless session with a filelist no longer rebuilds on open either (the filelist defines the scope; the buffer is overlaid at the next rebuild regardless).- The clamp is the deepest containing root, not the first. With nested workspace folders the tighter floor is the honest one — the user opened both, and the inner one is the more specific statement about that file.
- The rootless flat read is kept at depth 0 and only at depth 0. Turning it
into a walk would have changed the "a file opened on its own" case that has
its own documented reason to be shallow; leaving it flat at every depth
would have made
scopeDepth: 1index the parent directory while losing the file's own siblings, which is worse than either. So: unchanged at the default, walked the moment the user raises the depth, and both halves pinned. - The startup scan indexes nothing now, because no buffer is open yet. That
reads as alarming and is exactly the feature: the e2e transcript's first bar
ends
0 files indexed, thedidOpenbar reports the real file, and that sequence is asserted on the wire. - The blast radius was 151 tests, and the honest fix was to make each of them
say what scope it wants. Every test across the crate whose subject is not
the scope now calls
Workspace::open_whole_workspaceorSession::wideinstead of the plain form — a mechanical, reviewable change that leaves each test exercising exactly what it exercised before, with the scope no longer a hidden variable. Four settings pushes inside those tests gained"scope": "workspace"for the same reason a push replaces every field. The new default's own behaviour is covered by the 22 new tests rather than by accident. - One test was superseded rather than repaired.
a_rootless_session_gaining_its_first_folder_flips_didopen_from_reindex_to_publishpinned the branch this round deletes; it is replaced bya_didopen_rebuilds_exactly_when_it_widens_the_scope, same case list, under the rule that replaced it, with an explicitSuperseded this round:note in the house style. - Two e2e expectations moved, both of them the model becoming visible on the
wire:
indexing_reports_its_progress_over_the_wirenow shows three bars (empty startup, the wideningdidOpen, the save) with the honest end messages, anda_save_asks_a_capable_client_to_refresh_its_code_lenses_over_the_wirecounts two refreshes because there are now two rescans in its script. - The
.gitignoregap was found by a failing test I had written to assert the opposite, and is documented and pinned as a delta rather than papered over or "fixed" by reaching intolucisv_core's walk, which is the CLI's too. - Files touched:
crates/vlog_semantic/src/workspace.rs,crates/vlog_semantic/tests/workspace.rs,crates/lucisv_server/src/settings.rs,crates/lucisv_server/src/state.rs,crates/lucisv_server/src/server.rs,crates/lucisv_server/tests/e2e.rs, the test modules ofcompletion/hierarchy/file_ops/includes/inlay/hover/lens/ nav/ports/rename/type_def/type_hierarchy/signature/symbols(constructor swap only),editors/vscode/package.json,docs/features/lucisv-server/README.md,docs/features/indexing-ux/README.md, this README. No new dependency, no version bump, noCHANGELOGedit, nodocs/site/, no commits.
Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings. cargo test --workspace: 2217
passed, 0 failed (2198 on HEAD, measured — 19 new). cargo test -p vlog_formatter:
green, untouched. cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK. node -e JSON.parse(package.json):
parses.
The 19 new tests, the 3 extended and the 1 rewritten, and what each is for:
| test | pins |
|---|---|
no_insertion_order_can_change_what_the_builder_produces (vlog_semantic) |
QA's attack, three orders, full fingerprint — ids, disambiguation winner, member tables, defines |
a_path_added_twice_is_one_file_whichever_end_the_duplicate_is_at (vlog_semantic) |
index_order's dedup rule surviving the move into finish, non-adjacent duplicate included |
the_index_scope_is_the_open_folder_until_a_client_asks_for_the_workspace (settings) |
the default, both words, six junk values → the narrow default |
the_scope_depth_is_zero_until_a_client_raises_it (settings) |
the default, no upper bound, six wrong types |
the_index_settings_come_through_the_pull_door_too (settings) |
both new keys through from_section as well |
the_default_scope_is_the_open_files_own_folder_and_everything_under_it (state) |
the headline: own folder and subtree, no sibling folder, nothing before a buffer opens |
a_scope_depth_of_one_reaches_the_folder_beside_it (state) |
the rtl/ + ../include layout the setting exists for |
the_climb_stops_at_the_workspace_root (state) |
the clamp at depth 99, and the deepest of two nested roots winning |
a_rootless_climb_stops_at_the_filesystem_root (state) |
termination at / with no root — on the directories, never walking one |
a_rootless_session_that_raises_the_depth_walks_instead_of_reading_one_level (state) |
the one exception, from the other side |
the_workspace_scope_setting_restores_the_walk_of_every_root (state) |
the migration line, and that the depth is ignored on that rung |
a_filelist_still_defines_the_scope_exactly_whatever_the_folder_rung_would_say (state) |
rung 1 over rung 3, and that no didOpen can widen a filelist |
closing_a_file_never_narrows_the_scope (state) |
the close decision |
the_folder_scope_honours_every_exclude_and_the_gitignores_below_it (state) |
both excludes, the in-scope .gitignore, and the root-.gitignore gap, both scopes |
a_folder_added_mid_session_widens_nothing_until_a_file_in_it_is_opened (state) |
folder events × the folder rung |
a_scope_or_a_depth_change_asks_for_a_rescan (state) |
both directions, both settings |
the_open_files_are_indexed_first_and_the_index_cannot_tell (state) |
the event order and that the index equals the plain-order one |
a_didopen_rebuilds_exactly_when_it_widens_the_scope (server) |
the unified rule: widens → rebuild, covered → publish only, rootless and rooted |
a_new_index_scope_or_depth_rescans_through_the_real_dispatch (server) |
parser + change test + rescan, end to end through didChangeConfiguration |
the_bar_names_the_open_file_before_the_rest_of_the_scope (server) |
1/3 m_open.sv first on the wire |
the_folder_scope_widens_when_a_file_in_another_folder_is_opened (e2e) |
the real binary: definition into a sibling folder empty, opening it resolves, and a "workspace" client resolves immediately |
indexing_reports_its_progress_over_the_wire (e2e, updated) |
the model on the wire: three bars, 0 files indexed then 1 file indexed twice |
2026-08-28 — dev agent (a rescan stops re-parsing what is already analyzed)
The symptom, reproduced first. nav.rs's
qa_didopen_latency_when_a_new_folder_widens_the_scope, --release, three
runs on HEAD: the widening didOpen 227.2 / 229.3 / 229.4 ms, the rescan
alone 224.5 / 224.7 / 225.4 ms, and 12.5 / 13.1 / 12.6 ms for the same
rescan with the 1.4 MB top.sv closed. (The closed number is the floor for a
reason worth naming: top.sv is 1.4 MB, over the 1 MiB default
lucisv.index.maxFileSize, so with no buffer open it is not walked at all. The
"13 ms" is the other 400 files, not 401.)
Where the 210 ms actually goes. rebuild_index_with timed stage by stage,
with the buffer open, per rescan:
| stage | with the buffer open | with it closed |
|---|---|---|
collect_sources (401 reads) |
9.5 ms | 8.4 ms |
| the facts loop | 133.5 ms | 1.5 ms |
IndexBuilder::finish |
0.4 ms | 0.12 ms |
Candidates::build |
68.5 ms | 0.85 ms |
IncludeGraph::build |
0.84 ms | 0.14 ms |
| overlay refresh | 0.12 ms | ~0 |
So the brief's "210 ms of re-lexing and re-parsing the open buffer" is right in
total and understates the shape: the buffer was lexed twice per rescan.
Once inside FileFacts::of (tokenize 62 ms, parse 66 ms, analyze 18 ms,
the fact walk under 2 ms — 133 ms in all), and again inside
Candidates::build, whose words_in re-lexes every file's text to harvest
identifiers (62 ms of the 68 ms). A third, smaller waste sat in
collect_sources, which read the 1.4 MB disk copy of top.sv and then threw
it away because the buffer overrides it. Every one of those three is work this
server had already done: the Document for that buffer holds the tokens, the
tree, the define table and the Semantics, all built from the same text by the
same functions, at the last keystroke.
Shape taken: (b), extended to the completion words. (a) was investigated and rejected, on two grounds.
- (a) cannot hold its own mandatory test. The brief's hard requirement for
an incremental widen is that the widened index fingerprint byte-identically
to a fresh full build. It does not, in a case that is easy to reach: the
index is rebuilt on save, not on change, so between two rebuilds any open
buffer may carry unsaved edits. A full rebuild at the widening
didOpenindexes those edits (collect_sourcesoverlays live buffer text); an incremental widen that indexed only the newly in-scope files would not. That is an answer change — typepackage p;into an open buffer, jump into a new folder, and the two shapes disagree about whetherpexists — and the fingerprint test would catch it as a failure, correctly. Making (a) safe means re-indexing the changed buffers anyway, which is (b) with a diff bolted on in front. - (a) would have fixed a third of it. It touches only the facts loop, and
only on the rescans a widen triggers. The 68 ms word re-lex is in
Candidates::build, which a widen rebuilds whatever the file list did; and every other rescan with a big buffer open — a save that falls back to a whole rebuild, a settings change, a folder event, a watched file — keeps paying the full 200 ms. (b) is one rule that covers all of them: an open buffer's finished analysis is what the buffer contributes, wherever it is asked.
The equivalence is by construction, then pinned anyway. facts_of was
split: everything after tokenize/parse_tolerant/analyze moved into
facts_from_analysis, and FileFacts::of now calls it. So
FileFacts::from_analysis is not a second way of computing a record — it is
the same code entered one step later, which is the difference between an
equivalence that has to be tested for and one that has to be broken to fail.
The same split gives words_of_tokens (the whole of words_in after the lex)
and WorkspaceIndex::update_facts (the whole of update_file after the
parse). What is left to prove is the narrow claim that Document::new's
analysis is facts_of's analysis — two separate call sites of the same three
functions, including the all-or-nothing lex-failure branch — and that is what
the corpus sweeps are for.
The reuse is wired where the override already lives. collect_sources is
the one place that decides "this buffer's text beats the disk copy"; the facts
and the words are now taken from the same Document in the same loop
iteration, so a record and the text beside it can never describe different
bytes. rebuild_index_with consults that map before the persistent cache,
deliberately: an open buffer's own analysis is right even when the buffer has
unsaved edits, which is exactly when a content-keyed store has nothing to
offer. It still writes the record through to the store, so the next session
starts from it.
One argument rather than one wasted walk. collect_sources has a second
caller — sources(), which every refactoring reads the workspace through — and
it wants the texts alone. Building a record and a word set off every open buffer
for it would be ~5 ms of dead work per prepareRename with a 1.4 MB buffer
open, so the function takes a HeldAnalyses argument saying which caller it is.
A boolean would have read as collect_sources(watch, true) at the call site;
the two-variant enum says what the true means.
update_one takes the same shortcut, through the new analysis_of, which
finds the buffer the same way current_text does — so a didSave on a big
buffer stops re-parsing it too. That is not the brief's headline case but it is
the same waste on the path a user hits most often.
A third event word rather than a fourth meaning for cached.
IndexEvent::Analyzed is its own variant so "N from cache" in the progress
bar's end message keeps meaning the persistent store and nothing else — that
sentence is index-persistence's, and e2e transcripts assert it. The per-file
log gains analyzed: <path>; the end message gains nothing, because one
file out of a workspace is not why a scan finished fast, and a bar that grew a
clause in every session with a file open would say less rather than more.
Analyzed still ticks the bar, like the other two: it is a file of the work
list.
Two existing tests moved, both for the same honest reason.
the_open_files_are_indexed_first_and_the_index_cannot_tell counted Parsing
events to check the order of the work list; it now counts all three routes,
because the open buffer it is watching no longer parses.
the_cache_never_puts_back_a_file_the_scan_no_longer_visits asserted its open
buffer came from the store; it now asserts it came from its own analysis, and
also that it appears on neither of the other two lists — the test's real point
(tb/b.sv has a record and is still not an indexed file) is untouched.
After, same probe, three runs: the widening didOpen 22.7 / 23.2 /
24.0 ms, the rescan alone 22.6 / 23.1 / 24.7 ms, the closed-buffer floor
11.5 / 12.8 / 12.4 ms — unmoved, as it must be. ~228 ms → ~23 ms, 10×,
and the open 1.4 MB buffer's own share of a rescan went from ~212 ms to ~11 ms.
The probe now prints that share directly and permanently, so the claim is
re-measurable rather than remembered:
That buffer's own share: facts 140.3ms parsed vs 1.67ms reused,
words 62.9ms re-lexed vs 3.09ms reused
references-nav's own probe is unchanged and green on the same run
(110 µs cross-file references either direction, 1.18 ms for the in-file
fallback on a name used 10 001 times), which is what says this round did not
pay for its rescan out of the request path.
What is left, and why it is not waste. The ~12 ms the open buffer still
adds is the fact walk over its tree (1.7 ms), the identifier set over its
tokens (3.1 ms), and Candidates::build taking 40 000 identifiers into the
workspace-wide word table. All three are work over content that really is in
the index; none of them repeats work already done.
Tests added (6). vlog_semantic:
facts_from_a_finished_analysis_are_byte_identical_to_facts_from_the_text
(13 crafted shapes — empty, unlexable, tolerant-parse-with-errors, packages,
classes, nested classes, `define/ `undef, imports and :: paths, a
file-scope instantiation that is deliberately not an edge, a generate body),
the_two_ways_to_read_a_files_facts_agree_over_the_whole_corpus (860 files,
encoded records byte-identical),
an_index_built_from_finished_analyses_fingerprints_the_same_as_one_built_from_text
(workspace scale, files added in reverse path order so the reuse cannot smuggle
an ordering in, plus update_facts == update_file). lucisv_server:
an_open_buffers_analysis_indexes_to_exactly_what_its_bytes_on_disk_would
(an edited buffer — bytes nowhere on disk — against the same bytes written
to disk and parsed: same fingerprint, same words, same unit candidates, and the
event lists prove the two really took different routes),
an_open_buffer_offers_the_facts_and_words_its_text_would_over_the_real_corpus
(the narrow claim, over real Document::news — this is the one that catches
Document::new drifting from facts_of),
a_buffer_on_the_large_file_fast_path_offers_no_analysis_to_reuse.
Attacked before believing. Three deliberate mutations, each run and each
caught: giving Document::facts an empty DefineTable fails both the crafted
fingerprint test and the corpus record sweep; dropping every 97th token in
Document::new fails the corpus words sweep. (A mutation to words_of_tokens
itself is not caught, and correctly so — both roads go through that one
function, which is the point of the split.)
Files touched: crates/vlog_semantic/src/workspace.rs,
crates/vlog_semantic/tests/workspace.rs,
crates/lucisv_server/src/state.rs, crates/lucisv_server/src/candidates.rs,
crates/lucisv_server/src/server.rs, crates/lucisv_server/src/nav.rs
(the probe's own numbers), this README,
docs/features/references-nav/README.md (the Handshake, delivered),
docs/features/indexing-ux/README.md (the new log word), TODO.md. No new
dependency, no FACTS_FORMAT change, no scope-semantics change, no version
bump, no commits.
Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings. cargo test --workspace: 2413
passed, 0 failed (2407 on HEAD, measured — 6 new). cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK.
2026-08-28 — dev agent (a widen indexes what is new, not everything again)
The symptom, reproduced against the real repo before anything was written.
The lead's probe, adapted to time exactly the thing the owner feels — a
didOpen in a new folder, then the very next textDocument/definition, which
must_wait holds behind the rescan the open asked for. --release, over
stdio, /Users/guoliangchen/repo/opentitan (3 979 SV files), folder scope,
warm store, two runs of the binary built from HEAD:
| jump | before, run 1 | before, run 2 |
|---|---|---|
didOpen hw/ip/aes/rtl |
119.9 ms | 119.5 ms |
didOpen hw/ip/kmac/rtl |
131.2 ms | 133.6 ms |
didOpen hw/ip/hmac/rtl |
137.7 ms | 136.5 ms |
didOpen hw/ip/spi_device/rtl |
168.6 ms | 169.9 ms |
— the growth is the report: every jump re-pays for every folder before it. Settled definitions in the same session are 0.06–0.11 ms, which is the owner's own expectation and was already true.
After, same probe, same machine, same session, the two binaries alternated:
| jump | after, run 1 | after, run 2 |
|---|---|---|
didOpen hw/ip/aes/rtl |
22.3 ms | 21.6 ms |
didOpen hw/ip/kmac/rtl |
18.2 ms | 17.8 ms |
didOpen hw/ip/hmac/rtl |
12.2 ms | 12.8 ms |
didOpen hw/ip/spi_device/rtl |
44.3 ms | 44.3 ms |
The shape is the point, not the ratio. What is left is proportional to the
folder being opened — spi_device/rtl is the big one and costs the most, every
time — and no longer to how long the user has been browsing. The first
definition of the session, which waits for the didOpen(tb.sv) widen, went
from 99.7 ms to 0.9 ms for a reason worth naming separately: begin_scan
re-opens the persistent store on every whole rescan, and reading and decoding
3 979 records is most of that 99 ms. A widen keeps the handle the last whole
rescan left, so it pays none of it. (The probe is in the scratchpad, not in the
tree: nothing committed may depend on that checkout.)
The synthetic regression is the same measurement without opentitan.
perf::what_a_jump_into_a_new_folder_costs_before_and_after generates 40
folders × 25 files of 200 lines, jumps through six of them, and runs both
shapes over the same tree in the same run — asserting after every jump that
the two indexes fingerprint identically, so the columns are comparable by
construction:
| jump | files in scope after it | whole rescan | incremental widen |
|---|---|---|---|
| 0 | 25 | 18.2 ms | 17.8 ms |
| 1 | 50 | 37.1 ms | 18.1 ms |
| 2 | 75 | 54.0 ms | 18.6 ms |
| 3 | 100 | 71.7 ms | 18.7 ms |
| 4 | 125 | 89.4 ms | 19.1 ms |
| 5 | 150 | 107.1 ms | 19.2 ms |
The first row being equal is the honest baseline: with nothing indexed yet the two paths do the same work.
Round 19's objection was right, and answering it is two lines in
begin_widen. That round rejected this shape because a widen that indexed
only the new folder would drop the unsaved edits a whole rescan's
collect_sources overlay picks up — "type package p; into an open buffer,
jump into a new folder, and the two shapes disagree about whether p exists".
So the widen's work list is the new files plus every open buffer, each
contributing the FileFacts/words it already holds — the machinery round 19
itself built, at ~1.7 ms + ~3.1 ms for a 1.4 MB buffer and no parse at all.
a_widen_leaves_the_tables_a_whole_rescan_would_have_left is that exact attack
run as a test, and it fails without the buffer refresh.
The same rule answers the case round 19 did not name. collect_sources
drops a buffer on the large-file fast path from the index entirely, so a file
whose buffer has grown past the threshold since the last rescan is one a whole
rescan removes. Following collect_sources exactly means the widen removes it
too — the one thing a purely additive widen would have got wrong, and the
reason Scan has a gone list rather than an assumption.
The include graph needed a real change, and it is the one that makes the
equivalence structural. IncludeGraph::absorb re-resolves only the batch's
own edges, so a file already indexed kept whatever spelling it had. That is
almost always the same answer, and narrowly not: as_the_index_spells_it
lends an in-scope file's own spelling to a case-mismatched include, so a file
the widen brings into scope can change how an edge resolved before it arrived
must be spelled. Rather than re-scan every file's text (which is the re-read
this round exists to avoid), the graph now holds each edge as the filesystem
answered it and re-spells all of them on every relearn — in memory, no
is_file call, no file re-read. Which file an include lands on is a question
for the disk; which spelling that file has is a question for the scope; only
the second one moves when the scope grows. a_widen_lends_a_new_files_spelling_to_an_include_resolved_before_it
is the witness, and it fails against the old storage.
The chooser is deliberately narrower than what is reachable. widen_of
takes the cheap path only when the scope grew and lost nothing. Nothing takes a
directory out of the folder scope today — opened_dirs only grows and a
didClose costs no rescan — so the fall-back arm is a rule kept rather than a
case reached; a future shrink gets the whole rescan, which is always a correct
answer, instead of a subtly wrong cheap one. The table is
widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else.
Mid-scan a widen defers rather than folding in, and that is the coalescing
rule unchanged. A scan in flight holds a work list taken from the old scope;
folding a widen into it would make "which files exist" mean two things inside
one scan. reindex_widened sets the same rescan_wanted flag every other
mid-scan trigger sets, so the answer is one more whole scan behind this one —
cheap, because it reads the persistent store for everything the running scan
already parsed. Reached by driving the flag directly rather than over the wire,
and the test says why: a widen never drains the queue, and under the folder
scope the startup scan indexes nothing and so never interleaves, so the wire
route to this case is a didOpen answered inside a long whole rescan — which is
this flag and this call.
finish_scan branches; the three calls before it do not. Scan grew a
private kind, and finish_scan dispatches on it, so a caller cannot land a
widen as a whole scan or the other way round. Everything per-file —
begin_scan's siblings scan_step and publish_scan — is literally the same
code for both shapes, which is what makes the cache behaviour, the open-buffer
reuse and the event stream identical without a second implementation to keep in
step. Two things the widen deliberately skips are in the Handshakes section
with their reasons: the store is not compacted and the view cache is not
cleared.
The progress bar counts the widen's own work list, which is what the brief
asked for: a jump into a 25-file folder says 1/25, not 1/3979. The end
message still names the index's whole size, which is end_indexing's existing
sentence and is the honest one — the bar names the scan, the message names what
the workspace now holds.
Files touched: crates/lucisv_server/src/state.rs,
crates/lucisv_server/src/server.rs, crates/lucisv_server/src/includes.rs,
crates/lucisv_server/src/perf.rs, crates/lucisv_server/tests/e2e.rs,
this README, docs/features/scan-interleave/README.md,
docs/features/file-watching/README.md,
docs/features/indexing-ux/README.md, docs/perf/README.md, TODO.md.
No new dependency, no unsafe, no
#[allow], no scope-semantics change, no version bump, no commits.
Tests added (12).
| test | where | pins |
|---|---|---|
a_widen_leaves_the_tables_a_whole_rescan_would_have_left |
state.rs |
the headline, with an unsaved edit in an already-open buffer: index fingerprint, words, units, macros, include graph |
a_widen_reads_only_the_files_the_new_folders_brought_in |
same | the work list: two new files parsed, both buffers reused, the old folder untouched |
a_widen_bar_counts_the_new_files_and_not_the_whole_scope |
same | the progress denominator |
a_widen_into_a_folder_that_contains_the_old_one_indexes_each_file_once |
same | a file in both the old and the new scope portion, and the tables still equal |
a_widen_lends_a_new_files_spelling_to_an_include_resolved_before_it |
same | the include-graph re-spelling, which is why edges are stored raw |
a_buffer_grown_past_the_threshold_leaves_the_index_when_the_scope_widens |
same | the one removal a widen makes, against the rebuild |
the_persistent_cache_answers_for_the_files_a_widen_brings_in |
same | cache hits on a widen's own files |
a_widen_that_adds_nothing_new_still_refreshes_the_open_buffers |
same | the degenerate widen, where the refresh is all the work there is |
widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_else |
server.rs |
the chooser, as a seven-row table |
a_didopen_widen_leaves_the_index_a_whole_rescan_would_have_left |
same | two jumps through the real dispatch, then the rescan, then compare |
a_widen_asked_for_mid_scan_defers_to_one_whole_rescan_behind_it |
same | the coalescing rule |
a_jump_into_a_new_folder_indexes_that_folder_and_not_the_ones_before_it |
tests/e2e.rs |
the real binary over a generated 24-folder workspace: per-bar, per-file, the log proves each jump read its own 19 files and reused every open buffer |
One #[ignore]d probe added
(perf::what_a_jump_into_a_new_folder_costs_before_and_after), which is the
before/after table above and asserts the two indexes match at every jump.
Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings. cargo test --workspace: 2 469
passed, 0 failed (2 457 on HEAD — 12 new). cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK. The one
existing measurement this round could have moved —
state::tests::qa_perf_cold_warm_and_half_warm_scans, since the include graph
now re-spells its edges on every relearn — is 361 / 381 / 202 ms against
the 322 / 353 / 189 recorded and the 347 / 387 / 203 QA measured, with the store
byte-identical at 2 380 790 bytes.
How the opentitan pair was taken, so it can be re-taken. git archive HEAD | tar -x -C /tmp/lucisv-before && cargo build --release -p lucisv_server there
gives the "before" binary; the probe (widen_probe.py, in the session
scratchpad — nothing in the tree may depend on that checkout) drives each binary
over stdio and times the definition sent straight after each didOpen. Both
binaries were run twice, alternated, in one session on one machine.
QA log
2026-08-27 — QA agent (gates, attack surfaces, mechanical-sweep audit)
Gates, re-run clean on the untouched working tree. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings.
cargo test --workspace: 2217 passed, 0 failed, 5 ignored (matches the
dev's count exactly). cargo test -p vlog_formatter: 114 passed, untouched.
cargo build && node editors/vscode/smoke.js target/debug/lucisv-server:
smoke: OK. Every temporary probe test below was inserted, run alone, and
reverted before the final re-run; the final git diff of state.rs/server.rs
hashes identically to the pre-QA diff, confirming no probe was left behind.
The 151-test mechanical sweep. Sampled all 14 non-scope test modules
(completion, file_ops, hierarchy, hover, includes, inlay, lens,
nav, ports, rename, signature, symbols, type_def,
type_hierarchy — every .open_roots( call in them, ~40 sites) plus the
server.rs/state.rs Session::wide/Workspace::open_whole_workspace
call sites: every one is a pure constructor swap (open_roots →
open_whole_workspace, or Session::with/Session::new →
Session::wide/Session::wide_with, or a "scope": "workspace" key added
to a settings push). No sampled assertion changed beyond that. Verdict:
mechanical sweep is genuinely mechanical, as claimed.
The inverse hunt (tests that should have been swapped but weren't) found
one real bug and two weakened premises, all in state.rs's own test
module, which is the one file that still has bare .open_roots( calls
mixed in with the new scope tests:
- MEDIUM —
a_folder_added_twice_across_two_events_is_absent_after_one_removal(crates/lucisv_server/src/state.rs:851-876) no longer tests what it says it does. It callsws.open_roots(...)but never opens any buffer, so under the new default (folder scope)scope_dirs()is empty for the entire test and"x"is never indexed — not because of the root add/remove/dedup logic under test, but because nothing is ever in scope. The finalassert_eq!(indexed(&ws, &["x"]), [])passes vacuously. Confirmed by temporarily inserting a premise check (assert_eq!(indexed(&ws, &["x"]), ["x"])) right after the firstchange_rootsadd and running the test alone: it failed (left: [] right: ["x"]), proving the premise never held. Thechange_rootsreturn-value assertions (true/false/true) are unaffected and still test the set-not-multiset behavior correctly — only the closingrebuild_index/indexedpair is vacuous. Fix: either open a buffer inextra's directory before checking, or switch toopen_whole_workspaceand keep the indexed-content assertion meaningful. Not fixed directly — it is a one-line-comment-vs-actual-behavior mismatch that the dev should decide the intended fix for (open a buffer, since the test's own comment is about indexing, not about scope). - LOW —
an_open_buffer_is_indexed_however_big_the_file_is(state.rs:1151-1168)'s "premise: capped on disk" assertion is now true regardless of the cap, because no buffer is open at that point either, so folder scope is empty and nothing is indexed for that reason first. The test's actual point (the open buffer overrides the cap afterset_document) still holds and is still meaningfully exercised, sinceset_documentadds the directory to scope before the secondrebuild_index. Not a false pass on the assertion that matters, but the premise no longer demonstrates what its comment claims. - LOW — stale rung numbers in comments, not behavior:
without_a_filelist_there_are_no_incdirs_at_all(state.rs:1454-1462) says "Rung 2 of the ladder names no include path," anda_broken_filelist_leaves_the_include_graph_without_incdirs(state.rs:1464-1475) implies the same fallback. Both are now rung 3 (folder scope) by default, not rung 2 — the assertions (Noneeither way, since no filelist means no incdirs regardless of which walk rung ran) are unaffected, but the comments should say "rung 2 or 3" or just "the fallback."
All other .open_roots( calls left bare in state.rs were individually
checked and are correct as left: the filelist tests (rung 1 always wins,
scope-independent), the rootless tests (rung 3 is the only rung with no
root, unaffected), and a_folder_change_that_changes_nothing_asks_for_no_rescan
/ a_trailing_slash_in_the_removed_folder_still_matches_the_held_root (test
change_roots's bookkeeping only, no indexed-content assertion to weaken).
Scope correctness at the boundaries — all traced and probed, all correct, none pinned by a permanent test beyond what's listed below:
- Depth clamping when the open file is at the root:
raised()'s first loop iteration comparesout == floorbefore descending, so a root-level buffer returns immediately at any depth. Covered bythe_climb_stops_at_the_workspace_root. - Nested roots, deeper clamps tighter:
max_by_key(|root| root.components().count())— confirmed by the same test's second half. scopeDepthpast the path depth: terminates at/(rootless) or the containing root (rooted), confirmed bya_rootless_climb_stops_at_the_filesystem_rootand the depth-99 case inthe_climb_stops_at_the_workspace_root.- A file opened from outside every workspace root, with roots present
(folder scope still the active rung): no permanent test covers this.
Probed with a temporary test (root A open, a buffer opened from an
unrelated tree B):
scope_dirs()at depth 0 is just B's own directory, and raisingscopeDepthto 99 climbs all the way to/— exactly the rootless behavior, becauseraised()'sfloorisNonewhen no root contains the directory. Correct, but untested and not called out in the README's Assumptions as a distinct case from "rootless session." Recommend a pinned test plus a sentence in the README. - Symlinked folders / case differences on macOS:
opened_dirsdedups by literalPathBufequality (seen == dir), not canonicalized — a symlink and its target, or/RTLvs/rtl, are two separate scope directories that both get walked. Not a regression: the pre-roundsibling_filesdeduped the same way. Informational only.
The grows-only model's costs. Opening three folders then closing all
three: union sticks, verified with a temporary test (three folders opened,
all three closed, rebuild_index, same five packages still indexed) — not
just the dev's one-of-two-closed case. The pathological end (opening files
across many folders converges the walk cost back toward the whole-workspace
walk this round exists to avoid) is acknowledged only indirectly — the
README's "Not done, deliberately" section says there's no shrink/LRU/TTL and
names "restart or set a filelist" as the escape hatch, but never states the
asymptotic point plainly. Recommend one sentence owning it, e.g. "a session
that has opened files in most of the project's folders pays close to the
whole-workspace walk on every rescan; that is the trade, not a bug."
Builder hardening. no_insertion_order_can_change_what_the_builder_produces
and a_path_added_twice_is_one_file_whichever_end_the_duplicate_is_at both
pass. Independently re-derived the "first wins" claim from first principles
rather than trusting the doc comment: wrote a 6-line scratch program
exercising Vec::sort_by + Vec::dedup_by with the exact closure shape used
in finish (sort_by(|a,b| a.path.cmp(&b.path)) then
dedup_by(|a,b| a.path == b.path)) on [("a",1),("a",2),("b",3)]; it
produces [("a",1),("b",3)], confirming dedup_by really does keep the
first of a run in this position (the docs' phrasing invites an off-by-one
misreading given the reversed-argument-order caveat). add_file after
finish: prevented at compile time — finish(mut self) consumes the
builder, so this is Rust's ownership system doing exactly what a type-state
SortedFiles wrapper would do, for free, matching the README's stated
rationale for not building one. Empty builder finish(): sorts/dedups an
empty Vec, loop body never runs, returns WorkspaceIndex::default() — no
panic, consistent with an_empty_workspace_answers_nothing_and_panics_nowhere
already covering WorkspaceIndex::build([]) through the same path.
Cross-feature interaction sweep — verified clean, and structurally so
rather than by accident. symbols.rs, lens.rs, type_hierarchy.rs all
read from ws.index() directly; rename.rs reads from ws.sources(),
which is collect_sources(...).texts, the exact same source_files() ladder
rebuild_index uses. There is one scope-aware code path, not one per
feature, so "workspace/symbol, codeLens, typeHierarchy and rename all answer
in-scope only" is a structural fact, not a per-feature promise that could
drift. workspace/diagnostic (server.rs:988 workspace_report) iterates
self.workspace.open_uris() only — confirmed independent of the index
scope entirely, exactly the "unaffected" claim. The cap composes with scope
by construction too: collect_sources applies max_file_size to
scope.files, which is already the scope-filtered list — no special-casing
needed, none found.
Migration path. Rather than diff against a git stash baseline binary,
verified the stronger claim algebraically: default_files()'s
walks_the_workspace() branch calls self.walked_files(&self.roots), and
walked_files(dirs: &[PathBuf])'s body is byte-identical to the pre-round
walked_files(&self)'s body with &self.roots substituted for dirs at
every use — confirmed by re-reading the diff hunk line by line. So
scope: "workspace" is not merely equal in practice to the pre-round
default, it is the same function called with the same argument, which is a
stronger guarantee than a fixture comparison could give. from_section
delegates to from_payload with zero new code (settings.rs:208-210), so
both settings doors carrying the two new keys is confirmed structurally.
Own-shapes probes (C), all via temporary tests, all reverted:
- Rapid
didOpenacross 10 distinct folders: generation increases by exactly 20 (2 per widening open), completes in ~0.02s — no quadratic blowup at this scale.opened_dirs.sort()runs on everyset_documentandscope_dirs()sorts+dedups again on every call (twice perdidOpen), which is O(n log n) per open and O(n² log n) over a session — fine at realistic folder counts, worth knowing if a future report cites hundreds of folders in one session. - Lowering
scopeDepthmid-session (1 → 0) viaset_client_settings: does narrow the index on the next rebuild, unlike closing a buffer. This is correct and is the right answer (a settings change is a deliberate user action, not the same "never take away an answer" casedidCloseis), but no permanent test pins it and the README's Assumptions section states "the scope only ever grows" without distinguishing the open/close axis (grows-only) from the settings axis (moves either way). Recommend a test plus a clarifying sentence. - A filelist appearing mid-session (settings push) while folder scope was
active: flips the ladder to rung 1 immediately on the next rebuild
(
folder_scoped()re-checksfilelist_path()fresh every call, andset_client_settings's rescan condition already includesfilelistchanges). Correct, and covered indirectly by the existing rescan test, but there is no test that also checks the index content actually changes to the filelist's files rather than just triggering a rescan — probed with a temporary test, passed.
CLAUDE.md compliance. verify.rs untouched (no diff, confirmed by
git diff --name-only). No new unwrap()/expect()/panic! outside
#[cfg(test)] modules in the round's diff (grepped the four core files'
diffs for all three patterns; every hit is inside mod tests). Doc comments
present on every new public item (IndexScope, ClientSettings::index_scope
/index_scope_depth, Workspace::scope_dirs). has_roots() confirmed
genuinely #[cfg(test)]-only — grepped every call site in the crate, all
seven are inside #[test] functions. README sections present exactly once.
TODO.md's M1 annotation accurately describes the new default and points at
this feature's README. Corpus tests still skip-guarded (if !corpus.exists() { return; } pattern unchanged, only their open_roots calls swapped).
One item beyond the brief, informational only: editors/vscode/package.json's
lucisv.index.scope description says the pre-round behavior is "as lucisv
did before 0.11" — a forward guess at the next release number. This round
makes no version bump (confirmed: Cargo.toml and package.json both still
say 0.10.2). Not wrong today, but it is a claim about a future version
number sitting in a shipped-looking description; worth a quick check by
whoever cuts the next release that it lands on 0.11 and not, say, 0.10.3 or
0.12.
Not touched: docs/site/ (per instructions), no commit, no push
attempted (remote noted as flaky).
Verdict: committable as-is, modulo the dev's call on the one MEDIUM
finding (the vacuous a_folder_added_twice_across_two_events_is_absent_after_one_removal
assertion — a real but narrow test-coverage gap, not a product bug: nothing
about change_roots's actual dedup/removal behavior is broken, only that
one test no longer demonstrates it). The two LOW-MEDIUM missing-permanent-test
items (out-of-root buffer under folder scope; depth-narrows-on-settings-change)
and the stale-comment LOW items are follow-up hygiene, not blockers — every
behavior they probe was independently verified correct by hand in this
session.
2026-08-28 — QA agent (round 19: drift, staleness, threshold and log-semantics attacks)
Charter. The round under review (dev work log "a rescan stops re-parsing
what is already analyzed", same date) claims an open buffer's index facts and
completion words can be read off its already-held analysis instead of
re-parsed, and that this is safe because FileFacts::of and
Document::new/FileFacts::from_analysis are now one code path entered at
different points. The charter was to attack exactly the seam where the two
routes could still disagree — a masked-corruption seed in CLAUDE.md's terms —
plus staleness, the large-file threshold boundary, the cap interaction, and
the new log word. No drift, no staleness bug, and no cap regression were
found. One real, pre-existing (round-independent) robustness gap was found
and is filed separately, not against this round.
1. Drift attack — crafted non-corpus shapes, both facts and words.
Traced Document::new (crates/lucisv_server/src/state.rs:64-92) against
parse_and_collect/facts_of (crates/vlog_semantic/src/workspace.rs:773-793, 1023-1034) line by line: same tokenize → collect_defines/parse_tolerant
on the Ok branch (same token vector, so collect_defines reads the same
bytes in both places), same parse_source_tolerant on the Err branch. The
one asymmetry — Document::new computes collect_defines(&tokens)
unconditionally, including when tokens is the empty Vec from a lex
failure, while facts_of's Err arm substitutes DefineTable::default()
directly — cannot drift: DefineTable derives Default as entries: Vec::new(), and collect_defines(&[]) produces exactly that (confirmed by
reading collect_defines, crates/vlog_parser/src/defines.rs:91-104: the
loop never runs on an empty slice). Also confirmed analyze(tree, text)
(crates/vlog_semantic/src/lib.rs:65) takes only the tree and the text — no
workspace-index dependency — so nothing about the workspace state at the
moment a buffer was analyzed can make its semantics differ from a fresh
parse's.
Verified by construction is not verified by attack, so 16 crafted non-corpus
shapes were run through the real Document+FileFacts::of pair (encoded
facts equality and sorted-word equality), added as a permanent test:
qa_attack_crafted_non_corpus_shapes_drift_check
(crates/lucisv_server/src/state.rs:3361-3441) — a UTF-8 BOM, CRLF, BOM+CRLF,
an unterminated block comment, an unterminated attribute, an unterminated
macro call, an unterminated string, an embedded control character, deep
begin/end nesting, deep paren nesting, 500 `defines, `include
directives, a tree with parse-error recovery, mixed line endings, an embedded
NUL, and tabs/form-feeds. All 16 passed — no drift. (The BOM cases lex
clean, confirmed separately: tokenize silently absorbs a leading BOM rather
than erroring, so they exercise the Ok branch like ordinary source, not the
lex-failure one — noted so the case list isn't mistaken for dead weight.)
One robustness finding, filed as out-of-scope, not blocking this round —
LOW/INFORMATIONAL, pre-existing. Deep begin/end nesting
(500 levels) overflows the stack under cargo test's default per-test-thread
stack (2 MiB) — and it does so calling FileFacts::of alone, no
Document, no reuse, nothing this round touched. Reproduced identically on
git stash-ed pristine master with the same crafted input run through a
temporary vlog_semantic test (cargo test -p vlog_semantic on unmodified
HEAD: same abort). Because both routes being compared fail identically,
this is the opposite of the drift this charter hunts for, and it is not a
regression — the recursive-descent parser/analyzer has always had this
ceiling; a real server thread's default OS stack is larger (8 MiB main-thread
default on macOS, confirmed by running the same input outside the test
harness) so this is unlikely to bite in the shipped binary at 500 levels, but
the underlying unbounded-recursion-depth issue is real and worth a filed
follow-up (a recursion-depth guard in the parser/analyzer, or running the LSP
request-handling thread with an explicit larger stack). The permanent test
above works around it by running on a dedicated 64 MiB-stack thread, which is
what let the drift comparison actually exercise 500-level nesting without
tripping the unrelated ceiling. Spun off as a background task rather than
fixed here — it is not in this round's files or in verify.rs, and touching
the parser's recursion handling is a bigger, separate change.
2. Staleness attacks. qa_unsaved_edits_win_then_close_reverts_to_disk_on_the_next_rescan
(crates/lucisv_server/src/state.rs:3482-3517, new): an open buffer edited
away from disk content (never saved) rescans from the live edit — confirmed
via the Analyzed route and the indexed member changing from ON_DISK to
IN_BUFFER — and, after close_document with no save in between, the very
next rescan reparses from disk (Parsing route) and the index reverts to
ON_DISK, with no trace of the closed buffer's analysis anywhere. Also traced
structurally: the persistent IndexCache is keyed by a content hash of the
exact bytes (crates/lucisv_server/src/index_cache.rs:135-157,
content_hash(text.as_bytes())), so even though rebuild_index_with writes
an open buffer's unsaved-edit facts through to the cache
(state.rs's facts-loop, self.cache.record(&facts, text)), a later lookup
against disk's differently-hashed bytes cannot accidentally hit that record —
the two are different cache keys by construction, not by care. The
"didSave where disk write happens after the rescan reads" race cannot occur
either, traced rather than merely tested: server.rs's DidSaveTextDocument
handler (crates/lucisv_server/src/server.rs:1319-1334) calls
self.set_document (updating the in-memory Document from the notification's
own text, when present) before reindex_one/reindex, and the reused facts
come from that in-memory Document, never from a disk read — so there is no
window in which the index can read disk before the save's bytes land there.
3. Large-file threshold crossing via unsaved edits, both directions —
the charter's explicit "break it differently" ask, since the dev's own test
only checks doc.large flips, not that a rescan's event routing follows it
mid-session. Two new tests:
qa_a_buffer_edited_past_the_threshold_is_excluded_from_reuse_mid_session
and qa_a_buffer_huge_on_disk_shrunk_live_becomes_a_real_analysis_to_reuse
(state.rs:3520-3596). Small-on-disk/huge-live: a real analysis is reused
(Analyzed) until the buffer is edited past the threshold, at which point the
very next rescan drops it from every list (analyzed empty, parsed empty —
contributes nothing at all, matching the fast-path contract), and shrinking it
back reinstates reuse on the next rescan. Huge-on-disk/small-live: doc.large
is decided from the buffer's own live text length (is_large,
state.rs:1298-1301) and never from what is on disk, so the on-disk size is
provably irrelevant to the routing — the buffer is on the fast path the
instant it is opened with huge text, whatever the disk copy says, and reuse
resumes the instant it is edited back down. No boundary bug in either
direction.
4. Cap interaction, unchanged in both directions. New test
qa_an_open_buffer_over_the_cap_is_both_skipped_and_analyzed_unchanged_from_before
(state.rs:1780-1817): an open buffer whose file exceeds maxFileSize is
still reported Skipped once, from collect_sources's disk-phase walk (the
spoken_for short-circuit this round added only skips the wasted read, not
the cap check that runs ahead of it — traced in
collect_sources, state.rs:930-937) — and it is still indexed in full
afterward, now via Analyzed rather than Parsing. Confirmed the file is
never re-parsed (parsed empty) and the content is indexed exactly as before
this round. The cap boundary moved in neither direction.
5. Event/log semantics — a real gap found and closed. No test anywhere
in the repository — not state.rs's unit tests (which only check the
IndexEvent::Analyzed variant, via the scan() helper), not any e2e test —
exercised the actual "analyzed: <path>" string a real client would receive
over window/logMessage, despite docs/features/indexing-ux/README.md
documenting the exact wording. Added
qa_the_analyzed_log_word_names_only_the_open_buffer_and_only_on_a_rescan
(crates/lucisv_server/tests/e2e.rs, after the_size_cap_and_the_file_log_work_over_the_wire):
against the real binary, a scope-widening didOpen with one open buffer and
one disk-only file logs analyzed: .../m.sv and indexing: .../disk_only.sv
— never the other word for the other file — and the follow-up didSave
(the incremental reindex_one path) emits no log line at all, confirmed
by counting exactly two analyzed:/indexing: lines in the whole transcript.
This also incidentally re-confirms the work log's claim that reindex_one
sends no per-file log line, which was previously asserted only by a code
comment.
6. Reproducing the numbers, --release, three fresh runs of
qa_didopen_latency_when_a_new_folder_widens_the_scope: widening didOpen
23.95 / 24.20 / 24.31 ms (claimed ~23 ms), rescan alone 23.91 / 24.09 /
23.88 ms, closed-buffer floor 12.96 / 12.83 / 12.70 ms (claimed ~12 ms,
unmoved — confirmed unmoved). The buffer's own share, printed by the probe:
facts 144.3 ms parsed vs 1.7 ms reused, words 65.8 ms re-lexed vs
3.1 ms reused — matches the work log's 140.3 ms/1.67 ms and 62.9 ms/3.09 ms
within noise. qa_references_latency_with_a_big_open_top
(references-nav's own probe): 113 µs/128 µs cross-file either
direction (claimed ~110 µs), 1.19 ms for the in-file fallback on a name
used 10 001× (claimed 1.18 ms) — unmoved, confirming this round did not move
cost onto the request path.
7. Gates. cargo fmt --all -- --check: clean (after formatting the new
tests). cargo clippy --all-targets --workspace: zero warnings (two clippy
hits in QA's own new tests — cloned_ref_to_slice_refs,
useless_format — fixed before the final run). cargo test --workspace: all
green, 0 failed, across every crate (lucisv_server's own suite: 1204 passed,
23 ignored — the ignored set is the manual latency probes, run separately
above). cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK. verify.rs: no diff (confirmed via
git diff --name-only). No new unwrap()/expect()/panic! outside
#[cfg(test)] in the round's diff or in QA's additions (grepped both).
One documentation nit, LOW, informational. This README's Handshakes
section (docs/features/index-scope/README.md:219) says
words_of_tokens(tokens) "is pub(crate)"; the actual declaration
(crates/lucisv_server/src/candidates.rs:246) is pub fn. Harmless in
practice — lucisv_server is a bin-only crate with no lib target
(confirmed: cargo test -p lucisv_server --lib errors "no library targets
found"), and candidates is a private mod (main.rs:9), so there is no
larger scope for pub to leak into within this crate — but the README's
wording doesn't match the code. Worth a one-word fix (pub → pub(crate),
or the sentence corrected) whenever this file is next touched.
Tests added (8), all permanent, all passing. crates/lucisv_server/src/state.rs:
qa_an_open_buffer_over_the_cap_is_both_skipped_and_analyzed_unchanged_from_before,
qa_attack_crafted_non_corpus_shapes_drift_check (+ its _body helper, run on
a dedicated large-stack thread),
qa_unsaved_edits_win_then_close_reverts_to_disk_on_the_next_rescan,
qa_a_buffer_edited_past_the_threshold_is_excluded_from_reuse_mid_session,
qa_a_buffer_huge_on_disk_shrunk_live_becomes_a_real_analysis_to_reuse.
crates/lucisv_server/tests/e2e.rs:
qa_the_analyzed_log_word_names_only_the_open_buffer_and_only_on_a_rescan.
Verdict: SHIP. The round's central claim — an open buffer's held analysis is byte-identical to a fresh parse's, so reusing it cannot corrupt the index — held against every attack this session could construct, including shapes the dev's own corpus sweep and crafted-shape list did not cover. Staleness, the large-file threshold's two crossing directions, the cap interaction, and the new log word all check out. The one real finding (stack depth) predates this round, affects both compared routes identically, and is filed as a follow-up rather than a blocker.
2026-08-28 — QA agent (round 21: the shipped scopeDepth moves 0 → 2)
Verdict: SHIP. No scope silently grew or shrank outside what round 21 documents; the one production line outside this feature's usual file set is confirmed minimal and correctly scoped.
Single source of truth, verified. DEFAULT_SCOPE_DEPTH (settings.rs)
is the only place 2 is written for this purpose: ClientSettings::default
and from_payload's unwrap_or both read it, editors/vscode/package.json
declares the same 2 and is locked against drift by
the_extensions_declared_defaults_are_the_ones_this_module_ships (read the
manifest as JSON, don't hand-copy it) — re-ran this test standalone, passes,
and hand-verified the manifest file itself still says 2 after the round's
edit (editors/vscode/package.json:249).
Explicit-0 and junk-value attacks. the_scope_depth_is_two_until_a_client_ says_otherwise (dev's test, re-run and re-read): an explicit scopeDepth: 0
comes back as 0, not defaulted — confirmed correct by reading from_payload
(settings.rs:229-234): count(...) parses the JSON number 0 successfully
via Option, so unwrap_or(DEFAULT_SCOPE_DEPTH) only fires when count
itself returns None (missing key or wrong JSON type), never for a
successfully-parsed 0. The six junk values (-1, 1.5, "2", true,
null, [2]) all fall to DEFAULT_SCOPE_DEPTH, not to 0 — matches the
"an unreadable value must never be the reason a user's index is narrower than
the server promised" comment in from_payload, and is the correct direction
(a typo'd config should not silently narrow a user back to the pre-2026-08-28
default).
Clamp attacks. the_climb_stops_at_the_workspace_root (pre-existing,
still green) covers depth 99 against nested roots; traced raised()
(state.rs:670-683) by hand for depth 2 from the workspace root itself (the
floor is the root's own parent-chain search, which for a file at the root
finds dir == floor immediately — climbs zero levels, matches root) and from
one level below root (climbs one level, hits the floor, stops) — both are
degenerate cases of the existing clamp loop, not special-cased, so no new
attack surface. No regression test added here since the existing clamp tests
already exercise the loop generically over depth.
Rootless no-climb rule — the flagged production line. raised()
(state.rs:670) now returns dir.to_path_buf() unchanged when self.roots. is_empty(), before running the climb loop at all. Grepped every caller of
raised( and every roots.is_empty() site in state.rs: raised has
exactly one call site (scope_dirs(), line 633), so the change cannot
reach any other path indirectly. Two other, independent
roots.is_empty() && index_scope_depth == 0 checks exist
(state.rs:1075 widened_files, state.rs:1688 folder_files) — these gate
the separate "read flat instead of walk" exception and are keyed on depth
being exactly 0, not on whether raised() climbs, so they are unaffected by
this change and correctly produce the dev's documented consequence: a
rootless session at the new default (2) finds only its own directory (no
climb) but walks it rather than reading it flat (since the flat-read
exception no longer matches at depth 2). Confirmed with a direct read of both
call sites rather than by inference alone.
No other path was found to depend on the old rootless-climbs-to-/ rule.
The two rewritten tests (a_rootless_session_does_not_climb_at_all,
covering depths 0/1/99; a_rootless_session_reads_its_own_directory_flat_ until_the_depth_is_raised, covering depths 0/1) between them cover
everything the two deleted tests covered (termination, and the flat-vs-walk
split) minus only the removed capability itself (a rootless session widening
by raising the depth) — confirmed by diffing the old and new test bodies
line by line rather than by the dev's own characterization.
Cost delta reproduced. cargo test --release -p lucisv_server perf::what_the_scope_depth_default_costs -- --ignored --nocapture --test-threads=1:
depth 0: 1 files indexed, 5 index names, scan 532.583µs
depth 1: 1 files indexed, 5 index names, scan 342.666µs
depth 2: 21 files indexed, 25 index names, scan 15.6445ms
depth 3: 252 files indexed, 256 index names, scan 183.902708ms
Matches the dev's claimed 1/1/21/252 files exactly, and the round brief's "21 files / 15 ms at depth 2" (15.6 ms here, same machine-noise band).
Gates: cargo fmt --check, cargo clippy --all-targets, cargo test --workspace (1261 passed — includes my additions to completion.rs and
nav.rs from the same session; this feature's own tests are unchanged and
green), node editors/vscode/smoke.js target/release/lucisv-server — clean.
No fixes applied; no new tests needed in this feature's own files (the existing round-21 test suite already covers what I attacked). No commits.
2026-08-29 — QA agent (round 22: subsumption is an add, and the merge that fixes it)
Verdict: SHIP. The dev's refutation of the brief's diagnosis holds up under
attack, both pinned properties genuinely bind what they claim to, the
merge_words rewrite is equivalent to a whole build over every hostile shape
tried, and the perf claims reproduce on the real checkout to within run-to-run
noise. No corruption, no idempotency break, no dropped comment — not this
round's concern, but checked by inspection since candidates.rs is outside
this feature's usual set.
Chooser and file-diff mutation attacks, each isolated and reverted.
- Mutated
Workspace::scope_dirs(state.rs:629) to collapse a subsumed directory into its containing one — simulating the brief's own (refuted) model of the world, where a contained directory disappears from the list. Neither of this round's two new tests caught it:server::tests::widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_elseconstructs itsbefore/afterPathBuflists by hand and never callsscope_dirs, andstate::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_addscomputes its ownaddedlist by filteringscope_dirs()'s two snapshots rather than routing throughwiden_of, so a collapsed list still yields the sameaddedby coincidence. What did catch it, over the full workspace suite, is the pre-existingserver::tests::a_didopen_rebuilds_exactly_when_it_widens_the_scope(left: 4 right: 5— one fewer rebuild than expected). Not a gap: the two new tests are unit tests for two separate pieces (the chooser as a pure function;begin_widen's file diff given a correctadded), and the full-path property is what the older integration-shaped test is for. Stated here so it isn't rediscovered as a false alarm. - Mutated
widen_ofitself (server.rs:2640) to collapseafterby containment before comparing againstbefore— the same brief-shaped bug, applied inside the chooser instead of at its input. Caught: exactlyserver::tests::widen_of_takes_the_cheap_path_for_a_pure_add_and_nothing_elsefails, on the new subsumption row (left: Whole, right: Added(["/w"])); no other test in the crate moves. - Deleted
begin_widen'sheld.contains(&path) { continue; }skip (state.rs:1002). Caught: exactlystate::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_addsfails (aes_core.sv/aes_env.sv— the old block's own files — reappear inseen.parsed); no other test in the crate moves. Matches the work log's own claim verbatim.
Together: the chooser row and the state test each bind exactly one of the two
properties the work log calls "true by accident of two separate decisions,"
not both — and the reason that's fine is the older a_didopen_rebuilds_...
test binds the composition of the two. All three mutations reverted; final
git diff of state.rs/server.rs matches the pre-attack diff exactly.
merge_words mutation attack. Changed count_words' first-touch
bookkeeping (touched.entry(word).or_insert(...)) to plain touched.insert(word, ...) on both the removal and the addition arm — so a word the batch takes from
one file and gives back through another is (wrongly) recorded as newly added
rather than as never having moved. Caught: exactly
candidates::tests::a_batch_absorbed_leaves_the_word_table_a_whole_build_would_have_sorted
fails, with the duplicated words spelled out in the assertion output
("a", "a", ..., "only_a", "only_a", ..., "Shared", "Shared", ...) — plus one
pre-existing test,
candidates::tests::updating_the_same_file_twice_in_a_row_never_double_counts_or_goes_negative,
which is extra coverage the work log didn't claim but is a welcome bonus.
Reverted; candidates.rs diff (minus the one test I kept, below) matches the
pre-attack diff.
Extra coverage added, one test, candidates.rs (permanent). The brief's
attack list named "empty batches" and "a batch where every word is already
present" as hostile shapes; the round's own test covers duplicate/moved/gone/
case-variant words but not either of these two. Added
qa_extra_empty_and_noop_batches_do_not_disturb_the_table: an empty
absorb(&index, Vec::new()) and a batch that re-declares one file's words
unchanged (module name included — the first version of this test omitted it
and correctly failed, since dropping a real word is a real change, not a
no-op; fixed before landing it) both leave words("") byte-identical to
before. No bug found — merge_words's if added.is_empty() && dropped.is_empty() { return; } early-out (candidates.rs) already handles both correctly — but
the charter asked for the attack and it is now a permanent regression rather
than a one-off check.
Perf probe's fingerprint assertion, verified real. Mutated widened_files
(state.rs:1074) to .pop() one file off the end of its own walk, simulating
a widen that silently skips a file. cargo test --release -p lucisv_server perf::what_a_widen_that_subsumes -- --ignored --nocapture --test-threads=1
fails on the assertion the round added
(assert_eq!(whole.index().fingerprint(), incremental.index().fingerprint(), ...)),
dumping both fingerprints and diverging at the missing file. Reverted. Ran the
probe clean afterwards:
scope 35 -> 700 files; the widen read 667 of them (the 35 already indexed are not re-read)
whole rescan 662.558333ms, subsuming widen 645.5425ms (landing it: 52.5085ms)
Close columns confirmed as honest, not a bug: this synthetic tree has no
persistent-store warm-up (a fresh temp directory every run, so both columns
pay a genuinely cold parse of most of their files) — the win the round
actually bought is in "landing it" (candidates.absorb's merge), which is
what the opentitan table is for.
Opentitan reproduction, both binaries, from scratch. git archive HEAD | tar -x -C /tmp/lucisv-before && cargo build --release -p lucisv_server for the
pre-round binary; cargo build --release -p lucisv_server in this tree for
the post-round one. Wrote a fresh stdio probe (this session's scratchpad,
opentitan_probe.js, modelled on editors/vscode/smoke.js's framing) against
/Users/guoliangchen/repo/opentitan (1 807 hw/ip files, confirmed by find
— matches the brief exactly), pushing scopeDepth: 2 and timing each
didOpen to its publishDiagnostics. Warm store, two runs per binary,
alternated:
didOpen at scopeDepth: 2 |
before (HEAD) |
after (this round) |
|---|---|---|
hw/ip/aes/dv/tb/tb.sv → hw/ip/aes, 124 files |
42.9 / 42.3 ms | 42.7 / 46.8 ms |
hw/ip/aes/rtl/aes.sv → hw/ip, 1 685 new |
872 / 876 ms | 535 / 542 ms |
Both runs logged widen finished: 1685 files (0 skipped, 1683 from cache) —
matches the work log's own 1 685 (not 1 807) exactly. The before/after gap
(872–880 → 535–546 ms) reproduces the claimed 935/881 → 555/564 ms within
the alternation's own run-to-run spread; did not re-take the cold-store row
(moving ~/Library/Caches/lucisv/index aside on a checkout this session
doesn't own felt like the wrong thing to disturb without asking, and the warm
row already carries the round's claim).
Full gates, re-run clean on the round's actual diff (state.rs/server.rs
restored byte-for-byte after every mutation attack above; candidates.rs
carries only the one extra test noted above beyond the round's own diff).
cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace:
zero warnings. cargo test --workspace: 0 failed (exit 0);
lucisv_server's own binary: 1291 passed, 34 ignored (1289 on the round's diff
alone, +2 for the qa_extra test and the dev's own count already included).
cargo build && node editors/vscode/smoke.js target/debug/lucisv-server:
smoke: OK. node editors/vscode/restart_test.js target/debug/lucisv-server:
restart: OK — 44 checks over the restart chain.
Not re-verified in depth: the TODO.md §10 follow-up lines for codeAction
and inlayHint (correctly unchecked, correctly cite performance_take2.md,
correctly not fixed here) — cross-checked against the source document's §6a
and §7/§8 numbers by direct comparison, word for word, and they match.
Review
2026-08-29 — lead, subsumption round
Reviewed after QA's SHIP; gates re-run (fmt clean, 1292 server tests green). The round's real contribution is epistemic: the brief's diagnosis — mine, built on take 2's cold-store numbers — was half wrong, and the dev proved it with the HEAD binary before writing a line of fix. The chooser and the file-diff were already correct; what was quadratic was folding a widen's words into the sorted table one insert at a time (403 → 43 ms), and what was unpinned were the two accidental properties the diagnosis would have needed to break. QA's mutation matrix — five mutations, each caught by exactly the test that claims to bind it — is the standard the parallel-lane loop should hold every pin to. The warm RTL jump lands at ~545 ms, the target missed honestly: the residual is 1 683 genuinely new files and a 325 ms word re-lex the store cannot yet answer, filed as the FACTS_FORMAT follow-up rather than hidden. Take 2's regression entry stands corrected in the work log: cold-store cost, not a chooser bug. Accepted; committed by the lead.
2026-08-28 — lead, performance-wave Lane B (scope default)
The scopeDepth 0 → 2 default is the lead's own decision implemented faithfully: single-source constant, manifest locked by test, explicit 0 byte-identical, junk values falling to the shipped default, and the cost measured (21 files / 15 ms on the opentitan-shaped tree — the trap's fix costs a keystroke's worth of scan). The one production line in state.rs (rootless sessions no longer climb) is the right call, not just an allowed deviation: an unclamped climb from a loose file was a latent walk of an unnamed tree, and the capability it removes — depth-raising with no workspace open — protected nothing a rootless session can actually name. QA verified the single call site and the rewritten pins. Behavior change goes in the CHANGELOG at release. Accepted.
2026-08-28 — lead, incremental-widen round
Reviewed the full diff; gates run by the lead twice (fmt clean, clippy
silent, 2469 workspace tests green both times). QA was started and
then stopped by the owner mid-gates — its adversarial phases had run
and its last report was "fmt clean, now clippy and tests", but no
verdict was recorded; the owner chose to validate on the real
workspace instead, and the lead's independent gate runs stand in for
the missing QA sign-off. The chooser (widen_of: pure adds only,
anything else whole) and the mid-scan deferral are the two safety
hinges and both are pinned by the dev's tests, including the
unsaved-edit equivalence case that killed the naive version of this
idea a round earlier. The IncludeGraph raw-edge refactor is accepted
on its argument — spelling equivalence made structural rather than
narrow — and the honest watcher-coverage narrowing is documented where
the lead asked for it. Field validation on opentitan (the owner's own
repro): jump-triggered rescans went from 120–169 ms growing to
12–44 ms flat, first definition 99.7 → 0.9 ms. The owner's remaining
0.5 s report was subsequently traced by instrumentation to
textDocument/codeAction (3.1 s per cursor move on the instantiation
— ports::code_actions reading the whole 3979-file workspace through
ws.sources()), which is a different defect and the next round.
Accepted; committed by the lead.
2026-08-28 — lead, rescan-reuse round
Reviewed the diff and both logs after QA's clean SHIP; gates re-run
independently (fmt clean, clippy silent, 2419 workspace tests green).
The dev's deviation from the brief's preferred incremental-widen shape
is correct and well-argued: a widen that skipped already-indexed files
would also skip unsaved buffer edits the full rebuild indexes, an
answer change the mandatory fingerprint test would have caught — so
shape (b) with the split constructors is the honest one, and the split
is genuinely by construction (facts_of = parse + facts_from_analysis,
words_in = lex + words_of_tokens; one implementation each). The
drift attacks QA ran — 16 crafted non-corpus shapes plus both corpus
sweeps — are the right coverage for the one risk this design carries,
and the staleness/threshold/cap boundary tests close the state-machine
edges. IndexEvent::Analyzed kept separate from Cached so the
persistence transcripts keep their meaning: good instinct. ~228 ms →
~23 ms reproduced by dev, QA and the probe's own printout. Lead fixed
QA's doc nit directly (words_of_tokens tightened to pub(crate) to
match the Handshakes prose; all callers in-crate). The pre-existing
deep-nesting overflow QA found on pristine master is correctly out of
scope and spun off. Accepted; committed by the lead.
2026-08-27 — lead
Reviewed the diff, the work log and the QA log; re-ran all gates myself (2217 workspace tests, 0 failed), clean. The round delivers the owner's model exactly and the two structural decisions are right: scope grows only along the open axis (recomputing from the open set would take working answers away on unrelated saves), and the builder hardening makes the open-files-first ordering provably a reporting nicety — QA independently re-derived the dedup-keeps-first-copy claim and confirmed misuse-after-finish is prevented by ownership, which is the cheapest kind of enforcement there is. The migration path being the same function rather than an equal-output one is the strongest form of the "workspace restores today" promise.
Lead actions on QA's findings before commit: the vacuous folder-add/remove test now runs whole-workspace scope with a present-while-added assertion restored (the MEDIUM); the big-buffer cap test's premise is the cap's doing again; the stale rung comments and the forward-guessed version string in the setting description are corrected. The behaviors QA verified by hand but left unpinned (depth-narrowing on a settings change, a mid-session filelist flipping the ladder, an outside-root buffer on the folder rung) are accepted on that verification and assigned to round 19's brief as permanent-test obligations — its dev works in these exact files next. The gitignore-below-root delta stays filed against lucisv_core. Accepted as shipped.