Files
lucisv/docs/features/localized-reindex/README.md
T

1295 lines
80 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
# localized-reindex
## Goal
The owner's report: *"Every time a file gets edited, the whole database gets
re-indexed, which I think is not needed. I understand that changing a define
might cause the whole database to re-index, but not on typical changes that are
localized."* The incremental-index round (2026-08-27) already replaced a save's
whole rebuild with a one-file update, but that update still did work
proportional to the **workspace** — every file's references re-resolved, the
completion tables re-derived whole, the include graph re-spelled whole — and
VS Code runs it **twice per save**. This round makes a save cost work
proportional to the file that changed plus the files that actually read what
changed, removes the watcher triggers that took a whole rescan for a file the
index could never hold, and pins all of it with differential tests against a
from-scratch build.
## Assumptions
- **An index is a function of its records, so an unchanged record moves
nothing.** `WorkspaceIndex::update_facts` now returns whether the index
moved, and answers `false` — touching no table — exactly when the file's new
`FileFacts` equals the held one. That is the watcher's echo of every save
(the second of the two re-indexes VS Code caused per save), a re-save, and
any edit after the file's last token or inside a comment of unchanged length.
The server then owes the index nothing: no merge, no completion tables, no
overlay refresh, no lens refresh, no hierarchy invalidation (those two read
the index alone). **It still republishes every open buffer under a new
generation** (amended in the fix round, QA F2 — see "What a diagnostic reads"
below). Two other things are still done because they are not in the record:
the file's `` `include`` lines are re-scanned (`"a.svh"` and `<a.svh>` read
the same to the record), and the record is written through to the persistent
cache under the new text.
- **Which files a moved key can reach is recorded, not inferred.** Every
lookup the cross-file resolution makes (`units`, `member`, `members_of`,
`hierarchical_member(s_of)`, `reexports`, `base_of`) notes the table and key
it read — misses included — while the index's own resolution pass records
(`workspace/dependents.rs`; off for every request-time caller). The index
keeps *key → files that read it* (the readers table, 13 806 keys / 69 222
entries on OpenTitan, well under 2 MB). An update re-resolves this file and
the readers of the keys whose values moved, and no one else. This is exact
by construction rather than by a model of the resolution walk: a file that
read no moved key read only unchanged values, and its resolution is a pure
function of those values and its own facts. Inferring readers from the word
census was considered and rejected: a reference two `extends` hops, one
re-export or one hierarchical instance away from the changed file need not
write any of its names (the negative controls below show each of those
hops breaking a narrowing that forgets it).
- **"Moved" is judged the way resolution reads a value.** A posting is keyed by
the declaration's file and name span; resolution also reads a declaration's
kind, its declared type (the next hop) and how many declarations a name has.
It never reads `decl_span`, lines, positions or detail. So a body edit, which
grows a module's extent but not its name, moves the `units` entry for every
consumer that shows extents (overlays, hover, the hierarchy view — all
refreshed) but moves **no posting**, and the 121 files instantiating
`prim_flop` are not re-resolved for it. Member tables are judged a whole unit
at a time, connection and hierarchical surfaces separately: a new local
signal re-resolves only the files whose hierarchical paths read that
module's hierarchical members.
- **The old tables are swapped back for the moment it takes to take the
readers' old postings out.** A posting list carries no record of which
table values produced it; re-resolving the readers against the tables they
were resolved against (the moved entries and the old record, held aside and
swapped in) finds exactly what was put in, so nothing per file is stored to
undo it.
- **Wide on purpose** (sound over-approximations, each re-doing more than
needed rather than less):
- adding or removing a file still merges every table and re-resolves every
file — every `FileId` after it moves; in memory, no file read;
- an edit above a widely referenced declaration moves its name span, and
every file that references it is re-resolved (OpenTitan's
`prim_generic/prim_flop.sv` with a line inserted at the top: 61 ms);
- a re-export entry carries no file, so an update to a file that writes an
`export` re-merges that table from every file;
- the class → base table is rebuilt whole when either record extends a class;
- a `` `define`` change re-merges the macro table entries it names and
re-derives those completion entries; no file is re-parsed for it (lucisv
does not expand macros across files, `docs/features/incremental-index`);
- **the republish stays wholesale** whenever the index moved: every open
buffer is re-linted and republished. Measured at ~0.3 ms a buffer on
OpenTitan (10–20 ms for 50 buffers), it is not the cost the owner saw, and
narrowing it is exactly where a stale squiggle would hide — lints read the
index through the census and `module_interface`, not only through the
overlay. Unchanged records republish too: the index did not move, but
what a lint reads from disk may have (below).
- **What a diagnostic reads, and what invalidates each** (fix round, QA F2).
`Server::diagnostics_of` → `LintRun::for_document` + `diagnostics::all_in`:
1. the buffer's `Document` (text, parse, semantics, overlay) — `didOpen`,
`didChange` (flushed), a text-carrying `didSave` with new text, and an
overlay refresh whenever the index moves;
2. the index (the mention census, `module_interface`, the buffer's own
`FileId`) — every update that moves it republishes every buffer;
3. the client's `lucisv.*` settings — `didChangeConfiguration` /
`workspace/configuration` (`apply_settings`, unchanged by this round);
4. the `lucisv.toml` governing the buffer — `[lint]` select/ignore, rule
options, `lineLength`, `indent`, the waiver list — read from disk at
every lint. **No notification reports it** (the client watches sources
only), so a save is when an edit to it takes effect, as at 7408fac: every
`didSave` and every watcher event the server acts on republishes every
open buffer under a new generation, whatever the record did; a watcher
event that *names* a `lucisv.toml`/`.lucisv.toml` (a client that forwards
more than it was asked for) is a whole rescan, because the same file moves
excludes and the filelist key;
5. the waiver files (the config's and `lucisv.lint.waivers`) — read from
disk at every lint, reported by nothing; refreshed by the same
every-save republish;
6. the workspace roots (editor waivers resolve against them) —
`didChangeWorkspaceFolders`, a whole rescan;
7. the port-entry grace state — its own timer and release path, untouched.
The cost of the republish is ~0.07 ms a buffer re-sent and ~0.2 ms a buffer
re-linted when the index moved (QA R2-2, full OpenTitan): with 200 buffers
open it is most of a save — 14 ms for a no-op save, 53 ms for a local
signal, against 203–207 ms at 7408fac. The index work it used to ride on is
what the round removed; narrowing the republish is still not done (it is
where a stale squiggle would hide).
- **The completion tables are one block per exact name** (`word_cmp` is a
total order on distinct strings), so an update that changes what a file
declares re-derives only the blocks for the names either record declares,
from `WorkspaceIndex::symbols_named` (`workspace_symbols` for exact names,
same order). An update whose records declare the same names, kinds and
containers in the same order (`FileFacts::declares_the_same`) touches
neither table; the word table is patched per file as before.
- **A watcher event names files, and each is classified before anything is
rescanned** (`state/watched.rs`): held (by its own spelling, or by another
spelling of a scope directory — a symlinked root, a different case on a
case-insensitive disk — resolved through `canonicalize` on the scope's
anchors), provably outside (a filelist that does not list it; a walk of the
scope's directories, `lucisv_core`'s own `collect_files_below` with the
scan's `.gitignore` and excludes, that does not find it or finds it over the
size cap), or unknown (a file the scope may take and the index does not
hold — a creation). An open buffer the index does not hold counts as held:
a rebuild takes every open buffer in, and the one-file path adds it (fix
round, QA F4). Outside costs the index nothing, one held file is the
one-file update, anything unknown or two or more held files is the whole
rebuild, as a checkout always was.
- **But every path a watcher event names re-resolves the `` `include`` lines
that could name it, first, in scope or not** (fix round, QA F1). An include
is resolved against the disk, not the scope, so a header appearing in a
gitignored `gen/`, an unlisted header under a filelist's `+incdir+`, or one
in an excluded directory moves an in-scope includer's edge. The graph now
holds every file's include lines as written (`IncludeGraph::lines`), and
`refresh_naming(path)` re-resolves, against the disk, the lines of every
file that writes a target whose last component is `path`'s name
(case-insensitively; a target with no last component counts as naming
everything) — the only lines whose answer the file's appearance or
disappearance can change. No file is read, no rescan is started. A deleted
*directory* is reported by its own path, which has no source extension and
is dropped by the filter before this (true at 7408fac too; filed below).
- **An open buffer the index does not hold joins it on its first save (or a
watcher event naming it) without a rescan** — a buffer outside the filelist
or under an `exclude`, or one VS Code restored while the startup scan was
taking its work list. What a rebuild would re-read besides the buffer is
every other file's `` `include``s, and the add re-resolves exactly the ones
that could name it (`refresh_naming`). The first cut instead trusted the
file's birth time to prove it was on disk before the scan; QA showed `mv`,
`cp -p`, `ditto`, `rsync -a`, `tar x` and `touch -t` all set it back on macOS
(F3), and Linux often has none. No timestamp is consulted now. A buffer the
index holds under another spelling still takes the rebuild, which would
replace that spelling.
- **A removal re-resolves the include lines that could name the removed file**
(`refresh_naming`, by name rather than by the resolved spelling, so an
includer that wrote another case is covered too). This closes the standing
exception the incremental-index round documented ("another file's
`` `include`` of the removed file keeps its edge until the next whole
rebuild").
- **The mention census is left as it was.** Measured at 51 µs of an average
lint pass and 2.8 ms at worst on OpenTitan, a keystroke-path cost, not the
save-path cost reported; a merged word → files map is ~10 MB and was rejected
for the same reason by `docs/features/semantic-lints-on`.
- **When the readers hold a large share of every reference, their old postings
are swept out rather than re-resolved** (fix round, QA F5). Re-resolving the
readers once against the old tables and once against the new costs two
resolutions each; for a package most of the tree imports (`prim_mubi_pkg`:
677 importers) that was slower than 7408fac's single whole pass. When the
readers hold more than an eighth of all references, in an index of at least
20 000 of them, the sites they contributed are dropped by one pass over the
postings, their ambiguity taken back from a per-file record
(`ambiguous_by_file`), and their ids struck from every reader list — then
they are resolved once. Both ways are held to a whole build by
`replace::tests::both_ways_out_give_the_index_a_whole_build_gives`.
- **The readers table is paid for on every whole merge**, CLI and
`lucisv_mcp` builds included. On OpenTitan it adds ~25–30 ms to the merge
(`absorb` 134–136 → 158–164 ms at startup, 163–165 → 191–195 ms in a cached
rescan, three runs each, back to back), which is +40 to +120 ms of warm
startup depending on machine load: measured +23 ms (first cut, quiet), +40
ms (fix round), +76 ms and +104 ms (QA, loaded). Every whole rescan,
including a burst's (below), carries the same few per cent.
- **A watcher burst takes the whole rescan past a threshold** (round 3, QA
R2-1). Sorting an event path by path costs ~0.10 ms a path on OpenTitan
(classification; the include-line refresh is one pass for the whole event
since this round), a cached rescan ~0.16 ms an indexed file. An event naming
more than one path per two indexed files (`server/index.rs`'s
`BURST_DIVISOR`) takes the rescan: below it the sorted path costs at most
~0.3× the rescan it saves, above it the cost is the one rescan 7408fac paid
— plus the readers-table cost above.
## Handshakes
### `vlog_semantic` (consumed by `lucisv_server`; `lucisv_mcp`/`vlog_refactor` unaffected)
- **Changed:** `WorkspaceIndex::update_file(path, src) -> bool` and
`update_facts(facts) -> bool` (were `()`): whether the index moved. Callers
that ignore the value compile unchanged.
- **New:** `WorkspaceIndex::symbols_named(&HashSet<&str>) -> Vec<WorkspaceSymbol>`
— `workspace_symbols` restricted to exact names, same order.
- **New:** `FileFacts::declares_the_same(&FileFacts) -> bool` and
`FileFacts::declared_names() -> (HashSet<&str>, HashSet<&str>)` (workspace
symbols, `` `define``s).
- **Amended:** `WorkspaceIndex::fingerprint()` also renders the readers table
(`read <table> <key> by [ids]` lines), so every existing equivalence test
holds it to a rebuild's too.
- Internal: `merge()` takes no argument (always whole); the restricted path is
`replace.rs`; `ambiguous_references` is a count map (the observable
`references_are_ambiguous` is unchanged).
### `lucisv_server`
- **New:** `Workspace::update_one_file(path) -> OneFile { NotHeld, Unchanged, Changed }`;
`update_one(path) -> bool` is now `#[cfg(test)]` over it.
- **New:** `Workspace::watched(path) -> Watched { Held(path), Outside, Unknown }`.
- **Changed:** `watch::one_scope_file` → `watch::scope_files(changes, filelist)
-> Option<Vec<PathBuf>>` (every scope path an event names; `None` when the
filelist is among them). `watch.rs` was touched for this only.
- **Changed:** `IncludeGraph::update_file` removed; `update_held(path, text)`
(this file's edges, nothing relearned), `add_known(path)` and
`refresh_naming(path)` added, and `refresh_naming_all(&[PathBuf])` (round
3: one walk for a batch of paths) (`includers_of`, added in the first cut, is
gone). The graph holds every file's include lines; its test fingerprint
renders them.
- **New:** `Workspace::refresh_includes_naming(&[PathBuf])` (round 3 batched
it; it was `(path)` before); `watch::names_a_config`.
- **Changed:** `WorkspaceIndex::fingerprint` renders each ambiguity's count.
- **Changed:** `Candidates::update_file`/`update_words` are `#[cfg(test)]`;
`set_file_words` and `refresh_names` are the production halves.
- **Changed (protocol):** a `didSave` or watcher event whose record did not
move sends no `workspace/codeLens/refresh` and no
`lucisv/moduleHierarchyChanged`; it still republishes every open buffer
under a new generation (fix round). The `--verbose` line reads
`reindex_one(<path>, unchanged) took <ms>` for it (the old shape still
matches its prefix). A text-carrying `didSave` whose text differs from the
buffer is analyzed and published by the save itself.
- **Changed (protocol):** a watcher event for a file the scope cannot take
starts no rescan and shows no bar; it re-resolves the include lines that
could name the file and republishes every open buffer.
- **Changed (protocol):** a watcher event naming a `lucisv.toml` is a whole
rescan (it was ignored).
- `Server::diagnostics_of` is `pub(super)`, for the differential tests.
- **Taken from the formatter-styles lane (round 3):** `lint.rs`'s `line-length`
width is now `file.line_length.or(client.line_length)`, else the chosen
style's width (`file.format_style.or(client.style)` through
`vlog_formatter::style::preset`), else 100 — the ladder `format::indent_width`
walks and the width `lucisv check` uses. `style = "auto"` names no preset
and takes the configured or default width. Pinned rung by rung in
`lint::tests::line_length_holds_a_buffer_to_the_width_the_formatter_and_check_use`
against `lucisv check`'s own ladder (`Config::named`, then the explicit
width). The request in `docs/features/format-styles/README.md` is answered
here; that README is the other lane's and was not edited.
- `watch::names_a_config` reads `lucisv_core::config::NAMES` (made public by
the formatter-styles lane) rather than a copy.
### The fast-path trigger table, amended (`docs/features/incremental-index`)
| trigger | before | now |
|---|---|---|
| `didSave` / watcher `Changed`, held file, record unchanged | one-file, O(index) | include re-scan + republish, no index work |
| `didSave` / watcher `Changed`, held file, record changed | one-file, O(index) | one-file, O(file + readers of moved keys) |
| watcher event for a held file under another spelling | whole rebuild | one-file |
| watcher event for a file the scope cannot take | whole rebuild | include lines naming it re-resolved + republish |
| `didSave` / watcher event for an open buffer the index does not hold | whole rebuild | one-file add (whole merge in memory) + include lines naming it |
| watcher event naming a `lucisv.toml` | nothing | whole rebuild |
| watcher `Created` for a file the scope takes | whole rebuild | whole rebuild |
| watcher event naming two or more held files | whole rebuild | whole rebuild |
| the filelist, settings, folders, renames, deletes via `didDeleteFiles` | whole rebuild | whole rebuild |
No request to another lane; `editors/vscode/extension.js` was not touched (the
watcher configuration was not the problem — the server's answer to it was).
### A note for the next lane: an open buffer can lose its latest edit during a whole rescan (QA F6, pre-existing — closed in `v0.65.8` / `scan-ordering`)
> **Status note (2026-11-26, `docs-sync-r4`):** Notification overtaking mid-scan (`must_hold`, `changes_state`) was fixed in `scan-ordering` (`v0.65.8`, `0` divergent on both `rand_run.py` seed 7 and `rand_run2.py` seed 42), and request/version ordering (`after_scan`, `Document::version`, `after` state oracle) closed in Round 1 (`server-ordering-r1`, `8f5a4fb`). What follows is the historical v0.65.6 investigation note.
- **Symptom.** After a sequence that includes whole rescans (creations,
deletions), an open buffer's *own* answers — document symbols, semantic
tokens, its diagnostics — describe the text before its last `didChange`,
while the client's text, the disk and a fresh server agree. Re-sending and
re-saving the buffer repairs every answer, so the index is right and the
`Document` is what is stale. That fits the owner's "Find References says
not found, then works after clicking away and back": coming back sends a
change or a request that flushes or rebuilds the buffer.
- **Reproductions** (QA, deterministic): `QA_PULL=0 rand_run.py <bin>
~/.cache/lucisv-corpus corpuspush 7 200 25` (7408fac fails on the same seed
at step 100), and `rand_run.py <bin> ~/.cache/lucisv-opentitan-full/hw otfull
21 50 50` (both binaries). A 10-iteration isolated race (`oracle/race.py`)
did not reproduce it, so it needs the interleaving of a longer run.
- **Where the losing `didChange` lands:** while a whole rescan is in flight,
i.e. inside `Server::scan_until_settled`, whose interleaved drain answers
messages between two files. Places worth reading first, none proven:
1. `server/notification.rs`'s `didChange` arm takes its base text from
`self.dirty`, else from the workspace's `Document`; a change applied on
the wrong base (an entry taken by a flush between two drained batches, or
a `Document` replaced mid-drain) would silently drop the previous edit;
2. `server/batch.rs`'s coalescing of a burst, across a drain the scan cuts;
3. the 150 ms quiet-timer flush (`server/mod.rs`) runs only in the main
loop, so a buffer dirtied during a scan stays dirty until the next
message — harmless if every path then flushes, wrong if any answers or
publishes from the analyzed `Document` without flushing (requests held by
`must_wait`, the scan's own `publish_scan`).
- The oracle's `QA_REPAIR` mode (re-send and re-save before each check) hides
it, which tells it apart from an index bug quickly.
### Three more pre-existing items for the next lane (QA round 2, P1–P3; 7408fac the same)
> **Status note (2026-11-26, `docs-sync-r4`):** **P1 (`#48`)** was closed WON'T FIX by owner ruling (`2026-11-26`, rely on VS Code; no second watcher registration). **P2 (`#49`)** and **P3 (`#51`)** shipped in Round 2 (`index-lifecycle-r2`, `4d384ec`): `WorkspaceIndex::remove_file` tombstones closed excluded/unlisted buffers on `didClose` (`close_and_reconcile`), and `(dev, ino)` / canonical-path deduplication enforces one deterministic spelling without basename gating.
- **P1 — a watcher event that names only a directory loses what is inside
it.** A header directory created: its includer's edge is missing
(`oracle/r2attack.py dir-create`); a directory of held files deleted: the
index keeps them (`held-dir-delete`, 9 answers differ). The path has no
source extension, so `watch::touches_scope` drops it before anything runs.
Whether VS Code's watcher reports a `git checkout` that removes a directory
per file or by the directory alone is unobserved (git unlinks per file, so
per file is likely). A fix would treat a directory path as "every held file
and include line under it".
- **P2 — an excluded or out-of-filelist buffer, once taken into the index,
stays after `didClose`.** A fresh server without it open does not hold it
(`excluded-open-close`, 20 answers differ after the close). This round
takes such a buffer in on any event naming it (F4), so the state is reached
more often; the close path is 7408fac's (`close_document` does not touch the
index). A fix is a removal on close when the scope would not take the file
(`Workspace::watched` already answers that question).
- **P3 — symlinked files.** OpenTitan's `top_englishbreakfast/rtl/*.sv` are
symlinks into `top_earlgrey/rtl/`. Whether a rebuild holds one spelling or
both depends on whether the target is an open buffer at scan time
(`discover.rs`'s `Aliased`), so the incremental answer and a rebuild's
disagree in all six of `oracle/filelink.py`'s variants, on both builds. The
rule to pick is "one file, one spelling, whatever is open", applied by the
walk, the overlay and the one-file path alike.
## Status / TODO
- [x] Step 1 — reproduce over LSP on the full OpenTitan tree, measure, record
- [x] Unchanged facts short-circuit the index work (the save's watcher echo is
free of index work)
- [x] Readers table; references re-resolved only for the readers of keys whose
value moved, as resolution reads it
- [x] Table merge restricted to the files contributing to an affected key
- [x] Completion index tables re-derived only for the names either record declares
- [x] Include graph: one file's edges re-scanned
- [x] Watcher events classified: outside → no rescan; another spelling → one-file
- [x] An open, unheld buffer joins the index on its first save / watcher event
- [x] Differential tests: hand-written cases, seeded sweeps (corpus, OpenTitan
sample), negative controls
- [x] Before/after numbers
- [x] Fix round (QA F1–F5): include lines re-resolved for every watched path
and on a removal or an add; every save and acted-on watcher event
republishes; the birth-time guard replaced; open unheld buffers taken in
on a watcher event; a sweep way out when the readers hold most
references; F1–F4 as differential tests and sweep event kinds
- [ ] **Not done, deliberately:** the republish of open buffers stays wholesale
(see Assumptions).
- [ ] **Not done, deliberately:** the mention census keeps its linear walk.
- [ ] **Filed, not done:** postings are keyed by name span, so an edit above a
widely used declaration re-resolves every user of it. Stable declaration
ids would end that and are a bigger change than this round.
- [ ] **Filed, not done:** the word table's patch is a merge over the sorted
table plus a whole re-mask (~2 ms on OpenTitan when a file gains or loses
a word nobody else has).
- [ ] **Filed, not done:** every whole merge pays for recording the readers
table (re-measured in the fix round's log), CLI and `lucisv_mcp` builds
included.
- [x] ~~**Filed, not done:** a watcher event for a deleted *directory* names a
path with no source extension and is dropped before anything runs, so
includes of files that were under it keep their edges until a rebuild
(7408fac the same).~~ — **WON'T FIX (2026-11-26, owner ruling on `#48`)**: rely on VS Code; no second watcher registration.
- [x] ~~**Filed, not done (F6, pre-existing):** an open buffer can lose its
latest `didChange` during a whole rescan — see the note under Handshakes.~~ — **Closed in `v0.65.8` (`scan-ordering`)**: notification ordering fixed via `must_hold` (`0` divergent on seed 7 and seed 42).
- [x] ~~**Filed, not done (P1–P3, pre-existing):** directory-only watcher
events; an excluded buffer stays indexed after close; symlinked files'
spellings — see Handshakes.~~ — **Closed 2026-11-26 (`docs/features/index-lifecycle-r2` + owner ruling)**: P1 (`#48`) WON'T FIX; P2 (`#49`) tombstoned `didClose` removal and P3 (`#51`) `(dev, ino)` symlink canonicalization delivered in Round 2 (`4d384ec`).
- [x] Round 3 (QA R2-1): the include-line refresh is one pass per event; a
burst past `BURST_DIVISOR` takes the whole rescan.
- [x] Round 3 (formatter-styles Handshake): `line-length`'s width falls back to
the chosen style's width.
- [ ] **Known cost (QA R2-2):** with 200 buffers open the republish is most of
a save (53 ms for a local signal; 4× faster than 7408fac).
- [ ] **Known cost (QA R2-3):** warm startup +40 to +120 ms on OpenTitan,
load-dependent (the readers table).
## Work log
### 2026-11-19 — dev agent: Step 1, what the owner is actually seeing
Measured with the real `lucisv-server` (release build of 7408fac, `--verbose`)
driven over stdio by a small LSP client that speaks what VS Code's client
speaks around an edit: `didChange`, `didSave`, and the
`workspace/didChangeWatchedFiles` the client's watcher forwards for the saved
file — the server registers `**/*.{v,vh,sv,svh}` (`watch.rs`) and VS Code's
file watcher reports the editor's own saves, so **one save is two
notifications that both re-index the file**. The client advertises
`hierarchyView`, code-lens refresh and dynamic watcher registration, as the
extension does. Tree: `~/.cache/lucisv-opentitan-full/hw` (4 058 indexed
files, 471 596 reference sites, 94 442 connection members), warm persistent
cache. Apple M5 Max, shared with another lane's builds; medians of 3 runs
(LSP) or 5 (in-process), re-run twice.
**(a) Which path each trigger takes** (scope `workspace` unless stated; "bar" is
`$/progress` messages):
| trigger | path | wall | bar | publishes |
|---|---|---:|---:|---:|
| keystroke (`didChange` + flush) | buffer only | 3.4 ms | 0 | 1 |
| `didSave`, leaf module `uart_tx.sv` | one-file | 166 ms | 0 | every open buffer |
| …the watcher's `Changed` for the same file | one-file **again** | 163 ms | 0 | every open buffer |
| `didSave`, `prim_generic/prim_flop.sv` (125 instantiating files) | one-file | 174 ms | 0 | all |
| `didSave`, `uart_reg_pkg.sv` (package) | one-file | 170 ms | 0 | all |
| `didSave`, `prim_assert.sv` (`` `define`` header) | one-file | 163 ms | 0 | all |
| `didSave`, `prim_assert_standard_macros.svh` (include file) | one-file | 158 ms | 0 | all |
| same five, default folder scope (1 778 files) | one-file | 65–82 ms ×2 | 0 | all |
| watcher `Changed` for a source file the index does not hold (outside the folder scope, not in the filelist, a generated file) | **WHOLE rescan** | 271–745 ms | 576–892 | all |
| watcher `Changed` naming a held file by another spelling (symlinked root, or different case on macOS) | **WHOLE rescan** | 714–736 ms | 815 | all |
| watcher `Created` for a new file in scope | WHOLE rescan (by design) | 711 ms | 815 | all |
| watcher `Deleted` for a held file | one-file | 159 ms | 0 | all |
| watcher `Changed` for the `.f` filelist | WHOLE rescan (by design) | 353 ms | 576 | all |
| watcher `Changed` for `lucisv.toml` / an unconfigured `.f` | nothing | 4 ms | 0 | 0 |
| `didSave` of an excluded file that is open | one-file | 85 ms | 0 | all |
| first `didSave` of a file opened *after* the startup scan from outside the filelist/scope | WHOLE rescan | ~620 ms | 577 | all |
After every one-file update the server also sends
`workspace/codeLens/refresh` and `lucisv/moduleHierarchyChanged`; the
extension answers the latter with a `lucisv/moduleHierarchy` request —
**27.7 ms and a 2.7 MB answer on OpenTitan**, rebuilt client-side, twice per
save.
**(b) Where a one-file update's ~165 ms goes** (temporary `Instant` probes in
`update_one`/`merge`/`reindex_one`, 20 updates over the five files, 10 buffers
open; probes removed afterwards):
| stage | mean |
|---|---:|
| `merge_references` — re-resolving **every** external reference in **every** file | **116.8 ms** |
| `Candidates::take_index_tables` — the unit/macro completion tables re-derived whole | **30.9 ms** |
| `merge` loop over every file's records, restricted to the affected keys | 9.6 ms |
| `IncludeGraph::update_file` — relearn + re-spell every file | 1.1 ms |
| republish of 10 open buffers (lint + send) | 1.4 ms |
| `bases` rebuilt whole | 0.7 ms |
| the buffer's facts, overlays of 10 buffers, cache write-through | 0.3 ms |
With 1 and 50 buffers open the update is 169–173 ms and 165–185 ms: the
republish is ~0.3 ms a buffer and is **not** the cost. The in-process probe
(`state::tests::reindex_perf`, release) agrees: 138–144 ms for every file and
every edit kind, **including an edit that changes nothing at all** (the
watcher's echo of a save) — the cost does not depend on what changed.
**(c) The mention census per keystroke**: `mentioned_outside` costs 156 µs a
question at this scale (a linear walk of 4 058 sorted word lists). What the
rules really ask, measured as one buffer's lint pass with the workspace minus
the same pass with none: **51 µs on average over all 4 058 files, 2.8 ms worst**
(`alert_handler_reg_top.sv`, of a 4.9 ms pass). Real but small, and on the
keystroke path rather than the save path the owner reported.
**What the owner is seeing**, in order of how often it happens:
1. **Every save costs the same ~330 ms of blocking work on OpenTitan whatever
was edited** — two whole-index passes (save + watcher echo), each
re-resolving 470 k references and rebuilding the completion tables, then a
2.7 MB hierarchy snapshot twice. Nothing shows a bar, but in `--verbose` the
output channel says `reindex_one(...) took 168 ms` twice per save, and every
request behind it waits. This *is* "the whole database re-indexed", just
without the re-read.
2. **Real whole rescans with the progress bar** for triggers that need none: a
watcher event for a `.sv` the scope cannot take (a generated file, a file
outside the folder scope or the filelist) or for a held file under another
spelling; and the first save of a buffer opened from outside the filelist.
Design consequences: attack `merge_references` and the completion tables
first; make the watcher's echo of a save free; filter watcher events against
the scope. The republish of open buffers is ~0.3 ms each and stays wholesale
when anything changed (narrowing it is where a stale squiggle would hide, for
no measurable gain); the census does not justify a 10 MB inverted word index
(`docs/features/semantic-lints-on` rejected one for the same reason) and is
left as measured.
### 2026-11-19 — dev agent: the design, and what it measures
Attacked in the order Step 1 ranked the costs.
1. **The unchanged record** (`update_facts` → `false`). Kills the watcher's
echo of every save and every re-save outright: ~165 ms → 0.1–0.4 ms at
OpenTitan scale, nothing sent.
2. **`merge_references` → readers table** (`dependents.rs`, `references.rs`,
`replace.rs`). The thread-local recorder follows the precedent of
`lint_trace`/`scan_trace`; the alternative — a recorder parameter through
`external.rs`/`reexport.rs`/`hierarchy.rs` — would have changed a dozen
signatures shared with every request handler for one caller. First cut
judged "moved" by key alone (any key either record names) and re-resolved
121 files (64 ms) for a local signal in `prim_flop.sv`; judging the value
as resolution reads it (`replace.rs::seen`) and splitting the connection
and hierarchical member keys took that to 2.5 ms.
3. **The completion tables** (`Candidates::refresh_names`). First cut skipped
the 31 ms re-derivation when `declares_the_same` held; a package member
added still paid it, so the blocks for the touched names are now re-derived
alone (uart_reg_pkg member added: 36 → 9 ms).
4. **The restricted merge visits only the contributing files** (read off the
tables' own entries) — same loop, fewer files; 9.6 ms → ~0.
5. **The include graph** re-spells one file (`update_held`).
6. **Watcher classification** (`state/watched.rs`) and the **open-buffer add**
(`add_open_buffer`), both found by Step 1's trigger table.
Deviations from the brief, each argued in Assumptions: the inverted word index
was not built (the census measured small; the readers table is the reverse map
this needs, keyed by what resolution reads rather than by words, which is the
only shape that is sound across `extends`, re-export and instance hops); the
republish was not narrowed (measured not to be the cost). Four existing tests
pinned "a save that changes nothing still refreshes/republishes" and were
amended to save a real edit, each with an added assertion that the no-op save
now sends nothing: `requests.rs`
`a_rescan_asks_a_capable_client_to_refresh_its_code_lenses` and
`qa_a_rescan_with_several_open_buffers_still_sends_exactly_one_refresh`,
`pull_diagnostics.rs` `an_index_rebuild_moves_the_result_id_too`, `e2e.rs`
`a_save_asks_a_capable_client_to_refresh_its_code_lenses_over_the_wire`.
**Before / after** — same LSP driver, same OpenTitan tree, scope `workspace`,
10 buffers open, release builds of 7408fac and this tree, medians of 3, the
`--verbose` `reindex_one` line (wall time to the next answered request in
brackets). "watched" is the watcher's `Changed` for the same file right after
the save.
| file / edit | save before | save after | watched before | watched after |
|---|---:|---:|---:|---:|
| `uart_tx.sv` comment at end | 141 ms | 0.14 ms (nothing sent) | 153 ms | 0.10 ms |
| `uart_tx.sv` local signal | 144 ms | 5.2 ms | 158 ms | 0.10 ms |
| `uart_tx.sv` comment at top | 143 ms | 2.1 ms | 171 ms | 0.09 ms |
| `prim_flop.sv` (125 instantiating files) local signal | 145 ms | 5.2 ms | 174 ms | 0.07 ms |
| `prim_flop.sv` comment at top (every user's posting moves) | 144 ms | 61 ms | 167 ms | 0.19 ms |
| `uart_reg_pkg.sv` package member added | 148 ms | 11.7 ms | 152 ms | 0.30 ms |
| `uart_reg_pkg.sv` comment at top | 144 ms | 7.6 ms | 157 ms | 1.1 ms |
| `prim_assert.sv` (`` `define`` header) local edit | 145 ms | 4.7 ms | 169 ms | 0.18 ms |
| `prim_assert_standard_macros.svh` local edit | 148 ms | 4.9 ms | 170 ms | 0.69 ms |
| watcher `Changed` for a `.sv` the scope cannot take | 746 ms, bar | 3.5 ms, nothing | | |
| watcher `Changed`, held file by its real path under a symlinked root | 736 ms, bar | 3.6 ms, one-file | | |
| watcher `Changed`, held file in another case (macOS) | 714 ms, bar | 3.3 ms, one-file | | |
| first save of an unlisted buffer restored during the startup scan (filelist) | 394 ms, bar | one-file add | | |
| watcher `Created`, file in scope | 711 ms, bar | 742 ms, bar (by design) | | |
With 50 buffers open the changed rows add the republish (~0.3 ms a buffer:
16–35 ms); the unchanged rows are unchanged. Default folder scope (1 778
files): 65–82 ms before, 0.1–12 ms after. In-process
(`state::tests::reindex_perf`, release): 138–144 ms for every edit kind before;
after, 6–240 µs unchanged, 2.5–3.7 ms for a local signal, 0.2–3 ms for a
comment at the top except `prim_flop.sv` (61 ms), 9 ms for a package member
added. Cost of the readers table: see Assumptions (+23 ms per whole merge).
**Differential tests** (all green):
- `vlog_semantic/tests/localized_reindex.rs`: 11 hand-written sequences, one
per resolution hop (port connection, import + re-export, three-level
`extends`, struct member chain, a member whose type alone changes, a unit
whose kind alone changes, a hierarchical path through two instances, misses
that become hits and ambiguities, duplicate modules, defines and a broken
file, the unchanged record), each step checked against a whole build by
fingerprint — postings and readers included; plus a seeded sweep, 8 seeds ×
40 mutations over the five designs (320 checks, 0 divergences).
- `vlog_semantic` `workspace::replace::tests`: four tests pinning the
narrowing itself (which files a body edit, a port rename, a moved internal
signal and an edit above everything re-resolve).
- `lucisv_server` `server::tests::localized_reindex`: drives the real server
with an editor's notifications (change, disk write, save, watcher echo; or a
watcher event alone for closed files, creations, deletions) and after every
step holds the index, completion tables, include graph, every open buffer's
overlay **and the diagnostics last published for every open buffer** to an
in-place whole rebuild. Eight hand-written cases (module edits incl. ports,
hierarchical names and renames; a closed package, a define header, include
lines; the census lint with a closed mentioning file; files created and
deleted beside open buffers; watcher events outside the scope; a symlinked
root; a buffer outside the filelist, older and younger than the scan) and
three seeded sweeps: the design (3 seeds × 25 steps, in the normal suite),
`~/.cache/lucisv-corpus` (860 files, seeds 11–13 × 60 steps, `#[ignore]`,
35 s in release) and an OpenTitan sample (269 files of `ip/{uart,gpio}`,
`prim`, `prim_generic`, `tlul`, seeds 21–22 × 60 steps, `#[ignore]`); each
step one of: a line inserted, deleted, duplicated or swapped, a local signal
added, an identifier renamed to another the file uses, a closed file deleted
(1 in 20), a file created (1 in 20). 0 divergences; 1–5 whole rescans per
sweep, all of them creations.
- **Negative controls**, each a one-line sabotage of the implementation, run
and reverted: readers ignored (21 tests fail), `base_of` / re-exports /
hierarchical members / units / connection members not recorded (3/4/4/5/8),
`seen` ignoring a declaration's type or kind (3/3, after the two
type-alone and kind-alone cases were added for exactly this), contributors =
the file alone (5), the base table not rebuilt (4); server side: no
republish when the index moved (3), include line not re-scanned (3),
completion names not refreshed (5), a removed file's includers kept (1),
unknown files treated as outside (5), overlays not refreshed (4), words not
patched (7), aliases not resolved (1), the open-buffer add without its age
guard (1, on the `include` edge it exists for).
The first run of the server-level test found a real divergence older than this
round: a removed header's includers kept their edge (incremental-index's
documented limit). Fixed (`remove_one`).
**Checks run** (2026-11-19, this tree): `cargo fmt --all -- --check`;
`cargo clippy --all-targets -- -D warnings`; through `tools/guard.sh`:
`cargo test -p vlog_semantic` (434 passed), `-p lucisv_server` (1 985 passed,
47 ignored), `-p lucisv_mcp` (383), `-p vlog_linter` (673); the two `#[ignore]`d
sweeps in release; `tools/gates.sh` — every step passed except `fmt`, on a
probe file appended after the last format, re-run green with
`--only fmt,clippy,build,suite:lucisv_server,suite:vlog_semantic`.
**Not verified here:** no real VS Code was driven. That its watcher forwards a
`Changed` for the editor's own save (the second re-index per save) is
VS Code's documented watcher behaviour, replayed by the driver, not observed;
and that VS Code maps events under a symlinked or differently-cased workspace
back to the folder's spelling is likewise not observed — the server now
answers either spelling. The LSP driver and the scenario scripts are scratch
(`step1*.py`, `lsp.py`), not checked in.
### 2026-11-19 — dev agent: fix round for QA's FAIL (F1–F5)
The principle QA restored: a shortcut may skip work only when everything that
work would have produced is provably unchanged. "Outside the scope" and
"record unchanged" proved it for the index, not for the include graph (resolved
against the disk) or the diagnostics (which read `lucisv.toml` and waiver files
from the disk). What changed:
- **F1** — `IncludeGraph` keeps every file's include lines; every path a
watcher event names (any extension, any scope) first re-resolves the lines
whose target's last component could be that name (`refresh_naming`), and so
do the open-buffer add and a removal. No rescan, no file read.
- **F2** — every `didSave` and every watcher event the server acts on
republishes every open buffer under a new generation, whatever the record
did; lens refresh and hierarchy invalidation stay gated on the index moving
(they read nothing else). Every input of `diagnostics_of` and what
invalidates it is now listed in Assumptions. A watcher event naming a
`lucisv.toml` is a whole rescan.
- **F3** — the birth-time guard is gone; the add re-resolves the include lines
that could name the file instead, which needs no witness of when it appeared.
- **F4** — an open buffer the index does not hold is `Watched::Held`; the
one-file path adds it.
- **F5** — when the readers hold more than 1/8 of all references (index of at
least 20 000), their old postings are swept out in one pass instead of
re-resolved; per-file ambiguity is recorded for that. The fingerprint now
renders ambiguity counts, so a drifted count shows.
- **Coverage restored:** `requests.rs::a_client_that_cannot_refresh_code_lenses_is_never_asked_to`
saves a real edit again and asserts the index moved. **Five** existing tests
were amended in the first round, not four (that one was missed in the list);
`pull_diagnostics.rs::an_index_rebuild_moves_the_result_id_too` now expects
`full` after the no-op save again, as at 7408fac. vlog_linter is 672 tests as
the gate counts them (673 summed with doc-tests).
- **The README had lost its Status / TODO section** (a replace in the first
round swallowed it); restored.
**New differential tests** (`server::tests::localized_reindex`), each verified
to fail with its fix reverted: an ignored-dir header created/deleted/recreated
(F1), an unlisted `+incdir+` header created/deleted in filelist mode (F1), a
`[lint]` edit followed by a no-op save, there and back (F2), a file moved in
from elsewhere then opened and saved with no watcher echo (F3), an excluded
open buffer changed on disk (F4); `replace::tests::both_ways_out_…` runs a
chained design through both ways out (sweep sabotage of sites, readers or
ambiguity each caught). The seeded sweeps gained the event kinds QA found: an
out-of-scope header (gitignored `gen/`, waited for by an in-scope file)
toggled, a `lucisv.toml` lint edit plus a no-op save, a file moved in and
opened and saved, an excluded file created, opened and changed on disk.
**QA's oracle against the fixed binary** (logs `scratchpad/dev711/or-*.log`):
`outside.py`, push and pull: 14/14 cases, 0 diverged (were 4 diverged).
`small.py`, push and pull, workspace and folder scope: every scenario 0
divergent steps except `NEGCTL-silent` (the negative control, diverging as it
must) in all four runs. `rand_run.py`, 300 steps, check every 25: corpus seeds
1, 2 (pull, workspace) and 3 (push, folder) and OpenTitan sample seeds 11, 12
(pull) — 12 checks each, 0 divergent, 7 849–9 545 answers compared per check.
**Timings** — QA's `perf.py`, full OpenTitan, workspace scope, push, 10 buffers,
medians of 5, 7408fac and this tree back to back (`reindex_one` line, which now
includes the republish):
| edit | 7408fac | first cut (QA) | now |
|---|---:|---:|---:|
| uart_tx comment at end | 162 | 0.13 | 0.05 |
| uart_tx local signal | 170 | 15.1 | 4.4 |
| prim_flop local signal | 167 | 15.7 | 4.2 |
| prim_flop line at top | 163 | 88.8 | 47.1 |
| uart_reg_pkg member added | 167 | 27.1 | 11.5 |
| prim_assert local edit | 159 | 11.0 | 1.5 |
| prim_mubi_pkg member added (677 importers) | 162 | **178** | 92.1 |
| prim_mubi_pkg line at top | 163 | **171** | 84.6 |
| tlul_pkg line at top | 161 | 142 | 67.6 |
| new class `uvm_object` | 164 | 19.4 | 4.2 |
| new `` `define`` in a macros header | 160 | 20.2 | 6.4 |
| clk_rst_if line at top | 157 | 34.7 | 15.9 |
The watcher echo is 0.03–0.27 ms for every row. **Startup**, warm (cache):
1 113 / 1 124 ms → 1 171 / 1 148 ms, about +40 ms (+4 %); QA measured +76 ms
on a busier machine, the first cut's README said +23 — the honest range is
+25 to +75 ms depending on load. Cold: 2 729 → 2 194 ms (one run, noise).
**Checks:** fmt clean; clippy `--all-targets -D warnings` clean; guarded
`vlog_semantic` 435, `lucisv_server` 1 990 (48 ignored), `lucisv_mcp` 383,
`vlog_linter` 672 (gate count); both `#[ignore]`d sweeps in release (corpus 3
seeds, OpenTitan sample 2 seeds, 0 divergences); **full `tools/gates.sh`:
PASS**, every step (corpus 814/6, the same six known failures).
**Not verified:** no real VS Code; Linux not run (no birth time is consulted
any more, so that question is gone). F6 untouched (see Handshakes).
### 2026-11-19 — dev agent: round 3 (QA R2-1, the formatter-styles Handshake, docs)
On the lead's rebase onto 0.65.5 (the three `auto_styles` calls in
`server/notification.rs` kept as they are).
- **R2-1 — watcher bursts.** Two changes, both boring:
1. the include-line refresh takes the event's whole path list and makes one
pass over the held lines for the set of names
(`IncludeGraph::refresh_naming_all`); re-resolving a file once per
matching name or once for all of them gives the same answer, so it is
equivalent to the per-path loop it replaces;
2. an event naming more than one path per `BURST_DIVISOR` (= 2) indexed files
takes the whole rescan, before any per-path work (the rescan re-resolves
every include line itself). The constant's comment carries the
measurement that chose it.
One notification of N files created under a gitignored directory of the
OpenTitan copy (4 029 files indexed, so the threshold is 2 014 paths),
`scratchpad/dev711/burst.py`, medians of 3, back to back:
| paths in one event | 7408fac | round 2 | now |
|---:|---:|---:|---:|
| 1 000 | 0.68 s | 0.22 s | 0.11 s |
| 3 000 | 0.64 s | 0.65 s | 0.68 s (rescan) |
| 5 000 | 0.65 s | 1.07 s | 0.68 s (rescan) |
| 10 000 | 0.67 s | (QA: 2.5 s) | 0.70 s (rescan) |
QA's `genburst.py` on the same tree, this build: one event 0.10 / 0.69 /
0.70 / 0.71 s for 1 000 / 3 000 / 5 000 / 10 000; the same files as that
many one-path events 0.28 / 0.83 / 1.37 / 2.76 s in all (7408fac rescans
once per event there, 0.65 s each). **Past the threshold the event costs one
rescan, which is 20–40 ms (3–6 %) more than 7408fac's** — the readers-table
cost every whole merge carries (Assumptions), not anything the burst adds.
Below it, never more than ~0.3× the rescan it replaces.
`a_burst_of_created_files_is_sorted_below_the_threshold_and_rescanned_above`
pins both sides (no rescan at `held / 2` paths, one rescan at one more, the
state a rebuild's after each).
- **The formatter-styles Handshake** — `line-length`'s width falls back to the
chosen style's width (Handshakes). `lint::tests::line_length_holds_a_buffer_…`
checks five rungs (explicit width over a style; project style `ansi` 80;
editor style `microsoft` 120; default 100; `auto` 100), each at the width and
one column past it, against `lucisv check`'s ladder; with the fix reverted
it fails at "project style".
- **Docs:** QA's R2-2 (republish at 200 buffers) and R2-3 (startup range)
under Assumptions and Status; P1–P3 beside F6 under Handshakes; the
changelog paragraph rewritten to the final behaviour and numbers.
## Changelog paragraph (for the lead)
**Saving a file no longer re-indexes the workspace.** A save used to cost
~160 ms of whole-index work on OpenTitan whatever was edited — and VS Code
triggered it twice, once for the save and once for its own file watcher. Now
the index does only what the edit can reach: the watcher's echo and a save that
changes nothing the index records cost well under a millisecond; a typical edit
inside a module costs a few milliseconds (4 ms for a local signal in
`uart_tx` or `prim_flop`, 12 ms for a package member added); edits that really
reach far still pay for what they reach (a line above a module 125 files
instantiate, 47 ms; a member added to a package 677 files import, 92 ms). Every
save still re-checks every open file's diagnostics, so a `lucisv.toml` or
waiver edit takes effect at the next save as before — with hundreds of files
open that is most of what a save costs (53 ms at 200 buffers, against ~205 ms
before). Watcher events for files the index cannot hold — generated files in a
gitignored directory, files outside the filelist or folder scope — no longer
start a whole rescan with a progress bar, though they still update the include
lines that may name them; nor do held files reported through a symlinked root
or in another case; a file opened from outside the filelist joins the index on
its first save; and a burst of thousands of files in one event still takes the
single rescan it always did. The `line-length` lint now uses the chosen
formatting style's width. Still wide: adding or deleting a file (an in-memory
merge, no re-read), an edit above a declaration many files use, and every whole
rescan, which costs a few per cent more than before (warm OpenTitan startup
+40 to +120 ms, load-dependent) for the table that makes the rest cheap.
## QA log
### 2026-11-19 — QA agent (Opus 5.5): FAIL — the index core holds, the watcher and "unchanged sends nothing" rules leave stale answers
**Verdict: FAIL.** Four reproducible stale answers, each a regression against
7408fac, where a from-scratch server on the same files answers differently
(F1–F4). Nothing my oracle could find is wrong in the vlog_semantic narrowing:
postings, ambiguity, readers, completion tables, overlays, hierarchy and lens
counts all matched a fresh server across every hand case and every random
sequence. The failures are server-side. Two rules — "a watcher event for a file
the scope cannot take does nothing" and "an unchanged record sends nothing" —
drop work whose result is not covered by the index record: the include graph
(resolved against the **disk**, whatever the scope) and the lint configuration
(read from the disk at lint time). Scratch for everything below:
`/private/tmp/claude-501/-Users-lucio-repo-lucisv/d043c274-11ff-4de2-ab0f-45daa8a877f0/scratchpad/qa711/`
(`oracle/` holds the scripts, `*.log` the runs).
**Baseline checks (final tree).**
- `cargo fmt --all -- --check`: clean. `tools/gates.sh`, run whole, not inside
`guard.sh`: **PASS**, every step: fmt, clippy, build, vlog_parser 521/0,
vlog_semantic 434/0, vlog_refactor 743/0, vlog_formatter 352/0, vlog_linter
672/0, lucisv_core 117/0, lucisv 143/0, lucisv_server 1 985/0 (47 ignored),
lucisv_mcp 383/0, docs 1/0, corpus 814/6 (gate exit 0; the same 6 known
failures as at 7408fac), node 37/0. No step killed.
- Test counts against 7408fac's gates log: vlog_semantic 418 → 434 (+4
`replace::tests`, +12 `tests/localized_reindex.rs`), lucisv_server 1 977 →
1 985 (+8 run, +6 ignored). Every other crate is unchanged, and the diff
removes no `#[test]`. (The dev reported vlog_linter as 673; the gate counts
672 at both commits.)
- The two `#[ignore]`d sweeps, release, through `guard.sh`: both pass, 39.5 s.
The readers probe reproduces the dev's figures: 13 806 keys (376 KiB of key
text), 69 222 reader entries.
- **The amended tests.** No assertion was weakened beyond the stated protocol
change, and each amended test gained a "the no-op save sends nothing"
check. One count is off: **five** tests changed, not four.
`requests.rs::a_client_that_cannot_refresh_code_lenses_is_never_asked_to`
gained a `tree.write("top.sv", …)` so that its watcher event really changes
something. Its `didSave` now moves nothing, so for a client that cannot
refresh, "silence on the save path" no longer exercises a moved index (LOW,
coverage).
**The oracle** (mine; I read the dev's harness only to find entry points). A
Python LSP client drives the release `lucisv-server` over stdio, through
`tools/guard.sh`. Edits are sent the way VS Code sends them: `didChange`, disk
write, `didSave`, then the watcher `Changed`. A disk-only edit sends just the
watcher event, after a `didChange` reload when the file is open and clean. A
checkout sends one watcher event for several files. There are creates,
deletes, and renames as delete+create in both orders, in one event or two.
After each step a **fresh** server is started with an empty storage dir on the
resulting files and the same buffers, and every answer is compared verbatim
(only `resultId`, `revision` and `version` are dropped):
- per buffer: documentSymbol, codeLens, documentLink, semanticTokens/full,
inlayHint, pull diagnostics, the last pushed diagnostics;
- per identifier: definition, typeDefinition, references, hover,
documentHighlight, completion, prepareCall/TypeHierarchy plus
incoming/outgoing and super/subtypes;
- workspace/symbol, `lucisv/moduleHierarchy`, and `willRenameFiles` for
chosen headers (the include graph's observable).
Push and pull diagnostic modes were both run. Negative control: a disk edit
with no notification diverges on 14 answers as expected (`NEGCTL-silent`).
| edit kind | small trees (ws + folder scope, push + pull) | corpus / OpenTitan |
|---|---|---|
| comment, whitespace, same-length comment, newline-in-comment at the same byte length, UTF-16-only column shift, CRLF, tab↔space | pass | pass (random) |
| local signal; add/remove/rename a port; rename a module and back; param default/type | pass | pass (random) |
| package member add/remove/rename, typedef, enum member, struct field | pass | pass (random) |
| `import p::*` ↔ explicit import; `export`; 3-level `extends` (base member add/remove, extends retarget, base rename) | pass | — |
| interface/modport rename, interface signal rename | pass | — |
| `` `define `` add/remove/params change; redefine in a second header; include order swap; `` `include `` add/remove; `"x"`→`<x>` | pass | pass (random include toggles) |
| miss→hit / hit→miss (create, edit, delete); ambiguity appears/disappears | pass | pass (random) |
| two files alternately; A, B-depends-on-A, undo A; no-op save right after a change | pass | pass (random) |
| create, delete, rename (both orders, one or two events), delete+recreate, header delete+recreate | pass | pass (random) |
| unparseable and recovery; whole-file replacement (200 modules) | pass | — |
| disk-only edits of closed files; 2–3 files in one watcher event | pass | pass (random) |
| edits during the startup scan | pass | pass: OT sample + full OT ×2 seeds, 52–56 ops in the first 1.5 s |
| symlinked root (either side), symlinked subdir, other case (macOS) | pass: one-file path taken, file held once | — |
| buffer outside the filelist saved the first time, older/younger than the scan | pass | — |
| `.f` edit, `didChangeConfiguration` exclude | pass | — |
| **out-of-scope header created** (gitignored dir; unlisted in filelist mode) | **FAIL (F1)** | — |
| **file with an old birth time moved in after the scan** | **FAIL (F3)** | — |
| **`lucisv.toml` `[lint]` change, then a save that moves nothing** | **FAIL (F2)** in push and pull | — |
| **excluded buffer changed on disk** | **FAIL (F4)** | — |
The same F1–F4 scripts pass against a 7408fac build (`outside-base.log`).
**Random runs** (`oracle/rand_run.py`). Each step is one of: a mutation saved
through the editor or written to disk (insert, delete, duplicate or swap a
line; rename an identifier to another the workspace uses; add a signal, a
package member or a top line; rename a module or a port; a same-length
comment change; blank lines at the top), a no-op save, a create, a delete, a
rename, a checkout of 3 files, an open, a close, or an include toggle. A fresh
server comparison runs every N steps.
| tree | seeds × steps (every) | answers compared | divergent checks |
|---|---|---:|---|
| corpus, pull, workspace scope | 1–4 × 500 (25) | 684 k (80 checks) | 0 |
| corpus, push, workspace / folder scope | 9 × 500, 8 × 500 (25) | 393 k with the next row (47 checks) | 0 |
| corpus, push | 7 × 200 (25) | | **1 at step 200 — F6, pre-existing** |
| OpenTitan sample (541 files: uart, i2c, spi_device, rv_timer, prim, prim_generic, tlul) | 11–13 × 500 (25) | 514 k (60 checks) | 0 |
| full OpenTitan `hw` (4 061 files) | 21 × 50 (50) | 6 538 | **1 — F6, pre-existing**; seed 21 also diverges at step 50 on 7408fac (248 answers) |
| full OpenTitan, buffers re-sent and re-saved before each check (F6 workaround) | 21 × 200 (50) | 30 k | 0 |
**Findings.**
- **F1 — MEDIUM, regression: a watcher `Created`/`Deleted` for a file the
scope cannot take leaves include edges stale.**
- Where: `state/watched.rs:39-49` classifies the file `Outside`, and
`server/index.rs:139` then does nothing. But
`includes.rs:351` (`found` → `path.is_file()`) resolves every held file's
`` `include`` against the disk, not the scope. A header that appears or
disappears outside the scope is exactly what an in-scope includer's edge
points at: a generated header under a gitignored `build/`, an unlisted
header in filelist mode (the normal case there), or a header in an
excluded directory. 7408fac re-scanned for every such event.
- Repro (`oracle/outside.py gitignored-header-created`): `.gitignore` holds
`gen/`; `rtl/a.sv` and `rtl/a_inc.svh` both `` `include "../gen/h.svh"``,
and `gen/h.svh` does not exist. Start the server in workspace scope, then
write `gen/h.svh` and send `didChangeWatchedFiles` with type Created.
`workspace/willRenameFiles gen/h.svh → …` now answers `null`. A fresh
server, and 7408fac, rewrite the include line in both `a.sv` and
`a_inc.svh`.
- Same in filelist mode (`filelist-header-created`: an `+incdir+` header
created after the scan; the includer's edit is missing).
- Also visible: second-hop reachability in `includes::reachable_from`, which
hover uses to pick the `` `define`` a file sees. The edges stay wrong until
the next whole rebuild. A user renaming the header in VS Code gets a rename
that leaves the include line pointing at the old name.
- **F2 — MEDIUM, regression: a save that moves no record no longer refreshes
diagnostics that depend on the lint configuration on disk.**
- Where: `server/index.rs:110` gates the generation bump and the republish
on `OneFile::Changed`. The `lucisv.toml` `[lint]` select/ignore/options and
the external waiver files are read from the disk at every lint
(`lint.rs` `Discovered`), and the watcher does not report `lucisv.toml`
(both commits).
- Before, saving any file made the edited config take effect. Now:
- push mode: the stale diagnostics stay;
- pull mode: `textDocument/diagnostic` with the previous result id answers
`"unchanged"`, because the result id is the generation, and the client
keeps the stale squiggles.
- Repro (`outside.py toml-lint-change`, `QA_PULL=0` and `=1`): a buffer with
`no-tabs`, `no-trailing-whitespace`, `wire-reg-mixup` and `unused-signal`.
Write `lucisv.toml` with `[lint] ignore = [those four]`, then
`didSave` the unchanged buffer plus the watcher echo. 71.1 still shows
four diagnostics (push), or `unchanged` (pull). 7408fac and a fresh server
show none (push), or `full []` (pull).
- This is exactly the "not in the record but user-visible" class the
Assumptions say does not exist. Waivers, `[lint.<rule>]` options and
`lineLength` from `lucisv.toml` behave the same way (same code path; not
run separately).
- **F3 — LOW–MEDIUM: the open-buffer add's age guard can be fooled; on macOS
it is routine.**
- Where: `state/incremental.rs:127-128` compares the file's **birth time**
with `scanned_at`. On APFS the birth time comes with the file: `mv` and
`ditto` keep it, `cp -p` copies it, and setting an mtime earlier than the
birth time (`touch -t`, `rsync -a`, `tar x`) pulls the birth time back too.
Measured: `touch -t 2020…; cp -p` gives a new file born in 2020.
- So a header unpacked or copied in after the scan, then opened and saved,
takes the one-file add. Other files' includes that were waiting for it are
not re-resolved: the exact edge the guard exists for.
- Repro (`moved-in-old-file`): filelist mode, an unlisted `late.svh` moved in
after the scan, opened, saved. `willRenameFiles` on it misses `rtl/a.sv`'s
include line; a fresh server and 7408fac have it.
- In practice this compounds F1, whose `Created` event was already dropped.
- Separately (informational): where `created()` is unsupported (several
Linux filesystems, see TODO §70) the guard always fails, which is sound
but turns the fast path off silently.
- **F4 — LOW, regression: an open buffer the index does not hold, changed on
disk, is no longer taken in.**
- Where: `watched.rs:42-44` → `Outside`. The Assumptions argue a rebuild
"would take the buffer's text, not the disk", but a rebuild also **adds**
every open buffer, and 7408fac's rescan did.
- Repro (`excluded-open-buffer`): an excluded `rtl/b.sv` opened after the
scan, then changed on disk with a watcher `Changed`. 21 answers differ
from a fresh server: references to `b` from `top.sv`, `b`'s completion
entry, call hierarchy. The buffer is taken in on its next save, so this
is the documented "opened after the scan" state lasting longer than
before.
- **F5 — LOW, cost not documented: an edit to a package most of the tree
imports costs more than the old whole pass.**
- A wildcard import reads the package's member table as one key, so any
member added or removed re-resolves every importer, and does it twice:
out against the old tables, in against the new.
- Measured (full OpenTitan over LSP, push, 10 buffers, medians of 5,
`reindex_one` line):
| edit | 7408fac | 71.1 |
|---|---:|---:|
| `prim_mubi_pkg` member added (677 files) | 159 ms | **178 ms** |
| `prim_mubi_pkg` line at top | 157 ms | **171 ms** |
| `tlul_pkg` line at top | 155 ms | 142 ms |
- The README lists "an edit above a widely used declaration" as the wide
case (prim_flop, 61 ms). A plain member add to a widely imported package
is the more common edit and is not listed; it is also slower than before.
Not a correctness problem; it belongs in Assumptions and in
`docs/perf/README.md`.
- **F6 — pre-existing (7408fac fails the same way), not this lane:
an open buffer's analysis can lose its latest `didChange`.**
- The server keeps showing the previous text's document symbols, semantic
tokens and diagnostics, while my client's text, the disk and a fresh
server agree with each other.
- Repros, deterministic: `QA_PULL=0 rand_run.py <bin> ~/.cache/lucisv-corpus
corpuspush 7 200 25` (71.1 fails at step 200; 7408fac on the same seed at
step 100), and `rand_run.py <bin> ~/.cache/lucisv-opentitan-full/hw
otfull 21 50 50` (both binaries, 248 answers).
- The notifications sent are well-formed (`didOpen` v1, `didChange` v2…v3,
saves). The losing `didChange` lands while the whole rescans that the
random creates and deletes trigger are in flight. A 10-iteration isolated
race (`oracle/race.py`) did not reproduce it.
- Re-sending and re-saving the buffers repairs every answer, so the index
itself is right. Recommend filing it separately.
- **Observations, not defects.**
- Recording the readers is always on in `IndexBuilder::finish`, so the CLI
and `lucisv_mcp` whole builds pay it too, with no update to use it for.
- `remove_one`'s `includers_of` compares the raw (as-resolved) spelling,
so on a case-insensitive disk an includer that wrote another case is not
re-scanned on removal (code reading only; no observable answer found).
- A burst of 2 000 watcher events for files in a gitignored build directory
now costs 0.2–0.3 s and no rescan, where 7408fac started 2 000 rescans.
**Cost, re-measured.** Full OpenTitan `hw`, workspace scope, over LSP, push
mode, 10 buffers open. Medians of 5, on a machine busy with another lane and
Spotlight/file-provider work.
| | 7408fac | 71.1 |
|---|---:|---:|
| warm startup scan (`scan finished`) | 1 064 ms | 1 140 ms (+76 ms; `absorb` 138 → 174 ms) |
| cold startup scan (one run each) | 2 673 ms | 2 179 ms (noise-dominated) |
| server RSS after settle (median of 3) | 456 MB | 448 MB (no measurable growth) |
| uart_tx comment at end: save / echo | 155 / 153 ms | 0.13 / 0.08 ms |
| uart_tx local signal | 169 / 169 ms | 15.1 / 0.06 ms |
| prim_flop local signal | 164 / 159 ms | 15.7 / 0.05 ms |
| prim_flop line at top | 157 / 159 ms | 88.8 / 0.02 ms |
| uart_reg_pkg member added | 161 / 156 ms | 27.1 / 0.32 ms |
| prim_assert local edit | 154 / 153 ms | 11.0 / 0.24 ms |
| new class `uvm_object` (a name ~150 DV files miss on) | 158 ms | 19.4 ms |
| new `` `define`` in prim_assert_standard_macros.svh | 157 ms | 20.2 ms |
| clk_rst_if line at top (195 users) | 155 ms | 34.7 ms |
- The narrowing delivers the headline: the echo is free and a local edit
costs ~15 ms. My local-edit figures are 2–3× the dev's (5.2 ms), and
`prim_flop` line-at-top is 89 ms against the dev's 61; the push republish
and machine load are both in these numbers.
- The warm-scan increase (+76 ms, +7 %) is about three times the dev's +23 ms.
Both are small against what one save saves.
**Not verified.**
- No real VS Code was driven. The watcher echo, VS Code's spelling of events
under symlinked or case-variant roots, and the order of `didOpen` and
`Created` for "New File" are all replayed, not observed.
- I did not re-run the dev's 21 sabotage controls; my own negative control is
the silent edit.
- Linux (no birth time) was not run.
**What I changed:** nothing in the source or tests. This QA log is the only
edit to the tree.
### 2026-11-19 — QA agent (Opus 5.5), round 2: PASS WITH FINDINGS
**Verdict: PASS WITH FINDINGS.** F1–F5 are fixed: every round-1 reproduction
now matches a fresh server.
- In what my oracle could reach, I found no stale answer this lane causes.
Every divergence I did find also reproduces, in the same form, against a
7408fac build.
- The new findings are two costs (R2-1, R2-2) and one measurement note
(R2-3), all LOW.
- The pre-existing defects are listed at the end for the next lane.
Binary: `cargo build --release -p lucisv_server` on the fix-round tree, copied
to `scratchpad/qa711/lucisv-server-r2`.
**Baseline.**
- Full `tools/gates.sh` (not inside `guard.sh`): **PASS** on every step.
- fmt, clippy, build, docs 1/0, corpus 814/6 (the same six), node 37/0
- suites: vlog_parser 521, vlog_semantic 435, vlog_refactor 743,
vlog_formatter 352, vlog_linter 672, lucisv_core 117, lucisv 143,
lucisv_server 1 990, lucisv_mcp 383 — all 0 failed
- Against round 1: vlog_semantic +1, lucisv_server +5. No `#[test]` was
deleted.
- Both `#[ignore]`d sweeps, release, guarded: pass (40.2 s).
- Test changes since round 1:
- `a_client_that_cannot_refresh_code_lenses_is_never_asked_to` saves a real
edit again and asserts the save moved the index (`member_in("sub", "w")`).
- `an_index_rebuild_moves_the_result_id_too` expects `full` after a no-op
save, which is stronger than round 1.
- Nothing is weaker.
- File sizes (non-blank, non-comment lines before the first `#[cfg(test)]`):
the largest touched file is `candidates.rs` at 435, then `record.rs` 358 and
`includes.rs` 327. Everything is under 600.
**Oracle, re-run in full on the new binary**: the same scripts and the same
battery as round 1, plus `willRenameFiles` probes.
| suite | result |
|---|---|
| `small.py`, 52 scenarios × workspace/folder scope × pull and push | 156 + 156 checks ok; only `NEGCTL-silent` diverges, as it must |
| `outside.py` (the F1–F4 reproductions and the rest of round 1's list), pull and push | 14/14 and 14/14 ok (round 1: 4 diverged) |
| `r2attack.py`, 21 cases, pull and push, against r2 **and** 7408fac | r2: 17 ok; 4 diverge — **identical in 7408fac** (pre-existing, below) |
| `f5.py`, sweep threshold: 11 trees × 7 steps | 77/77 ok |
`f5.py` details:
- Below the floor: `n50/k50`, ~18 k references.
- Just above the floor: `n60/k60`, ~21.7 k.
- Readers' share straddling 1/8: `n170` with `k` = 40, 45, 48, 50, 52, 56, 64.
- Far above: `n170/k170`. Far below: `n170/k5`.
- Each tree has two packages exporting `X`, so every importer of both is
ambiguous. The steps: member add, line at the top, the ambiguity removed
and restored, a member used everywhere removed, `X` removed from one
package, a filler edit.
`r2attack.py` cases:
- F1: include through a symlinked directory; target spelled in another case
(`../GEN/H.SVH` against `gen/h.svh`); the same basename in the own dir and
an `+incdir+` (create incdir, create own-dir so it wins, delete own-dir,
delete incdir, recreate own-dir, every step ok); a transitive header
created inside an out-of-scope header; a path with no extension; directory
events.
- F2: waiver file created, edited and deleted, each followed by a no-op save;
a nested `rtl/sub/lucisv.toml` followed by a no-op save of *another* file;
`didChangeConfiguration` of `lint.ignore`.
- F3: a file moved in by `mv`, `cp -p`, `rsync -a` and `tar x`, each with an
mtime of 2020, opened and saved with and without a watcher echo (8 cases);
a buffer opened before its file exists on disk, then written and saved.
- F4: an excluded buffer opened, changed on disk, closed, reopened, saved and
closed.
**Random runs** (`oracle/rand_run2.py`): round 1's ops plus the event kinds
behind F1–F4.
- `qa_gen/` (gitignored) headers created and deleted, and in-scope files
gaining an `` `include`` of them; `willRenameFiles` probes for those headers
are in the battery.
- `lucisv.toml` `[lint] ignore` rewritten, followed by a no-op save.
- A `cp -p` of a file dated 2020 into a random directory, opened and saved,
half the time without a watcher echo.
- Excluded `qa_excl/` files opened and changed on disk.
The oracle needed two adjustments, and both apply equally to 7408fac:
- `QA_FRESH_SAVE`: after its scan, the fresh server saves its own open
buffers. A buffer opened while the startup scan takes its work list is
documented as not taken in, which made the fresh side non-deterministic.
- Closing an excluded buffer was dropped from the op mix. That is pre-existing
P2 below, seen first in seeds 31–33.
All seeds are new; 500 steps, checked every 25, unless noted.
| tree | seeds | answers | result |
|---|---|---:|---|
| corpus, pull, workspace | 31, 32, 37, 33 (re-run after the close change) | 487 k + | 0 divergent |
| corpus, push, workspace | 34, 35 | 424 k (with the next row) | 0 |
| corpus, push, folder | 36 | | 0 |
| OpenTitan sample | 41, 43 | 364 k (with 42) | 0 |
| OpenTitan sample | 42 | | step 350: the saved buffer's own answers stale = **F6** (deterministic; 0 divergent over 500 steps with `QA_REPAIR`) |
| full OpenTitan, `QA_REPAIR`, symlinks copied as files | 51, 52 × 300 (check every 50) | 78 k | 0 |
| full OpenTitan, symlinks kept | 51 × 50 | | divergent = pre-existing P3 (7408fac diverges on the same seed, on another symlinked file) |
**F6 is unchanged.** Corpus seed 7 (push) diverges at step 200 on the same 8
answers as in round 1. In OpenTitan-sample seed 42 the losing `didChange` and
its save land between a `checkout x3` (a whole rescan) and a `create`; the
server logs no `reindex_one` for that save. That fits the dev's Handshakes
note: a change dropped while a whole rescan is in flight. An isolated loop
(`oracle/movedthenedit.py`, 15 iterations) did not reproduce it.
**Cost re-measured** with `perf.py` and `startup.py`: full OpenTitan,
workspace scope, push, 10 buffers, medians of 5. The `reindex_one` line now
includes the republish. The machine was busy with my own runs and with
Spotlight indexing, and both binaries ran back to back under the same load.
| edit | 7408fac save / echo | r2 save / echo |
|---|---:|---:|
| uart_tx comment at end | 165 / 178 ms | 0.9 / 0.9 ms |
| uart_tx local signal | 179 / 169 | 8.8 / 0.9 |
| prim_flop local signal | 178 / 174 | 10.0 / 0.8 |
| prim_flop line at top | 171 / 169 | 51.9 / 0.9 |
| uart_reg_pkg member added | 167 / 164 | 15.9 / 1.1 |
| prim_assert local edit | 164 / 171 | 5.0 / 1.1 |
| prim_mubi_pkg member added | 170 / 166 | **101** / 1.3 |
| prim_mubi_pkg line at top | 166 / 178 | 91.5 / 1.2 |
| tlul_pkg line at top | 166 / 167 | 73.5 / 1.3 |
| new class `uvm_object` | 169 / 169 | 9.1 / 1.2 |
| new `` `define`` in a macros header | 170 / 175 | 10.8 / 1.3 |
| clk_rst_if line at top | 164 / 166 | 21.2 / 1.4 |
| warm startup scan (medians of 5, alternating) | 1 259 ms | 1 363 ms (+104 ms, +8 %) |
| RSS after settle (median of 3) | 475 MB | 468 MB |
No edit is slower than 7408fac. F5's package case is fixed: 101 ms against
170 ms at 7408fac.
**Findings (round 2).**
- **R2-1 — LOW, cost: one watcher notification costs ~0.24 ms per path named,
linearly.**
- Where: `server/notification.rs`'s watcher arm calls
`refresh_includes_naming` for every path, and `includes.rs:188`
(`refresh_naming`) walks every held file's include lines once per path.
Out-of-scope paths then also take `watched()`'s directory walk.
- Measured on full OpenTitan, one `didChangeWatchedFiles` naming N files
created in a gitignored directory:
| N | 7408fac (one whole rescan) | r2 (no rescan) |
|---:|---:|---:|
| 1 000 | | 0.23 s |
| 2 500 | | 0.59 s |
| 5 000 | 0.75 s | **1.21 s** |
| 10 000 | | 2.52 s |
- Not quadratic. Past ~3 000 paths in one event (a generator writing a
build tree), the cheap path costs more than the rescan it replaced, and
it blocks the queue.
- Repro: `oracle/genburst.py <bin> 5000 <ot-full copy with qa_burst/
gitignored>`.
- **R2-2 — LOW, cost: with many buffers open, the republish now dominates a
save.** Full OpenTitan, push, median of 5 (`oracle/manybuf.py`):
| buffers | 7408fac no-op / local signal | r2 no-op / local signal |
|---:|---:|---:|
| 10 | 162 / 170 ms | 0.8 / 9.7 ms |
| 50 | 170 / 172 ms | 3.7 / 19.3 ms |
| 200 | 203 / 207 ms | 14.3 / **53.4** ms |
- A no-op save re-sends ~0.07 ms a buffer. An edit that moves the index
clears every lint snapshot and re-lints ~0.2 ms a buffer, against ~5 ms of
index work.
- Still 4× faster than 7408fac at 200 buffers. The README's "~0.3 ms a
buffer" is the right order.
- **R2-3 — measurement note:** warm startup +104 ms (+8 %) on a loaded
machine, above the dev's stated +25 to +75 ms. Load-dependent, as the dev
says.
**Pre-existing: reproduced on 7408fac identically, not this lane.** For the
next lane:
- **P1** — a watcher event that names only a **directory** loses what is
inside it.
- `r2attack.py dir-create`: a header directory created → its includer's
edge is missing.
- `held-dir-delete`: a directory of held files deleted → the index keeps
them, 9 answers differ.
- A deleted header directory with only the directory named happens to
match.
- The dev's note ("a deleted directory is filtered out, edges stay stale,
same as 7408fac") is confirmed for both builds.
- What `git checkout` of a removed directory sends through VS Code's
watcher (one event per file, or the directory alone) I could not observe.
git unlinks file by file, so per-file events are the likely shape
(**unverified**).
- **P2** — an excluded or out-of-filelist buffer, once taken into the index,
**stays after `didClose`**. A fresh server without it open does not hold
it: `excluded-open-close` diverges on 20 answers after the close, in both
builds. F4 makes the take-in more frequent, since the one-file path now adds
such a buffer on any event. The close behaviour itself is 7408fac's.
- **P3** — **symlinked files.** OpenTitan's `top_englishbreakfast/rtl/*.sv` are
symlinks into `top_earlgrey/rtl/`.
- Whether a rebuild holds both spellings depends on whether the target is
an open buffer at scan time.
- `oracle/filelink.py` diverges in all six variants (via target or link ×
editor/disk/open-only) on both builds.
- **F6** — unchanged; see above. The Handshakes note matches what I observed.
**Not verified:**
- no real VS Code (the watcher's shape for directory operations, the
"New File" event order, symlinked roots);
- Linux;
- that the sweep path actually ran in the `f5.py` trees near 1/8. Its
references count is not observable over LSP, so I bracketed it:
`k170`/`n60` are certainly above the floor and the eighth, `n50` and `k5`
certainly below, and every case passed.
**What I changed:** nothing outside this QA log.
## Review
**Lead, 2026-11-19.** Accepted for 0.65.6, after a QA FAIL, a fix round, a QA pass and one more small round.
- Step 1 mattered more than the design: an incremental path already existed,
and what the owner was seeing was the watcher echo doubling every save,
whole rescans for files the index could not hold, and a one-file path that
was still O(index). The dev measured before designing, and dropped two
things my brief asked for (the inverted word index, narrowing the
republish) because the measurements said they were not the cost. Right.
- Recording what each file READ — misses included — instead of inferring
readers from the names a file mentions is the decision that makes this
sound; the dev's negative controls show the name-based version breaking on
`extends` chains, re-exports and hierarchical paths.
- The first cut failed QA, properly: two shortcuts ("outside the scope does
nothing", "unchanged record sends nothing") were proven for the index and
assumed for the include graph and the diagnostics. The rule I gave for the
fix round stands for whoever touches this next: a shortcut may skip work
only when everything that work would have produced is provably unchanged.
F2's fix is the conservative one — every save republishes, as before this
lane — and that is deliberate.
- QA's fresh-server oracle is the evidence I accept this on, not the dev's
harness: it was built independently, it failed the first cut, and it
passes the final one. Round 3 (burst threshold, include batching, lint
width) was re-checked by the dev against QA's hand scenarios but not by QA
and not against new random seeds; I accept that for a change of that size,
and say so.
- I rebased the lane onto 0.65.5 myself; the formatter lane's three calls in
`server/notification.rs` survived, and its `lint.rs` request is taken here.
- Not verified: a real VS Code (the watcher's behaviour is from its
documentation), and Linux.
- Open, handed to lane 71.7 with reproductions: the out-of-order edit during
a rescan, directory-only watcher events, excluded buffers after close,
symlink spellings.
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->