# decomposition-server — TODO §28 Lane C: `lucisv_server`'s `server.rs` and `completion.rs` ## Goal Split the two files every server feature lane collides in — `server.rs` (8 851 lines: 2 558 non-test + 6 293 test) and `completion.rs` (4 178 lines: 1 716 + 2 462) — into module directories a human can navigate: `server/`, eleven files each the answer to one question about the request loop, with its tests in `server/tests/`, one file per feature; and `completion/`, six files each one answer the response is built from, with each provider's tests at the foot of the file whose code they pin. A **pure move**: no behaviour change, no renamed item, every path another module of the crate imports preserved by re-exports, test counts identical per binary, the CLI byte-identical against the 0.33.0 baseline, the e2e suite and the vsix smoke unchanged. `perf.rs` (1 189 lines) is left whole, and the reason is below. ## Assumptions - `lucisv_server` is a binary crate (no `lib.rs`); "public path" here means the paths other modules of the crate import. `crate::server::{ClientAbilities, Server}` (used by `main.rs`) stay in `server/mod.rs`; `crate::completion::{completions, plan_for, nearest_definition, at_instantiation_site, layout_at, snippet_hole}` (used by `inline.rs`, `instantiate.rs`, `server/dispatch.rs`) are either still defined in `completion/mod.rs` or re-exported from it with `pub(crate) use`. `completion::module_header` is used only by `perf.rs`, which is itself `#[cfg(test)]`, so its re-export is `#[cfg(test)]` too — an unconditional `pub(crate) use` would be an unused import in every other build, and the comment above it says so. `main.rs` is untouched: `mod server;` and `mod completion;` resolve to the new `mod.rs` files. - Sibling files are private modules; everything a sibling calls is `pub(super)` (taken from the compiler, not guessed: the build was iterated until it named nothing more), and that marking doubles as each file's list of entry points. `Server`'s fields stay private — child modules see their ancestor's private items — so no field widened. `completion::word::Word`'s and `Spine`'s fields are `pub(super)` because every other file reads them. - The server tests are one `#[cfg(test)] mod tests;` in `server/mod.rs` → `server/tests/mod.rs`, whose sibling files are the sections the one big test module had (same banner names). A helper more than one section used moved to `tests/mod.rs` under a banner saying so; a helper one section used stayed with it. The three production items only the tests reach (`batch::is_shutdown`, `progress::{reports, MAX_REPORTS}`) are `pub(super)` and imported in `tests/mod.rs`, which every test file globs. - The completion tests are in-file (`#[cfg(test)] mod tests` at the foot of each provider) on a shared `#[cfg(test)] mod harness;` — in-file so each file's tests reach its private functions through `use super::*` without a widening for every helper a test touches. - The corpus byte-identity check for this lane is the ten-file sample the brief asks for (this crate does not touch formatting; the release binary is built anyway); opentitan is not run at all. - "Production lines" in the brief's numbers (2 559 / 1 716) count every non-test line, comments included; the tables below use that metric (non-test lines) and give code-only lines beside it. ## Handshakes - **Consumes** (unchanged): everything `server.rs` and `completion.rs` imported before — `crate::{state, settings, format, on_type, tokens, diagnostics, lint, watch, file_ops, candidates, pairs, signature, symbols, templates, uri, …}` and the leaf feature modules the dispatch delegates to. - **Promises** (unchanged): `crate::server::{ClientAbilities, Server}` with `Server::new` and `Server::run` at the same signatures; `crate::completion::{completions, plan_for, nearest_definition, at_instantiation_site, layout_at, snippet_hole}` at the same paths and signatures; `completion::module_header` at the same path in test builds (its only caller is `perf.rs`, `#[cfg(test)]`). - **Requests**: none. Nothing outside `crates/lucisv_server/src/server/`, `crates/lucisv_server/src/completion/`, this README and the Lane C line of `TODO.md` changes. `main.rs`, `perf.rs`, `hover.rs`, `nav.rs`, `inline.rs`, `instantiate.rs`, `ports.rs` and every other file of the crate are byte-identical to 35f0b8d. ## Status / TODO - [x] Baseline pinned: per-binary test counts, `cargo doc` item list (667 pages), longest-function census, `/tmp/lucisv-0.33.0-baseline` present and `--version` 0.33.0 - [x] `git mv src/server.rs src/server/mod.rs`, `git mv src/completion.rs src/completion/mod.rs` - [x] Tests out of `server.rs` first: `server/tests/{mod + 15 files}.rs` - [x] `server/` production split into eleven files; `cargo build` and `cargo test -p lucisv_server` green after each carve - [x] `completion/` split into six files + `harness.rs`, tests in-file - [x] `perf.rs` left whole (reason in the work log) - [x] Text-level purity: line-multiset check for both files (below) - [x] `cargo test -p lucisv_server` per binary identical to baseline (1435 passed / 34 ignored, 85 / 2, 3) - [x] `cargo fmt -p lucisv_server` (`--check` clean), `cargo clippy --all-targets --workspace` 0 warnings, `cargo doc -p lucisv_server --no-deps` 8 warnings = the 8 pre-existing ones (none in the moved files), `cargo test --workspace` (see work log) - [x] `cargo doc` item list diffed: same items, in the new module pages - [x] e2e (85 passed) and vsix smoke (`node editors/vscode/smoke.js target/debug/lucisv-server` → OK, 20 messages) unchanged - [x] Release `lucisv --version` = 0.33.0, ten corpus files `--stdout` byte-identical (stdout, stderr, exit code) to the baseline binary - [x] `TODO.md` Lane C line ticked ## Work log ### 2026-09-02 — baseline Branch `decomp-server` at 35f0b8d (master with Lane B merged), worktree `.claude/worktrees/decomp-server`. Pinned `cargo test -p lucisv_server` (per binary): | binary | passed | ignored | |---|---|---| | `src/main.rs` unit tests | 1435 | 34 | | `tests/e2e.rs` | 85 | 2 | | `tests/grammar.rs` | 3 | 0 | | **sum** | **1523** | **36** | `cargo doc -p lucisv_server --no-deps`: 667 HTML pages, 8 warnings (all unresolved intra-doc links in `nav.rs`, `state.rs`, `diagnostics.rs`, `lint.rs` — untouched files). Longest functions before (brace-matched, whole function incl. comments): | file | fn | lines | |---|---|---| | server.rs | `answer_request` | 393 | | server.rs | `handle_notification` | 197 | | server.rs | `started` | 91 | | server.rs | `process_batch` | 58 | | completion.rs | `completions` | 81 | | completion.rs | `member_answer` | 76 | Two functions are over 150 lines and both are dispatch tables over a method-name set — `answer_request` over request methods, `handle_notification` over notification methods. They stay whole; each file's module doc says so. Nothing else is over 100. No function was split. ### 2026-09-02 — `server.rs` → `server/` **Method.** `git mv` first so history follows; then every new file was *copied* out of the HEAD blob by a plan of named items (a script resolved `fn name` / `struct name` / `const NAME` to "doc comment through closing brace" and refused any name that matched twice), and `mod.rs` was rewritten wholesale from the items it keeps. Nothing was deleted by script; the proof that nothing was lost is the line-multiset check below. Visibility widenings (`pub(super) `) were inserted one at a time from the compiler's own "is private" list, and the three unused imports that produced were removed by hand. The one code-order edit is `progress.rs`: `progress_on` moved above the in-file `human_size_tests` module, which clippy's `items_after_test_module` asked for. **Module map, old `server.rs` line → new file** (production; the file is 8 851 lines and the 12–74 `use` block became one per-file block): | old lines | what | new file | |---|---|---| | 1–10 | module doc | `mod.rs` (extended with the module map) | | 76–228, 235–253 | `ClientAbilities`, `Server`, `CHANGE_DEBOUNCE`, `INTERLEAVE_ABOVE`, `Pending`, `TokenAnswer` | `mod.rs` | | 230–233 | `INDEXING_TITLE` | `progress.rs` | | 255–555 | `new`, `started`, `run`, `process_batch`, `must_wait`, `index_is_complete` | `mod.rs` | | 557–969 | `request`, `answer_request` | `dispatch.rs` | | 971–1110 | `large_file_answer`, `tokens_declined`, `large_definition`, `large_references`, `large_scan` | `large_file.rs` | | 1112–1256 | `formatting`, `range_formatting`, `ranges_formatting`, `on_type_formatting`, `will_save_wait_until`, `warn_about_config`, `edits` | `formatting.rs` | | 1258–1306 | `deliver`, `show_instantiations` | `client.rs` | | 1308–1354 | `semantic_tokens_full`, `semantic_tokens_delta`, `remember_tokens` | `semantic_tokens.rs` | | 1356–1438 | `document_report`, `workspace_report`, `result_id`, `diagnostics_of` | `diagnostics.rs` | | 1440–1650 | `notification`, `handle_notification` | `notification.rs` | | 1652–1713 | `response`, `applied`, `configured` | `client.rs` | | 1715–1755 | `apply_settings`, `lint_selection` | `notification.rs` | | 1757–1811 | `request_configuration`, `register_watchers`, `send_request` | `client.rs` | | 1813–2099 | `reindex_for`, `reindex_one`, `reindex_widened`, `reindex`, `scan_until_settled`, `scan_once`, `watching`, `answer_what_is_waiting` | `index.rs` | | 2101–2164 | `begin_indexing`, `end_indexing` | `progress.rs` | | 2166–2182 | `refresh_code_lenses` | `client.rs` | | 2184–2195 | `hierarchy_index_changed` | `index.rs` | | 2197–2200 | `progress` | `progress.rs` | | 2202–2233 | `report_scope` | `client.rs` | | 2235–2326 | `set_document`, `mark_dirty`, `flush_dirty`, `announce_fast_path`, `publish`, `send_diagnostics` | `diagnostics.rs` | | 2328–2411 | `show_message`, `notify`, the timing section (`timer`, `timed`, `timing`, `say_held`), `ms`, `plural` | `client.rs` | | 2393–2395 | `offset` | `dispatch.rs` | | 2413–2584 | `MAX_REPORTS`, `reports`, `IndexWatch`, `human_size` + `human_size_tests`, `progress_on` | `progress.rs` | | 2585–2592 | `notify_on` | `client.rs` | | 2594–2765 | cancellation: `is_shutdown`, `forward`, `burst`, `cancelled_in`, `Widen`, `widen_of`, `opened_in`, `cancelled_id`, `cancelled_response` | `batch.rs` | | 2767–2830 | `Failure`, `TOO_LARGE`, `document_uri`, `decode`, `to_value` | `dispatch.rs` | | 2832–2858 | `folder_paths`, `extract`, `closing_uri` | `notification.rs` | | 2860–8851 | `mod tests` | `tests/` (next table) | Within a file the order is the original's except where the file's own reading order is better: `diagnostics.rs` reads dirty → analysis → push → pull; `client.rs` reads requests-out → answers-in → messages → timing → the connection-level free functions. **Test map, old `server.rs` line → `server/tests/`** (the section banner names are the file docs): | old lines | section | new file | |---|---|---| | 2862–3230 | `Tree`, `Session`, `progress_step`, `token_text`, `watching_progress` | `tests/mod.rs` | | 3231–3623 | a scan that answers messages while it runs | `tests/scan.rs` | | 3625–3969 | the indexing bar | `tests/progress.rs` | | 3971–4560 | cache, size cap, file log, one bar per rescan path | `tests/index.rs` | | 4561–4834 | file watchers | `tests/watchers.rs` | | 4835–4976 | `workspace/applyEdit` | `tests/apply_edit.rs` | | 4977–5244 | pull diagnostics | `tests/pull_diagnostics.rs` | | 5245–5707 | `selectionRange`, `linkedEditingRange`, `codeLens`, hierarchy view | `tests/requests.rs` | | 5708–5989 | incremental text sync | `tests/sync.rs` | | 5990–6630 | `onTypeFormatting`, `rangesFormatting`, `willSaveWaitUntil` | `tests/formatting.rs` | | 6631–6984 | semantic tokens | `tests/tokens.rs` | | 6985–7380 | `$/cancelRequest` | `tests/cancel.rs` | | 7381–7552 | file operations | `tests/file_ops.rs` | | 7553–8005 | workspace folders | `tests/folders.rs` | | 8006–8429 | pulled settings | `tests/settings.rs` | | 8430–8850 | the large-file fast path | `tests/large_file.rs` | Fifteen helpers were used by more than one section and moved to `tests/mod.rs` under "helpers more than one file uses": `SUB`, `TOP`, `change`, `buffer`, `changed`, `capping`, `pulling`, `document_pull`, `indexed`, `filelist_push`, `wide_ish`, `lens_tree`, `propagating`, `formatting_result`, `configuration_request`. The test bodies were de-indented by four spaces (they left a `mod tests { … }` block for files); rustfmt then re-joined a few dozen lines that now fit in the width, in the tests only. **Cuts that differ from the brief, and why.** The brief's list was `{mod, dispatch, lifecycle, diagnostics, workspace, client}`. What the code said: - there is no `lifecycle.rs`: `initialize` lives in `main.rs` and `shutdown`/`exit` are two lines of `process_batch`, so the file would have held only the notification dispatch — which is what it is, so it is named `notification.rs`; - `workspace` split in two by what a reader wants: `index.rs` is the rescans (the loop and its four entries), `progress.rs` is the bar and the log they run under — 600 lines together, and the second is about *saying* while the first is about *doing*. Config changes and folder events are notifications and stayed with the dispatch that handles them (`notification.rs`, with `apply_settings`); watcher registration and the settings pull are requests made of the client and went to `client.rs`; - `batch.rs` is new: the forwarder, the burst drain, the cancels and the `didOpen` widen are all "reading a burst before serving it", used by both the loop in `mod.rs` and the mid-scan drain in `index.rs`, so neither could own them; - three small files rather than one `handlers.rs`: `formatting.rs` (170), `large_file.rs` (159), `semantic_tokens.rs` (60). Each is what one feature lane touches on the server side (format-on-save, large-file mode, token deltas) and each is one sentence; a `handlers.rs` would have been three unrelated sentences joined by "and", which is the rule's definition of a file that wants splitting. **Line counts after** (non-test lines are the brief's metric; code-only excludes comment lines): | file | total | non-test | code-only | one sentence | |---|---|---|---|---| | `server/mod.rs` | 540 | 540 | 215 | the `Server`, what the client can do, the loop and its order contract | | `server/dispatch.rs` | 528 | 528 | 380 | `answer_request`, the table over request methods, and its decoders/`Failure` | | `server/client.rs` | 341 | 341 | 173 | what goes to the client other than a response | | `server/index.rs` | 325 | 325 | 172 | the rescans and what a rebuild owes every open buffer | | `server/notification.rs` | 303 | 303 | 165 | `handle_notification` and the settings applier | | `server/progress.rs` | 272 | 255 | 130 | the indexing bar and the per-file log | | `server/diagnostics.rs` | 206 | 206 | 130 | when a buffer is analyzed and how what it says reaches the client | | `server/batch.rs` | 188 | 188 | 89 | reading a burst before any of it is served | | `server/formatting.rs` | 170 | 170 | 90 | the five formatting entries and their manners | | `server/large_file.rs` | 159 | 159 | 88 | what a large buffer answers instead of the dispatch | | `server/semantic_tokens.rs` | 60 | 60 | 32 | the remembered answer a token delta is computed against | | `server/tests/*.rs` (16 files) | 5 999 | — | — | one file per feature, harness in `mod.rs` | No file over 600. Longest functions after: `answer_request` 393 (`dispatch.rs`), `handle_notification` 197 (`notification.rs`), `started` 91, `process_batch` 58 (`mod.rs`) — identical to before; `pub(super)` on a signature made rustfmt wrap six of them, nothing else moved a line. ### 2026-09-02 — `completion.rs` → `completion/` Same method. **Module map, old `completion.rs` line → new file:** | old lines | what | new file | |---|---|---| | 1–36 | module doc | `mod.rs` (extended with the module map) | | 59–67, 79–96, 111–146 | `LIMIT`, `FUZZY_MIN`, the `TIER_*` consts, `KEEP_MY_INDENTATION` | `mod.rs` | | 69–77, 98–109 | `MODULE_LIMIT`, `HEADER_WINDOWS` | `module.rs` | | 148–170, 172–175, 183–192 | `ITEM_SCOPES`, `NOT_ITEM_SCOPES`, `STATEMENT_SCOPES`, `PROCEDURAL`, `STATEMENT_END` | `site.rs` | | 177–181 | `STATEMENT_HEADS` | `word.rs` | | 194–280 | `completions` | `mod.rs` | | 282–589 | `member_answer`, `Member`, `indexed_detail`, `members_at`, `connection_members`, `connected_names`, `Members`, `last_segment` | `member.rs` | | 591–868 | `module_tier`, `module_detail`, `nearest_definition`, `shared_components`, `plan_for`, `module_header`, `header_from`, `header_end`, `skip_parens`, `skip_to_semicolon` | `module.rs` | | 870–1076 | `scope_tier`, `index_tier`, `template_tier`, `offered`, `layout_at`, `keyword_tier`, `word_tier`, `buffer_words` | `tiers.rs` | | 1078–1242 | `Items`, `completion_kind`, `declaration_detail`, `shorten` | `mod.rs` | | 1244–1272 | `visible_symbols`, `innermost_scope` | `tiers.rs` | | 1274–1325 | `in_comment_or_string`, `in_comment`, `snippet_hole` | `mod.rs` | | 1327–1555 | "where the cursor is": `Word`, `Sep`, `Spine`, `typed_word`, `separator`, `scope_head`, `dot_spine`, `split_ident`, `strip_indices`, `is_ident_char`, `line_head_is_blank` | `word.rs` | | 1557–1715 | `at_instantiation_site`, `line_indent`, `at_module_item`, `at_statement`, `enclosing_scopes`, `is_procedural`, `balanced` | `site.rs` | | 1725–1735, 1801–1892 | `SUB`, `Tree`, `asking`, `opened`, `opened_named`, `items`, `inserted`, `tier`, `skeletons`, `find`, `labels` | `harness.rs` (`#[cfg(test)]`, items `pub(super)`) | | 1736–1761 | interface kinds + `module_detail` card | `module.rs` tests (it reads `module_detail`) | | 1762–1799 | the scope-gate sweeps | `site.rs` tests | | 1893–2439 | tier 0's header slice, planning, `nearest_definition` | `module.rs` tests | | 2441–2447 | `snippet_hole` escaping | `mod.rs` tests | | 2449–2727, 2777–2859, 3163–3460 | templates, keywords, tier order/dedup, fuzzy matching | `tiers.rs` tests | | 2728–2776, 2860–2975, 2976–3162 | comments/strings, backtick, filtering/cap, the perf claims | `mod.rs` tests | | 3461–4177 | the member answer, the connection list | `member.rs` tests | **Cuts that differ from the brief, and why.** The brief's list was `{mod, members, modules, templates, keywords, symbols, fuzzy}`: - no `fuzzy.rs`: the fuzzy matcher is `candidates.rs`'s `Query`; in this module "fuzzy" is one constant (`FUZZY_MIN`, in `mod.rs`) and a two-arm `match` repeated in each tier, which is not a module; - no `templates.rs`, `keywords.rs`, `symbols.rs`: the template tier is 40 lines, the keyword tier 8, and each would have been a file whose only sentence is "one tier". `tiers.rs` holds tiers 1–5 in the order `completions` runs them, which is the sentence a reader wants; - `word.rs` and `site.rs` are new and carry what was the "where the cursor is" banner: what is *typed* (text read backwards from the cursor) and what may be *written* here (the token-stream gates) are two questions with two kinds of code, and `inline.rs`/`instantiate.rs` ask only the second. **Line counts after:** | file | total | non-test | in-file test | code-only (non-test) | one sentence | |---|---|---|---|---|---| | `completion/mod.rs` | 837 | 464 | 373 | 240 | the entry point, the response under construction, the shared helpers | | `completion/member.rs` | 1 060 | 336 | 724 | 183 | the exclusive member answer after `.`/`::`, connection lists included | | `completion/module.rs` | 913 | 335 | 578 | 146 | tier 0 and the instantiation planning two other modules share | | `completion/tiers.rs` | 941 | 272 | 669 | 183 | tiers 1–5 in the order they fill the response | | `completion/word.rs` | 246 | 246 | 0 | 136 | what is typed at the cursor | | `completion/site.rs` | 264 | 217 | 47 | 129 | what may be written here | | `completion/harness.rs` | 114 | (test) | — | — | the tests' scratch workspace and helpers | `mod.rs` is 464 non-test lines by the brief's metric (QA correction, 2026-09-02: the work log's original 822/15 split undercounted the in-file `mod tests` block — see QA log) and 240 lines of code. Splitting `Items` out to make the number smaller would put the response builder one file away from the only function that drives it; not done. Longest functions after: `completions` 81 (`mod.rs`), `member_answer` 76 (`member.rs`) — identical to before. **`perf.rs` left whole.** Its one sentence is already on its first line: "Perf measurements for the paths a keystroke and a hover run through." It is `#[cfg(test)]`, every function is one `#[ignore]`d measurement printing a number, and the 1 189 lines are twelve such measurements plus the generated inputs they share. A split "by what it measures" would be two files whose sentences differ only in the noun, sharing the same inputs across a module boundary. The brief said split only if the sentence needs an "and"; it does not. ### 2026-09-02 — proofs **Line multiset** (`scratchpad/multiset.py`: every non-blank line of the HEAD blob, stripped of indentation, `use` statements, visibility keywords, `//!` docs, `// ----` rules, `#[cfg(test)]`, `mod x {`/`impl X {` openers and lone braces, must appear at least as often in the new files): - `server.rs`: 7 227 lines → 7 218 present. **Missing: 10**, all of them the banner *title* lines under the `// ----` rules (`// requests`, `// the large-file fast path`, `// semantic tokens`, `// pull diagnostics`, `// notifications`, `// responses to what we asked`, `// outgoing`, `// watching an index rebuild`, `// cancellation`, `// decoding and failures`) — each became the file it names. Extra: 1 (the `// helpers more than one file uses` banner in `tests/mod.rs`). - `completion.rs`: 3 303 → 3 304. **Missing: 1**, the `// where the cursor is` banner title (now `word.rs` + `site.rs`). Extra: 2, the two-line comment over the `#[cfg(test)]` re-export of `module_header`. The check ran before `cargo fmt`; rustfmt's diff afterwards was the per-file `use` blocks, six `pub(super)` signatures wrapped in the production files, and re-joined lines in the de-indented tests. **Counts.** `cargo test -p lucisv_server`: 1435 passed / 34 ignored, 85 / 2, 3 / 0 — identical per binary to the baseline. `cargo test --workspace`: see the last entry below. **Gates.** `cargo fmt -p lucisv_server -- --check` clean; `cargo clippy --all-targets --workspace` 0 warnings (the one it raised during the work, `items_after_test_module` in `progress.rs`, fixed by moving `progress_on` above the test module); `cargo doc -p lucisv_server --no-deps` 8 warnings — the same 8 unresolved links in `nav.rs`, `state.rs`, `diagnostics.rs`, `lint.rs` the baseline had. Five links that broke because their target moved to a sibling file were re-pointed (`[`LIMIT`](super::LIMIT)` and the like), so none of the moved files warns. **Public item list.** `cargo doc` pages: 667 before, 682 after. Diffed by item name the two lists are identical except for 15 added `index.html` — one per new module. Diffed by full path, every moved item appears under its new module page (`server/dispatch/enum.Failure` where it was `server/enum.Failure`) and nothing appears or disappears otherwise. The only paths other files import are unchanged and listed under Handshakes. **Behaviour.** `tests/e2e.rs`: 85 passed / 2 ignored (unchanged). vsix smoke: `node editors/vscode/smoke.js target/debug/lucisv-server` → `OK — completed initialize/didOpen/shutdown/exit (20 messages)`. Release `lucisv --version` = `lucisv 0.33.0`, same as `/tmp/lucisv-0.33.0- baseline`; ten corpus files (every 86th of the sorted 860, from `common_cells/formal/counter_properties.sv` to `ibex/vendor/lowrisc_ip/ip/prim_xilinx/rtl/prim_pad_attr.sv`) through `--stdout` on both binaries: 10/10 identical in stdout, stderr and exit code. Opentitan was not touched; `git -C ~/repo/opentitan status --porcelain` shows only the three pre-existing modified files. **`pub(super)` census.** 105 markings across the two directories, 14 of them in `completion/harness.rs` (test helpers); every one was demanded by the compiler. ### 2026-09-02 — `cargo test --workspace` 48 binaries, **3 215 passed / 0 failed / 40 ignored** — the baseline's 3 215 (the 40 ignored are the 34 + 2 of this crate plus the 4 elsewhere, unchanged). Run after every edit above, on the tree as it is handed over. ## QA log ### 2026-09-02 — independent verification (Sonnet QA) All checks run in-tree at `.claude/worktrees/decomp-server`, read-only except the one correction below and the throwaway worktree used for the behavioural diff (removed after use). No `git checkout`/`reset`/`stash`/ `clean` run anywhere. **1. Gates.** - `cargo fmt -p lucisv_server -- --check`: clean (exit 0). - Forced rebuild (`touch main.rs`) + `cargo clippy --all-targets --workspace`: 0 warnings. `grep -rn '#\[allow'` over `crates/lucisv_server/src/server/` and `.../completion/`: no hits — no new `#[allow]`. - `cargo test --workspace --no-fail-fast`: 48 binaries, **3 215 passed / 0 failed / 40 ignored** — matches the pinned baseline exactly. Per-binary for `lucisv_server`: main.rs unittests 1435/34 ignored, `tests/e2e.rs` 85/2 ignored, `tests/grammar.rs` 3/0 — all three identical to the README's claim. - `cargo doc -p lucisv_server --no-deps`: 8 warnings, all in untouched files (`diagnostics.rs`, `lint.rs` ×2, `nav.rs`, `state.rs` ×3) — the same 8 the work log names, none in a moved file. - `git status --porcelain`: confined to `crates/lucisv_server/src/`, `docs/features/decomposition-server/`, and `TODO.md` (only the Lane C line — confirmed by `git diff master -- TODO.md`). - `git diff 35f0b8d -- crates/lucisv_server/src/{main,inline,instantiate, perf,hover,nav,state}.rs`: 0 lines for all seven. Confirmed. **2. Pure move — independent, from scratch (not the dev's script).** Wrote my own line-multiset checker (strip whole `use …;` blocks including multi-line import lists, `mod x;`, `//!` docs, `// ----` fence lines, lone braces, `impl X {` / `mod x {` openers, normalize leading `pub(…)`), comparing `git show 35f0b8d:…server.rs` against the concatenation of `src/server/**/*.rs`, and `completion.rs` against `src/completion/*.rs`. - `server.rs`: after excluding the 10 banner-title lines, the 6 `pub(super)`-triggered signature rewraps (`formatting`, `show_instantiations`, `document_report`, `workspace_report`, `send_request`, `timed` — matches "six … wrapped" in the work log exactly), the one re-pointed `reindex_widened` doc link, and the one extra "helpers more than one file uses" banner, a token-level re-check (ignoring all whitespace) of the remaining ~170/~100 one-sided lines found a residual of **10 stray commas vs 7 braces/semicolons** — trailing-comma additions/removals from rustfmt re-joining lines that fit once the tests were de-indented. No identifier, no logic token, differs anywhere. - `completion.rs`: 8 missing / 19 extra lines total. All accounted for: the `// where the cursor is` banner (1), two more `pub(super)`-triggered signature rewraps (`module_tier`, `innermost_scope`), three of the five re-pointed doc links (`LIMIT`, `FUZZY_MIN`, `at_instantiation_site`; the other two — `plan_for`/`module_header` and `Server::reindex_widened` — live in `//!` lines or `server.rs` respectively and are excluded/counted there), and the logged 2-line `module_header` re-export comment. Zero unaccounted lines. - **Function-signature census** (independent regex over both trees, not trusting the dev's line-range table): `server.rs` 360 `fn` names → 360 in `server/**`, exact multiset match, none added/removed/ split. `completion.rs` 188 → 188, exact match. - **15 hoisted test helpers**: `grep -rl "fn ("` over `server/tests/*.rs` for all 15 (`SUB`/`TOP` are `const`, checked separately) — every one defined in exactly one file (`tests/mod.rs`), confirming the claimed dedup. - **`pub(super)` census**: 62 (server) + 43 (completion) = **105**, exactly the dev's number; 14 of them in `completion/harness.rs`, also exact. - **Test name census**: extracted every `#[test] fn` name from the 35f0b8d blobs and diffed against the new trees. `server.rs`: 190 names, all 190 present (189 in `server/tests/*.rs` + 1, `the_unit_is_chosen_by_what_the_rounded_number_reads_as`, in `server/progress.rs`'s in-file `human_size_tests` module exactly as the module map says). `completion.rs`: 110/110, exact match, all in `completion/*.rs`. - **Test-body spot-check**: 10 helper/test bodies compared whitespace-normalized across `scan.rs`, `progress.rs`, `watchers.rs`, `apply_edit.rs`, `pull_diagnostics.rs`, `requests.rs`, `sync.rs`, `tests/mod.rs` helpers — 9/10 identical outright; the 10th (`a_pulling_client_is_never_pushed_diagnostics`) differs only in a rustfmt-collapsed `session.notify(…)` call losing its trailing comma when its two-line form joined into one after de-indentation — confirmed token-identical otherwise. Same rustfmt artifact as the aggregate multiset check above, not a content change. **3. Behaviour.** - `cargo test -p lucisv_server --test e2e`: 85 passed / 2 ignored, standalone run, matches. - `cargo build -p lucisv_server` + `node editors/vscode/smoke.js target/debug/lucisv-server`: `OK — completed initialize/didOpen/shutdown/exit (20 messages)`. - `cargo build --release -p lucisv`: `lucisv 0.33.0`. Corpus byte-identity: reconstructed the sorted-860-file list myself (`command find corpus -name '*.sv' -o … | sort`, 860 files, first entry `common_cells/formal/counter_properties.sv` matching the work log) and diffed every-86th sample's stdout/stderr/exit code between this build and `/tmp/lucisv-0.33.0-baseline`: **10/10 identical**. (My reconstructed 774th/860th files differ slightly from the two the work log names — `common_cells`/`ibex`/`opentitan`/`picorv32` sort order is locale-sensitive — but since this crate cannot affect the formatter, the exact file identities don't matter; what matters is that all 10 sampled files, whichever they are, are identical.) - **LSP session vs. 35f0b8d**, read-only: built `lucisv_server` in a throwaway worktree at 35f0b8d (created under scratch, `git worktree add`, removed after use — main tree and `decomp-semantic` worktree never touched). Drove both servers with a hand-rolled Node LSP client (`didOpen` on `opentitan/hw/ip/aes/dv/tb/tb.sv`, workspace root `hw/ip/aes` so cross-file resolution actually engages, 3 s settle time for the read-only index scan) then `textDocument/completion` at the `edn_if[0].` site, `hover` and `definition` on the `aes` instantiation's module name, and `documentSymbol`. Filtering out `window/logMessage`/`$/progress` noise (which differed only in `indexing:` vs `cached:` labels — a filesystem index-cache artifact of running two server processes against the same tree, not a code difference), the 7 substantive messages (initialize response, the 4 probe responses, `publishDiagnostics`, shutdown) are **byte-for-byte identical** between the two builds. Hover/definition resolved cross-file correctly in both (`aes.sv:9`); completion returned `null` in both (interface member completion needs `edn_if`'s typedef, outside the scoped workspace root — same in both builds, not a regression). - `git -C ~/repo/opentitan status --porcelain`: only the three pre-existing files (`hw/ip/aes/dv/tb/tb.sv`, `hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`). No new modification — confirmed both before and after the LSP session. **4. Size rule.** Independent per-file line count (own script: total lines, and a proper character-level scan for `#[cfg(test)]` item spans — attribute-line-to-`;` for a bare `mod x;`/`use` item, attribute-line-to-matching-brace otherwise) plus a from-scratch longest `fn` by brace-matching. - All 11 `server/*.rs` total line counts match the work log exactly (`mod.rs` 540, `dispatch.rs` 528, … `semantic_tokens.rs` 60); no file over 600. Longest functions confirmed identical to baseline: `answer_request` 393/394 (one extra line is the `pub(super)` keyword itself, expected), `handle_notification` 197/198 likewise, `started` 91, `process_batch` reported separately — all dispatch tables or under the 150-line threshold, matches. - `completion/{member,module,site,tiers,word}.rs` and `harness.rs`: every total/non-test/in-file-test number matches the work log exactly, and I confirmed each file's single `#[cfg(test)] mod tests` block genuinely runs to true EOF (no truncation) before trusting the match. - **Finding (MEDIUM) — `completion/mod.rs` line count row was wrong.** The work log's table (837 total / 822 non-test / 15 in-file-test / 515 code-only) undercounts the in-file test block by ~354 lines. Reproduction: `mod tests { … }` in `crates/lucisv_server/src/ completion/mod.rs` actually runs from the `#[cfg(test)]` at line 469 to the file's closing `}` at line 837 (369 lines, 14 `#[test]` functions, confirmed by `grep -c '#\[test\]'` and manual read) — not 15 lines. Both the dev's counting script and my first attempt at one hit the same bug: a naive brace-counter doesn't understand Rust string-literal contents, and the test `a_tabstop_default_is_escaped_so_the_snippet_grammar_cannot_read_it` (line ~478) contains `"a}b\\c"` and `"${4:a\\}b\\\\c}"` — literal `}` characters inside string literals — which drive a naive per-character `{`/`}` counter back to net-zero depth 15 lines into a 369-line block. Corrected numbers, computed with the true block boundary: **total 837, non-test 464, in-file-test 373, code-only 240**. This does not change the size-rule verdict (464 is still comfortably under the 600 target, no split needed) and does not affect the pure-move verification above (that check operates on raw line/token multisets across the whole file, unaffected by the test/production split). It is a documentation-accuracy issue only — fixed directly in the table and the paragraph below it per the QA small-fix allowance, since the correct number is mechanically verifiable and unambiguous. All four other completion files' single `#[cfg(test)]` block was confirmed (by checking the skip range's end line equals the file's total line count) to run cleanly to true EOF, so this bug is isolated to `mod.rs`. - One-sentence test: every file's stated sentence matches what it actually contains, spot-checked by reading each file's public items against its "one sentence" column. No "and" files. `perf.rs`'s stay-whole reason holds (verified unchanged, `#[cfg(test)]`, single topic). **5. Docs.** All required README sections present (Goal, Assumptions, Handshakes, Status/TODO, Work log, QA log, Review-reserved). Five line ranges from each module map (server: 557, 971, 1813, 2413, 2767; completion: 69, 177, 591, 1327, 1557) diffed against `git show 35f0b8d:…` — all ten match exactly. **Fix applied directly**: corrected the `completion/mod.rs` row in the line-counts table (§ "`completion.rs` → `completion/`" work log section) from `837 | 822 | 15 | 515` to `837 | 464 | 373 | 240`, and rewrote the paragraph beneath it that referenced the wrong non-test/ code-only split, per the finding above. **Verdict: PASS.** No HIGH or CRITICAL findings. One MEDIUM (documentation line-count error in the `completion/mod.rs` table row, fixed directly above) and no LOW findings beyond that. The pure-move claim is independently verified at the line-multiset, token, function- signature, `pub(super)`, test-name, and test-body level; behaviour (e2e, vsix smoke, corpus byte-identity, and a live read-only LSP session against opentitan compared byte-for-byte against a 35f0b8d baseline build) is unchanged; the opentitan tree carries no modification beyond the three pre-existing files. ## Review **2026-09-02 — lead.** Accepted; merged onto master after lanes A and B. The server split is the one that pays back fastest: 6 000 test lines out of the way of 2 500 production lines, and then eleven files where "what does this do" has a one-sentence answer — the loop, the dispatch table, what goes to the client, the rescans, the notifications, the progress bar, diagnostics, batching, and three feature lanes. The cuts that differ from the plan are argued from the code (no `lifecycle` because initialize lives in `main.rs`; `index` + `progress` instead of `workspace`; `batch` on its own), and the completion providers are grouped by what they answer rather than by the sketch's names, which was a sketch. `perf.rs` left whole with the one-sentence test passed is the rule applied honestly. Proof: counts identical, 105 `pub(super)` markings each demanded by the compiler, a from-scratch signature and multiset census by QA, a live LSP session against opentitan producing byte-identical responses from this build and the base. QA's MEDIUM (a brace-counter fooled by a `}` inside a string literal — a good catch, and the kind of thing that argues for counting with a parser) fixed in the README by QA.