Files

indexing-ux

Goal

Three things a user of a large workspace has been asking the index for, all of them about knowing and controlling what the scan is doing. (1) A per-file size cap — lucisv.index.maxFileSize, 1 MiB by default: a Verilog file bigger than a mebibyte is almost always a generated netlist or a dumped trace, and indexing one costs minutes and answers nothing anybody asked. (2) A counting progress bar — the $/progress bar that work-done-progress put up was deliberately indeterminate, because rebuild_index was one opaque call; this round makes the build observable per file, so the bar says 137/860 core_ibex_env.sv and carries a real percentage. (3) Per-file status in the editor's output channel — lucisv.index.logFiles, on by default: one window/logMessage naming each file as it is parsed, plus a line for each file the cap skipped, so "why is this symbol missing" and "why is this scan slow" are answerable without a debugger. All three settings ride both settings doors (push and pull) for free, because settings.rs is the one parser for both.

Assumptions

  • The cap's blast radius is every sources() consumer, not just the index (QA log, 2026-08-27, lead-expanded): a capped file is invisible to the workspace index, the hierarchy census (code-lens counts, incomingCalls), type-hierarchy subtypes, cross-file navigation, rename's collection sweep, and willRenameFiles' include rewriting. This is the one coherent reading — "which files exist as far as this server is concerned" — and nothing dangles, because the file is equally absent from every layer. The honesty gap QA proved: a rename that would have touched a capped file leaves its text stale on disk with no warning. Follow-up filed (see the task the lead spawned): sweeps that WRITE should say when the cap hid files from them.

  • The cap applies to walked files only; an open buffer is always indexed in full. The user opened it deliberately, and an editor that refused to understand the file on screen because of a size setting would be absurd. collect_sources reads the scope's files (capped) and then folds every open buffer in over the top (uncapped) — the same override that has always made a buffer beat disk. Amended 2026-08-27 by large-file-mode, and this is the one exception: a buffer over lucisv.largeFile.threshold (4 MiB by default) was never lexed or parsed at all, so it contributes nothing to the index — and it takes the disk copy of its own path out with it, rather than leaving the index describing bytes the buffer no longer has. The two settings do not overlap in intent: this one is about files nobody asked for, that one is about the file on screen. The interaction table is in docs/features/large-file-mode/README.md.

  • The cap is enforced with fs::metadata before the read. The whole saving is that a 200 MB netlist is never read into memory; a cap applied after read_to_string would be a cap that costs what it saves. A file whose metadata cannot be read is not skipped — it simply fails the read, as it always did.

  • 0 means no cap, and must be exactly today's behaviour. Pinned against the real corpus: the index built with the default cap and the index built with maxFileSize: 0 are the same files in the same order with the same counts (the_default_cap_changes_nothing_about_the_real_corpus). It is true today because the largest file in corpus/ is 94 KB — eleven times under the cap, and zero corpus files exceed 1 MiB — and that test is what notices if a future corpus or a future default changes it.

  • A wrong-typed cap falls back to 1 MiB, not to 0. Every other setting in settings.rs drops a bad value and goes silent; here "silent" has to mean the shipped default, because reading junk as 0 would turn the cap off, which is the failure the setting exists to prevent.

  • The cap is a server indexing cap and nothing else. It is not pushed into lucisv_core's walk and not into the CLI's formatting path: lucisv format on a 4 MB file must still format it, and a lucisv.toml has no key for this. It lives in Workspace::collect_sources, which is the one place the server decides which files exist.

  • …which means a refactoring sees the cap too. Workspace::sources() — what a workspace rename and find_references read — goes through the same collect_sources. That is the consistent answer rather than an oversight: a file that is not in the index is not a file this server rewrites. Stated here because it is the one non-obvious reach of the setting.

  • The denominator is the work list after exclude and after the cap. It is vlog_semantic::index_order's length, known before the first parse, so the bar counts towards a number the scan will actually reach. Amended (index-scope, 2026-08-28): a scope widen's work list is the files it is actually indexing — the folders it added, plus the open buffers it refreshes — so a jump into a 25-file folder of a 4 000-file project says 1/25, not 1/3979. That is the same rule, not an exception to it: the denominator has always been "what this scan will do", and a widen simply does less. The bar's end message is unchanged and still names the whole index ("N files indexed"), because the bar names the scan and the message names what the workspace now holds. No test in this feature moved; the fixtures here are small enough that a widen's work list is the whole scope, and the new denominator has its own test in state.rs (a_widen_bar_counts_the_new_files_and_not_the_whole_scope).

  • The percentage only counts up, and the last file always reports. See the throttle below; the_report_schedule_never_floods_and_never_stops_short checks both properties across nine workspace sizes.

  • logFiles defaults to on. The owner asked for it, and the channel it lands in is hidden until somebody opens it — MessageType::LOG goes through vscode-languageclient's default: branch straight to outputChannel.appendLine, with no popup, no channel reveal and no trace gate (read out of node_modules/vscode-languageclient/lib/common/client.js, not assumed). A user who minds turns it off.

  • The startup scan runs at the defaults, because settings arrive after it. Both doors deliver settings only once initialized has been seen, so the first index build always uses the 1 MiB cap and always logs its files, even for a user who set neither. A differing cap then costs one extra rescan when it lands — the same one lucisv.exclude has always cost (docs/features/folders-and-config/README.md) — and a logFiles: false takes effect from the second rescan onwards. This is visible in the measurements below, where the "off" rows still carry the startup scan's 860 lines.

  • The skip count survives with the log off. The skip lines are gated by logFiles like every other per-file line, but the progress end message becomes "N files indexed, M skipped" whenever M > 0, whatever the log setting says. A user who silenced the log should still learn that part of their workspace is not in the index.

  • Changing the cap rescans; changing the log setting does not. max_file_size changes which files exist as far as this server is concerned, exactly as exclude and filelist do, so it joins them in set_client_settings's change test. log_files changes only how loudly the next rescan narrates itself.

  • The completion tables and the include graph are outside the bar's count. They are built from the same list after the index, and cost a small fraction of the parse. A bar that reached 100% and then sat there would be worse than one that ends.

Handshakes

vlog_semantic — one addition, build redefined over it

WorkspaceIndex::build was one opaque call, so nothing outside the crate could see a rebuild advance. It is now the loop over two new public items, and its own signature and behaviour are unchanged:

pub fn index_order<'a>(files: impl IntoIterator<Item = (PathBuf, &'a str)>)
    -> Vec<(PathBuf, &'a str)>;          // sorted by path, one entry per path

pub struct IndexBuilder;                 // new() / add_file(path, src) / finish()

pub fn build<'a>(files: …) -> WorkspaceIndex {
    let mut builder = IndexBuilder::new();
    for (path, src) in index_order(files) { builder.add_file(path, src); }
    builder.finish()
}
  • Why the builder rather than a callback parameter. A callback would have put a &mut dyn FnMut in a crate whose whole documented character is "pure: the same inputs always give the same index". The builder adds no parameter to anything and no closure to any signature; the caller that wants to watch simply runs the loop itself.
  • Why index_order is public alongside it. The builder hands out FileIds in call order, and both the file ids and the disambiguation order of a name declared twice are the path order build used to establish privately. Exporting the ordering rule is what keeps a watched build and a plain build the same index — and the server needs the list's length before the first parse anyway, for the progress denominator. It is the honest alternative to a comment telling callers to sort. Superseded in part (index-scope, 2026-08-27): the builder hands out FileIds in call order — it sorts inside finish now, so feeding it index_order's list is no longer required for correctness. index_order stays public and unchanged for the denominator, and build still calls it so a duplicate path is not parsed twice.
  • Proof of equivalence: every existing vlog_semantic test is unchanged and every one of them goes through build. One new test (the_incremental_builder_is_what_build_is_made_of) drives the builder path directly and asserts the same files(), the same counts(), the same winning Def for a path handed over twice.
  • Noted, not done: vlog_refactor::rename::Scope::build re-derives the same sort-and-dedup by hand, with a comment saying so (crates/vlog_refactor/src/rename.rs:148). It could now call index_order. Out of this round's scope; filed here.

lucisv_server::state

  • Workspace::rebuild_index_with(&mut dyn FnMut(IndexEvent)) and open_roots_with(roots, …) are the watched forms; rebuild_index() and open_roots() keep their exact old signatures and behaviour as the unwatched forms. server.rs always watches, so the unwatched pair is now reachable from tests alone and is #[cfg(test)] — several dozen call sites across the crate, none of which has an opinion about progress.
  • Amended (incremental-index, 2026-08-27): a rescan triggered by exactly one file the index already holds does not go through rebuild_index_with at all — it is Workspace::update_one, which reports no events, puts no bar up and writes no log lines, because one parse is not a scan to narrate. Every whole rescan is unchanged. The cap still applies, through the same oversize test, and a file that grew past it leaves the index on the incremental path too.
  • pub enum IndexEvent<'a> { Parsing { done, total, path }, Skipped { path, size, cap } }. Numbers and paths only: this module speaks no protocol, and the wording of every message stays in server.rs. Amended (index-persistence, 2026-08-27): a third variant, Cached { done, total, path } — the same three numbers, for a file the persistent index cache answered for instead of a parse. A new variant rather than a flag on Parsing, so that every consumer is asked by the compiler what it wants to say about a file that was not parsed.
  • ClientSettings::max_file_size is read in collect_sources; nothing else in state.rs changed. Amended (perf5-p4 §P4b3, 2026-09-08): collect_sources no longer reads any file's text — a scan reads a file when it indexes it — but the cap is untouched and is still a fs::metadata call there, ahead of any read. That matters to this feature for three reasons the bar depends on: the skips are still counted and reported before the first file is parsed, so Scan::total is still known up front and still excludes them; the events are still emitted in the same order for the same files, so a_scan_reports_the_same_events_in_the_same_order_however_it_is_driven is unchanged; and a file whose text has gone by the time its step comes reports no event at all and is not counted as a cap skip — it is not a file the cap kept out, and saying so would be a lie in the end message. The per-file log's order did move: the work list now leads with the open buffers' own files and then the folders those raise to (docs/features/index-scope/README.md), so a user watching a rescan sees their own neighbourhood go by first rather than the alphabet.

lucisv_server::settings

  • Two new fields, max_file_size: u64 and log_files: bool, parsed from lucisv.index.maxFileSize / lucisv.index.logFiles. VS Code nests a dotted setting id under each segment, so the section arrives as {"index": {"maxFileSize": …}}; an index that is missing, null, or not an object leaves both at their defaults.
  • ClientSettings's Default is now hand-written. Two of the fields do not default to silence (1 MiB, and the log on), which a derive cannot say. Every other field is its type's zero, exactly as the derive produced, so every ..Default::default() in the crate keeps meaning what it meant.
  • DEFAULT_MAX_FILE_SIZE is public so the tests and the docs name one number.

lucisv_server::server

  • IndexWatch turns IndexEvents into a $/progress report and a window/logMessage, and counts the skips. It holds &Connection rather than &Server, because the workspace is borrowed mutably for the whole of the rebuild it is watching; Server::new and reindex therefore destructure self into its connection and workspace fields around the call. Same value, same operations, same order.
  • Server::notify and Server::progress now delegate to free notify_on / progress_on functions taking a &Connection — one implementation, two callers, no duplicated send.
  • end_indexing takes the skip count and says "N files indexed, M skipped" when it is non-zero. Amended (index-persistence, 2026-08-27): it takes the cached count as well and names it first — "860 files indexed, 858 from cache, 2 skipped" — because a scan that finished suspiciously fast should say why. Same rule as the skip count: the number is in the end message whether or not the per-file log is on. IndexWatch also grows an arm for IndexEvent::Cached, whose log line reads cached: <path> where a parsed file's reads indexing: <path>, and whose bar tick is identical — a cached file is a file of the work list, and the bar flying through them is the point. Amended again (index-scope, 2026-08-28): a third arm, IndexEvent::Analyzed, for a file that went into the index from an open buffer's own finished analysis rather than from a parse or from the store. Its log line reads analyzed: <path>; its bar tick is identical again. It deliberately adds no clause to the end message — one file out of a workspace is not why a scan finished fast, and "N from cache" keeps meaning the persistent store and nothing else, which is the sentence index-persistence's e2e transcripts assert. See docs/features/index-scope/README.md.
  • begin still carries no percentage: the first honest one is the first file's.

editors/vscode

  • Two new contributes.configuration properties. No extension.js change: synchronize: { configurationSection: 'lucisv' } already pushes the whole section including the nested index object, and new LanguageClient('lucisv', …) already owns an output channel that vscode-languageclient appends every MessageType::LOG message to verbatim.
  • smoke.js sends capabilities: {} and no index section, so it takes the no-bar path with the log at its default; it passes untouched.

Cost, measured

Release build, this Mac, 860-file corpus/, min of three runs of a session that does two full scans (startup + one save-triggered rescan):

progress logFiles wall stdout log lines reports
off off* 668.8 ms 1.16 MB 860 0
off on 670.9 ms 1.34 MB 1720 0
on off* 687.0 ms 1.50 MB 860 1720
on on 704.9 ms 1.69 MB 1720 1720

* the settings push lands after the startup scan, so the "off" rows still carry the startup scan's 860 lines; only the second scan is quiet. That is what makes the rows subtract cleanly.

So, per 860-file rescan: 860 log lines ≈ 173 KB (≈ 201 B each, mostly absolute path), 860 reports ≈ 160 KB (≈ 186 B each). Both features on cost ≈ 18 ms on a ~690 ms two-scan session — about 2.6%, and about 333 KB of extra stdout per rescan.

Stated honestly: at 10,000 files the log is the part that gets ugly. The reports are throttled to at most 1000 per rescan whatever the size, so they stay at ~190 KB; the log is not, so it would be ~2 MB of JSON on every save. That is a real number and a real cost, and the follow-up is batching (one logMessage per N files, or per directory) — filed, not invented here, because a batching scheme designed without a user complaining about it would be guessing at the wrong granularity. The escape hatch exists today: turn lucisv.index.logFiles off.

The throttle rule

const MAX_REPORTS: usize = 1000;
fn reports(done: usize, total: usize) -> bool {
    let step = total.div_ceil(MAX_REPORTS).max(1);
    (done + 1).is_multiple_of(step) || done + 1 == total
}

Up to 1000 files, step is 1 and every file reports. Past that, every ⌈total/1000⌉-th file reports — at most 1000 per rescan, so the bar still moves in steps of a tenth of a percent, which is under a pixel. The || done + 1 == total is the reason 10,001 files do not leave the bar one file short of the work it finished. Both regimes are pinned: the rule itself exhaustively for nine sizes, and a real 1100-file workspace end to end.

Status / TODO

  • lucisv.index.maxFileSize, bytes, default 1 MiB, 0 disables
  • Enforced on fs::metadata before the read, walked files only
  • Open buffers exempt, and pinned as such
  • A cap change rescans; logFiles, lineLength, indent, formatOnSave, inlineTemplates still do not
  • $/progress reports carrying n/total file.sv and a real percentage
  • Throttled to ≤ 1000 reports per rescan, last file always reported
  • The same reports on the startup build and on every reindex trigger
  • window/logMessage (MessageType::LOG) per file, plus skip lines
  • Both gated by lucisv.index.logFiles, default on; skip count survives with the log off, in the end message
  • vlog_semantic::IndexBuilder + index_order, with build redefined as the loop over them and every existing test unchanged — and the builder's ordering contract carried by a doc comment superseded (index-scope, 2026-08-27): finish sorts, so the contract is the code
  • package.json declares both settings, with the 0-disables semantics and the open-buffer exemption in the descriptions
  • 21 new tests; 7 existing progress tests updated for the reports
  • Not done, deliberately: no batching of the log lines. See "Cost, measured" — the number is stated, the follow-up is named, and the granularity is not guessed at.
  • Not done, deliberately: no cap in lucisv_core's walk or in the CLI. lucisv format on a huge file must still format it.
  • Not done, deliberately: no lucisv.toml key for the cap. It is an editor-session resource setting, not a project style decision — the same reason serverPath has no config key.
  • Filed, not done: vlog_refactor::rename::Scope::build could call index_order instead of re-deriving the sort/dedup.

Work log

2026-09-08 — §61.3: no report while the denominator can still grow

Amends the denominator assumption, and keeps both of its properties. A workspace-scoped startup with a buffer open now takes its work list in two goes — the user's own folder, then the rest of the workspace (docs/features/perf5r-first-answer/README.md) — so for the length of that head, "what this scan will do" is not yet known.

The rule this README states is "the percentage only counts up, and every one of them is measured", and a growing denominator breaks both: 124/124 followed by 125/3 976 is a bar that falls from 100 % to 3 %. Neither of the review's two suggestions was taken — a second $/progress token would put two bars on one scan, and a "known so far" denominator is exactly the invented percentage begin_indexing refuses. What ships instead costs nothing: the bar token is withheld while the work list can still grow. IndexWatch::tick needs the token and returns early without one; IndexWatch::say does not, so every file of the head is still named in the per-file log. The client sees the begin (which has carried no percentage since it was written), then the log, then the first measured report — against the finished work list, counting up from there. The last file still always reports.

the_bar_paints_no_percentage_until_the_denominator_is_final asserts all three: the sequence never falls, the first report is not the head's own 50 %, and both the buffer's step and its folder's are in the log.

The skip count is unaffected: the head's skips and the rest's are summed onto the same scan, and the end message names the total as it always did.

2026-08-27 — dev agent (indexing UX: cap, counting bar, per-file log)

  • vlog_semantic: builder, not callback — and the reason is FileId. The brief allowed either and asked for a justification. The builder shape did not fight the code, but it did expose an invariant: build sorted and deduped privately, and both the file ids and a duplicate name's disambiguation order depend on that. An IndexBuilder alone would have pushed "remember to sort" onto every caller as a comment. Exporting index_order beside it turns that into a call, and the server needed the ordered list's length before parsing anyway (the progress denominator), so the second public item has a real second use rather than being an abstraction for a user that does not exist. build is now three lines over the two of them; every existing vlog_semantic test is byte-identical and green, which is the equivalence proof.
  • The cap went in collect_sources, one fs::metadata ahead of the read. That is the one place the walked list becomes text, so it is the cheapest point and the only one where "never read the netlist" is true. Consequence found and documented rather than papered over: Workspace::sources() — the refactoring path — shares that function, so the cap reaches a workspace rename too. That is the consistent reading of "which files exist as far as this server is concerned", and it is now written down in Assumptions.
  • ClientSettings::default() is hand-written now. Two settings whose default is not silence (1 MiB, log on) cannot be derived, and pushing them into Options would have made every use site re-decide what unset means. Every other field keeps the derive's value, so no existing ..Default::default() changed meaning — the whole suite passing unchanged is the check.
  • A wrong-typed maxFileSize falls back to the default, not to 0. This is the one place this module's "drop it and go silent" rule needed a direction: silence here is 1 MiB, because reading junk as 0 would silently un-cap.
  • Nested keys, because VS Code nests them. lucisv.index.maxFileSize arrives as {"index": {"maxFileSize": …}} through both doors; the parser reads lucisv.get("index") once and a non-object index is the same as no index. Pinned through from_section too, since these are the first nested keys to go through the pull door.
  • IndexWatch holds &Connection, not &Server. The workspace is borrowed mutably for the whole rebuild, so Server::new and reindex destructure self and hand the watcher the connection field. notify and progress were re-pointed at free notify_on/progress_on functions so there is still exactly one place a notification is sent.
  • The report message names the file, the log line names the path. The bar is a few dozen characters of status bar; the path belongs in the channel that has room for it.
  • human_size, not a fixed MiB. The first draft printed skipped (0.0 MiB > 0.0 MiB cap) for a 4 KiB file under a 1 KiB cap — the e2e test caught it. The cap is settable to anything, so the unit adapts: bytes, KiB, MiB.
  • Seven existing tests were updated, all of them pinning "no report". That assumption is exactly what this round removes, so each one gained its reports rather than being relaxed: the_startup_index_build_runs_under_the_first_bar, a_save_puts_a_bar_up_and_takes_it_down_again, the_bar_is_down_before_the_republish, every_rescan_path_gets_its_own_bar_and_its_own_token (its "no invented percentages" line became "every report is inside its own bar", which is the stronger property), the_refresh_rides_after_the_indexing_bar_comes_down, the_startup_watcher_registration_arrives_after_the_indexing_bar_comes_down, one_folder_notification_is_one_rescan_with_one_bar_and_one_generation, plus the e2e indexing_reports_its_progress_over_the_wire.
  • One surprise worth recording: package small; does not index — small is a SystemVerilog keyword (charge strength). Two new fixtures were renamed to small_pkg after that cost ten minutes.
  • Files touched: crates/vlog_semantic/src/workspace.rs, crates/vlog_semantic/src/lib.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, editors/vscode/package.json, TODO.md, docs/features/work-done-progress/README.md, docs/features/lucisv-server/README.md, this README. No new dependency, no version bump, no docs/site/, no commits.

Verification. cargo fmt --all -- --check: clean. cargo clippy --all-targets: zero warnings. cargo test --workspace: 2197 passed, 0 failed (2176 on HEAD — 21 new). cargo test -p vlog_formatter: green. cargo build && node editors/vscode/smoke.js target/debug/lucisv-server: smoke: OK. Corpus: 0 of 860 files exceed 1 MiB (largest, picorv32.v, is 94 KB), and the default-cap index is identical to the uncapped one — pinned by a test, not just measured.

The 21 tests, and what each is for:

test pins
the_size_cap_defaults_to_a_mebibyte_and_zero_turns_it_off (settings) the default, the empty sub-section, 0, and no upper bound
a_wrong_typed_size_cap_leaves_the_default_standing (settings) six wrong types, and four wrong shapes of index itself
the_file_log_is_on_until_a_client_turns_it_off (settings) absence, both booleans, five wrong types
the_index_settings_come_through_the_pull_door_too (settings) the nesting survives from_section, one set of rules
a_walked_file_over_the_cap_is_left_out_of_the_index (state) the cap itself
the_default_cap_is_a_mebibyte_and_zero_turns_it_off (state) a real >1 MiB file against the shipped default, then 0
an_open_buffer_is_indexed_however_big_the_file_is (state) the exemption
every_skipped_file_is_reported_with_its_size_and_the_cap (state) the Skipped event's path, size and cap
the_watcher_sees_every_file_in_index_order_against_a_total_it_knew_first (state) the denominator is post-exclude, post-cap; events are in index order
the_default_cap_changes_nothing_about_the_real_corpus (state) cap-on == cap-off over corpus/, files and counts
the_bar_counts_the_files_as_it_goes (server) 1/2 a.sv at 50%, 2/2 b.sv at 100%
the_reports_thin_out_when_the_workspace_is_huge (server) 1100 real files: ≤1000 reports, monotonic, last is 1100/1100
the_report_schedule_never_floods_and_never_stops_short (server) the rule at 1, 2, 999, 1000, 1001, 1999, 2000, 12345, 40000
the_end_message_names_what_the_cap_skipped (server) "1 file indexed, 1 skipped", with the log off
a_capped_file_is_out_of_the_index_and_an_open_buffer_is_not (server) both halves of the cap through the real dispatch
every_indexed_file_is_named_in_the_log_and_so_is_every_skip (server) one line per file, MessageType::LOG, the skip line's sizes
the_file_log_goes_quiet_when_the_setting_is_off (server) not one line, skips included
the_file_log_does_not_wait_for_a_progress_bar (server) the log is not gated on the progress capability
a_new_cap_rescans_and_a_new_log_setting_does_not (server) the change detection, both directions, through didChangeConfiguration
the_incremental_builder_is_what_build_is_made_of (vlog_semantic) builder == build: files, ids, counts, duplicate-path winner
the_size_cap_and_the_file_log_work_over_the_wire (e2e) the real binary: nested setting → rescan → symbol gone, log lines, report and end message decoded off the wire

QA log

2026-08-27 — QA agent (one round: cap, counting bar, per-file log)

Gates. cargo fmt --all -- --check: clean. cargo clippy --all-targets --workspace: zero warnings. cargo test --workspace: 2197 passed, 0 failed (matches the dev's number exactly; one incidental failure of an unrelated pre-existing timing-budget test, lens::tests::code_lenses_for_a_whole_file_cost_about_one_workspace_walk, during a run made while several other cargo/release builds were competing for CPU in the background — reran clean in isolation twice, not a regression, not touched by this round). cargo test -p vlog_formatter: 114 passed, verify.rs untouched (confirmed via git status/git diff — it never appears). node smoke.js target/debug/lucisv-server: OK.

All temporary attack code below was added directly to the tracked files listed, run, and then removed with a diff-identical revert verified against a saved copy of the original git diff before continuing — no attack code remains in the working tree.

1. FileId/ordering invariant — VERDICT: safe today, latent risk in the abstraction. WorkspaceIndex::build and Workspace::rebuild_index_with (the only two callers of IndexBuilder::add_file in the tree) both feed it index_order's list, in order, so the two are provably identical — confirmed independently by feeding a workspace with a case/depth-nontrivial duplicate module name (z_late.sv / a_early.sv, both declaring dup) through build and through a manual index_order + IndexBuilder loop: same FileIds, same disambiguation winner (a_early.sv first, both ways).

But Closed by index-scope, 2026-08-27 (see docs/features/index-scope/README.md): IndexBuilder::add_file now keeps its file's declarations to itself and finish sorts them by path before handing out any FileId, so no insertion order can reach the result. QA's construction below is a permanent test, no_insertion_order_can_change_what_the_builder_produces. The finding as filed, kept legible:

IndexBuilder itself enforces nothing — it is a dumb accumulator, and the ordering guarantee is carried entirely by the doc comment ("Feed it index_order's list"), not the type system. Direct attack, temporarily added to crates/vlog_semantic/tests/workspace.rs and run:

let files = [
    ("z_late.sv", "module dup (input a); endmodule\n"),
    ("a_early.sv", "module dup (input b); endmodule\n"),
];
let mut wrong = IndexBuilder::new();
for (p, s) in files { wrong.add_file(PathBuf::from(p), s); }   // raw order, NOT index_order
let wrong = wrong.finish();
let right = WorkspaceIndex::build(files.iter().map(|(p, s)| (PathBuf::from(*p), *s)));
assert_eq!(wrong.files(), right.files());   // FAILS

Result: wrong.files() == ["z_late.sv", "a_early.sv"] vs. right.files() == ["a_early.sv", "z_late.sv"] — FileId(0) and the dup disambiguation winner both flip. So insertion order does leak into the result the moment a caller bypasses index_order, exactly as the brief warned. Severity: MEDIUM, not HIGH — both current production call sites are verified correct, so this is not a live bug in this round's shipped code, but it is a real footgun for the one thing the README itself flags as "filed, not done" (vlog_refactor::rename::Scope::build migrating to IndexBuilder later). Suggest, as a non-blocking follow-up: either have IndexBuilder::add_file debug-assert paths arrive in non-decreasing order, or fold index_order into IndexBuilder itself (e.g. buffer-then-sort on finish()) so the invariant can't be bypassed by a future caller who didn't read the doc comment.

2. The cap's blast radius through sources() — documentation gap, coherent behavior. Workspace::sources() is also consumed by crates/lucisv_server/src/hierarchy.rs:90 (codeLens counts / callers_of_each), ports.rs:61,87, nav.rs:132 (find_references), and type_hierarchy.rs:112 (subtypes) — not just rename.rs/file_ops.rs. The indexing-ux README's Assumptions section and the lucisv-server README's new paragraph name only the rename/refactoring reach ("a refactoring sees the cap too"); the existing per-endpoint table rows for callHierarchy/incomingCalls and typeHierarchy/subtypes (docs/features/lucisv-server/README.md lines 46 and 50) are untouched by this diff and say nothing about the cap, even though those two consumers are exposed identically. The behavior itself is coherent — a capped file is invisible everywhere consistently, nothing dangles — but a future reader of those two table rows would not learn that a netlist over the cap silently vanishes from an instantiation count or a subtype list too.

Concretely reproduced the rename case as the sharpest instance (temporarily added to crates/lucisv_server/src/rename.rs, run, reverted): a workspace with sub.sv (declares sub), top.sv (open, instantiates sub), and a 4 KB netlist.sv over a 1 KiB cap that also instantiates sub. Renaming sub to child:

let (edit, warnings) = rename(&ws, &uri, at(TOP, "sub u_sub"), "child").expect("renames");
// changes.len() == 2 (sub.sv, top.sv) — netlist.sv is absent
// warnings == [] — nothing at all says netlist.sv exists or was skipped

So a rename leaves netlist.sv with a stale, now-broken reference to the old name, with zero warning anywhere in the rename response — not in refactoring.warnings, not in any diagnostic. The only place this is ever surfaced is the output-panel skip line from whichever index build happened to run earlier (logFiles on), which is decoupled in time from the specific rename and easy to have scrolled past. Severity: MEDIUM — the "not indexed → not rewritten" design is defensible and documented as intentional, but the complete silence at the point of the risky action is a real UX gap. Suggest as a follow-up: have rename/find_references check ws.sources() against a cheap re-walk (or thread the skip list through) and fold "N file(s) over the size cap may also reference this symbol" into refactoring.warnings when the cap is non-zero.

3. Cap edge semantics.

  • Exact boundary, pinned by hand (dev's suite doesn't cover it): a file of exactly 1024 bytes against a 1024-byte cap is not skipped — oversize is size > cap, so the cap is inclusive (≤ cap survives). Verified with a temporary test in state.rs creating a file measured at exactly 1024 bytes on disk and confirming it appears in the index under a 1024-byte cap. Correct and sensible, just untested — worth a permanent test.
  • Metadata failure: confirmed consistent with the documented behavior — oversize's fs::metadata(path).ok()? returns None on failure, so the file is not reported as skipped; it falls through to fs::read_to_string, which will also fail for the same reason, and the file is silently absent from texts exactly as it always was pre-cap. No regression, no new silent-failure mode.
  • Growing file mid-scan: not a race, as claimed — oversize and the read are back-to-back for one file within one scan.
  • Symlinks: verified directly (a symlink link.sv → a 5053-byte target_big.sv, plus a symlink_metadata comparison showing 13 bytes for the link itself vs. 5053 via fs::metadata). oversize uses fs::metadata (follows the link), and so does the subsequent fs::read_to_string — the cap is measured against the same bytes that would be read, not the symlink's own size. Coherent, no bug.

4. Settings parsing.

  • Nested {"index": {"maxFileSize": …}} and the wrong-type→default fallback: verified via the dev's own tests, both green.
  • Flat {"index.maxFileSize": …} shape (untested by the dev's suite): confirmed by a temporary test that lucisv.get("index") looks for a literal "index" key, so a flattened dotted key is invisible to the parser and silently resolves to the default (1 MiB) — same as index being absent entirely. Coherent with the module's "drop it and go silent" philosophy, but this specific shape isn't pinned by a test, unlike every other edge case in this settings addition. Low-severity gap, easy add.
  • Pull-door parity (from_section): verified via the dev's own test, green.

5. Throttle honesty. The dev's own the_report_schedule_never_floods_and_never_stops_short already covers the rule exhaustively at 1, 2, 999, 1000, 1001, 1999, 2000, 12345, 40000, and the_reports_thin_out_when_the_workspace_is_huge exercises it against 1100 real files end to end. Both ran green in the full-suite run; no gaps found worth a separate synthesis.

6. Logging gate. Verified via the dev's own tests (the_file_log_goes_quiet_when_the_setting_is_off, every_indexed_file_is_named_in_the_log_and_so_is_every_skip asserting MessageType::LOG specifically — not INFO — and the_file_log_does_not_wait_for_a_progress_bar). All green. No gaps found.

7. The 8 updated tests. Read every diff hunk. Seven of them (the_startup_index_build_runs_under_the_first_bar, a_save_puts_a_bar_up_and_takes_it_down_again, the_bar_is_down_before_the_republish, the_refresh_rides_after_the_indexing_bar_comes_down, the_startup_watcher_registration_arrives_after_the_indexing_bar_comes_down, one_folder_notification_is_one_rescan_with_one_bar_and_one_generation, and the e2e indexing_reports_its_progress_over_the_wire) only insert "report" entries into an already-asserted ordering sequence — their original point (bar goes up, comes down, in the right place relative to X) is intact. The eighth, every_rescan_path_gets_its_own_bar_and_its_own_token, is the one whose point was "no report is ever invented" — that assumption is exactly what this round removes, and it is replaced with the strictly stronger "every report belongs to a currently-open bar" check, under an explicit // Superseded this round: comment. That is the correct way to retire an assumption per CLAUDE.md's house style, and it is the one case that needed it.

8. CLAUDE.md compliance.

  • No unwrap()/expect()/panic! outside #[cfg(test)] in any touched non-test code (server.rs, settings.rs, state.rs, workspace.rs, lib.rs) — checked directly, clean.
  • Every new pub item (index_order, IndexBuilder + its three methods, IndexEvent, open_roots_with, rebuild_index_with) has a doc comment.
  • The feature README has all seven required sections exactly once (plus two extra informational sections, "Cost, measured" and "The throttle rule", which CLAUDE.md doesn't forbid).
  • The superseded-assumption annotations in TODO.md, docs/features/work-done-progress/README.md, and docs/features/folders-and-config/README.md all follow the existing house style (~~struck~~ + a dated "Superseded ... by ..." note that keeps the original reasoning legible) consistently.
  • verify.rs is untouched — confirmed absent from git status and git diff entirely.
  • The new corpus-gated tests (the_default_cap_changes_nothing_about_the_real_corpus in state.rs) follow the if !corpus.is_dir() { eprintln!("corpus/ not checked out — skipping"); return; } convention exactly as the pre-existing corpus tests in vlog_semantic do.

C. Beyond the list.

  • maxFileSize: 1 (temporary test in state.rs): every walked file skipped, index ends up with 0 files (not a panic, not an error), and an opened buffer is still indexed in full afterward. Server stays functional at the extreme.
  • logFiles toggled mid-session: already covered by the dev's own the_end_message_names_what_the_cap_skipped (toggles logFiles false in the same session as a cap change) and a_new_cap_rescans_and_a_new_log_setting_does_not. Both green; no gap found.
  • Overhead measurement, ~18 ms / 2.6% claim: attempted an independent spot-reproduction twice (a release/LTO build that did not finish in reasonable time in this sandboxed environment, then a debug-mode custom harness that hit a broken pipe in its own scratch code talking to the real binary over a hand-rolled 860-file corpus session — a bug in the throwaway harness, not reproduced against the dev's own passing corpus-based tests). Not independently re-measured; not verified numerically. The mechanism itself is architecturally sound for the claimed order of magnitude — one extra fs::metadata call and one extra window/logMessage/$/progress notification per file, both cheap, no additional passes over file content — so I have no reason to doubt the figure, but I did not confirm it myself.
  • human_size rounding boundary — new finding, LOW-MEDIUM, cosmetic only. human_size(1_048_575) (one byte under 1 MiB) prints "1024.0 KiB" instead of switching to the MiB branch, because 1_048_575.0 / 1024.0 == 1023.999... is < MIB so it takes the KiB arm, then rounds up to 1024.0 at {:.1} precision. Same failure mode one level up: human_size(1_073_741_823) (one byte under 1 GiB, which this function has no branch for) prints "1024.0 MiB". Verified directly:
    1048575    -> 1024.0 KiB
    1073741823 -> 1024.0 MiB
    
    This is the same class of bug the e2e test already caught once ("0.0 MiB > 0.0 MiB"), just at the opposite (upper) rounding edge, and only reachable today via a skip line whose size or cap happens to land in one of those windows — cosmetic, no effect on cap enforcement or index correctness. Worth a follow-up fix (e.g. bump the branch threshold down by half a unit, or format then re-check which unit the rounded string actually names).

Verdict: committable as-is. No correctness regression, no invariant violated, all four gates green, 2197/2197 tests passing. Two MEDIUM findings (the IndexBuilder ordering footgun, and the silent rename-blast-radius gap) are both documented-intentional-behavior-with-an-honesty-gap rather than bugs in what shipped, and are appropriately deferred as dev follow-ups rather than blockers. One LOW-MEDIUM new cosmetic finding (human_size rounding) and two LOW test-coverage gaps (exact-boundary cap, flat settings key) are cheap to add later and do not affect behavior today.

Review

2026-08-27 — lead

Reviewed the diff, the work log and the QA log; re-ran all gates myself, clean. The three features land the way the owner asked and the details show the right instincts: junk cap values fall back to 1 MiB rather than 0 (misparse must never un-cap), the denominator is the real work list known before the first parse, the skip count outlives the log toggle, and the vlog_semantic change follows the established redefinition pattern with index_order exported so the FileId ordering rule is a call, not a comment.

Rulings on QA's findings. The builder-ordering footgun (MEDIUM) is real and correctly assessed as latent — both production callers funnel through index_order, proven by QA's both-ways construction — and the fix belongs to the next round, whose scope work is precisely the future caller at risk: round 18's brief requires making the builder order-insensitive or formally enforcing the contract, with QA's attack as the acceptance test. The cap blast radius (MEDIUM) is accepted as the one coherent reading — absent from every layer equally — and I have expanded the Assumptions to name every consumer, with the write-path warning gap (a rename silently leaving a capped file's text stale) filed as a visible follow-up task rather than buried. The human_size rounding bug (LOW) I fixed directly with the unit chosen by what the rounded number reads as, plus the boundary test. The unreproduced 18 ms overhead claim stands as the dev's measurement with QA's non-verification noted — the mechanism is sound and the number is not load-bearing. Accepted as shipped.