# TODO — best practices adopted from ruff and Verible Curated backlog for lucisv, drawn from `astral-sh/ruff` (architecture, CLI/UX, fix model) and `chipsalliance/verible` (formatter safety, alignment, waivers, and especially test methodology). Items reference the current draft's files. Roughly ordered by priority within each section. Legend: **[V]** = practice from Verible, **[R]** = from ruff, **[V+R]** = both. --- ## 1. Correctness safety net (highest priority) - [x] **[V] Token-stream equivalence verification.** Verible's formatter re-lexes its output and asserts it is lexically equivalent to the input (`verilog_equivalence.cc`); on mismatch it emits the *original* text. Add `verify_equivalence(input, output)` to `vlog_formatter`: re-lex both through `vlog_parser::lexer`, compare token kinds + text (whitespace excluded, comments included). Run it inside `format_source()` on every call — not just in tests. This turns "the formatter can never corrupt code" from a test-suite property into a runtime guarantee. - [x] **[V] Convergence (idempotency) verification at runtime.** Verible formats twice and checks a fixed point before writing. Do the same in `format_source()` (optionally behind `--no-verify` for speed later). Today idempotency is only asserted in `tests/fixtures.rs`. - [x] **[V] Failsafe fallback semantics.** On any internal verification failure, return the input unchanged *with a diagnostic and nonzero exit*, never partially formatted output. Parse errors already behave this way (README notes it); extend the same contract to the two checks above. - [x] **[R] Panic containment.** ruff catches panics per-file and reports them as errors instead of killing the whole run. Wrap per-file work in `crates/lucisv/src/main.rs` with `std::panic::catch_unwind`. - [x] **`@(* )` fails to lex** (bug-fix QA find): `(*` followed by anything but `)` is unconditionally lexed as an attribute (`lexer.rs`), so a bare space inside `@( * )`-style spellings errors out. Make the attribute scan back off when the contents are just `*`. → `docs/features/lexer-cleanup/README.md`, with the BOM and non-ASCII message fixes and the `lucisv check` lex-error silence fix. - [x] **Recursion-depth limit in the parser.** Found by cli-polish QA: ~150 levels of expression nesting overflow the stack and abort the whole process — uncatchable by `catch_unwind`, so mid-batch files after the crash never get processed. Add an explicit depth counter in `vlog_parser::parser` that returns a parse error past a documented limit (ruff does the same). Do the same in the formatter's recursive walk. - [ ] **Atomic in-place writes.** QA find during cli-filelist (2026-08-25, pre-existing): `process_file` and the `--fix` path write with plain `fs::write` (open/truncate/write) while `cache.rs` next door already does tempfile+rename. Two workers reaching one inode through two spellings (symlink alias — lexical dedup cannot see it) could tear a file. Fix: tempfile+rename in both writers; optionally canonicalized dedup keys as a second line of defense. ## 2. Formatter features - [x] **[V] Format-off fences.** Support `// verilog_format: off` / `// verilog_format: on` (accept a `lucisv: off/on` alias). Verible implements this as "emit the original byte range verbatim" — the trivia in `Meta` already carries comments, so detect fences during formatting in `format.rs` and splice source text by span. Requires nodes to carry byte spans (see §5, it's needed for LSP anyway). → `crates/vlog_formatter/src/fence.rs`; grammar, item-level semantics and join rules in `docs/features/format-fences/README.md`. Item scopes only — statement-level fences are documented as not implemented. - [x] **[V] Range formatting: `--lines M-N[,M-N...]`.** Format only constructs intersecting the given line ranges; emit everything else verbatim. This is what makes adoption in dirty legacy codebases possible (Verible ships `git-verible-verilog-format.sh` on top of it). Follow-up: a `lucisv --diff-base ` or contrib script that derives ranges from `git diff`. → `crates/vlog_formatter/src/range.rs` (`format_range`, `LineRanges`), the CLI's `--lines`, the server's `documentRangeFormattingProvider`, and `tools/lucisv-changed.sh` for the `git diff` half of the follow-up (a `--diff-base` flag inside lucisv is still open). The unit is one item; modules and packages are descended into so a three-line edit does not reflow a two-thousand-line body; statements and generate regions are deliberately atomic. Fences outrank ranges, the cache is bypassed, and the runtime safety net runs over the whole output — the convergence half by replaying the per-item decisions, since line numbers move when text does. 578 corpus files × 8236 range trials: 0 refusals, and whole-file output is byte-identical to before. Semantics, interaction rules and the honest limits in `docs/features/range-formatting/README.md`. - [x] **[V] Alignment inference for declaration/port/connection groups.** Verible's most-loved feature: infer align-vs-flush-left intent from the original spacing (≥4 excess spaces = author wants alignment), and break alignment groups at blank lines and standalone comments (`--alignment_group_boundary`). Start with the three constructs where RTL culture demands it: port declarations, named connections (`.clk (clk)`), and localparam/parameter lists. This needs original-spacing info preserved through the lexer — record "excess spaces before token" as trivia. → `crates/vlog_formatter/src/align.rs`; all three constructs ship (ports align the name column, connections the `(`, parameters the name and `=` columns). No lexer trivia was needed after all: `name_span` plus the source text the formatter already holds gives both the preceding gap and the token's column, so the spans suite is untouched. Zero churn on the 397-case table; 291 of 578 formattable corpus files now format differently, with 0 verification errors and 0 round-trip failures over 2312 config-sweep runs. Rule, fixed-point argument and the parked columns (`#( ... )` parameter ports, the type column, the trailing-comment column) in `docs/features/alignment/README.md`. - [x] **Comment inside port/param lists and assignment patterns is dropped → refused** (found at scale by format-fences QA: 112 of 1868 corpus injection trials refuse with exit 2). The failsafe holds, but this is the largest remaining comment-attachment gap; fix alongside the three documented expression refusals (replication, compact bracket, assign-value) from docs/features/formatter-bug-fixes and corpus-bugs. → `Meta::before_sep` keeps a comment on its element's side of the separator, at every list kind; replication, gate arguments, header imports, event lists, a connection's own parens and the enum dangling bucket all gained comment slots too. Injection-harness refusal rate 2.3% → 0.4%. Still refused (documented, not hacked around): `[a : b]`-style bracket interiors and a comment before a *procedural* statement's `;` — see `docs/features/comments-round/README.md`. → Round 2 closed the two shapes a plain line-insertion sweep still hit (14 of 989 trials): a comment before a module/instantiation head's `#(` or `(` (four new `Vec` fields), and a comment written next to an `(* attribute *)`, which `Fmt::leading` now interleaves by span instead of printing all comments then all attributes. Sweep 14 → 0; the exhaustive per-line sweep's survivors are the shapes parked above plus a comment before `else` — see `docs/features/comments-round-2/README.md`. → QA round-1 follow-up closed three more shapes with no node of their own: between `bind` and its target (and before the bound module name), before a call's `(` / inside an empty `()`, and on either side of a postfix `with`. Still parked: a comment before a procedural statement's `;`, and one inside a `bind`'s `: instance, list`. - [x] **Two leading comments separated by one blank line come out separated by two** (format-fences QA find, pre-existing): `leading` pushes a HardLine after each comment and a BlankLine before the next. Fix churns snapshots; take it with the comments round above. → `Fmt::leading_comments` emits the break *before* each comment instead of after; 6 corpus files became fixed points, zero test churn. - [x] **[R] `--diff` mode.** Like `ruff format --diff` / Verible's autofix `patch` mode: print a unified diff instead of rewriting, for CI logs and code review. - [x] **[R] `--stdin-filename `.** Editors pipe buffer contents via stdin; the filename is needed for good error messages and (later) per-directory config resolution. ## 3. CLI / UX (mostly ruff) - [x] **[R] Config file discovery.** Search upward from each input file for `lucisv.toml` / `.lucisv.toml` (analog of `ruff.toml` / `pyproject.toml`). Keys: `line-length`, `indent`, `exclude` globs. CLI flags override file config. Keep Verible's philosophy of *few* knobs — don't grow a clang-format-sized option surface. → `crates/lucisv_core/src/config.rs` (lifted from crates/lucisv by lucisv-core-lift); discovery rule, TOML subset and precedence in `docs/features/config-discovery/README.md`. - [x] **[R] Parallel file processing.** ruff's speed story is embarrassing parallelism over files. `main.rs` formats serially; use `rayon` par_iter over the collected file list (formatting is already pure). → `crates/lucisv/src/main.rs`; pool sizing (`vlog_parser::PARSE_STACK_SIZE` worker stacks, per the recursion-limit handshake), the reworked panic hook and the ordered-reporting determinism argument in `docs/features/parallel-files/README.md`. `--threads N` pins the worker count; output is byte-identical at any count. 3.6× on 10 cores. - [x] **[R] Content-hash cache.** Skip files whose (content hash, config hash, lucisv version) triple is unchanged, stored in `.lucisv_cache/`. Do this *after* parallelism; it matters for big monorepo RTL trees. → `crates/lucisv_core/src/cache.rs` (`--no-cache`, `--cache-dir`); the key stores the resolved `line-length`/`indent` *values*, and only the "already formatted" verdict is ever cached — a would-reformat or an error is re-checked every run, so `--check`/`--diff` cannot go stale. Hand-rolled FNV-1a and a hand-rolled tab-separated store (no new dependency); corrupt or another version's entries are ignored, never fatal. Warm `--check` over the pre-formatted corpus: 7.7× on one thread, 2.3× at the default thread count. Collision posture, the semantics table and the cwd-relative-default limitation in `docs/features/format-cache/README.md`. - [x] **[R] Respect `.gitignore`** and add `--exclude` globs when walking directories (`collect_files` in `main.rs` currently walks everything, including e.g. generated netlists). → `--exclude` shipped with cli-polish; `.gitignore` is hand-rolled in `crates/lucisv_core/src/walk.rs` (anchoring, directory-only, `!` negation, nested files override) with a `--no-gitignore` escape hatch. The supported subset and everything git does that this does not are listed in `docs/features/parallel-files/README.md`. - [x] **[V+R] Exit-code contract doc.** Already ruff-like (0 clean / 1 would-reformat / 2 error) — document it in README and freeze it; CI scripts will depend on it. ## 4. Linter (`lucisv check`) — new crate `vlog_linter` Design it ruff-style from day one (shared parse, fix model), with Verible's rule ergonomics (waivers, configurable rules). - [x] **[R] One parse, two tools.** `lucisv check` and `lucisv format` must share `vlog_parser` output in a single invocation (`lucisv check --fix --format` style workflows come free later). ~~*Not done:* `lucisv check` re-parses today (tolerantly, which the formatter does not), and nothing in `vlog_linter`'s API prevents sharing a tree later — only `LintContext` would change.~~ → Delivered on the linter side (`docs/features/one-parse/README.md`): `LintContext::from_parse` accepts pre-built products, `ParsedSource` is the owned bundle, `lucisv check` parses once per file (one lex instead of two — corpus check 266 → 208 ms single-threaded), and `lucisv_server` lints from the `Document` it already analyzed (didChange→publish 18 → 11 ms on picorv32.v). Byte-identical output proven against a HEAD-worktree binary. The formatter half stands unchanged by design: `lucisv format` needs the *strict* parse its safety net is defined over, so a combined `check --fix --format` workflow remains a future feature — but nothing in the API blocks it anymore. - [x] **[V+R] Rule trait + registry.** Each rule: stable kebab-case name, one-line summary, longer doc with style-guide rationale (Verible links each rule to a style-guide section — do the same), and a `check(node/token) -> Vec` over syntax tree or token stream. → `crates/vlog_linter`: `Rule` (name/summary/doc/check over a `LintContext` carrying tokens, the tolerant AST, the source and a `LineIndex`), `all_rules`/`default_rules`/`rule_by_name`/`select_rules`. Rules, waiver grammar and the corpus baseline in `docs/features/linter-core/README.md`. - [x] **[V] Diagnostic format `FILE:LINE:COL: message [rule-name]`** plus **[R]** `--output-format json` for tooling from the start. → `lucisv check`; text sorted by file then position, JSON one array on stdout (hand-rolled, no new dependency) with location, end_location, range and fix. - [x] **[R] Fix applicability model.** ruff distinguishes *safe* vs *unsafe* fixes (`--fix` vs `--unsafe-fixes`). Adopt it now — retrofitting safety classification is painful. → `Fix { edits, applicability: Safe | Unsafe }` and `--fix` / `--unsafe-fixes`. Only `no-tabs` and `no-trailing-whitespace` ship fixes (both Safe); the unsafe path is plumbed and tested but no rule uses it yet. - [ ] **[V] Waiver mechanisms:** inline `// lucisv: waive rule-name` (accept `verilog_lint: waive` for migration), `waive-start`/`waive-stop` ranges, and external waiver files (`waive --rule=X --line=N --location=glob`) for code you can't touch. ruff's lesson: also warn about *unused* waivers. - [x] inline `waive`, `waive-start`/`waive-stop`, both spellings, and the `unused-waiver` pseudo-rule (unused, unknown rule, malformed, unmatched `waive-stop`). A `verilog_lint:` waiver naming a rule lucisv lacks is ignored rather than reported, so Verible-annotated code lints unedited. - [ ] external waiver files — needs a file format, a discovery rule and a precedence story against inline waivers. - [x] **[V] Configurable naming rules via regex** (module/instance/ parameter/enum naming), with named presets like Verible's (snake_case, ALL_CAPS, etc.). → Named presets ship, **without a regex dependency**: `parameter-name-style`, `enum-name-style`, `struct-union-name-style` (Verible-default-on, Verible's own names and patterns) and `module-name-style` (default-off — Verible has no such rule to inherit a default from). Presets are character-class predicates in `crates/vlog_linter/src/naming.rs`; the justification, the parked rules and the corpus baseline are in `docs/features/lint-rules-2/README.md`. *Not* done: making the style **configurable per rule** — that needs the `lint` key in `lucisv.toml`, still open below. - [x] **[V] `--generate_markdown`-style self-documentation** — generate the rule reference from the registry so docs can't drift. ruff does the same for its 900+ rules. → `vlog_linter::rules_markdown() -> String` renders the whole registry (name, default on/off, fix applicability, summary, doc), with a golden shape test and an "every registered rule appears" test. Renderable today via `cargo run -p vlog_linter --example rules_markdown`; a `lucisv check --rules-doc` flag is filed as a handshake for `crates/lucisv`. - [ ] Seed rules (all syntactic, all from Verible's default set): no-tabs, no-trailing-spaces, explicit-parameter-storage-type, case-missing-default, always-ff-non-blocking / always-comb-blocking, forbid `wire`-reg mixups in SV files, module-filename match. - [x] `no-tabs`, `no-trailing-whitespace`, `explicit-parameter-storage-type`, `case-missing-default`, `always-ff-non-blocking`, `always-comb-blocking`, `module-filename` — corpus baseline per rule in `docs/features/linter-core/README.md`. - [x] `wire`/`reg` mixups in SV files — `wire-reg-mixup`, default on. The SystemVerilog-ness decision is the **file extension** (`.sv`/`.svh`), so a stdin buffer without `--stdin-filename` is silent. It flags the `reg` keyword only; `wire` is legitimate SystemVerilog and is not flagged. Note for the record: unlike the other seed rules this one is **not** from Verible's default set — Verible has no wire/reg rule at all; the rationale is IEEE 1800 (`logic` and `reg` are one type) and the lowRISC style guide. See `docs/features/lint-rules-2/README.md`. ## 5. Testing — adapt Verible's methodology Verible's formatter confidence comes from a few complementary layers (`formatter_test.cc`, component tests, equivalence/convergence checks). Adapt each: - [x] **[V] Massive text-in/text-out table tests.** Verible's `formatter_test.cc` is thousands of small `{input, expected}` pairs — the backbone of the formatter. `small_cases` in `crates/vlog_formatter/tests/fixtures.rs` is the seed; grow it into a dedicated `tests/cases/` organized by construct (one file per area: ports, expressions, case-statements, generate, comments, macros...). Port cases directly from `formatter_test.cc` where our supported-syntax overlaps — it encodes years of accumulated edge cases (translate expected output to our style: 2-space indent matches, wrap style differs). - [ ] **[V] Run equivalence + convergence on *every* test case**, not just snapshots — once §1's `verify_equivalence` exists, assert it in the fixture harness too, so every new case buys three checks for free. - [ ] **[V] Component-level tests.** Verible tests the pipeline stages separately (`token-annotator_test.cc`, `tree-unwrapper_test.cc`). Ours: unit tests for `lexer.rs` trivia attachment (comment → leading/trailing decisions, blank-line counting), `parser.rs` per-construct parse tests, and `printer.rs` group-breaking behavior on synthetic docs. - [x] **[V] Lint test harness with inline violation markers.** Port the `LintTestCase` / `RunLintTestCases` idea: test cases embed expected findings positionally in the source (Verible splices `ExpectedTokenInfo` fragments inline). A Rust adaptation: annotate with a marker comment or a `^^^` caret line, e.g. `assert_lint::("module m;\n\twire x;\n ^ no-tabs\nendmodule")`. Exact-match: unexpected findings fail the test too. → File-driven: `crates/vlog_linter/tests/cases/*.lint` (76 cases, all 13 rules with violating/clean/waived/unused-waiver coverage) run by `tests/lint_cases.rs` — `//^ ` markers carry the exact `line:col` the CLI prints, matched exactly in both directions, with stale-marker detection (a marker naming a dead rule fails the suite) and 12 self-policing tests pinning the failure reports. Format spec and migration stats in `docs/features/lint-harness/README.md`. - [x] **[V] `RunApplyFixCases` equivalent:** every autofix rule gets `(input, fixed_output)` pairs, and the fixed output must itself be lint-clean and formatter-idempotent. → A `----` section in a `.lint` case: the CLI's fix→re-lint loop must land exactly on the expected text, leave nothing Safe-fixable, and the fixed output must be accepted and converged by `vlog_formatter::format_source` (inputs the formatter refuses must say `#tolerant`, enforced in both directions like `#SKIP`; that population is empty today — all 5 fix cases for the 2 fixable rules run the full cross-tool check). - [ ] **[V] Error-case tests.** Table of inputs that must *fail* to parse with the expected error position — locks in the failsafe path. - [x] **[R] Real-world corpus check (ruff's "ecosystem check").** ruff CI runs against big OSS codebases and diffs results between commits. Do the same with permissively-licensed RTL: e.g. lowRISC Ibex, OpenTitan, PULP cores, picorv32. Script: clone pinned revs, run lucisv over every `.sv/.v`, report parse-success rate + equivalence/convergence failures; fail CI on regression. Also the honest tracker for the "not yet supported" list in README. → `tools/corpus_fetch.sh` + `tools/corpus_check.sh`, baseline and findings in `docs/features/corpus-check/README.md`. CI wiring is the one part left open (network access is a separate decision). → Latest movement: classes/constraints (`docs/features/classes/README.md`) took the corpus from 476/820 formattable (58.0%) to **578/820 (70.5%)** — 102 files gained, 0 lost, 0 verification errors, 0 crashes, checked by diffing the two TSVs by path. 72 of the 142 `extends`-blocked files now format; the other 70 advanced to a second blocker, and the new top blocker is dynamic arrays and queues (README roadmap item 4, 41 files). → Dynamic types (`docs/features/dynamic-types/README.md`) then took it from 578/820 to **636/820 (77.6%)** — 58 files gained, 0 lost, 0 verification errors, 0 crashes, all 636 round-tripped individually. Queues/dynamic arrays, named call arguments and `case ... inside` are done; the new top blocker is `interface` declarations (25 files, README roadmap item 8), then `` `else`` inside an element (13, the documented directives-in-lists non-goal) and `` `uvm_field_int `` (11, the documented macro-items lexer gap). → item-misc (`docs/features/item-misc/README.md`) then took it from 636/820 to **661/820 (80.6%)** — 25 files gained, 0 lost, passing set verified as a strict superset. The `` `uvm_field_int `` gap is closed (in the parser, at item position only — the lexer glue stays parked for the reason `docs/features/lexer-cleanup/README.md` gives), along with a bare macro item followed by a declaration on the next line, `` `error``/`` `warning`` directives and elaboration system tasks (`$error`/`$fatal`/`$warning`/`$info`) at item position. `interface` (31 files) and `bind` (28) are now the top two blockers. → bind (`docs/features/bind/README.md`) then took it from 671/820 (81.8%, the baseline after round 21) to **699/820 (85.2%)** — all 28 `bind` files gained, 0 lost, passing set verified as a strict superset. `interface` (31 files) is now the top blocker. → interfaces (`docs/features/interfaces/README.md`) then took it from 712/820 (86.8%, the baseline after round 21) to **740/820 (90.2%)** — 28 of the 31 `interface` files gained, 0 lost, passing set verified as a strict superset and all 28 round-tripped individually. `interface`/`modport`/`clocking` and `virtual` interface types in every type position are done; the 3 files left advanced to blockers in the `expressions` and `other` buckets. `dv-statements` (26 files) is now the top blocker. → expressions-2 (`docs/features/expressions-2/README.md`) then took it from 751/820 (91.6%, the baseline after round 21) to **772/820 (94.1%)** — 20 of the 21 `expressions` files plus the `dv_utils_pkg.sv` `other` file gained, 0 lost, passing set verified as a strict superset. Casts over any constant primary, streaming concatenations, `->`/`<->` implication, drive strengths on continuous assigns, attributes on named port connections, the `'{N{0}}` pattern replication, `inside` a macro and `const ref` arguments are done; the one file left (`compare_helper.sv`) advanced to a macro-items blocker (`` `MACRO expr`` in expression position). `dv-statements` (26 files) is still the top blocker. → dv-statements (`docs/features/dv-statements/README.md`) then took it from 772/820 (94.1%, the baseline on the same tree) to **796/820 (97.1%)** — 24 of the 26 `dv-statements` files gained, 0 lost, passing set verified as a strict superset. `randomize() with { ... }`, array-method `with (expr)`, package-scoped and hierarchical `foreach`, `randcase`, `wait fork`, block-level `import`, `let`, omitted call arguments, statement labels and a stray `;` after a task/function footer are done, along with a comment written before `else` (which had been crossing the keyword and failing verification). The 2 files left advanced to blockers other clusters own: `dv_base_vseq.sv` to macro-items (a bare macro followed by `@` on the next line), `riscv_instr.sv` to the `new obj` shallow-copy expression. `directive-split` (14 files) is now the top blocker. → mop-up-2 (`docs/features/mop-up-2/README.md`) then took it from 796/820 (97.1%, the baseline on the same tree) to **800/820 (97.6%)** — 4 files gained, 0 lost, passing set verified as a strict superset. A macro statement that ends its line followed by a symbol on the next one, the `new obj` shallow copy (IEEE 1800 §8.12), and a based number whose digits are a macro (`` 32'h`DM_ADDR ``) are done; the `lex-macro-number` bucket is gone. `compare_helper.sv` stays failing and is not fixable: `` `X_EACH_CSR 1 `` needs the macro's body, which lives in a file lucisv deliberately does not read. `directive-split` (14 files) is still the top blocker, and every remaining failure is in a deliberately-unsupported category. - [ ] **[R] Fuzzing.** ruff fuzzes its parser. `cargo-fuzz` targets: (a) parser must never panic on arbitrary bytes, (b) for inputs that parse, format must satisfy equivalence + convergence. - [ ] **[R] Consider `insta`** for the snapshot harness (review workflow `cargo insta review` beats `UPDATE_SNAPSHOTS=1`), keeping the idempotency loop from `fixtures.rs`. ## 6. LSP: full editor support (a first-class goal, not a maybe) Goal (owner's requirement, 2026-08-19): lucisv becomes a language server for VS Code and Vim/Neovim with feature parity, for Verilog/ SystemVerilog, with what the Python VS Code stack (ruff + Pylance) offers over LSP — scoped to **synthesizable Verilog first**: - semantic syntax highlighting (`semanticTokens`) - formatting (document + range) and lint diagnostics as you type - go-to-definition and find-all-references - hover: declaration/type info, and **`` `define`` expansion on hover** (hover a macro usage → see its value/body) - document + workspace symbols; later: completion, rename, signature help for module instantiation - **cross-file resolution through header imports**: `import pkg::*;` / `import pkg::name;` at the top of a file or in a module header must resolve into the package's file anywhere in the workspace (workspace index of modules/packages; `` `include`` paths resolved too) One server binary serves both editors (VS Code via a thin extension, Vim/Neovim via built-in LSP config); no editor-specific logic below the protocol layer. Foundation decisions that are cheap now and expensive later: - [x] **Byte spans on every token and AST node.** Prerequisite for everything in this section (and for §2 fences/range formatting). `token.rs` / `ast.rs` should carry `TextRange { start, end }` offsets; add a line-index utility (ruff's `ruff_source_file`) for offset↔line:col. → `docs/features/spans/README.md`. `vlog_parser::span::TextRange` on every token, comment and node; `vlog_parser::line_index::LineIndex` for offset↔line:col; token-level losslessness is a test (`crates/vlog_parser/tests/spans.rs`). - [x] **Error-tolerant parsing mode.** A formatter may refuse broken input; an LSP cannot — code is mid-edit most of the time. Add recovery in `parser.rs`: on statement-level error, record a diagnostic, skip to a sync token (`;`, `end`, `endmodule`), continue. Formatter keeps requiring zero errors; the LSP consumes the partial tree. → `vlog_parser::parse_source_tolerant(src) -> (SourceFile, Vec)`; unparsable ranges become `ItemKind::Error` / `StmtKind::Error` leaves. Sync tokens, the four guarantees and the deliberate gaps (no tolerant *lexer*, no recovery inside headers or lists) in `docs/features/error-recovery/README.md`. `parse_source` unchanged. - [ ] **Keep the CST lossless.** Current design (trivia in `Meta`) is format-oriented; verify every source byte is reachable from the tree (tokens + trivia + spans). A `reconstruct(tree) == input` round-trip test makes losslessness a tested invariant — this is what makes the same tree serve formatter, linter, and highlighter. If gaps appear, consider a rowan-style green tree (rust-analyzer / ruff direction) rather than patching `Meta`. - [x] **New crate `vlog_semantic`** (analog of `ruff_python_semantic`): symbol tables per scope (module/package/function/block/generate), binding → references. Serves go-to-definition/hover first, then semantic lint rules (unused-signal, undriven-net) which are the lint rules people actually want and Verible *can't* do (it's syntax-only — this is the differentiation opportunity). → `vlog_semantic::analyze(&SourceFile, src) -> Semantics`, never failing, with `symbol_at` / `definition_of` / `references_of` / `document_symbols`. Two-pass bind-then-resolve (so forward references work), imports of in-file packages resolved and all others kept as `Resolution::ExternalCandidate` for the workspace index below. Rules, simplifications and the corpus baseline (79.5% of uses resolved in-file on cleanly-parsed corpus files, 19.6% external, 0.9% unresolved) in `docs/features/vlog-semantic/README.md`. → The crate's biggest named gap — "no name declared inside a class body is indexed, hovered or navigable" (the classes round's handshake) — has since closed: `docs/features/class-semantics/README.md` binds classes (`SymbolKind::Class`, `ScopeKind::Class`, members, `extends`, `this`/`super`, out-of-body methods, the honest `Resolution::InheritedCandidate` for what only a base class could supply), indexes classes and their members in the workspace layer, and grows the corpus tables by +4 232 symbols / +16 631 references (clean files: 74.0 % in-file, 17.9 % external, 7.1 % inherited, 1.0 % unresolved, 0 unplaced). - [x] **`` `define`` table for hover expansion.** Record every `` `define`` (name, params, body text, source span) during lexing instead of treating it as fully opaque — no expansion during formatting (that non-goal stands), but the table feeds hover (`` `WIDTH`` → "defined as 8 in defs.svh:12") and later single-step macro expansion display. Cheap to collect now that directives carry `RawText`. → `vlog_parser::defines::collect_defines(&tokens) -> DefineTable`, a post-lex pass with zero lexer changes. `Define { kind, name, params, body, span, name_span }`; every definition of a name is kept (`all`/`latest`) and `` `undef`` is recorded as an event. Body normalization (backslash-newline removed, nothing else touched) and the gaps — no `` `ifdef`` evaluation, no cross-file `` `include`` — in `docs/features/define-table/README.md`. Hover itself waits on `lucisv_server`; this is only the table. - [x] **Workspace index for cross-file navigation.** Map module/package/ typedef names → (file, span) across all workspace files, so header imports (`import pkg::*;`) and instantiations resolve to definitions in other files. Start as a full-scan-on-startup index (Verilog codebases are small); ~~incrementality comes with salsa later~~ — one file at a time since 2026-08-27, without salsa (`docs/features/incremental-index/README.md`); and ~~re-scanned from zero on every startup~~ — what a scan learns persists since 2026-08-27, so a reopened workspace indexes from records rather than parses and an interrupted scan resumes (`docs/features/index-persistence/README.md`). → `vlog_semantic::WorkspaceIndex::build(files) `+ `resolve_external(&Semantics, &WorkspaceIndex) -> ExternalResolutions`, a two-layer design: the index is a full scan (860 corpus files in 0.7 s), the answers arrive as an overlay keyed by `ReferenceId` and `Semantics` is never mutated. Package/module members and per-file `` `define`` tables are indexed too, so `import p::*`, `p::x` and `.port(...)` all reach into the other file. On cleanly-parsed corpus files the workspace answers **87 % of the external candidates**, taking the unresolved- external rate from 19.6 % to 2.6 % of all references. Duplicate-name policy, `` `define`` lookup (no include graph → no resolution order) and the honest gaps in `docs/features/workspace-index/README.md`. → The index's biggest named gap has since closed: accepting `` `ifdef`` inside a port/parameter/enum list (README roadmap item 6, `docs/features/directives-in-lists/README.md`) means `picorv32`, `picorv32_axi` and `picorv32_wb` index at all — 521 → 530 modules, 8044 → 9174 exported members, external candidates answered 87.0 % → 93.6 % on cleanly-parsed files (unresolved-external rate 2.6 % → 1.3 % of all references). The instantiation half followed in `docs/features/directives-in-instances/README.md` (directives in an instantiation's `#( ... )` overrides and an instance's `( ... )` connections); after it **no corpus file is blocked on a compiler directive at all**, so nothing is left unindexed for this reason. The *index* counts above did not move (530 modules, 9174 exported members, 502 defines — the six files it unblocked have headers that already parsed, so their modules were already indexed); what moved is 6 more files that now format, and with them external candidates answered 93.6 % → **94.0 %** on cleanly-parsed files (unresolved-external rate 1.3 % → **1.2 %**). - [x] **New crate `lucisv_server`** (analog of `ruff_server`): LSP over stdio via `tower-lsp` or `lsp-server`. Order of capabilities: 1. `textDocument/formatting` + `rangeFormatting` (reuses §2 `--lines`), 2. publish parse/lint diagnostics, 3. `semanticTokens` for highlighting (needs only the lexer + spans), 4. `hover` (decl info + define table) / `definition` / `references` (needs `vlog_semantic` + workspace index), 5. document/workspace symbols; then completion, rename, signature help for instantiations. → `crates/lucisv_server`, binary `lucisv-server`, on `lsp-server` + `lsp-types` (synchronous, no async runtime). **Shipped:** `textDocument/formatting`, `textDocument/rangeFormatting` (round 18, on §2's `--lines`), parse diagnostics on didOpen/didChange/didSave, `semanticTokens/full`, `hover` (in-file and workspace `` `define`` expansion, declaration snippets), `definition` (both resolution layers, all locations when ambiguous), `references` (in-file), `documentSymbol` and `workspace/symbol`. **Not shipped, deliberately:** ~~`rangeFormatting` (waits on §2 `--lines`)~~ **delivered**, lint diagnostics (waits on `vlog_linter`) **delivered**, cross-file references, completion/rename/signature help. Byte↔UTF-16 position conversion, the state/staleness model and the dependency audit are in `docs/features/lucisv-server/README.md`. - [x] **Editor packaging.** A minimal VS Code extension (launch the server, register file types) and a documented Vim/Neovim `lspconfig` snippet. No editor-specific features beyond launching. → `editors/vscode/` (41-line plain-JS `extension.js` on the official `vscode-languageclient`, pinned `9.0.1`; one setting, `lucisv.serverPath`; `.v`/`.vh`→`verilog`, `.sv`/`.svh`→`systemverilog`; no grammar — semantic tokens come from the server; no commands, no status bar) and `editors/nvim/README.md` (`vim.lsp.config` for Neovim 0.11+, plus `nvim-lspconfig`, Vim 9 `vim-lsp` and coc.nvim). `editors/vscode/smoke.js` is the pre-publish check: zero-dependency node, spawns the server with the extension's exact contract and drives `initialize`/`didOpen`/`shutdown`/ `exit` over hand-rolled framing. Manual install steps only — CI packaging and Marketplace publishing are out of scope, and `publisher` is a placeholder. `docs/features/editor-packaging/README.md`. - [ ] **Salsa-style incrementality — defer.** ruff's `ruff_db` uses salsa; don't take that dependency until hover/definition across files exists. Per-file recompute is fine at Verilog file sizes. **Partly answered without salsa, 2026-08-27** (`docs/features/incremental-index/README.md`): `WorkspaceIndex::update_file` replaces one file's contribution and provably gives the index a whole build would have, so a save costs 33 ms instead of 1.5 s over the corpus. No query graph and no dependency tracking — the salsa question is still open, and is still deferred. **A second piece answered without salsa, 2026-08-27** (`docs/features/index-persistence/README.md`): every file's `FileFacts` are written to a content-keyed store as a scan parses them, so the recompute a *new session* would otherwise repeat is skipped instead — 1.8x on a whole corpus rescan, and a scan interrupted halfway resumes where it stopped. **A third piece answered without salsa, 2026-08-28** (`docs/features/change-debounce/README.md`): the per-keystroke recompute a query graph would have made unnecessary is instead *not started* — a burst of `didChange`s is coalesced into one reanalysis. Still no query graph and no dependency tracking; the salsa question remains open and deferred. Measured costs for what a recompute actually is are now recorded in `docs/perf/README.md`. **Round 2, 2026-08-28** (`docs/features/interactive-latency/README.md`): that recompute is now broken down stage by stage, and 79 % of it is lexing and parsing. If the salsa question is ever reopened, that is the number it has to beat — incremental *lexing and parsing*, not incremental queries over a whole-file parse, and it lands squarely on `CLAUDE.md`'s hard invariants 1 and 2. **A fourth piece answered without salsa, 2026-08-28** (`docs/features/hover-line-index/README.md`): a derived fact a query used to recompute — the *line* a declaration is written on, which cost a whole file read and a whole `LineIndex` per request — is now computed once when the file is indexed and stored beside the span (`Def::lines`, `FACTS_FORMAT` 3 → 4), and the one thing still needing that file's text is served from a small bounded cache of closed files. A repeat hover into a 12 MB closed file goes 5.75 ms → 0.95 µs; a whole scan is unchanged and the store grows 2.9 %. Still no query graph: what is cached is a value, invalidated at four named points, not a node in a dependency graph. **The larger number the same round measured is not an incrementality problem at all**: the first request of a session waits out the startup scan (780 ms cold, 287 ms warm), because `Server::new` scans before the message loop starts. Filed there, not fixed. → **Fixed 2026-08-28** (`docs/features/scan-interleave/README.md`): the scan is now per-file steps with the message queue drained between them, so a startup scan of more than 64 files answers requests while it runs — 780 ms → **15.5 ms** cold, 287 ms → **12.8 ms** warm, with the scan's own total moving under a percent (860-file corpus: 351 → 353 ms cold, 187 → 189 ms warm). The merge cost was measured first and ruled per-file feeding out: a merge is a pass over the whole index, so one per file would have cost 631 ms of merging on 200 files against 464 ms of parsing. Records are staged per file and folded in with one `WorkspaceIndex::absorb` per *drain*, and a drain only happens when a message is waiting — so a scan nobody is waiting on pays nothing. Answers given mid-scan read the index as of that moment, and only the startup scan gives them: a request queued behind a message that asked for a rescan waits for that rescan, which is the order contract the loop always kept. - [x] **Release prep.** `LICENSE` (MIT), `CHANGELOG.md` (v0.2.0), version bumped to 0.2.0 across the workspace and the extension, `tools/release.sh` (release binaries + `.vsix` + `SHA256SUMS` into a gitignored `dist/`) and `tools/RELEASING.md`. `docs/features/release-prep/README.md`. **Publishing (owner actions):** fully optional and deferred per the owner (2026-08-19) — sideloading the `.vsix` is the supported path. If it is ever revisited, only the owner can do it: create a Marketplace publisher id and replace `REPLACE-ME` (done 2026-08-25: publisher `guoliangchen`, author Guoliang Chen), hold the `vsce`/`ovsx` tokens, supply an extension icon, and confirm the public repo URL. Commands are in `tools/RELEASING.md`'s appendix. ## 7. Deliberate non-goals (also a best practice) - No preprocessor expansion *in the formatter*: like Verible, format unpreprocessed source and never expand macros into the output. (The LSP's define table in §6 *records* definitions for hover display — that is bookkeeping, not expansion, and doesn't weaken this rule.) - No option explosion: Black/ruff's lesson — every knob halves the value of a canonical style. Alignment inference (§2) is the culturally necessary exception. - No semantic claims in v1 lint rules: syntax-only rules first (Verible's scope), semantic rules only after `vlog_semantic` exists. ## 8. Refactoring — the rope port (owner request, 2026-08-24) Port the ideas of `python-rope/rope` to Verilog/SV, server-first. The full rope→Verilog mapping, feature checklist and milestone specs live in `docs/features/refactor/README.md` — that file is the source of truth; this section only tracks the milestones. - [x] **M1 `filelist`** — EDA `.f` filelist defines the index scope (`-f` nesting, `+incdir+`/`+define+` recorded, env vars); fallback: ~~workspace walk, then current file's directory when rootless~~ **the open files' own folders since 2026-08-27 (index-scope), with the workspace walk behind `lucisv.index.scope: "workspace"`; the filelist still outranks both. See `docs/features/index-scope/README.md`.** **Since 2026-08-28 a rescan no longer re-parses the buffers it already analyzed** — an open buffer's index facts and completion words come from the analysis it holds — so a scope-widening `didOpen` with a 1.4 MB buffer open costs ~23 ms rather than ~228 ms. **And since 2026-08-28 a widen indexes only the folders it added** rather than rescanning every folder reached so far, so the wait a jump puts in front of the next request stops growing with the session: over opentitan's 3 979 files, 120/132/137/169 ms per jump became 22/18/12/44 ms. - [x] **M2 `refactor-rename`** — new crate `vlog_refactor`; LSP `prepareRename`/`rename` for every symbol kind `vlog_semantic` resolves, cross-file, whole-edit-or-nothing verified by re-parse. - [x] **M3 `refactor-ports`** — add/remove/propagate module ports across the declaration and every instantiation (named/ordered/`.*`). **Amended 2026-08-28** (`docs/features/refactor-ports/README.md`): a `textDocument/codeAction` no longer reads the in-scope file set from disk per cursor move. The engine is handed the cursor's module's own fan-out through the index — definers, instantiation edges, reference postings, open buffers — by one builder both the code action and the three commands use, and the answer is asserted equal to the whole-workspace one. Over opentitan a code action went 4.56 s → 7.1 ms (2.93 s → 83 ms for a module instantiated in 36 files); it was the request every queued definition and hover had been waiting behind. - [x] **M4 `refactor-instantiate`** — module hinting: instantiation skeleton completion from the definition, auto-connect, signature help. - [x] **M5 `completion-core`** — keyword + project-wide identifier completion (token-harvested, comments/strings excluded), merged with M4's module snippets; version 0.3.0. - [x] **M6 `completion-templates`** — context-gated statement/item snippet completion from the server (if/else, case, always, loops, declarations), reconciled with the static VS Code snippets; version 0.4.0. - [x] **M7 `references-nav`** — cross-file find-all-references (reuse M2's collection machinery), document highlight, folding ranges from the rainbow's pair data. - [x] **M8 `inlay-hints`** — port-name hints on ordered connections and parameter-name hints on ordered `#(...)` overrides, from the index. - [x] **M9 `file-watching`** — `workspace/didChangeWatchedFiles` for sources and the filelist; reindex on external changes (git pull, filelist edits outside the editor). - [x] **M10 `include-nav`** — clickable `` `include`` lines resolved through the filelist's `+incdir+`s; cross-file `` `define`` lookup along the include graph. - [x] **M11 `hierarchy`** — module hierarchy both directions (who instantiates X / what X instantiates) over LSP callHierarchy. - [x] **M12 `semantic-lints`** — unused-signal, undriven-net, multiply-driven: the first semantic lint rules on `vlog_semantic`. - [x] **M13 `cli-filelist`** — `lucisv -f files.f` on the command line, reusing M1's parser; format/lint exactly the project's files. - [x] **M14 `macro-expansion`** — single-step macro expansion on hover (the define-table README's promised follow-up); version 0.5.0 with a CHANGELOG entry covering M7–M14. - [ ] Backlog (extract module, inline, `.*` expansion, ANSI conversion, organize imports, …) — triaged in the umbrella README after M5. ## 9. LSP 3.18 protocol audit (2026-08-26) Systematic comparison of `lucisv_server` against the LSP 3.18 specification. What we implement: hover, definition, references, documentHighlight, documentLink, document/workspace symbols, folding, semanticTokens/full, inlayHint, completion, inlineCompletion (3.18), signatureHelp, codeAction + executeCommand, rename + prepare, callHierarchy, formatting + rangeFormatting, push diagnostics, dynamic file-watcher registration, configuration push. Below is everything major that's missing, ordered by priority. The `resolve` endpoints (completionItem, codeAction, inlayHint, documentLink, workspaceSymbol) are **deliberately** unadvertised — every item is returned complete — and are not gaps. ### 9a. Compliance and high-value (round 1) - [x] **`executeCommand` must deliver its edit via `workspace/applyEdit`.** Today `ports::execute`'s `WorkspaceEdit` is returned as the request's *result* (`server.rs`, `ports.rs:79`), which the spec does not define and standard clients drop on the floor — `vscode-languageclient` does not apply executeCommand results and `editors/vscode/extension.js` has no custom handler, so `lucisv.addPort`/`removePort`/`propagate` invoked as *commands* currently do nothing in every stock client (the code-action path is unaffected: those carry the edit inline). Fix: push a `workspace/applyEdit` request, return `null` as the command result, and read the `ApplyWorkspaceEditResponse` (the one client response we can no longer ignore wholesale). Gate on the client's `workspace.applyEdit` capability with the old return-the-edit behavior as the documented fallback. → `docs/features/apply-edit/README.md`; the edit is pushed with a `lucisv: ` label, the result is `null`, and a refusal is shown as an ERROR naming the command. Watcher-registration answers stay ignored; `editors/vscode/extension.js` needed no change. - [x] **Pull diagnostics (3.17): `textDocument/diagnostic` + `workspace/diagnostic`.** The modern model — client controls timing, prioritizes visible editors, caches via `resultId`/`unchanged`. Advertise `DiagnosticOptions` (`inter_file_dependencies: true` — a save can change other files' diagnostics through the index; `workspace_diagnostics`), compute from the same parse+lint pass that feeds `publish`, answer `Unchanged` when the buffer version and index generation both stand. Keep push for clients that don't send `text_document.diagnostic` capability; never run both models for the same client (double diagnostics). → `docs/features/pull-diagnostics/README.md`; one generation counter is the whole `resultId` (bumped by `set_document` and `reindex`), the push gate sits in `send_diagnostics` so the `didClose` clear is suppressed too, and `workspace/diagnostic` reports the open buffers — the honest limit, stated there. - [x] **`textDocument/selectionRange`** — expand-selection. Cheap for us: the scope-pair matcher (`pairs.rs`) and AST spans already give the nesting chain; walk offset → enclosing token → statement → item → scope → file, one linked chain per input position. → `docs/features/selection-range/README.md` (`crates/lucisv_server/src/selection.rs`); token, AST, scope-pair and file ranges are collected and filtered down to what strictly nests. No expression step — deliberate, and recorded there. ### 9b. High-value, next rounds - [x] **Incremental text sync** (`TextDocumentSyncKind::INCREMENTAL`). Full-buffer sync on every keystroke scales poorly; apply range-scoped `contentChanges` in order, with a full-text fallback on any malformed change. Touches `set_document` and the staleness model in `docs/features/lucisv-server/README.md`. → `docs/features/incremental-sync/README.md` (`crates/lucisv_server/src/sync.rs`); one pure `apply_changes(text, changes) -> String` over `convert::Positions`, a fresh line table per change so each range sees the previous one's result, rangeless changes still replacing the whole buffer, and every desynced position clamped (line past EOF, character past line end, surrogate half rounds forward, `start > end` becomes an insertion). Still one `set_document` — one reparse, one generation bump, one publish — per notification. Advertised as `TextDocumentSyncOptions` with the open/close and `save.includeText: false` values a bare `Kind` already implied, so no client's save behavior moved. **Amended 2026-08-28** (`docs/features/change-debounce/README.md`): a `didChange` now only records the composed text; the reparse, the generation bump and the publish happen at the next *flush* — the next request, the next non-`didChange` notification, or a 150 ms quiet period — so a typing burst costs one of each instead of one per keystroke. The buffer's text is still exactly current after every notification; only its analysis is deferred, and intermediate diagnostics states are no longer published. **Measured 2026-08-28** (`docs/features/interactive-latency/README.md`): a burst of ten keystrokes over the wire produces exactly one `publishDiagnostics`, and a keystroke a request follows — the shape a real editor sends — round-trips in 4.8 ms at 1 000 lines and 37 ms at 10 000. - [x] **`textDocument/willSaveWaitUntil`** — the protocol-native format-on-save hook (client-side `editor.formatOnSave` already works; this serves the editors without it). → `docs/features/will-save-wait-until/README.md`; advertised as `willSaveWaitUntil: true` (the plain `willSave` notification stays unadvertised — there is nothing for us in it), and gated on a new `lucisv.formatOnSave` setting that is **off** by default, so a client with its own format-on-save never formats twice. On, it is `textDocument/formatting` with a different trigger: same engine, same all-or-nothing edit, same `[]` for an already-formatted buffer, and the settings ladder minus its `tabSize` rung because the request carries no `FormattingOptions`. Every save reason formats; an unopened buffer and the off state both answer `null`. - [x] **Semantic tokens `range` + `full/delta`** — we set `range: None` and no delta, so clients re-request whole-file token sets on every edit. Delta needs `resultId` bookkeeping per buffer. → `docs/features/semantic-tokens-delta/README.md`; `tokens.rs` split into classification → absolute form → filter → one pure encoder, so all three requests share a tokenizer. `range: Some(true)` answers the overlapping tokens whole, **re-encoded from the start of the document** (a range answer is self-contained, not a slice), carries no `resultId` and is not what a later delta diffs against; an empty range answers nothing. `full: Delta { delta: true }` answers one `SemanticTokensEdit` replacing everything between the common prefix and the common suffix — **the suffix capped to what the prefix left**, because identical lines of Verilog encode identically and an uncapped suffix claims the same tokens twice. `resultId`s are minted per answer, stored by `full` and `full/delta` alike, dropped on `didClose`; an id the server does not hold is answered in full. No token request bumps the diagnostics generation. Not done: `workspace/semanticTokens/refresh`. - [x] **Work-done progress** — `reindex()` is a synchronous full rescan on every save with no `window/workDoneProgress` reporting; on a big filelist the server just goes quiet. → `docs/features/work-done-progress/README.md`; every workspace rescan — the startup build, a save, a watched file, a changed `lucisv.exclude`/`filelist` — is wrapped in one `window/workDoneProgress/create` plus a `$/progress` begin/end pair on a fresh `lucisv-index-N` token, gated on the client's `window.workDoneProgress` (a client that did not ask is sent nothing at all, as the spec requires). `begin` goes out without waiting for the create's answer, because the rescan blocks the loop the moment it returns; the create's answer is ignored on the same path the watcher registrations' is. No percentage and no intermediate report — the rescan is one opaque call — and the `end` names the indexed file count, read off the index's own file list. The bar covers the scan, ending before the scope warnings and the republishes. → **Superseded in part, 2026-08-27**: the rescan is no longer opaque. `docs/features/indexing-ux/README.md` adds `vlog_semantic::IndexBuilder`/`index_order`, so the bar now carries `n/total file.sv` and a counted percentage (throttled to at most 1000 reports per rescan), a per-file `window/logMessage` under `lucisv.index.logFiles`, and a 1 MiB default walk-file size cap under `lucisv.index.maxFileSize` whose skips the `end` message counts. → **Extended again, 2026-08-27** (`docs/features/index-persistence/README.md`): a file restored from the persistent index cache logs `cached:` rather than `indexing:` and is counted in the `end` message — `860 files indexed, 860 from cache` — so a rescan that flew past says why. → **Extended once more, 2026-08-28** (`docs/features/index-scope/README.md`): a file that went into the index from an open buffer's own finished analysis — no parse, no store — logs `analyzed:` and adds nothing to the `end` message, so "from cache" still means the persistent store alone. → **The other half of the size story, 2026-08-27** (`docs/features/large-file-mode/README.md`): the walk cap covers files nobody opened, and `lucisv.largeFile.threshold` (4 MiB) now covers the file that *is* open. Over it, a buffer is line-indexed and nothing else — 41 ms for 100 MB — coloured a viewport at a time by `semanticTokens/range`, answered `null`/empty everywhere else, and left out of the index entirely (the one exception to "an open buffer is never capped"). It logs `large-file fast path: ( bytes)` once per buffer. Everything else above — the capability gate, the token scheme, the create's ignored answer, the ordering against the republish — is unchanged. - [x] **`$/cancelRequest`** — the loop handles requests sequentially and ignores cancellation; at minimum answer already-cancelled queued requests with `RequestCancelled`. → `docs/features/cancel-request/README.md`; **completes §9b.** `run()` now reads in bursts — one blocking receive, then everything already queued behind it — and handles the burst **in arrival order**, so a `didChange` ahead of a request is still applied before that request is answered. A request the same burst also carries a cancel for is answered `RequestCancelled` (-32800) without being dispatched; the cancels themselves are consumed there and never reach `notification()`. A cancel naming no request in its burst is dropped on the spot — it refers to a request already answered, or to one that never arrived — so the feature holds no state between bursts, and a double cancel is harmless. `shutdown` is honoured before the cancelled set is consulted and so is never cancellable. Numeric and string ids both read; malformed cancels dropped. The design's one correction: `lsp-server` 0.10 wires its stdio transport with `bounded(0)` *rendezvous* channels, so a backlog never sits on `connection.receiver` at all — the loop forwards messages onto an unbounded `std::sync::mpsc` queue of its own on one small thread (std-only, no new dependency), which stops at `shutdown` so `handle_shutdown` still reads the `exit` that follows. Nothing already running is cancelled; that needs the worker pool §6 defers. ### 9c. Moderate value, Verilog-shaped - [x] **Goto type definition** — from a net/variable use to its typedef/struct/enum/interface declaration; real value once `vlog_semantic` tracks declared types of bindings. → delivered 2026-08-26 by `docs/features/type-definition/README.md`: `typeDefinitionProvider` + `crates/lucisv_server/src/type_def.rs`. `vlog_semantic` was *not* changed — a binding still carries no type, but the type name it was declared with is already a `Reference`, so the answer is `nav::definition` of that name's own offset, found from the parse tree. Covers typedefs (alias/enum/struct), interfaces, classes, module instances, `pkg::t`, `import pkg::*`, header parameters and task arguments; one hop per keypress on an alias chain; built-ins answer an empty list. Two requests recorded there: `vlog_semantic` should report an unqualified lexical miss as an external candidate (stood in for by a fenced index lookup), and `vlog_parser` cannot parse an ANSI header whose first port has no direction. Both landed: the first on 2026-08-26 by `docs/features/overlay-promotion/README.md`, the second the same day by `docs/features/ansi-first-port/README.md`. - [x] **Linked editing range** — edit `module m` and its `endmodule : m` label together (`end : label`, `endfunction : name`, etc.). A genuinely good fit for SV's closing labels. → delivered 2026-08-26 by `docs/features/linked-editing/README.md`: `linkedEditingRangeProvider` + `crates/lucisv_server/src/linked.rs`. No engine change — the AST already records both name spans on one node (`name_span` + `end_label_span`), so the pair is a lookup and never a text match, which is what makes `begin : x begin : x ... end : x end : x` answer syntactically. Covers module/macromodule/ interface, package, class, function, task, clocking, named `begin`/`fork`, generate blocks and the prefix-labelled `b : begin ... end : b`. Two deliberate `null`s: an absent closing label (there is nothing to co-edit and this never offers to create one) and a mismatched one (the spec requires identical text, and linking would silently rewrite broken code). Escaped identifiers are excluded and the SV `wordPattern` is sent. `program ... endprogram : p` and the verbatim blocks (`property`/`sequence`/`covergroup`) are the only labelled constructs left out, because `vlog_parser` keeps no name span for them — recorded in that README's Handshakes. - [x] **Code lens** — "N instantiations" above each module header from the hierarchy index; `codeLens/resolve` unnecessary (counts are cheap), `workspace/codeLens/refresh` on reindex. → delivered 2026-08-26 by `docs/features/code-lens/README.md`: `codeLensProvider` (`resolveProvider: false`) + `crates/lucisv_server/src/lens.rs`. One lens per module *and* interface declaration, on the declaration's own name span, reading "no instantiations" / "1 instantiation" / "N instantiations". The count is not a second census: `hierarchy::incoming` was split into `hierarchy::callers_of_each`, a batched form of the same walk, so the lens counts exactly what the call hierarchy would list — asserted by an equality test, not by restating the arithmetic. The batch is the primitive because `Workspace::sources()` re-reads the file set, so a three-module file is one walk (133 ms over the corpus) rather than three (93 ms each). Clicking runs `lucisv.showInstantiations`, which answers every site as a `Location` and pushes a `window/showDocument` for the first when the client advertised it; a module with no instantiations gets a display-only lens instead of a click that leads nowhere. `workspace/codeLens/refresh` goes out from `reindex()` after the progress bar comes down, gated on `workspace.codeLens.refreshSupport`. One request recorded there: an instantiation-edge table in `WorkspaceIndex` would make both this and `callHierarchy/incomingCalls` a lookup instead of a workspace walk — **delivered 2026-08-27, `docs/features/incremental-index/README.md`**: `instantiations_of` is the table, the walk is gone, and a whole file's lenses went 92 ms → 0.26 ms over the corpus. - [x] **On-type formatting** — conspicuous absence for a formatter-first server; candidate trigger: newline (indent the new line per block nesting), `;` (reformat the finished statement). → delivered 2026-08-26 by `docs/features/on-type-formatting/README.md`: `documentOnTypeFormattingProvider` (`"\n"` + `[";"]`) + `crates/lucisv_server/src/on_type.rs`. Both candidate triggers, and only those two — not `}`, since SV closes its blocks with the word `end`. `;` goes through `format::range_formatting` unchanged, over the `;`'s own line, so that half is `textDocument/rangeFormatting` with a different trigger and no new formatting logic at all. `\n` is new logic outside the verified engine, so it is fenced two ways: the edit it builds can structurally only replace one line's leading whitespace with spaces (a wrong answer is a wrong indent, never a moved byte), and a corpus-wide agreement test formats every checked-in file with the real engine and forbids the model from disagreeing with the printer on any line of the output — 77 528 answered, 36 647 declined, 0 disagreements, with a coverage floor so it cannot pass vacuously. Nine of the ten rules the model needed were found by that test rather than predicted, including that `vlog_formatter` cuddles a `begin` onto its header but not a `fork`. **The path never speaks**: a refusal is `[]` with no popup, and — a correction to the design — a broken `lucisv.toml` is not reported here either, because `warn_about_config`'s dedup is re-armed by the `didChange` every keystroke produces and would give one popup per character. One deviation recorded there: the `;` range is the `;`'s own line rather than its enclosing AST node's span, which is the same answer wherever both are defined and avoids asking for a whole-module reformat when the `;` is the one closing a module header. `pairs.rs` gained three `pub(crate)` accessors so the matcher and the indent model read one keyword table. - [x] **Type hierarchy (3.17)** — arguably the semantically correct home for the module hierarchy (and later interface/class extends chains); keep callHierarchy as the compatibility surface. → delivered 2026-08-26 by `docs/features/type-hierarchy/README.md`: `typeHierarchyProvider` + `crates/lucisv_server/src/type_hierarchy.rs`, all three requests. **Classes, not modules** — the lead's scope call: an instantiation is a containment edge and `extends` is an inheritance edge, so the module hierarchy stays on callHierarchy exactly as this item's second clause asks, and typeHierarchy serves one node kind well. `supertypes` is not a new lookup: `extends Base` is already a `vlog_semantic` reference and overlay-promotion already made a bare cross-file class name reachable through it, so the answer is `definition_of` asked at the last byte of the extends name span — which is the tail of `pkg::base`, the whole of a bare `base`, and the bare name of a parameterized `base #(8)`. A base the workspace does not index (every UVM chain top) yields no item rather than a guess. `subtypes` is `hierarchy::callers_of_each`'s census in another key — ~~one `sources()` pass, substring prefilter, deterministic sort — at 55 ms over the 860-file corpus, 53 ms of it file I/O; the inheritance-edge table that would make it a lookup is filed beside the instantiation-edge table §9c's code-lens item already recorded.~~ **Both tables shipped 2026-08-27** (`docs/features/incremental-index/README.md`): `subclasses_of` makes `subtypes` a lookup, 55 ms → 0.71 ms. Two gaps recorded there: `lsp-types` 0.97 has no `typeHierarchyProvider` field, so the capability is inserted into the serialized `initialize` result by hand, and `vlog_parser` rejects `interface class`, so `implements` can never resolve and no item can carry `SymbolKind::Interface`. - [x] **File operations** — `workspace/willRenameFiles`: renaming a `.sv/.svh` rewrites `` `include`` lines that reference it (the include graph exists); `didRename/didDelete` as cheaper index nudges than the watcher round-trip. → delivered 2026-08-27 by `docs/features/file-operations/README.md`: `workspace.fileOperations` + `crates/lucisv_server/src/file_ops.rs`. An include is rewritten only when the graph says it **resolves** to the renamed file — never on a filename match, so two `defs.svh` in one workspace stay two files. The new spelling preserves the form where the new location allows it (bare stays bare when a rung reaches it, angled resolves through `+incdir+`s only, absolute stays absolute), shortest resolving suffix first, with a `../`-relative spelling as the last resort — which is also what answers a renamed include *directory*, since lucisv does not edit filelists. An include no spelling can reach is left exactly as written and named in a `window/showMessage` warning ("log all, show the first", the filelist rule): the server never invents a path that would not resolve. **Folders are handled**, not declined — LSP sends only the folder's URI and a folder is a path prefix, which is the same operation a file rename already was. The rule shipped with a mirror half the brief did not ask for: an include written *in* a file that moves breaks the same way and is re-spelled too. Every edit covers the path token alone (never the backtick, the delimiters or a trailing comment) and is verified three ways before it is emitted — re-scanned, re-lexed, and re-resolved against the filesystem the rename will leave behind. `didRename`/`didDelete` reindex through the same scope predicate the watcher uses, not deduplicated against it (a double rebuild is a re-read, never a different answer). One sweep is 54 ms over the 860-file corpus. `verify.rs` untouched. `includes.rs` gained `resolve_as_if` (so there is still exactly one copy of the EDA search order) and `normalize` became public; the standing request to extract one `lucisv_core::path::normalize` for the three private copies is still open. - [x] **`workspace/didChangeWorkspaceFolders`** — roots are read once at initialize; adding/removing a folder mid-session is ignored. → delivered 2026-08-27 by `docs/features/folders-and-config/README.md`: `workspace.workspaceFolders { supported, changeNotifications }` + `Workspace::change_roots`. One rescan per *notification* — the event carries both lists, and the progress bar, the code-lens refresh and the diagnostics generation all ride inside the existing `reindex()`. An event that leaves the root set where it was costs nothing: a folder already held, one never held, an empty event, params that do not parse, a non-`file:` folder. A removed folder's files leave the index while its **open buffers stay open and keep being diagnosed** — no code was needed for that, since `collect_sources` appends every open document after the scope ladder has spoken — and removing the *last* folder simply becomes rung 3 of that ladder, the rootless case. The watcher determination is recorded there: the source glob is a base-less string pattern and so is workspace-wide (no re-registration), while the filelist watcher is an absolute path anchored at the first root and is re-registered when a folder change moves it. `state.rs` gained exactly one 8-line method. - [x] **`workspace/configuration` (server-pull)** — we rely solely on push `didChangeConfiguration`; clients are moving to the pull model. → delivered 2026-08-27 by `docs/features/folders-and-config/README.md`: one `workspace/configuration` for the `lucisv` section at startup and again on every *empty* `didChangeConfiguration` (the 3.17 client's "something changed, ask me"), gated on `workspace.configuration`. A push with a payload still applies directly, so the legacy path is untouched; a client without the capability keeps exactly today's behaviour, empty-payload semantics included. **One parser** — the answer's entry 0 is wrapped back into the push shape and read by the same `settings::from_payload` — and **one applier**, so `exclude`/ `filelist` cost the same rescan and the same watcher re-registration whichever door they came in. An error, a `null`, an empty array or junk all resolve to the defaults and none of them says anything to the user. The outstanding-request tracking was refactored from `applying: HashMap` to `pending: HashMap`, one map and one `match`, with the three-way interleave (applyEdit + progress create + configuration) under test. Known and stated, not fixed: a pulled setting can land after the first index build, exactly as a pushed one always could. - [x] **3.18 additions:** `textDocument/rangesFormatting` (multi-range, feeds format-modified-lines), snippet edits in `WorkspaceEdit` (would improve `addPort` cursor placement), and `workspace/textDocumentContent` (could serve a read-only "expanded macro" document). → 2026-08-27 by `docs/features/lsp-318-extras/README.md`: **one shipped, two parked with evidence.** *Shipped* — `textDocument/rangesFormatting`, served as the `n`-range case of `rangeFormatting`: the ranges become one sorted, merged `LineRanges` (the constructor `--lines 3-9,40` already used, so unsorted, overlapping, adjacent and repeated ranges all normalize in the one place) and one `format_range` call, which keeps the all-or-nothing contract over the *union* rather than making it a per-range promise. `range_formatting` is now defined as the one-element call of it, so the reply shape, the refusal and the config warning are the same values and cannot drift; an empty `ranges` array is an ask for nothing, not an error. The capability is advertised by widening `documentRangeFormattingProvider` from `true` to `{ "rangesSupport": true }` — the spec's own `boolean | DocumentRangeFormattingOptions` union — **gated on the client having sent `textDocument.rangeFormatting.rangesSupport`**, so every client that shipped before this round sees the identical byte and only a 3.18 client sees the object; the handler is registered unconditionally. `lsp-types` 0.97 spells neither half, so the capability goes out through the `initialize_value()` JSON insertion (the type-hierarchy precedent) and the client flag is read from the **raw** initialize params before the typed decode drops it. *Parked* — **snippet `WorkspaceEdit` edits**: `lsp-types` 0.97 has no `SnippetTextEdit`, `WorkspaceEditClientCapabilities` has no `snippetEditSupport`, and the pinned `vscode-languageclient@9.0.1` has neither string anywhere in it, so a server sending one would be writing a literal `${1:name}` into the user's buffer. *Parked* — **`workspace/textDocumentContent`**: absent from `lsp-types` 0.97 and from the pinned client, and serving a custom URI scheme in VS Code needs a content provider the deliberately thin `extension.js` does not register; the expanded-macro view it would serve is also hover-sized today, not document-sized. Both have an exact re-check trigger recorded (one `node_modules` grep each). **This completes §9c.** ### 9d. Deliberately skipped (no Verilog use case) Notebook sync, moniker (LSIF), inline value (debugger), document color, goto implementation, goto declaration (Verilog has no declaration/definition split lucisv models). Recorded here so the audit doesn't repeat. ## 10. Performance wave (2026-08-28) — docs/performance.md findings Source: `docs/performance.md` (benchmark of every LSP action against opentitan, 3 976 files). Tracking for the two-worktree parallel round; each lane's dev ticks only its own lines. Lane file ownership is the merge contract — a lane touches no file outside its list. ### Done before the wave (trunk) - [x] `textDocument/codeAction` 3.1–4.6 s per cursor move → 7.1 ms (83 ms at a 36-file fan-out): `Workspace::module_sources` subset instead of `ws.sources()` — refactor-ports README, 2026-08-28 work log + Review. ### Lane A — rename family (worktree A; files: crates/vlog_refactor/*, crates/lucisv_server/src/{rename.rs,file_ops.rs,state.rs,perf.rs}, docs/features/{refactor-rename,file-operations}/README.md, docs/perf/README.md) - [x] `prepareRename` 2.5–3.0 s (F2 blocks everything) → buffer+index answer, < 1 ms; refusal-by-refusal parity table in the README. **1.663 s → 139 ns on OpenTitan**; parity table and six byte-by-byte parity suites in refactor-rename's README, plus 564 offsets of a real `tb.sv` swept identical, zero deferrals. - [x] `rename` 3.6–8.7 s → reference-postings fan-out subset with a written sufficiency argument; verifier integrity proven. **3.467 s → 105.5 ms on OpenTitan**, edits byte-identical at every cursor checked (7 files at `aes`, 114 files at `clk_rst_if`), the capture refusal still firing on a real workspace. QA found one lost refusal (a dangling use of the *new* name); closed by a sixth rung, `WorkspaceIndex::files_spelling` — 852 µs worst case on OpenTitan. One accepted residue remains — macro-**invocation**-argument warnings in files outside the fan-out, costing no edit and no refusal. - [x] `willRenameFiles` same `ws.sources()` shape (file_ops.rs:120) → include-graph/index-bounded subset. **249 ms of `sources()` → a 14.1 ms whole answer on OpenTitan** (331 includers of 3 976). ### Lane B — hot path + UX (worktree B; files: crates/lucisv_server/src/{completion.rs,candidates.rs,nav.rs, settings.rs,perf.rs}, crates/lucisv_server/tests/e2e.rs, editors/vscode/package.json, docs/features/{completion-core, references-nav,index-scope}/README.md, docs/perf/README.md) - [x] `completion` 34–66 ms per keystroke (worst at 0–4 chars) → profile, then < 5 ms with item-identical answers pinned. Profiled: the whole cost was tier 0, the module skeletons — every other tier is 0.19 ms at every prefix. Tier 0 now parses the declaring file's *header* instead of all of it, and reads the module names off a table built with the index instead of sorting the workspace's whole symbol table per keystroke. **3.17 ms** at the empty prefix on a 4 000-file generated corpus (was 53.2 ms); **13–15 ms** worst case on opentitan (was 34–66), and typing `aes_reg_top` 201 ms → 64.5 ms. Items pinned identical by a fifteen-shape plan-equality test and a module-table equality test. - [x] `documentHighlight` answered 0 results at every opentitan position while references answered — root-cause and fix (or prove the benchmark request wrong and correct docs/performance.md). **A real bug, not a benchmark mistake**: the handler asked only single-file `Semantics`, so a name this file uses but does not declare — an instantiated module, a `.port` connection — had no symbol to find, while `references` read the workspace overlay. Fixed in `nav::external_occurrences`, with a unit regression test and the two opentitan positions pinned over the wire. - [x] Default `lucisv.index.scopeDepth` 0 → 2 (folder scope indexed exactly one file in opentitan's dv/tb layout; every cross-file answer empty until a jump widens) — behavior change, CHANGELOG callout at release. Also removed the *rootless* climb, which had no root to clamp against and would have walked an unnamed tree at the new default. Cost measured rung by rung: 1 / 1 / 21 / 252 files at depths 0 / 1 / 2 / 3. ### Take 2 follow-up (2026-08-29) — the first RTL open at the default scope Measured in `performance_take2.md` §5b: opening `hw/ip/aes/rtl/aes.sv` at `scopeDepth: 2` raises the scope to `hw/ip` and costs 1.4–1.7 s. Files: `crates/lucisv_server/src/{candidates.rs,state.rs,server.rs,perf.rs}`, `docs/features/index-scope/README.md`, `docs/perf/README.md`. - [x] Diagnosis corrected against the running binary: the widen already takes the cheap path for a subsuming scope and already diffs by **file against the index** (the bar reads 1 685, not 1 807, when the old block's 124 files are inside the new root), so nothing was re-indexed. The chooser's `Whole` arm is still unreachable. Pinned by `state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds` and a `widen_of` table row. - [x] The real cost found and fixed: folding a widen's words into the completion table inserted each new word into a sorted `Vec` on its own, which is quadratic in the batch — **403 ms of the 935 ms** on opentitan's `hw/ip`. Counted per batch and merged once: 43 ms. Warm **935 / 881 → 555 / 564 ms**, cold **1 529 → 1 175 ms**. - [ ] **Still slow, filed:** what is left of that jump is real work over 1 683 genuinely new files — 325 ms re-lexing them for the completion word table (the persistent store holds a file's facts but not its words), ~100 ms walking and reading them, ~80 ms hashing and decoding records. Storing the word list beside the facts is the next lever and is `index-persistence`'s call: it is a `FACTS_FORMAT` change. - [ ] **Not done, deliberately:** a widen still does not interleave, so this is a bar the user watches once per session per big widen. The coalescing rule is unchanged. ### Deferred, filed - [ ] `codeAction` costs 185–201 ms at a 128-file fan-out and offers **zero** actions there (`performance_take2.md` §6a): ~1.4 ms per instantiating file plus a ~13 ms floor, paid before anything knows there is nothing to offer. Wants either the lazy resolve below or a cheap zero-detector that answers before the fan-out is walked. - [ ] `inlayHint` returns **0 hints at the default scope** where the workspace scope returns 4 (`performance_take2.md` §8): investigate before assuming it is scope-relative-answers working as intended — the hinted instantiation's module may be in scope and still unhinted. - [ ] codeAction lazy resolution (`codeAction/resolve`): make the offer index-only (~0 ms regardless of fan-out), edits computed on lightbulb click — kills the 83 ms worst case. Owner-approved direction, after the wave. - [x] Rename over an index-stale workspace: Lane A must state the staleness premise; if the verifier cannot catch a hidden reference, the honesty gate is the lead's review call. Stated verbatim under "The staleness premise, stated exactly" in refactor-rename's README, with what it costs (a file whose disk copy moved unseen is neither rewritten nor refused over) and the one exemption (open buffers, always in the set). Both residues ruled on: the dangling-use lost refusal was rejected and fixed (rung 6, `files_spelling`); the macro-invocation warning loss is accepted as documented, with the `FileFacts` macro census filed as the real fix. ## VS Code design-hierarchy sidebar (2026-08-29) Feature by codex; this section is that round plus the lead's QA finding and three owner items. See `docs/features/vscode-hierarchy-sidebar/README.md`. - [x] `lucisv/moduleHierarchy` + `lucisv/moduleHierarchyChanged`, gated on `initializationOptions.hierarchyView`; Activity Bar container, webview view, navigation, context menu, bookmark. - [x] `FACTS_FORMAT` 4 → 5: `Def::decl_span`, per-instance `InstanceOccurrence`s on the statement edge, and client positions on file-scope declarations and instance occurrences. Call hierarchy and code-lens counts unchanged. - [x] **Lead's HIGH finding — the snapshot read every module-declaring file per request.** Fixed by index-carried positions (zero file I/O), `WorkspaceIndex::units_of`, and a schema-2 wire (file table, four-number ranges, no ids, no per-instance definition copies). On opentitan, server-side handler **145–167 ms → 17–20 ms** warm, response **11.6 MB → 2.3 MB**, a definition pipelined behind a snapshot **263 ms → 41 ms**. Store cost of the positions: +1.7 % on the corpus, +1.9 % on opentitan. - [x] `complete` tightened to `!scanning && !must_wait()` and the window it has to be honest about written down and tested. - [x] Owner: the five-line hover source preview removed — the feature's last consumer of file text. - [x] Owner: every tree level collapsed by default; expansion state survives a refresh on stable row ids. - [x] Owner: search freeze fixed. The model is flat and resident, tree levels are built lazily, and a query is one pass over a prebuilt lowercased index with a character-mask pre-filter and a counting top-K — 3–8 ms per query over a generated 120 000-entry hierarchy, asserted in the node suite. - [ ] Filed, not done: rewire `locate::location` onto `DeclPositions` so `textDocument/definition`, references, the lens and both hierarchies stop reading a file to convert an indexed span. Every unit's range is now in the index for free. - [ ] Manual extension-host acceptance (themes, keyboard-only, zoom, screen readers, an old server binary, both VSIX shapes). ## 11. Testbench-syntax wave (2026-08-29) — syntax_coverage.md findings Source: `syntax_coverage.md` (opentitan sweep, 96.2% → the gap). The top two buckets both edit `vlog_parser/src/parser.rs`, so per CLAUDE.md's parallel-lane rule they run serially; the wave's first two lanes pair the constraints round with the TOPO-independent formatter bugs instead. ### Lane A — out-of-class constraints (worktree; files: crates/vlog_parser/src/parser.rs, crates/vlog_parser/tests/*, crates/vlog_semantic if an arm is needed, docs/features/ out-of-class-constraints/README.md, TODO.md §11 Lane A lines) - [x] `constraint C::name { ... }` at file/package/class-external scope — 45 files blocked, and the tolerant-mode cascade (300+ bogus diagnostics per file) is the real LSP damage. Expected shape: the classes feature's verbatim capture reused (justify if not). Done: `parse_constraint` reuses `parse_method_name`, no new AST variant. OpenTitan 151 → 107 failures; 44 of the 45 clean, the 45th advances to bucket 10. Tolerant diagnostics over the 45: 1 349 → 1. `docs/features/out-of-class-constraints/README.md`. ### Lane B — formatter round-trip bugs (worktree; files: crates/vlog_formatter/src/* EXCEPT verify.rs forgiveness, crates/vlog_formatter/tests/*, docs/features/formatter-bug-fixes/ README.md, TODO.md §11 Lane B lines) - [x] The 12 files the safety net refused (comment / `else if` merging shapes in syntax_coverage.md §bucket 2): fix the formatter so its output verifies; verify.rs forgiveness may NOT be widened (any widening needs masked-corruption attack tests per invariant 4 — prefer no widening at all). **11 of 12 fixed; `verify.rs` untouched.** The 12th (`keymgr_scoreboard.sv`) had its bucket-2 bug fixed and a second, distinct, *parser*-side bug behind it — `Parser::take_before_open` (parser.rs:757) drains the whole pending-comment queue, so a comment written after `if (` is swallowed by the condition's first call. Out of Lane B's file set; filed as a handshake in `docs/features/formatter-bug-fixes/ README.md`. - [ ] Owner/lead: the one-line parser fix above (Lane A's file), which closes the last of the 12. ### Serial, after Lane A merges (parser.rs frees up) - [x] Directive-split for expressions/statements: `` `ifdef `` splitting an assign RHS / instantiation head (chip_if.sv:1192 anchor; blocks both top_* tb.sv testbenches). 5-file floor, high leverage. Done: the mirror of `directive-split` — the failure lands on the `` `ifdef `` that *opens* a region inside a construct, not on the `` `else `` that closes one around it. Verbatim capture, at item and at statement level; no new AST variant or field, so no printer arm. Plus one guard in `take_list_directives` so an outer region's seam is not harvested as a list element, which is all the two tb.sv files needed. OpenTitan 107 → 100 failures: all 5 bucket-7 files, both `top_{earlgrey,darjeeling}/dv/tb/tb.sv`, zero regressions, corpus gate byte-identical at 813/820. `docs/features/directive-in-statements/README.md`. Also delivered there: the `Parser::take_before_open` handshake Lane B filed (`docs/features/formatter-bug-fixes/README.md`), which unblocks the 12th bucket-2 file, `keymgr_scoreboard.sv`. - [x] Mop-up bundle (~26 files): enum member ranges, cast-base drive strengths, local typedef statement, gate delays, virtual+modport, rand-on-struct, foreach-skip-dim, hierarchical bind instance list. Done: nine shapes, **47** files (the estimate was low, and two of `syntax_coverage.md`'s bucket labels were mis-diagnoses — bucket 6 is a *system function call* as the casting type, `$bits(x)'(y)`, not a drive strength; bucket 12 has six files, not five). Real grammar throughout, no verbatim capture, `verify.rs` untouched. One new `StmtKind` variant (the block-scoped `typedef`, which is the item form exactly) and four new fields; seven of the nine buckets needed no AST surface at all. OpenTitan 88 → 43 failures: 45 files clean, 2 advance to the `iff`-in-event-control gap, **zero** newly failing, and zero output change on any of the 3,896 previously-passing files. Corpus gate byte-identical at 813/820. Tolerant diagnostics over the failing set 1 644 → 1 290, none worse anywhere. `docs/features/testbench-mopup/README.md`. - [x] Skipped there, one file: a gate's drive strength (`pullup (weak1) u (...)`, spi_host/dv/tb.sv:101) — a different production from the cast bases bucket 6 named, costing two AST changes for one file. See that README's Status for the exact shape. Done in Round 2 below, at the amortized cost that round predicted. ### Round 2 (clocking wave) — every remaining grammar bucket, one round Serial in the main tree (`docs/features/clocking-wave/README.md`). Baseline 43 failures over 3,943 files at `5ad0772`; **43 → 11**, and the eleven left are the two OUT rows — macro fragments that need a preprocessor, and vendor files that are not SystemVerilog. Zero newly failing; one previously-passing file's output moves, and it moves because 55 lines that used to be swallowed into an opaque blob are now parsed (see below). Corpus byte-identical at 813/820 over all 860 files; `verify.rs` untouched. - [x] **Clocking signal bindings** — `output tms = _tms_internal;`, IEEE 1800 §14.4's `clocking_decl_assign`. **7 files.** Deviation from the brief: clocking is already a modelled node with a printer, spans and a linter guard, so the fix is the one missing field, not a verbatim capture that would have thrown that model away. The *opacity* the brief wanted is where it already lived — `analyze` keeps the block a leaf and the linter takes the whole item span, binding included, out through `opaque_spans` — and is now pinned by a lint case. Files: `crates/vlog_parser/src/{ast,parser}.rs`, `crates/vlog_formatter/src/format.rs`. - [x] **`default disable iff expr;`** (IEEE 1800 §16.12) — **7 files**, and not a clocking construct at all: the bucket label came from the error text, and reading all 14 sites is what split it 7 + 7. Verbatim capture, the round's only one, with six masked-corruption attack pairs. - [x] **A macro as a concurrent assertion's action statement** — not in the brief; the next blocker on 6 of the above once they parsed. `assert property (p) else \`ASSERT_ERROR(A)` has no `;` to scan to, so `skip_action_stmt` used to run through whatever followed. **This is the one change with a whole-tree output effect**: `prim_sync_reqack.sv` had ~55 lines of generate-block code absorbed into an assertion's opaque bytes; they are now parsed and laid out. - [x] **`iff` on an event-control term** (§9.4.2) — **5 files**. LRM scope checked: `iff` gates one event-expression term, so `@( … )` is the only position; the paren-less form and `wait` have no `iff` alternative. - [x] **Bare event control over an indexed hierarchical path** — `@cfg.agents["k"].vif.cb`, **3 files** (the rstmgr shape). Also closed a pre-existing hole: that loop boxed a layer per `.name` without charging the chain budget. - [x] **`program … endprogram`** (§24.3) — **3 files**, one dispatch arm reusing `parse_module`. - [x] **Chain limit 256 → 1024, `PARSE_STACK_SIZE` 16 → 32 MiB** — **7 files**, an engineering measurement, not a grammar change. Real generated register files need up to **567** links (`pinmux_reg_top.sv`); 9.20 KiB of debug stack per postfix link; the new worst case is **9 894 KiB** (a maximal chain inside nesting), so 32 MiB keeps the 2.7×-or-better margin. This round retires the feature's own "chains do not move the worst case" — true at 256, false at 1024 — while re-verifying the phase argument that keeps the two budgets additive. `docs/features/recursion-limit/README.md` round 4. - [ ] **Skipped, `jtag_if.sv`**: its clocking blocker is fixed; a **pre-existing** one sits behind it. Two rival, bracket-*balanced* interface headers in an `` `ifdef ``/`` `else `` region, which `at_split_conditional` does not fire on (it requires an open bracket), so the parser nests them. Handshake request to a future `directive-split` round; reproduced on trunk grammar alone. - [ ] **Skipped, `SimDTM.sv`**: a net delay written *after* the type (`wire [31:0] #0.1 x = y;`), which is where the LRM puts it — lucisv parses it only before. One `DataDecl` field has one print position, so accepting both spellings needs a positional field or the safety net rightly refuses the reordered tokens. One vendor file in `tb/unused/`. - [ ] **Skipped, `kmac_reduced_tb.sv`**: a trailing comma in a *named* parameter override list. Not legal SystemVerilog; rejecting it is correct. - [ ] **Recommended instead of grammar work**, for the sweep's non-SystemVerilog files: exclude patterns `**/*.tpl.sv`, `**/vendor/google_riscv-dv/**`, `**/pulp_riscv_dbg/tb/unused/**`. ## 12. Inline instantiation wave (2026-08-30) — owner request Two-level module-instantiation snippet expansion, sized for opentitan (~4 000 files, ~43k declarations). Single lane (one dev, one QA), no concurrency. Files: crates/lucisv_server/src/{inline.rs, completion.rs, candidates.rs, settings.rs}, crates/lucisv_server/tests/e2e.rs, editors/vscode/{package.json, smoke.js}, docs/features/inline-instantiation/README.md (new), handshake amendments in docs/features/{completion-core, refactor-instantiate, inline-templates, completion-templates}/README.md, TODO.md §12 lines. - [x] **Level 1 — popup names only.** `completion.rs::module_tier` stops planning skeletons per keystroke (up to 64 file reads + header parses today): module items insert just the module name. Owner ruling 2026-08-30 supersedes the M4 completion-skeleton byte-for-byte pins; flip them to name-only. Signature help and inlay hints keep consuming `instantiation_plan` unchanged. - [x] **Level 2 — exact-match ghost.** New trigger in `inline.rs`: cursor at the end of an `Ident` whose text exactly (case-sensitively) matches an indexed module name, at a position where an instantiation is legal, rest of line blank → ghost the full instantiation (parameters + all ports, tabstopped snippet) planned for exactly one module through the existing `module_definition` → `module_header` slice → `instantiation_plan` path and the `FileView` cache. Relative `\t` indentation per the inline indentation contract. - [x] **Exact-match probe.** `Candidates` exposes an O(log n) exact lookup over its sorted module table; the non-matching keystroke does no file I/O and no planning. - [x] **Setting.** `lucisv.inlineInstantiation` (unset = on), following the `lucisv.inlineTemplates` pattern; package.json entry. - [x] **Pins.** e2e: accept the name-only popup item, then `inlineCompletion` at the landing cursor ghosts the skeleton ("before or after autocomplete"); negatives (partial name, expression position, text after cursor, setting off, no-lex buffer); accepted ghost parses. - [x] **QA on opentitan** (read-only: `--check`/`--stdout` only, git status after): timing via `--verbose` — non-matching keystroke well under 1 ms, matching ghost sub-ms warm / few ms cold, popup module tier no longer reads files. ### §12 round 2 (2026-08-30, owner rulings after live use) Files: same lane list as round 1 (inline.rs, completion.rs, candidates.rs if needed, state.rs ONLY if a selector is needed there, e2e.rs, package.json description, smoke.js, the feature README + amendments, TODO.md §12). - [x] **Space-armed trigger.** The ghost offers only after `name`: the identifier must end exactly one space before the cursor (`aes ` ghosts; `aes` alone never does — `aes_dft` may still be coming). Ghost text loses its leading space accordingly. Popup round trip becomes accept-name, type space, ghost. - [x] **Every indexed module expands.** A module declared in more than one file no longer declines: pick the definition whose path shares the longest common prefix with the requesting document's path (the same top's copy in opentitan), tie-broken by lexicographic path; deterministic and pinned. `ast_dft` and `io_osc` (duplicated across top_earlgrey/top_darjeeling) are the motivating cases. - [x] **QA sweep on opentitan**: request a ghost for every module name in the index at a synthetic legal site; every non-ghosting name needs a written reason (escaped identifiers, unparseable definition file); `ast_dft`, `io_osc`, `aes` verified by hand. 1 131/1 131 ghosted, 0 declined; 199 names duplicated across 2-61 files, all resolved. One non-blocking finding (nearest-definition tie-break on a nested-subdirectory sibling) — see the feature README's round-2 QA log. ## 13. Fuzzy completion wave (2026-08-30) — owner request Subsequence ("fuzzy") matching for identifier completion, VS Code policy: prefix matching below 3 typed characters, fuzzy from 3 up (`clkenq` reaches `clk_osc_en_q`). Sized by the lead's benchmark on the real opentitan word list (139,800 words): char-bitmask prefilter + two-pointer scan = 0.07-0.32 ms/keystroke; naive scan 3.4 ms; 1-2-char queries stay prefix so the degenerate single-letter case never runs fuzzy. Single lane. Files: crates/lucisv_server/src/{candidates.rs, completion.rs}, crates/lucisv_server/tests/e2e.rs, docs/features/fuzzy-completion/README.md (new), amendment in docs/features/completion-core/README.md, TODO.md §13. - [x] **Mask table in `Candidates`.** Per-word 32-bit character mask for the words and units tables, built with the index and maintained by every mutation path (build, update_words, absorb, remove_file); query mask subset-check prunes before the subsequence scan. - [x] **Fuzzy tiers at ≥3 chars.** Words, index (project declarations) and scope-visible tiers match by case-insensitive subsequence when the typed word is 3+ chars; below 3, today's prefix behavior byte-for-byte. Module tier unchanged (substring, its own semantics). Dedup across tiers preserved. - [x] **Ranking.** Prefix hits outrank fuzzy hits within a tier; fuzzy hits scored (word-boundary bonus at `_`/case/digit boundaries, contiguity, gap penalty), deterministic, stable tie-break by name; top-K under the existing LIMIT. - [x] **isIncomplete correctness.** The 2-char prefix response must be marked incomplete or VS Code filters locally and the 3rd keystroke never reaches the server (the prefix→fuzzy transition is the trap); truncated fuzzy responses incomplete too. - [x] **Pins.** clkenq→clk_osc_en_q end to end; boundary-scored ranking; 1-2 char = prefix only; textEdit still replaces the typed word; no fuzzy hit whose letters are out of order; e2e over the wire incl. the 2→3 char transition. - [x] **QA on opentitan** (read-only, --check/--stdout only, git status after): fuzzy keystroke adds ≤0.5 ms warm vs today's 2.6-3.2 ms popup; <3-char path unchanged; index build/absorb not measurably slower from mask maintenance; clkenq finds clk_osc_en_q in a real ast buffer. **Dev note (2026-08-30): the ≤0.5 ms bar does not hold on the widest three-letter queries.** Measured on the real checkout: `clkenq` +0.05 ms, `clk` +0.52 ms, `prim_` +0.77 ms, `aes` +0.80 ms; 1-2-char requests unchanged. Numbers, the reason (three common letters leave 39 362 of 100 022 names past the mask and half of them really match) and the two untaken levers are in docs/features/fuzzy-completion/README.md, *Performance* — for the lead to rule on. **QA verdict (2026-08-30): SHIP.** Gates clean (fmt, clippy, `cargo test --workspace` 2691/0/36 exact match, debug+release builds, smoke.js). git status on opentitan confirmed unchanged (only the three pre-existing owner edits) before and after every session. `clkenq` confirmed live over the wire against the real `clk_osc_en_q` in `hw/top_earlgrey/ip/ast/rtl/gfr_clk_mux2.sv` (ast.sv itself doesn't declare it; grepped for the closest real name as instructed), both from another buffer and from inside that file's own buffer. Ten adversarial attack tests written against the matcher (mixed case, `$`/digit/`_` queries, a non-ASCII byte in a table entry, ranking determinism, absorb overwriting a path, remove-then-readd) — all ten passed, no corruption found; reverted after running (nothing to fix). Server "answered in" timings (fairer than wall-clock; still pays JSON marshalling the dev's isolated number does not): `aes` 1.7-2.2 ms, `clkenq` 0.4-0.5 ms, 1-2-char queries 0.9-2.0 ms (matches the unchanged-path claim in shape). **New finding**: `ena` (a common real RTL fragment) measured 2.95-4.05 ms, worse than `aes` — the *Performance* section's "aes is the worst case" is not shown to be a proven upper bound, just the case the dev tried. Informational, not blocking: same architecture, same order of magnitude, still within the ~1.1 ms absolute framing the lead already accepted. See the feature README's QA log for the full latency table and repro. ## 14. Null items wave (2026-09-01) — owner report "for loop inside generate" Lead diagnosis: the generate-for itself parses in every spelling (genvar in the header, declared outside, region-less; the three systemverilog.io examples all round-trip). What fails is the stray `;` the owner wrote after `endgenerate` — a **null item**, legal SV (IEEE 1800-2017 A.1.4 `package_or_generate_item_declaration ::= … | ;` and `class_item ::= … | ;`; slang warns `-Wempty-member`, "an unnecessary semicolon in a non-procedural scope"). Rejected today at module scope, inside `generate…endgenerate`, after a generate block's `end`, in package/interface/class bodies and at file scope; the procedural null *statement* already works; `endfunction;`/`endtask;` already survive via `end_semi`. Single lane. Files: crates/vlog_parser/src/{ast.rs,parser.rs}, crates/vlog_parser/tests/ spans.rs, crates/vlog_formatter/src/format.rs (+align.rs only if a group rule needs it), crates/vlog_formatter/tests/cases/ null_items.cases (new), crates/vlog_formatter/tests/verification.rs, crates/vlog_semantic/src/bind.rs (arm), crates/vlog_linter/src/ rules/empty_item.rs (new) + registry + a .lint case + rule docs, compile-fix arms elsewhere as the compiler demands (listed in Handshakes), docs/features/null-items/README.md (new), TODO.md §14. - [x] **`ItemKind::Empty`** — a first-class null item wherever an item may appear (module, generate region, generate-block body, package, interface, program, class body, file scope), span = the `;` token, comments attached through the ordinary `Meta`. No cascade: tolerant mode emits no diagnostic for it. - [x] **Formatter layout, token-preserving**: a null item on the same line as the previous item's last token prints glued (`endgenerate;`, `end;`, `;;`); one on its own line prints `;` at the current indent. Idempotent both ways; alignment groups are not joined across it. Corpus byte-identical (813/820). - [x] **Blast radius arms**: `format.rs`, `bind.rs`, `tests/spans.rs` (+ any other exhaustive match the compiler names). - [x] **Safety-net template**: `verify.rs` untouched; rejection pairs added anyway (dropped `;`, `;` moved across a comment, `;` moved into a procedural block). - [x] **Lint `empty-item`** (slang's `-Wempty-member`): warn on a null item, safe auto-fix removes it; default on; `.lint` case with the fix output verified by the harness. - [x] **Online-example pins**: the three systemverilog.io generate examples (16-input mux, arbiter assertions, nested memory case) as formatter cases, plus the owner's `endgenerate;` shape and slang's two warning examples. - [x] **QA**: adversarial null-item placements (before/after directives, between `` `ifdef `` arms, after attributes, with trailing/leading comments, CRLF), idempotency, opentitan sweep unchanged at 11 failures (read-only), LSP diagnostics show the lint (not a parse error) with the quick fix. ## 15. DV class semantics wave (2026-09-01) — owner request Round 1: **class-member-access**. `handle.member` through a class-typed variable resolves (hover / definition / references), inherited members chased through `extends` in-file and cross-file, `this.x`/`super.x` chased the same way (delivers topo §2.9-9), and an out-of-class method body (`task c2::update(...)`) sees its class's members. Design by the lead from the Explore map: today `a.b` records a reference for the head only (bind.rs `ExprKind::Member` arm, vlog-semantic rule 8), `Symbol` carries no declared type, `resolve_external` never chases `InheritedCandidate::base`, and the index has no base-class-of lookup. Single lane. Files: crates/vlog_semantic/src/{model.rs, bind.rs, resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/tests/* (+ new member_access.rs), crates/lucisv_server/src/{hover.rs, nav.rs} only if a rendering detail needs it, crates/lucisv_server/tests/e2e.rs, docs/features/class-member-access/README.md (new), amendments in docs/features/{class-semantics, overlay-promotion, vlog-semantic}/ README.md, TODO.md §15. - [x] **`Symbol::type_name`** — the declared type as written (`c1`, `pkg::c1`), captured where declarators bind (Var, TfArg, Port, class properties); additive field, `None` for everything else. - [x] **Tail reference for `head.member`** when the head is a plain identifier: new `Target::MemberOf`, tail span via `member_tail`; resolves the head lexically → its `type_name` → the class (in-file scope, else `ExternalCandidate { paths: ["C::member"] }`) → the member in the class scope, else chase `Scope::extends` in-file, else `InheritedCandidate { base, paths }`. - [x] **Index-side inheritance chase**: `WorkspaceIndex::base_of(class)` as a reverse map built from the existing inheritance-edge census (no new facts field); `resolve_external` follows `InheritedCandidate::base` upward with a visited set until a member hit or an unknown base. Also serves `this.x`/`super.x` misses (§2.9-9 delivered). - [x] **Out-of-class method bodies** (`task C::m(...)`): names inside resolve in class `C` first (in-file scope chain; cross-file via `InheritedCandidate { base: C }`), so `address = in_item.user_id` resolves both sides in the owner's example. - [x] **`FACTS_FORMAT` 5 → 6** — the reference census grows (new tail postings), so stores written by older builds must be discarded; `fingerprint`/`absorb`/`update_one` equalities re-pinned. - [x] **Hover renders the member's declaration** (`rand bit user_id;` with file:line for cross-file) through the existing external path; definition/references follow for free and are pinned. - [x] **Pins**: the owner's three-file example (base/c1/class2) in-file and split across files; inherited member two hops up; cycle in `extends` terminates; unknown base → graceful `None`; module instance heads unchanged (`a_hierarchical_name_resolves_only_its_head` stays green); rename of `user_id` renames the tail use. - [x] **QA on opentitan DV** (read-only; 2026-09-01): `item.a_addr` (`tl_seq_item`, cross-file) resolves correctly, 0.12 ms cold / 0.01 ms warm; `cfg.clk_rst_vif` (type-parameterized `cfg`) correctly answers nothing; no `uvm_pkg.sv` in the tree, so every UVM-base chase ends at an unknown base by construction; cold full-workspace scan 2956 ms / warm 1521 ms (3976 files), matching `docs/performance_take2.md`'s baseline; diagnostics unchanged on 3 sampled DV files; store size +9.56% on the whole opentitan tree (28 200 598 → 30 895 566 bytes). **First-pass QA verdict: REWORK** — finding 1: a typedef-typed (struct, enum or plain alias) local variable's member access is documented to record no reference at all but instead became an `ExternalCandidate`, which a same-named unit elsewhere in the workspace could wrongly answer (hover/ definition landing on an unrelated declaration). Confirmed live in real opentitan DV code (`cip_base_scoreboard.sv`'s `expected_alert_t`/`exp_alert`, harmless there for lack of a naming collision) and by three isolated repros. **Fixed by the dev (rework round, same day)**: `resolve.rs`'s `member_of` now routes through a three-way `TypeHere::{Scope, NotAUnit, Absent}` — only `Absent` (nothing in this file declares the type name at all) reaches the workspace; a type declared here as a typedef (`NotAUnit`) records no reference, full stop. Four new permanent pins in `member_access.rs`. **Re-verified 2026-09-01: all three original repros now pass; the live collision scenario (`bus_t` struct in A vs. unrelated `class bus_t` in B) answers `null`/`[]` over the release server, never B's member; the corrected live opentitan occurrence (`cip_base_scoreboard.sv:469`, `exp_alert.is_fatal`/`.max_delay`) now answers nothing; `item.a_addr` still resolves at the same timing; honest positives (owner's example, both file layouts, inherited `base_field`, out-of-body `address`, rename) unchanged byte-for-byte; corpus references 97 892 → 97 454 (−438 bogus postings removed), unresolved unchanged at 1 256. Gates: `cargo test -p vlog_semantic` 176/0/1, `-p lucisv_server` 1431/0/36, `--workspace` 2736/0/37, fmt/clippy clean. **Final QA verdict: SHIP.** - Round 2 (filed, not this round): chains `a.b.c` needing `Def::type_name` in the index; instance heads `u.port` via the module member table; struct-typed variables (`s.field`, needs §2.9-13 first); and a `base` field on `ReferenceFact` (another `FACTS_FORMAT` bump) so a use whose *only* handle on its declaration is the recorded base — `this.x`, `super.x`, a bare miss inside an extending class — gets an index posting too, and cross-file find-references lists it. Every use carrying a path, which is every `handle.member` tail, already posts. ### §15 round 2 — member chains and instance heads (2026-09-01) Rides on round 1's shape (`Symbol::type_name`, `Target::MemberOf`, `TypeHere`, `base_of`/`member_chain`). Same feature README, new round-2 section. Files: crates/vlog_semantic/src/{model.rs, bind.rs, resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/tests/ member_access.rs (+ others as needed), crates/lucisv_server/tests/ e2e.rs, docs/features/class-member-access/README.md, amendments in docs/features/vlog-semantic/README.md (rule 8), TODO.md §15 round 2. - [x] **`Def::type_name`** on indexed declarations (members and units' ports), same capture rule as `Symbol::type_name` (none on unpacked declarators); **`FACTS_FORMAT` 6 → 7**. - [x] **Chains `a.b.c`**: the tail carries the head's spelling plus the links before it (`Target::MemberOf { head, mids }`) rather than the inner tail's reference — the in-file walk hops declared type to declared type, and a chain that leaves the file arrives as **one composed path** (`item_t::hdr::addr`) in the existing path contract, which `follow_one` walks member by member. No new `Resolution` variant, and the index's own postings come free, so hover, cross-file references and rename cannot disagree. Any link that cannot be resolved honestly stops the chain. `item.hdr.addr`, `tb.dut_i.u_core.sig`. - [x] **Instance heads `u.port` / `u.internal`**: an instance symbol's type is its module (not for an instance array), and `type_here` already accepted a `Module` scope, so `u.port`, `u.internal_sig` and hierarchical tb paths resolve; `.*`/positional connections are unchanged. `a_hierarchical_name_resolves_only_its_head` flipped, old assertion kept for an untyped head. **Ruling against the plan: modules go on exporting ports and parameters only.** Exporting nets and vars costs +24 % of the corpus store (3 112 102 → 3 871 557 bytes) *and* makes a `.port` connection resolve to the module's internal net — a wrong answer (`an_internal_net_of_another_module_is_not_reachable` fails). Separating the two lookups is a workspace-index decision; left for the lead with the numbers. `u.internal_sig` resolves in-file. - [x] **Typedef alias chase**: `typedef c1 my_t; my_t h; h.x` follows the typedef's own `type_name` (in-file and, via `Def::type_name`, cross-file), visited-guarded; a typedef of a non-unit still records nothing (round-1 pins stay). Cross-file only for a file-scope typedef; one inside a package is filed. - [x] **`this.x`/`super.x` index postings**: a `base` on `ReferenceFact` so cross-file references from the declaration side list inherited-member uses (round-1 residue). `rename`'s `files_spelling` fan-out is deliberately unchanged; the rung-6 question it raises is filed in the feature README's Handshakes. - [x] **Pins**: two- and three-link chains in-file and across three files (both index orders); a chain broken by a struct link records nothing past the break, including against a same-named class elsewhere; a chain through an inherited member; instance port, parameter and internal signal through a module in another file; hierarchical tb path in one file and across two; alias one and two hops; alias cycle; ambiguous hop; record round-trip and every index mutation; e2e hover/definition/references/rename on a chain's third link and hover on an instance port. - [x] **Filed, fixed by the lead**: `crates/vlog_refactor/tests/ rename.rs:818` `a_hierarchical_tail_is_left_alone_and_named_as_such` pinned round 1's truth — a rename of `sig` leaves `u_sub.sig` alone and warns. Round 2 resolves that tail, so the rename correctly edits it; the pin was stale. The lead split it into `a_hierarchical_tail_that_resolves_is_renamed_with_its_declaration` (resolves, is edited) and `a_hierarchical_tail_that_cannot_resolve_is_left_alone_and_named_as_such` (unknown module: left alone, correctly, but the old `stray_reason` warning no longer fires — the tail now carries an `ExternalCandidate` the workspace cannot answer, which is neither an edit nor a warning today). The rename engine needed no other change. The lost warning is filed as `docs/topo.md` §2.9-20, not a REWORK item — the edit behavior itself is correct in both directions. - [x] **QA on opentitan DV/RTL** (read-only, 2026-09-01): real chains in `hw/ip/aon_timer/dv/env/aon_timer_scoreboard.sv:496` (`cfg.m_tl_agent_cfg.vif.h2d.a_valid`, a class-parameterized `cfg` — head resolves, every link past it correctly answers nothing per the no-elaboration assumption) and `hw/ip/uart/dv/env/uart_scoreboard.sv:195` (`ral.ctrl.tx`, `ral` typed `RAL_T` — same shape, same correct "nothing"); a hierarchical tb path `hw/ip/uart/dv/tb/tb.sv:84` (`dut.uart_core.rx_sync` — `dut` resolves, `uart_core` is an instance of `uart` in another file and answers nothing cross-file since a module exports ports/parameters only, `rx_sync` (an internal signal two hops deep) likewise); the round-1 positive case re-verified (`item.a_addr` → `tl_seq_item.sv:45`, cross-file, ~35-42 ms including RPC/parse) and the round-1 negative case re-verified (`exp_alert.is_fatal` / `.max_delay` against the real non-macro line, `cip_base_scoreboard.sv:469` — both still answer nothing; no coincidentally-named external unit). **15 probes, zero wrong answers.** Store: `FileFacts::of` + `encode()` over all 3979 `.sv`/`.v`/`.svh` files, trunk (v0.22.0, `91b7c2f`, detached worktree) vs this tree: 30 821 130 → 35 440 798 bytes (**+4 619 668, +15.0%**), matching the internal 860-file corpus's own +15.4% closely; read time ~1.8 s both trees (noise-dominated, no regression). `git -C opentitan status --short`: only the three pre-existing owner files, untouched by this QA pass. Diagnostics: not independently re-measured this round — `vlog_parser` and `vlog_linter` are outside this round's diff (confirmed by `git diff --stat`), and diagnostics are produced from parse/lint alone, so they structurally cannot move; round 1's own before/after measurement already stands for the shared code paths. ## 16. Interface semantics wave (2026-09-01) — coverage_gaps C2/H2 Interfaces are `SymbolKind::Module` (hover labels them "module"); modports and clocking blocks declare no symbol and the signal names inside them are not references; `is_exported(Module, ·)` passes ports and params only, so `vif.sig` through a `virtual my_if vif` handle resolves in-file but never across files (H2). `virtual my_if.mp vif` already records `type_name = my_if` (the modport half is dropped); `b_if.mp` in a connection resolves nothing (the C2 "wrong answer" was the head's "module" label, re-probed against HEAD). Delivers topo §2.9-7. Single lane. Files: crates/vlog_semantic/src/{model.rs, bind.rs, resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/ tests/* (+ new interfaces.rs), mechanical kind arms in crates/lucisv_server/src/{symbols.rs, hover.rs, tokens.rs, completion.rs, candidates.rs, type_def.rs, design_hierarchy.rs, hierarchy.rs} and crates/vlog_refactor/src/{ports.rs, instantiate.rs} (Module-only filters widened to Module|Interface so behavior is unchanged), crates/lucisv_server/tests/e2e.rs, docs/features/interface-semantics/README.md (new), amendments in docs/features/{interfaces, ansi-first-port, type-definition, class-member-access}/README.md, TODO.md §16. - [x] **`SymbolKind::Interface`** for `interface … endinterface` (`program` stays `Module` this round, documented). Every Module-exact match gains the arm (resolve.rs `Target::Module`/ `Target::Port`/`container_scope`/`member_scope`, workspace `is_unit`/`counts`, facts `kind_name`/`kind_of`, server labels and LSP kinds — hover says "interface", `SymbolKind::INTERFACE` / `CompletionItemKind::INTERFACE`); interfaces stay in the module table, the design hierarchy and code lens (an interface instance is an instantiation edge) — pinned unchanged. - [x] **Export rule for interfaces**: `Net | Var | Port | Param | Typedef | Function | Task | Modport | Clocking` — an interface's signals ARE its surface, so the module ruling (ports/params only) does not apply. `vif.sig` and `vif.cb.sig` resolve cross-file. - [x] **Modport symbols**: `SymbolKind::Modport` declared in the interface scope from `ModportDecl.name_span`; each modport port name / `import`/`export` name / `clocking cb` name becomes a reference to the interface's signal, method or clocking block; `b_if.mp` (connection) and the `.mp` half of an interface-typed port or `virtual my_if.mp` type resolve to the modport (bound as a member of the type in `bind_data_type`, where ansi-first-port said "the tail is where to bind them"). Hover shows `modport mp (…)`. - [x] **Clocking block symbols**: `SymbolKind::Clocking` for named blocks, with `type_name` = the enclosing interface's name so `vif.cb.data` hops cb → interface → `data` through round 2's machinery unchanged (the clocking signal aliases the interface signal; answering the signal's declaration is honest); each `ClockingSignal.name` is a reference to the interface signal (and `= expr` values bind as expressions). - [x] **`FACTS_FORMAT` 7 → 8** (new kinds; older stores discarded). - [x] **Pins**: kind flips in tests/workspace.rs (`an interface is a Module symbol` → Interface); modport/clocking symbols and references in-file and cross-file; `vif.sig`, `vif.cb.sig`, `virtual my_if.mp vif; vif.sig`, `b_if.mp` hover/definition; rename of an interface signal rewrites its modport list, clocking block and `vif.sig` uses (e2e); the refactor test `renaming_the_modport_half_of_a_port_type_is_refused` is re-examined by the lead at merge (a modport is a symbol now — renaming it should rename its type-position uses). - [x] **QA on opentitan DV** (read-only) — 2026-09-01, verdict SHIP. 17 probes over the real server (cfg.vif.* class-parameter chains, `vif.cb.scl_i` genuine cross-file resolution in `i2c_monitor.sv`, modport/clocking hovers in `uart_if.sv`/`tl_if.sv`, interface instance hovers in `tb.sv`): zero wrong answers, sub-ms hover (cold and warm). Store: index-cache +0.81% (31 949 117 → 32 208 241 bytes); cold scan 3 976 files unchanged at ~3.0s; diagnostics 0→0 on 5 DV files with interfaces. Full table in `docs/features/interface-semantics/README.md`'s QA log. ## 17. Struct members wave (2026-09-01) — coverage_gaps H1 + topo §2.9-13 `typedef struct packed {…} bus_t; bus_t s; s.field` records nothing. Mapped state: `SymbolKind::StructMember`/`ScopeKind::Struct` exist and the struct scope already hangs on the Typedef symbol's `child_scope`; every member declarator has a name span and its own `DataType`; the `MemberOf` pending use exists. Missing: `resolve.rs::member_scope` excludes `Typedef` (the whole in-file gap); members are declared with `declare`, not `declare_typed` (no `type_name`, so no nested hop); `is_exported` has no `Typedef` arm (no cross-file `Def`s); anonymous aggregates (`struct {…} s;`, `enum {A,B} x;`, inline nested struct members — the opentitan register-package shape) produce no symbols because `ty.name` is empty. Single lane. Files: crates/vlog_semantic/ src/{bind.rs, resolve.rs, workspace.rs, facts.rs, model.rs if a field is needed}, crates/vlog_semantic/tests/* (+ new struct_members.rs), crates/lucisv_server/src/type_def.rs (member-type descent, small), crates/lucisv_server/tests/e2e.rs, docs/features/struct-members/ README.md (new), amendments in docs/features/{types-decls, vlog-semantic, class-member-access}/README.md, TODO.md §17. - [x] **In-file**: `member_scope` accepts a `Typedef` whose child scope is a `Struct` scope (unions included — one node); struct members declared with `declare_typed` so `s.hdr.addr` hops through a member's own type; an alias of a struct typedef follows to it; enum/int-alias typedef heads still record nothing (`.name()` etc. are built-ins); the in-file struct answers in-file — never a stranger class of the same name elsewhere (round-1 pin stays). - [x] **Cross-file**: `is_exported(Typedef, StructMember)`; members of a struct typedef nested in a package land under the typedef's bare name like nested classes do (collisions across packages → the existing ambiguity refusal, documented); `Def::type_name` on members; `pkg::bus_t s; s.field` from another file. - [x] **Anonymous forms (§2.9-13)**: `enum {A,B} x;` declares its variants in the enclosing scope exactly like a typedef enum; an anonymous `struct {…} s;` gives the declarator a `Struct` child scope with its members, and `link_type` follows a head symbol's own child scope when it has no type name; an INLINE nested struct member (`struct packed { struct packed {…} q; } reg2hw_t;`) gets a child scope in-file and, cross-file, its inner members exported under a synthesized key `reg2hw_t::q` carried as the member's `Def::type_name` — so `reg2hw.ctrl.q` walks `reg2hw_t` → `ctrl` → `reg2hw_t::ctrl` → `q` without bare-name collisions (`q`/`d`/`qe` are everywhere in register packages). Cross-file anonymous *variables* (`pkg::cfg.f`) stay in-file only, documented. **Done 2026-09-01, one deviation**: the synthesized key joins with a **`.`**, not `::` — `member_type` calls `last_segment` on a `Def::type_name` before using it, so `reg2hw_t::ctrl` would have collapsed back to the bare `ctrl` the key exists to avoid. A `.` survives it whole and is unwritable as a type name. Argued in `docs/features/struct-members/README.md`. - [x] **`FACTS_FORMAT` 8 → 9**. - [x] **type_def.rs**: `typeDefinition` on a struct member's type name inside the body (descend into `TypedefKind::Struct` members). - [x] **Pins to flip/keep**: `a_struct_typedef_typed_head_records_nothing` → resolves; `an_alias_of_a_struct_records_nothing` → follows; `a_chain_broken_by_a_struct_link_records_nothing_past_the_break` → continues; `a_local_typedef_is_never_looked_up_in_a_same_named_class_elsewhere` stays (answers the struct's own field); enum/int-alias pins stay; rename of a struct member rewrites `s.field` uses in-file and cross-file (the existing declaration-only rename pin grows uses); corpus: unresolved must fall or hold, store delta reported. **Done 2026-09-01**: the cross-file half of `a_chain_broken_by_a_struct_link_...` stays a *refusal* (two `hdr_t` in the workspace — deviation argued in the feature README); every other pin landed as briefed. `vlog_refactor`'s existing declaration-only rename pin keeps passing untouched; the new cross-file use rename is pinned in this lane's own e2e. Corpus: unresolved **1 203 → 1 162**, unplaced 0, store **3 216 689 → 3 179 905 bytes (−1.14 %)** while indexed members grew 12 298 → 12 642 — the anonymous-enum variants turn external postings into local ones. `cargo test --workspace`: **2 810 passed, 0 failed, 38 ignored**; fmt clean, clippy zero warnings, smoke OK. - [x] **QA on opentitan** (read-only): `reg2hw..q` / `hw2reg..d` / `.de` in hw/ip/*/rtl/*.sv against the generated `*_reg_pkg.sv` (cross-file, nested inline structs); `tl_i.a_address`-style struct-typed ports; DV struct members; sub-ms hover; store delta (register structs are large); zero wrong answers. **Done 2026-09-01, verdict SHIP**: 28 probes across 6 IPs (uart, spi_device, aes, i2c, usbdev, tlul) plus one DV file — 23 resolved correctly (three planted sibling-name acid-test pairs hand-verified against `*_reg_pkg.sv`: i2c `rxfull`:546/`fmtfull`:549, usbdev `avsetup_rst`:417/`avout_rst`:420, spi_device `tpm_csb`:481/`csb`:484 — never the wrong sibling), 5 misses all the same pre-existing documented indexed-mid-chain limitation (`reg2hw.key_share0[i].q`, unrelated to struct-members — confirmed by three other AES chains through the same wildcard-imported type answering correctly with no index). Zero wrong answers. Hover/def 0.00–0.52 ms (first request pays warm-up, rest sub-ms). Cold scan 3 976 files: trunk `95f930c` 3 543.79 ms → this tree 3 925.48 ms. Opentitan on-disk index-cache: 32 208 241 → **33 583 533 bytes (+4.27 %)** — the predicted-direction gain from real `*_reg_pkg.sv` files, opposite of the synthetic corpus's −1.14 %. Diagnostics 0→0 on all 7 opened files. `git -C opentitan status` unchanged. Full table in `docs/features/struct-members/README.md`'s QA log. - Follow-on lane (filed): **member completion after `.`** — no dot context exists in completion.rs today; with member resolution in place, `item.` / `reg2hw.` / `vif.` listing members is the natural next DV/RTL daily driver. ## 18. Member completion wave (2026-09-01) — the DV/RTL daily driver `item.` / `reg2hw.ctrl.` / `vif.` / `vif.cb.` / `pkg::` / `this.` / `super.` list members. Mapped state: `typed_word` already yields an empty word with an empty replace range right after `.`/`::`, so today the cursor after a dot gets the whole-index dump (scope + index + 181 keywords + every project word, capped at 512, `isIncomplete`) — that is what this lane replaces; no dot/scope context exists anywhere in completion.rs; `trigger_characters: None` (main.rs:284, two pins); `WorkspaceIndex::members_of(unit)` is `pub`, documented for `pkg::` and uncalled, but omits inherited members; every chain-resolving helper (`resolve::member_of` prefix, `link_type`, `type_here`, `member_chain`, `member_type`, `aliased_unit`) is private. Single lane. Files: crates/vlog_semantic/src/{lib.rs, resolve.rs, workspace.rs} (public API only — one walk, no second resolver), crates/vlog_semantic/tests/*, crates/lucisv_server/src/{completion.rs, main.rs} (+ server.rs only if context plumbing is needed), crates/lucisv_server/tests/e2e.rs, editors/vscode/smoke.js (optional pin), docs/features/member-completion/README.md (new), amendment in docs/features/completion-core/README.md (the "every other tier ignores position" sentence; the stale five-row tier table), TODO.md §18. - [x] **Public prefix walk in `vlog_semantic`**: `Semantics::member_site (from, head, mids) -> Option` — the prefix of `resolve::member_of`, which is refactored to call it (one walk); `WorkspaceIndex::members_of_chain (unit) -> members incl. inherited/aliased`, walking the same `member_chain` hops nearest-first with subclass-overrides-base dedup, and `WorkspaceIndex::member_unit(unit, member)` (= `member_type`) to fold mids cross-file; an in-file class whose `extends` leaves the file merges its scope members with the chain's cross-file members. - [x] **`Word` learns its separator**: `.` or `::` immediately before the run, plus the head spine (`a.b.c` identifiers, balanced `[…]` index suffixes stripped so `q[i].` works; anything else → no head). `this.`/`super.` map to the class scope / its base chain. - [x] **Exclusive member tier**: with a separator, the answer is the members of the site and nothing else (kind from `completion_kind`, detail = kind label + declared type, table-only — no file reads), prefix-filtered below 3 typed chars and fuzzy from 3 (the house rule), `isIncomplete` only when the list is truncated; an unresolvable head answers **nothing** (no popup) instead of the 512-item dump. `pkg::` lists the package's members; `cls::` its static-visible members. - [x] **Triggers**: `trigger_characters: [".", ":"]` (the two main.rs pins updated); the handler decides from the buffer, not the trigger context; a lone `:` (label/ternary) falls through to ordinary completion unchanged. - [x] **Pins**: class in-file and cross-file with inherited members from a base in another file; struct fields incl. nested via synthesized key (`reg2hw.ctrl.`); interface signals + modports + clocking (`vif.`, `vif.cb.`); `pkg::`; `this.`/`super.`; typed prefix after the dot filters; the edit range is empty at the cursor; unresolvable head → None; absent base stops the chain but the known members still list; e2e over the wire with the trigger character; the two-to-three-char rule after a dot. - [x] **Connection and parameter lists** (lead ruling 2026-09-02, taken as rework inside this lane rather than filed): a `.` inside `sub u (...)` lists the module's **ports** and a `.` inside `sub #(...)` its **parameters** — in-file through `Semantics::instantiable_scope` (the call `Target::Port` itself makes), across files through the index's member table, which exports exactly those two kinds. The list is `signature.rs`'s own `enclosing_list`, lifted to `pub(crate)` so the popup and the signature card above it cannot disagree; already-connected names are dropped; a module nothing declares answers an empty list and a `.` in no list at all answers nothing — never the whole-index dump. Two shapes stay filed (an unpacked array head, cross-file `pkg::cls::`) in `docs/features/member-completion/README.md`. - [x] **QA on opentitan** (read-only): `item.`, `cfg.`, `reg2hw.`, `reg2hw..`, `vif.`, `vif.cb.`, `tlul_pkg::`, `this.` in real DV/RTL buffers — member lists complete (cross-check a sample against the declaring file), inherited members present for known bases, sub-ms answered-in, no whole-index dump after a dot anywhere; zero wrong members. **2026-09-02 QA: 15 probes run, all member/scope/interface/package lists exact-matched their declaring files, zero dumps — REWORK finding on the parameter-list half: a `localparam` inside a module's `#(...)` header (e.g. `hw/ip/prim/rtl/prim_fifo_sync.sv`'s `DepthW`, ~79 files in `hw/ip/*/rtl` alone use the idiom) is offered by `#(.` as if overridable — root cause `bind_param_ports` in `vlog_semantic/src/bind.rs` (out of this lane's file scope; `ast.rs` already carries `ParamPort.kw` to distinguish it). See the QA log in `docs/features/member-completion/README.md`. **2026-09-02 re-verification (SHIP): `SymbolKind::LocalParam` fix confirmed live on the original repro plus 3 new real sites in 3 other IPs (usbdev, spi_device, hmac/tlul) — zero strangers; sticky rule holds under a two-run header, a generate-block body and an interface header; empty-answer `isIncomplete` and the corpus fingerprint sweep (172 files, 30 mutation checks) both hold; 2887/0/38 over 40 binaries. Full re-verification log in `docs/features/member-completion/README.md`. - [x] **`localparam` is its own `SymbolKind`** — QA's rework finding, fixed at the root on the lead's ruling (2026-09-02). `bind.rs` never read `ParamPort::kw`, so every `#( … )` header entry *and* every body `localparam` was bound as `SymbolKind::Param`. Added `SymbolKind::LocalParam`, bound from the keyword with the **sticky** continuation rule `vlog_refactor::instantiate::params` had always applied — so the two layers now agree because they read the same field the same way. `FACTS_FORMAT` **9 → 10** (an older store calls every localparam a `param`, a wrong answer rather than a stale label). Every site that matched `Param` decided explicitly (table in the feature README): a localparam is exported, hovered, iconed and highlighted exactly as a `Param`, and `u_fifo.DepthW` still resolves; the only behavioural difference is that a `#(.` list offers `Param` **only**. The popup and `instantiation_plan` are now pinned against each other, and hover says "localparam" where it used to say "parameter" over a `localparam` declaration. QA finding 2 (a cold cross-directory request answering empty before the scope ladder widened) is documented as `index-scope`'s ladder, with one change: an empty member answer is now always `isIncomplete`, so the client comes back instead of caching the emptiness. ## 19. Escaped identifiers wave (2026-09-02) — owner report `wire \my-signal ;` was rejected outright: *verification failed: token stream diverges … input has identifier `\my-signal` … output has identifier `\my-signal;`*. An escaped identifier ends at the next whitespace and at nothing else (IEEE 1800-2017 §5.6.1); the lexer stops the token before that whitespace (correct), and the formatter then printed every name bare, so the following `;`, `(`, `,` or `:` was swallowed into the name on re-lex. Nothing was ever corrupted — the safety net refused the file — but no design carrying an escaped identifier could be formatted at all, which is every Vivado netlist (`\u_x/y_reg[3] `, `\gen[0].u `). Zero formatter or lexer tests existed with an escaped identifier. Single lane; `verify.rs` untouched (invariant 4). Files: crates/vlog_formatter/src/format.rs, crates/vlog_formatter/tests/cases/escaped_identifiers.cases (new), crates/vlog_formatter/tests/verification.rs, crates/vlog_parser/src/lexer.rs (tests only), docs/features/escaped-identifiers/README.md (new), TODO.md §19. - [x] **One choke point**: `format::named(&str) -> String` (plus `name_doc`, its `Doc` twin) appends the terminating space when the string ends inside an escaped name; every name emission in `format.rs` — 50 sites, declarators through end labels, including each `format!` splice, `join_names` and `join_paths` — goes through it. The audit list lives in the helper's doc comment. The predicate is `ends_escaped`, not `starts_with('\')`, because several names arrive as already-joined composites (`a.\b`, `pkg::\x`, a `bind` head) — the same rule `vlog_refactor::instantiate` already carries. - [x] **End of line**: the helper always writes the space; the printer's existing trailing-space trim (`newline`, `BlankLine`, `render` at EOF) removes it before a break, which terminates the name by itself. No `printer.rs` / `doc.rs` change. Both shapes pinned idempotent. - [x] **Attack pairs** in `tests/verification.rs`, `verify.rs` untouched: `\a;` glued, the space before a connection's `(` dropped, two escaped names merged (`\a \b` → `\a\b`), the same glue inside a class body, a label glued to what follows it — all rejected; plus the flip side, that writing the space is a whitespace-only difference. - [x] **Cases**: `escaped_identifiers.cases`, 18 live cases — declarators, ANSI/non-ANSI ports, package/interface/class/module names with end labels, typedefs, enum members, struct fields, instances and connections, hierarchical and scoped expressions, generate/block/fork/statement labels, `disable`, `foreach`, modport, clocking, imports, `let`, `defparam`, case labels, an aligned group, a broken connection list, an out-of-class method, a Vivado-style netlist fragment, and an escaped type name inside an aligned port group. - [x] **Lexer pin**: the token extent excludes the terminating whitespace (`src[span] == text`), a tab terminates, `\a;` is one identifier, and a name may end the file. - [x] **Corpus**: 813/820 held, and neutral by construction — every backslash in the 860 corpus files is inside a string literal or a comment, so no corpus file reaches the new branch. Same for the read-only opentitan sweep (13 failures, all parse/lex, zero verification errors). - [ ] **Follow-up for a parser lane**: `Parser::parse_scoped_name` joins `pkg::name` into one `String`, losing the boundary, so a `\my-pkg ::\state-t` type (or instantiated module, or `bind` target) is still rejected by the net — an error, never a corruption. Keep the segments. Recorded as the file's one `#SKIP` case and as `an_escaped_name_in_a_scoped_type_is_rejected_rather_than_corrupted`. - [x] **QA (2026-09-02)**: gates clean (fmt, clippy 0, tests 2819/0 after one QA-added attack pair, corpus 813/820 unchanged); scope matches the file list above exactly, `verify.rs` confirmed absent from the diff; 23 additional corruption-hunt shapes beyond the `.cases` file (punctuation after a name, adjacent names, EOF, comments, `` `define ``/macro args, `bind`, `defparam`, `import`, struct/enum members, implicit connections, instance arrays, hierarchical paths, CRLF) all formatted correctly and idempotently, with the one rejection being exactly the filed scoped-name gap; added `a_space_dropped_before_a_scope_operator_is_rejected` to `verification.rs` to close a gap in the attack-pair coverage (dropped space before `::`, confirmed rejected); opentitan `--check --no-cache` failure/would-reformat/unchanged sets byte-identical between this worktree and a trunk `v0.25.0` build (3869/97/13, same 13 files); opentitan `git status` unchanged (3 pre-existing owner files only). **QA verdict: SHIP.** Full log in the feature README's QA log. ## 20. Constraint bodies wave (2026-09-02) — coverage_gaps C1, round 1 Constraints (`constraint c { … }`, `constraint C::c { … }`, `randomize() with { … }`) are opaque verbatim: no name span (the parsed name is discarded, parser.rs:1895), nothing inside binds, so a rename of a class property leaves `constraint c { user_id < 5; }` untouched with only a generic "cannot attribute" warning — and none at all when the file got no other edits. Covergroups are round 2. Design: `ItemKind::Constraint { scope, name, name_span, body }` with `ConstraintBody::{Items(Vec), Verbatim(RawText)}` — the structured parse is attempted first and a body that does not fit the grammar REWINDS to today's verbatim capture (tolerant by construction; the opentitan sweep must not move); `ConstraintItem::{ Expr { soft, expr }, Dist, Implication { cond, block }, IfElse, Foreach { var(s), array, block }, SolveBefore, Unique, DisableSoft }` with `ExprKind::Dist { expr, weights }` added to the expression parser (`dist`, `:=`, `:/`); `WithConstraint.block` gains the same body type. Formatter: canonical layout (one constraint item per line, nested blocks indented, `dist` weight lists broken like connection lists) — the classes README's "no layout convention worth inventing" is superseded by ruff-style canonical layout now that the bodies are navigable; `verify.rs` untouched, the existing constraint attack pairs re-derived for the new layout plus new ones (dropped `soft`, swapped `:=`/`:/`, reordered solve-before). Binder: constraint name is a `SymbolKind::Constraint` in the class (or a stand-in scope for the out-of-class form, as class-member-access did for methods); every identifier inside binds lexically in the class scope (`this.` implicit), `foreach` loop vars declare in a constraint-local scope; so rename/references/hover reach inside. Linter: `visit.rs` descends; `signals.rs` stops routing constraints to `opaque_spans`. Blast radius: format.rs, bind.rs, spans.rs arms + visit.rs real arm. Files: crates/vlog_parser/src/{ast.rs, parser.rs, token.rs (dist/ soft/solve/before keywords — grammar lock: editors/vscode/syntaxes + tests/grammar.rs)}, crates/vlog_parser/tests/spans.rs, crates/vlog_formatter/src/format.rs, crates/vlog_formatter/tests/ cases/constraints.cases (new) + classes.cases/out_of_class_ constraints.cases rewrites, crates/vlog_formatter/tests/ verification.rs, crates/vlog_semantic/src/{bind.rs, model.rs, workspace.rs (export), facts.rs (FACTS_FORMAT 9 → 10)}, crates/vlog_semantic/tests/*, crates/vlog_linter/src/{visit.rs, signals.rs}, crates/lucisv_server compile-fix arms + e2e, docs/ features/constraint-bodies/README.md (new), amendments in classes / out-of-class-constraints / dv-statements / class-semantics READMEs, TODO.md §20. Runs AFTER §19 (both touch format.rs/verification.rs). - [x] parser + fallback · [x] formatter layout + attack pairs · [x] binder + facts · [x] linter descent · [x] pins incl. rename of a property used in a constraint (in-file, cross-file) · [x] QA on opentitan DV (read-only): sweep unchanged at 11, constraint bodies in hw/dv/sv sequence items format canonically and round-trip, rename of a rand field rewrites its constraint uses, hover inside a constraint. QA, 2026-09-02: verdict **REWORK**. Gates green (41 binaries, 2,944 passed incl. 2 new attack pairs), corpus 813/820, opentitan 48 DV files / 16 IPs read-only-swept — 48/48 idempotent, comment streams byte-identical input↔output, checkout untouched. Fallback exactness confirmed on a real file (`aes_message_item.sv`). Semantics/linter tests read and green. Finding: a comment placed immediately after `soft`, `dist`, `disable soft`, or around `solve`/`before` — the round's own four text-matched keywords — is dropped from the AST; `format_source`'s safety net catches it every time (file refused, never corrupted; not a widened-forgiveness bug) but the file cannot be formatted at all, a regression from v0.26.0's verbatim capture. `Implication`/`If` got explicit comment fields for their own new joints (`->`, `else`); these four did not. Full repros and the fix direction in the feature README's QA log. Closed a checklist-flagged gap in `verify.rs`'s attack pairs (dist weight reordered, `soft` moved to another item) with two new tests, confirmed failing before and passing after. Dev, 2026-09-02: `ItemKind::Constraint` + `ExprKind::Dist`, structured body with an exact rewind-to-verbatim fallback; canonical layout; `SymbolKind::Constraint` / `ScopeKind::Constraint`, out-of-class stand-in scope, `randomize() with` bound against the randomized object (`Target::InlineConstraint`); `FACTS_FORMAT` 10 → 11 (not 9 → 10 — member-completion had already taken 10). Four words are matched by **text**, not reserved, so `token.rs`, `pairs.rs` and the editor grammar are untouched — argument in the feature README. OpenTitan `hw` (3,975 files, read-only `--check`): failure set **unchanged**, 1,993 of 2,009 constraint declarations parse structured (16 fall back: 10 macro-item bodies, 6 non-LRM shapes), 13 of ~122 `with` blocks fall back (mostly `local::`). Corpus gate 813/820, 0 verification errors; 37 of 860 corpus files change layout, all verified. Dev rework, 2026-09-02 (QA HIGH: a comment after any text-matched word was dropped, so `format_source` refused the file). Fixed by giving every keyword and punctuation position this round introduced a named comment field — 14 of them — plus two rules that keep one owner per gap (`ConstraintItemKind::takes_semi`, `Parser::gap_before`). Found and re-verified with an exhaustive gap fuzzer (insert a comment into every inter-token gap of 15 fixtures = 358 gaps) diffed against a v0.26.0 worktree run over the *same* constructs written outside a constraint: **96 regressions → 40**, and all 40 remaining are in five shared functions (`take_member_prefix`, `parse_method_name`, `parse_foreach_target`, index expressions, `inside`/value ranges) that fail identically on v0.26.0 — filed, not fixed. All six QA repros plus 56 unnamed slots fixed. Parse of comment-free source unchanged: opentitan counts and the 1,105 tolerant diagnostics are identical to v0.26.0, failure set still 12. QA re-verification, 2026-09-02: verdict **SHIP**. Gates green (41 binaries, 2,950 passed, 0 failed — matches dev exactly), corpus 813/820. All six original repros now format, are idempotent, and round-trip comments byte-for-byte. Independently re-derived the fuzzer claim on 3 fresh fixtures (dist-heavy, nested if/else-if/ foreach, out-of-class `pkg::cls::c`): 150 gaps, 36 failing, all 36 classified by testing the equivalent non-constraint construct on a v0.26.0 worktree — 21/21 also fail on v0.26.0, so **zero new findings, zero constraint-bodies-specific regressions** (four of the nine failure shapes weren't in the dev's five-row table — class/ package header names, a bare `rand`/`int` gap, an array-dimension declarator — but each reproduces on a plain declaration with no constraint at all). Opentitan: 48/48 files re-swept idempotent with identical comment streams; `--check` over the full tree now shows 13 failures (not 12) but the set is byte-identical between this build and a fresh v0.26.0 build on the same checkout — the drift is the owner's `ast.sv` edits evolving between QA passes, not a regression; checkout confirmed untouched otherwise. `verify.rs` still untouched; both QA-added attack pairs still present and green. Full tables in the feature README's QA log. ## 21. Covergroup bodies wave — §20 round 2 (planned 2026-09-02) `covergroup … endgroup` is still a flat token scan into `ItemKind::Verbatim` (parser.rs `parse_covergroup`: header, `with function sample(...)`, coverpoints, bins, crosses, options and the `endgroup : g` label all inside `RawText`); no name span, nothing inside binds, so a `rand` field's rename leaves `coverpoint addr` untouched and coverpoint names are unreachable. Same shape as §20: structured attempt with the `Rewind`-to-verbatim fallback (character- for-character v0.26.0 capture), no keywords reserved (`coverpoint`, `bins`, `cross`, `binsof`, `intersect`, `wildcard`, `ignore_bins`, `illegal_bins`, `option`, `type_option` matched by text), canonical layout with the attack pairs re-derived, and a binder that declares `SymbolKind::Covergroup` + `Coverpoint`/`Cross`/`Bin`(?) symbols and binds every sampled expression to the class scope. Files: the §20 set minus nothing (ast/parser/spans, format.rs + cases, verification.rs, bind/model/workspace/facts (FACTS 11 → 12), linter visit/signals, server kind arms, e2e), docs/features/covergroup-bodies/README.md. - [x] AST: `ItemKind::Covergroup(CovergroupDecl { name, args, sample: Option, event: Option, items: Vec, end_label })`; `CoverItem::{ Coverpoint { label, expr, iff, bins: Option> }, Cross { label, items, iff, body }, Option { path, value }, Directive, Empty }`; `BinDecl { kind: bins|ignore_bins|illegal_bins, wildcard, name, array: Option, spec: BinSpec::{ Values(Vec), Transitions(Vec), Default, DefaultSequence, With(Expr), Binsof(Expr) }, iff }`. - [x] Parser with rewind fallback; `constraint_fallbacks` becomes a per-construct census. - [x] Layout: `covergroup g @(posedge clk);` header (`with function sample(...)` on the header), one cover item per line, `{ }` bin bodies like constraint sets, `endgroup : g` at the header column. - [x] Binder: `Covergroup` in the enclosing class/module scope with a child scope holding `Coverpoint`/`Cross` symbols (so `cg.cp` and `cross a, b` bind); sampled expressions bind lexically; the `sample()` args declare TfArg-like symbols visible in the body. - [x] Pins mirroring §20's (rename of a sampled field, comments in every slot, `binsof … intersect`, transition bins `(a => b)`, `default sequence`, `with (item % 2)`, wildcard bins, option assignments, `iff`, macro-body and non-LRM fallbacks byte-exact). - [x] QA on opentitan DV (read-only): every `covergroup` under hw/dv and hw/ip/*/dv (the fpv/cov files) round-trips idempotently with comments preserved; sweep unchanged; structured-vs-fallback census; rename of a coverpoint operand. **Dev, 2026-09-02.** Done, `docs/features/covergroup-bodies/README.md`. `ItemKind::Covergroup` with the `Rewind`-to-verbatim fallback; ten words matched by text and `token.rs` untouched; canonical layout; `FACTS_FORMAT` 11 → 12 with `SymbolKind::Covergroup`/`Coverpoint`/`Cross` and `ScopeKind::Covergroup`; `covergroup` left `on_type.rs`'s `OPAQUE`. The gap fuzzer was written *first* this time and ships as a test (329 gaps, 52 failing, every one classified against a non-covergroup analogue that fails too — `docs/topo.md` §2.9-22). OpenTitan `hw`: **544 covergroups structured, 0 fallbacks**, failure set and per-file tolerant diagnostics identical to v0.27.0, 81 files re-laid-out and verified, 87 DV covergroup files idempotent. Corpus 813/820, 0 verification errors, +1 139 references of which 1 135 are answered. `verify.rs` untouched; twelve new attack pairs anyway. **QA, 2026-09-02.** SHIP. All gates, the census (544/0 opentitan, 27/0 corpus) and the corpus resolution column reproduced exactly. Both shared- machinery guards (`at_postfix_segment`'s `[*/[->/[=` refusal, `no_with`) attacked directly and hold, including outside a covergroup and against a pathological nested `with ... with` (correctly falls back rather than mis-parsing). Independent fuzzer re-derivation on 3 fresh fixtures (340 gaps, 37 failing) found zero covergroup-bodies-specific regressions — all nine failing shapes reproduce on v0.27.0. 87/87 DV files idempotent, 87/87 comment streams equal (the one apparent mismatch is a pre-existing, non-covergroup block-comment reflow identical to v0.27.0). OpenTitan `hw` full sweep and this repo's `corpus/` both reproduced (13/13 and 7/7 failure sets byte-identical; 81 and 10 files re-laid-out, all covergroup-only). Gap found and closed: a dropped bin-array `[]` marker had no attack pin — added `a_dropped_bin_array_marker_is_rejected`. `cargo test --workspace`: 43 binaries, 3 010 passed, 0 failed. ## 22. Fragment mode + define continuation (2026-09-02) — coverage_gaps H4, corrected Mapped: class-body and module-item `.svh` fragments ALREADY parse (the file-scope item loop is the class-item loop). Three fragment shapes do not — a **statement list**, an **enum-member list** (`CUSTOM_1,` — riscv-dv's `riscv_custom_instr_enum.sv`, included between enum members), a **covergroup-item list** — and all three fail at one site, `parse_ident_item`'s "expected declaration or instantiation". Separately, `cip_base_vseq__tl_errors.svh` is NOT a fragment problem: its `` `define`` formal-argument list spans lines 8–9 with no backslash, which tools accept and lucisv's line-oriented directive lexing does not (lines 30–588 alone format today). The other opentitan residue is macro shapes (4 files — preprocessing decision) and one unbalanced source. Single lane. Files: crates/vlog_parser/src/{ast.rs, parser.rs, lexer.rs}, crates/vlog_parser/tests/spans.rs, crates/vlog_formatter/src/format.rs, crates/vlog_formatter/tests/cases/fragments.cases (new), crates/vlog_formatter/tests/verification.rs, crates/vlog_semantic/src/ bind.rs (+ facts only if a census changes), crates/vlog_linter/src/ visit.rs if an arm is needed, crates/lucisv_server compile-fix arms, docs/features/fragment-mode/README.md (new), amendments in docs/features/{define-table, lexer-cleanup, include-nav, error-recovery} /README.md, docs/coverage_gaps.md (H4 correction), TODO.md §22. - [x] **Fragment fallback**: when the FIRST file-scope item fails in `parse_ident_item`, rewind and try, in order, a statement list, an enum-member list, a covergroup-item list — each must consume the whole file to EOF to win; `SourceFile::fragment: Option), EnumMembers(…), CoverItems(Vec)}>` with `items` empty. A file that fits none keeps today's single error node (no cascade). Strict mode succeeds on a fragment (so `format_source` formats it). Existing loops become shared helpers (`parse_enum_members`, `parse_cover_items`, a statement-list helper) — one grammar, no copies. - [x] **Formatter**: a fragment prints at indent 0 through the existing statement / enum-member / cover-item printers; idempotent; `verify.rs` untouched; attack pairs (a dropped statement, a reordered enum member, a dropped trailing comma). - [x] **Binder**: statements bind in a file-level `Block` scope, enum members declare `EnumVariant`s at file scope, cover items bind their expressions; no index change unless the census needs it (argue; FACTS stays 12 if nothing new is exported). - [x] **Define continuation**: a `` `define NAME(`` whose formal argument list is still open at end of line continues the directive token until the `)` closes (balanced), no backslash needed; the macro body still needs backslashes. `DefineTable` records params as before. Pins in lexer.rs and define-table tests; `cip_base_vseq__tl_errors.svh` formats. - [x] **Pins**: each fragment shape formats and round-trips; a real class-body fragment still formats (regression); garbage that fits no shape → one error; a file that is a valid item list is never re-read as a fragment; the riscv enum fragment verbatim; comments in fragment slots; e2e: hover on an enum variant in a fragment file; diagnostics on a fragment file = 0. - [x] **QA on opentitan** (read-only; run by the dev and re-run by QA): sweep failures drop by exactly the two files (enum fragment + tl_errors.svh); nothing else moves; corpus `invalid-or-fragment` bucket 3 → 2; lint on the fragment files no longer silent. - [x] Correct `docs/coverage_gaps.md` H4 (dev). The clocking-wave README's "class body with no class" line is still the lead's. Done 2026-09-02 — `docs/features/fragment-mode/README.md`. Three deviations, argued in that work log: the trigger is "the first structural item failed" rather than the ident-item message (a keyword-initial statement fragment does not produce that message); each shape gets a freshly-lexed token stream rather than a `Rewind` (a `Rewind` does not restore the tokens' comment buckets); and the shape order is cover items → enum members → statements, narrowest first, because `cp: coverpoint a;` is a labelled declaration to the statement grammar. QA verdict SHIP with one MEDIUM, fixed the same day: the `` `define`` formal-list scan was quadratic on an *unclosed* list (20 000 lines took 2.5 s and grew with the square), so it is now incremental — `DefineParams` carries the paren depth and string/comment state across lines, with a `#[cfg(test)]` byte counter as the structural pin and a 20 000-line wall-clock pin. 20 000 lines: 2.504 s → 556.8 µs, and linear thereafter. Gates: fmt/clippy clean, `cargo test --workspace` 3 059 passed / 0 failed, corpus 814/820 (`invalid-or-fragment` 3 → 2, baseline bumped to 814), opentitan `--check` over `hw` 12 → 10 failures — exactly `riscv_custom_instr_enum.sv` and `cip_base_vseq__tl_errors.svh`, nothing else moved, and the set is byte-identical before and after the QA rework — and `smoke.js` OK. **QA, 2026-09-02.** SHIP. All gates reproduced exactly (45 binaries, 3 054/0, corpus 814/820, `invalid-or-fragment` 3 → 2 with `latch_map.v`/`testbench.v` the two survivors). Detection hunted with 27 false-positive attacks (directive/macro-then-item, only-includes, only-comments, empty, a leading `typedef enum`, an unwrapped class body, garbage, an unbalanced `begin`, both `UNIT_OPENERS` guards, the two documented "first construct is also an item" limits, shape-priority edge cases around `option`/`type_option`/bare commas) — zero misclassifications. Tolerant/strict parity re-attacked on 20 more shapes (`foreach`/`fork`/`case`/timing/`for`/`while`/`repeat`/`wait`/`disable` and more) — no second bug beside the dev's own `if/else` fix. Independent gap fuzzer (fresh Python tokenizer, 3 fixtures, 86 gaps, 29 failing) found 9 positions not in the dev's table (a `case` label's `:`, all 8 internal `for`-header positions) — all 9 reproduce identically on a v0.28.0 detached build outside any fragment, zero fragment-specific regressions. Opentitan sweep reproduced with the expected one-file live-checkout drift (13 → 11 here vs. the dev's 12 → 10; same two files moved, same phenomenon `constraint-bodies`/`covergroup-bodies` QA both logged); corpus lint byte-identical before/after (7 934 lines); both fixed files idempotent with identical comment streams; hover/diagnostics/outline e2e confirmed green. Semantics: 8 fragment tests read, plus an independent `WorkspaceIndex` `fingerprint`-equality check (`build` vs. `update_file`/`absorb`) over mixed fragment files — no drift, no panic. One small fix applied directly: `coverage_gaps.md`'s status table had this row's release column stale ("next"); corrected to `0.29.0`. **Finding, MEDIUM (performance, not correctness):** `define_params_open` (`lexer.rs`) rescans the whole directive from scratch on every line while a formal list stays open, making a pathological *unclosed* `` `define`` list quadratic — 2 000 never-closing parameter lines format in 0.10 s, 20 000 (10×) take 9.90 s (~100×). No corruption (the runaway directive prints back byte-for-byte, confirmed idempotent) and no hang in the literal sense, but a large real vendor file with one dropped `)` could read as one. Not blocking; filed for a follow-up (track paren/string/comment depth incrementally instead of re-deriving it). Dev reply, same day (not a follow-up — done): `define_params_open` is now `DefineParams`, an incremental scanner that carries the paren depth and the in-string / in-comment state across lines and walks only the bytes added since the last question. Reproduced first (31 ms at 2 000 lines, 2.504 s at 20 000 — 10× input for 81× time), then fixed and re-measured: 54.3 µs and 556.8 µs, with 200 000 lines at 6.08 ms — linear. Three pins, deliberately separated: an equivalence test against a from-scratch reference kept in the test module over 14 directive shapes, a **structural** pin using a `#[cfg(test)]` byte counter (it fails on a 42-byte fixture if the scan ever restarts — verified by reintroducing the regression by hand), and a 20 000-line wall-clock bound through `tokenize`. Workspace suite 3 059 passed / 0 failed; corpus, opentitan set (byte-identical to QA's sweep) and `smoke.js` all unchanged. See the `fragment-mode` README's work log. ## 23. Vendor & formal collateral grammar (planned 2026-09-02) — coverage_gaps M1–M3, L1/L2/L4/L5, corrected Evidence correction: the analysis's "13 corpus `checker` files" are UVM protocol-checker filenames/identifiers, not declarations. Measured declarations of `specify`/`specparam`, `primitive`/`table`, `checker`, `interface class`, `config`/`library`, `alias`, statement `expect`, `tagged`: **0 in the corpus, 0 in opentitan hw**. The one live use is `expect(...)` as a plain task call (40 sites) — so `expect` is matched by text (on_type.rs already does), never reserved. Value is completeness for vendored cell/IO/memory models and formal collateral, not measured pain; scope is kept to opaque leaves except where a real node is one arm. Files: crates/vlog_parser/src/{token.rs (+`checker`, `endchecker`, `config`, `endconfig`, `library` — measured 0 code-shaped collisions), parser.rs, ast.rs (StructType.tagged; ItemKind::Alias)}, editors/vscode/syntaxes/systemverilog.tmLanguage.json (the hand-edited alternation — tests/grammar.rs names any drift), crates/lucisv_server/src/{pairs.rs (+3 RULES rows: checker, config, table), on_type.rs (OPAQUE + specify/primitive/checker/config)}, crates/vlog_formatter/src/format.rs (Alias, tagged), tests/cases/ vendor_formal.cases (new), verification.rs, crates/vlog_semantic/src/ {bind.rs (checker/primitive names as instantiable symbols — argue), classes.rs (interface class collected), model.rs if a kind is added}, crates/lucisv_server/src/type_hierarchy.rs (`implements` supertypes), docs/features/vendor-formal-grammar/README.md (new), amendments in interfaces / type-hierarchy / editor-scopes / corpus-check READMEs, docs/coverage_gaps.md (M2 evidence corrected), TODO.md §23. - [x] Opaque scans via one `parse_opaque_block(open, close)` (the `parse_covergroup_verbatim` template): `specify…endspecify`, `primitive…endprimitive` (swallows `table…endtable`), `checker…endchecker`, `config…endconfig`; `SYNC_CLOSERS` gains their closers; `specparam` outside specify as a param-like item. - [x] `interface class … endclass` routed to `parse_class` with a kind marker; `ClassDecl.implements` already parsed — type hierarchy adds `implements` to `supertypes` (the two blocking pins flip); classes.rs collects it; `SymbolKind::Class` with an interface-class flag or a new kind (argue; FACTS bump if new). - [x] `alias a = b = c;` as `ItemKind::Alias(Vec)`; statement `expect (…) action;` text-matched into the concurrent-assertion verbatim path; `union tagged` flag on StructType (formatted); `tagged Valid 5` / `case … matches` left filed (pattern grammar). - [x] Pins: each construct formats + round-trips (opaque byte-exact), pairs/folding for the new pairs, grammar lock green, `expect(x);` as a task call unchanged (the 40-site regression guard), a module named `checker_x` unaffected; corpus 813/820 unchanged; opentitan sweep unchanged. - [x] **QA (2026-09-02)**: verdict **SHIP**. Gates reproduced exactly (fmt/clippy clean, tests 3 092/0/39, grammar lock green, corpus 814/820, release build + smoke.js OK, `verify.rs` untouched). Census re-derived independently (0/0/0 for config/library/checker across corpus + opentitan hw). Keyword- boundary, `expect`-disambiguation, opaque-block and unclosed-block attacks all landed as documented; gap-parity pin reproduced directly against `defparam`. Regression net (spiflash_tb.v, otbn tb.sv, rom_ctrl scoreboard) and a 30-file opentitan sample byte-identical against a trunk `c40e720` build; opentitan tree held only its 3 pre-existing owner files. One informational, non-blocking finding (pre-existing, confirmed on trunk too): an unquoted library wildcard path containing `/*` lexes as an unterminated block comment. Full log in the feature README's QA log. ## 24. Semantic lints on by default (planned 2026-09-02) — coverage_gaps M7 via topo §2.9-6 + §2.9-4 Mapped: `unused-signal`/`undriven-net`/`multiply-driven` ship off because a per-file analysis cannot see a signal read or driven from another file's hierarchy; `LintContext` has no workspace handle at all; the server has NO rule-selection surface (`lucisv.lint.*` absent, no `lint` key in lucisv.toml — §2.9-4), so on-by-default without an off switch is hostile; the CLI has no index. The index's `files_spelling` is name-only and misses hierarchy-root heads (`top.x` where `top` is not a local instance) and `bind` connections (§2.9-15); the server's `Candidates::per_file` word table is the textual census that catches everything but lives server-side only. Design: (1) **a per-file identifier census in `FileFacts`** (`words`: sorted, dedup'd `Ident` tokens incl. macro/directive words — the same harvest as `candidates::words_in`, lifted into `vlog_semantic` so there is one harvest) with `WorkspaceIndex::files_mentioning(name)`; this closes §2.9-6, gives §2.9-18's macro-argument census for free, and lets the server build its completion word table from facts instead of re-lexing at startup (TODO §10's deferred item). `FACTS_FORMAT` 12 → 13; store delta measured and ruled. (2) **`LintContext` gains a `MentionOracle`** trait (`mentioned_elsewhere(name) -> bool`); the server implements it over `files_mentioning` minus the current file; the CLI implements it over the job set (harvest words in the existing par_iter, then lint) — a single-file/stdin CLI run has no oracle. `unused-signal` and `undriven-net` say nothing when the oracle says yes (the false-negative-safe direction the in-file mention guard already takes). (3) **Default flip**: the three rules `default_on() == true` WHEN an oracle is present; without one (single-file CLI) they stay off — document the asymmetry. (4) **The off switch**: `[lint] select = […]` / `ignore = […]` in lucisv.toml (§2.9-4, CLI > config precedence) and `lucisv.lint.select/ignore` settings (package.json), both through the one settings parser; per-rule config left for later. Files: crates/ vlog_semantic/src/{facts.rs, workspace.rs, lib.rs, candidates harvest}, crates/vlog_linter/src/{context.rs, registry.rs, rules/{unused_signal, undriven_net,multiply_driven}.rs, rule_docs.rs} + .lint cases, crates/lucisv/src/{lint.rs, main.rs, args.rs}, crates/lucisv_core/src/ config.rs, crates/lucisv_server/src/{lint.rs, diagnostics.rs, settings.rs, candidates.rs (words from facts)}, editors/vscode/ package.json, docs/features/semantic-lints-on/README.md (new), amendments in semantic-lints / linter-core / index-persistence / completion-core READMEs, docs/site rules.md regenerated, TODO.md §24. - [x] words census + `files_mentioning` + FACTS 13 + store delta → `vlog_semantic::words` (the one harvest, lifted out of `lucisv_server::candidates`), `FileFacts::words`, `WorkspaceIndex::{files_mentioning, mentioned_outside}`. No inverted index: a linear walk over the per-file sorted lists, `files_spelling`'s own shape, argued in the feature README. The harvest splits macro invocations, directive lines and attributes into their words (QA finding, fixed the same day — the lexer hands each over as one token, so a signal a testbench names only inside `` `uvm_info(...) `` was not in the census); a quoted run inside such a token is a value and is skipped. Store delta **+16.9 %** on the corpus and **+15.0 %** on opentitan, both measured. This also delivers §2.9-18's macro-argument census as a substrate — rename can read `files_mentioning`; not wired here. - [x] `MentionOracle` in LintContext; server + CLI implementations → the server asks the index minus the buffer's own `FileId`; the CLI builds a census in a parallel pre-pass over the job list and subtracts each file's own harvest. A single-file or stdin run has no oracle. - [x] rules consult the oracle; default flip conditional on an oracle → `Rule::needs_workspace()` + `workspace_rules()` beside an unchanged `default_rules()`. `unused-signal`/`undriven-net` consult the oracle; `multiply-driven` cannot be wrong about a cross-file use and does not, but shares the default gate (argued). - [x] `[lint]` config key + `lucisv.lint.*` settings + precedence pins → `lucisv.toml`'s first table, per file, CLI-over-config key by key; `lucisv.lint.select`/`ignore` + `package.json`, with a republish (no rescan) when the selection changes mid-session. `[lint.]` is still open and is now named in the parser's error rather than ignored. - [x] completion word table from facts (startup re-lex retired) — argue or file if it does not fall out → retired. Two alternated A/B pairs on one machine, one line changed: a 667-file scan went 652.5 → 471.8 ms and 857.1 → 593.1 ms (−28 %, −31 %). TODO §10's deferred item. The completion table is the census minus one thing — a name the workspace `` `define``s, which the macro tier owns and offers by prefix only — filtered at the reader, not at the harvest, so `fuzzy-completion`'s ruling survives unedited. - [x] Pins: the QA two-file FP fixture from semantic-lints (README :500-541) no longer fires; corpus census before/after (the picorv32 debug-tap cluster should vanish where a testbench file reads them); selection precedence; every existing .lint case unchanged under `#select` → all four. Corpus: `unused-signal` 52 → 44, `undriven-net` 3 → 0, `multiply-driven` 0 → 0, **nothing added**; all eight silencings hand-checked and every one a whole-word false negative. picorv32's 33 debug taps stay (the corpus holds no testbench for them, verified by grep) and go to 31 the moment a testbench reads `uut.dbg_reg_x1`/`x2`. A new `#workspace` header in the `.lint` harness carries the on-by- default and silencing cases; the 163 existing cases are untouched. The macro-argument shape is pinned end to end (`a_signal_named_only_inside_a_macro_argument_is_not_reported_unused`), together with its inverse: a `"probe=%b"` format string does not silence a signal called `probe` in another file. - [x] QA on opentitan (read-only): `lucisv check` over hw with the rules on — opentitan is lint-clean under its own tools, so every finding is a suspect FP: hand-verify a sample of ≥30, report the FP rate by mode; server diagnostics on 10 RTL files; settings round trip over the wire; store/scan deltas. → dev's census over `hw` (3 947 files): `unused-signal` 10 in 6 files, `undriven-net` 4 in 2 files, `multiply-driven` 0. Fourteen findings is the whole sample there is; three were read against source and all three are true (`i3c_dat.sv:134`, `sha3pad.sv:776`, and `mm_ram.sv:124`, a real dangling signal read at lines 476/480 and assigned nowhere). QA owns the remaining eleven. → **QA, 2026-09-02**: re-ran `lucisv check --select unused-signal, undriven-net,multiply-driven hw` independently — same 14 findings, 0 files failed to check bar the one pre-existing `.tpl.sv` lex error. All 14 hand-verified TRUE (0% FP rate), the dev's three included: every declared name was grepped whole-word across the *entire* opentitan repo (not just `hw`), not just the census's own file set. 20 DV files under `hw/dv/sv` with `rand` fields read only in constraints/covergroups/ `with` blocks (`--select unused-signal,undriven-net`): **0 findings**. Full report and the oracle-attack table in `docs/features/semantic-lints-on/README.md`'s QA log — one real finding there: the census does not see an identifier used only as a macro invocation's argument (`` `uvm_info(id, dut.sig) ``-shaped), which contradicts this feature's own Assumptions section (\"a VPI probe named in a macro argument\" is claimed as covered but is not); did not manifest in any of the 14 opentitan findings or the corpus run. ## 25. Small-correctness residue (planned 2026-09-02) — §2.9-22, H5, M11, §2.9-20, §2.9-21 Mapped: comment "loss" is re-attachment — `bump` queues every comment and `take_meta` hands it to the NEXT node, so a slot with no field prints the comment one node later and the safety net (which compares comments too) refuses the file. Six fix families cover every filed slot: **G1** postfix segments (`.`/`::`/`[` branches of `parse_postfix_inner` — three bare `bump()`s beside a `(` branch that already keeps `CallComments`; `parse_foreach_target_inner` is a hand-copied duplicate of the same loop) → one `SegmentComments {before_open, after_open, before_close}` on Member/Scope/Index/Range and one shared loop; **G2** the `[a:b]` range grammar written three times (`parse_value_range`, the inlined `inside` copy, `parse_dims`) → one function with `RangeComments`, and `ExprKind::Inside` gets the `BinaryComments` its operator peers carry; **G3** `keyword (` headers (statement `if`/`case`/`foreach`, `@`, `#`) → the existing boxed `HeaderComments`; **G4** the gap before a statement's `;` → `Stmt.before_semi` + `StmtKind::takes_semi()` (constraint-bodies' "one owner of the `;`", widest blast radius); **G5** segment-preserving scoped names (`parse_scoped_name` joins a `String`) → `Vec` with per-`::` comments — closes §2.9-21 too (the escaped segment's space); **G6** per-construct fields: enum member `=`, sens-item edge keyword, `take_member_prefix`, `parse_label`, class/module header gaps, `parse_tf_ports` (the bulk of the covergroup count, 38 of 52). Plus three small fixes: **H5** `nav::definition` gains the macro branch hover already has (`DefineTable::latest` / `WorkspaceIndex::find_define` return file+`name_span`; the include-graph narrowing is factored); **M11** the cast's type binds (`bind_expr`'s `Cast { expr, .. }` drops `ty`; a `bind_type_expr` mirroring `bind_data_type`'s three shapes — type_def.rs's own doc claim about casts becomes true); **§2.9-20** the rename warning for a candidate reference that stayed `StillUnresolved` through the overlay ("`sig` after `.` could not be resolved — module `unknown_mod` not indexed"), `unaccounted_warnings` run over all files that mention the name (as `macro_use_warnings` does), the premise pin inverted in the same commit. Files: crates/vlog_parser/src/{ast.rs, parser.rs}, tests/spans.rs, crates/vlog_formatter/src/format.rs, tests/verification.rs (drive `EXPECTED_FAILING_GAPS` and `EXPECTED_FAILING_FRAGMENT_GAPS` to 0, delete the two analogue tests in the same commit, commit the constraint fuzzer that was never committed), cases/comment_slots.cases (new), crates/vlog_semantic/src/bind.rs (+ tests), crates/lucisv_server/src/ {nav.rs, hover.rs shared narrowing, type_def.rs test}, tests/e2e.rs, crates/vlog_refactor/src/rename.rs + tests/rename.rs, docs/features/ comment-slots/README.md (new), amendments in escaped-identifiers / overlay-promotion / type-definition / refactor-rename / the three fuzzer READMEs, docs/topo.md rows 20/21/22 struck (lead), TODO §25. Runs AFTER §23 (parser/format/bind collide), in parallel with §24. - [x] G1 · [x] G2 · [x] G3 · [x] G4 · [x] G5 (+§2.9-21) · [x] G6 - [x] fuzzers to zero (covergroup 329, fragment 153, constraint 395, RTL 352 — all 0 failing); both analogue tests deleted; constraint fuzzer committed; RTL fuzzer added; corpus 814/820 unchanged and byte-identical over all 860 files; opentitan sweep unchanged (3 975 files, 0 output differences, the same 10 failures) - [x] H5 define definition (in-file + cross-file + include-narrowed + a define inside a fragment file; unit + e2e) - [x] M11 cast type reference (`bind_type_expr`; semantic, typeDefinition and rename pins; `FACTS_FORMAT` 13 → 14) - [x] §2.9-20 rename warning + pin inverted - [x] QA: fuzz 5 fresh fixtures to zero failures; comment-stream equality over 48 opentitan DV files + 20 RTL files; rename of a typedef used in casts; `define` definition on opentitan macros (`uvm_*` absent → nothing, project macros → the define site). ## 26. Bind, macro spacing, and the instantiate command (planned 2026-09-02) — M4/M5/M6 corrected, §2.9-15, §2.9-19 Evidence correction (list-robustness map): **M4** was closed at item and statement position by item-misc (2026-08-20; `at_spaced_macro_call`); the 21 opentitan files with `` `uvm_field_int (x, y) `` all format. The residue is expression/list position (`assign x = \`WIDTH (a + b);`, a parameter override `` `MACRO (1) ``, an ordered connection): the file PARSES as a call, the formatter tightens the space, and the safety net refuses — a formatter fix (preserve the author's gap between a macro identifier and its `(`), not a lexer one. **M5**'s headline shape (`.a(` ⏎ `` `ifdef `` ⏎ … ⏎ `)`) has been captured verbatim since directive-in-statements — 53 opentitan files carry it, 0 failures — the cost is that the whole instantiation becomes opaque bytes (no instantiation edge, no connection references, no lens/hierarchy site); still hard errors: a directive inside an ANSI port-list ELEMENT and the one-line spelling. **M6** (indexed `bind` target `top.gen[0].u_core`) is real, untested, and `bind` records only the instantiated module (§2.9-15). **§2.9-19** has every piece (`plan_for`, `render`, `nearest_definition`, `ports::execute`/`deliver`). Files: crates/vlog_parser/src/{ast.rs, parser.rs} (bind path segments with `[expr]`; `ExprKind::Verbatim` for a balanced region holding a conditional directive inside an expression), crates/vlog_formatter/ src/format.rs (macro-call gap preserved; the expression verbatim arm), tests/cases, verification.rs, crates/vlog_semantic/src/bind.rs (bind target head → `Target::Module`; connections' port half → `Target::Port(inst.module)`; expression half → a target-scope walk on the `InlineConstraint` precedent, refuse-on-uncertainty), tests, crates/lucisv_server/src/{ports.rs or a new instantiate.rs (the `lucisv.instantiate` command), main.rs commands()}, tests/e2e.rs, editors/nvim/README.md, docs/features/bind-semantics/README.md (new), amendments in bind / macro-items / directives-in-instances / inline-instantiation READMEs, docs/coverage_gaps.md M4/M5 corrected, TODO §26. Runs after §25 (parser/format overlap). - [x] M4 residue: the formatter keeps the source's gap between a macro identifier and `(` in expression/list position (read from `src` spans, as `glued_null_item` does); the two verify pins stay. - [x] M5 residue: a conditional directive inside a connection/argument EXPRESSION becomes `ExprKind::Verbatim(RawText)` so the instantiation node survives (edge, lens, hierarchy, port references kept; the one verbatim expression records nothing); the ANSI port-list element and the one-line spelling stay filed unless the same arm covers them. - [x] M6 + §2.9-15: `BindDirective.target` → `Vec }>`; `at_bind_directive` scans past `[…]`; binder resolves the head as a module (or leaves an instance path unresolved), the port half of each connection against the bound-in module, the expression half in the TARGET module's scope with the `InlineConstraint` refuse-on-uncertainty shape; the escaped-segment case rides §25's G5. - [x] §2.9-19: `lucisv.instantiate [uri, position, module]` → `plan_for` → plain `render` → `workspace/applyEdit`; registered in `commands()`; `at_instantiation_site` validates the position; escaped-identifier plans inserted as plain text (M4's ruling); nvim README rewritten; e2e over the wire. - [x] Pins: the 21 spaced-macro files' shapes in expression position format + round-trip; a directive-inside-connection file keeps its instantiation edge and lens count; indexed bind targets parse, format, resolve; a bind's `.x(top.x)` hover resolves in the target; the command inserts the same text the ghost would. - [x] QA on opentitan (read-only, 2026-09-02): the "53" was corrected by the dev to 3 (the literal `.name(` ⏎ `` `ifdef `` shape: 0 hits by independent census) — QA's own grep-based scan (a directive inside a named connection's own paren-balanced value, whole tree) also finds exactly 3: the two files that now format canonically and `hw/top_earlgrey/dv/tb/tb.sv`, unchanged (directive-split, filed). `bind` files under `hw/ip/*/dv/sva` (aes, hmac, rv_dm, ...) are lone unindexed module targets, the resolved shape; three spot-checked re-format byte-identically. Sweep unchanged (`git status --porcelain` on opentitan showed only the owner's three files throughout). See QA log. ## 27. SVA bodies as real nodes (planned 2026-09-02) — the SVA half of C1/M8, plus §2.9-18 Mapped: `property`/`sequence` declarations, concurrent `assert`/`assume`/ `cover`/`restrict property` and `expect`/`cover sequence` are captured verbatim (`parse_concurrent_assertion`, `parse_property_decl`, `parse_expect_statement` → `RawText`), so a signal named only inside one is invisible to rename, references and the lints — the last correctness residue of `docs/coverage_gaps.md` (C1's "SVA expressions can follow"; M8). Population: opentitan 82 `property`/`sequence` declarations in 23 files and 106 concurrent assertions (its 4 643 `` `ASSERT* `` macro uses are macro tokens — §2.9-18's problem, carried here); corpus 80 concurrent assertions in 6 files. Plan, on the constraint-bodies / covergroup-bodies precedent (real nodes behind a `Rewind` snapshot, byte-exact verbatim fallback per construct, no keyword reserved — `and`/`or`/`not`/`until`/`throughout`/`within`/`intersect`/`nexttime`/ `always`/`eventually`/`implies`/`iff` and the `s_`/`sync_` forms are text-matched in SVA position only): **P1** grammar — `sequence_expr` / `property_expr` as one precedence-climbing extension of `parse_expr` (cycle delay `##n`/`##[a:b]`/`##[+]`/`##[*]`, repetition suffixes `[*n]`/`[*a:b]`/`[=n]`/`[->n]`, binary `and`/`or`/`intersect`/`within`/ `throughout`/`|->`/`|=>`/`#-#`/`#=#`/`until`/`until_with`/`implies`/ `iff`, unary `not`/`nexttime`/`always`/`eventually`/`strong`/`weak`/ `first_match`/`accept_on`/`reject_on`/`sync_*`, property `if … else` and `case … endcase`, a leading `@(…)` clocking and `disable iff (…)`, sequence instances with arguments, `.triggered`/`.matched`, local variable assignments `(a, x = b)`); **P2** declarations — property/ sequence headers with typed formals (`sequence`/`property`/`untyped`/ data types, defaults), local variable declarations in the body, `endproperty : name`, and the concurrent assertion's action block as the statement it already is; **P3** formatter — canonical layout with one rule: the spec's top-level operators (`|->`, `|=>`, `##`, `and`, `or`) break one-per-line at the parent's indent, everything else inline; the verbatim fallback keeps bytes; **P4** semantics — a property/sequence declares a `SymbolKind::Property`/`Sequence` symbol with a scope for its formals and local variables, every identifier in a body is an ordinary use, an instance names the declaration (`FACTS_FORMAT` bump), so rename/ references/hover/document symbols/the semantic lints all see inside (M8 closes by construction for what parses); **P5** what stays verbatim still *speaks*: a whole-word text scan of any remaining SVA verbatim region feeds rename an "inside an assertion lucisv could not structure" warning, the `macro_use_warnings` shape; **P6** §2.9-18 — those macro warnings answered from `FileFacts::words` for files with no other relationship to the name (the census exists since §24; only the wiring is missing); **P7** an SVA gap fuzzer (every inter-token gap of the fixture set takes a `/*C*/`; zero failures) on the comment-slots precedent, and the 12 assertion attack pairs kept with new ones for every token an SVA slot is defined between. Files: crates/vlog_parser/src/{ast.rs, parser.rs}, tests/spans.rs, crates/vlog_formatter/src/format.rs, tests/cases/{assertions.cases, sva_bodies.cases (new)}, tests/verification.rs, crates/vlog_semantic/ src/{bind.rs, facts.rs, resolve.rs, model.rs}, tests/sva.rs (new), crates/vlog_refactor/src/rename.rs + tests/rename.rs, crates/lucisv_server/src/{symbols.rs, hover.rs} (kinds), tests/e2e.rs, crates/vlog_linter (exhaustive-match arms only), docs/features/ sva-bodies/README.md (new), amendments in assertions / refactor-rename / semantic-lints READMEs, docs/coverage_gaps.md C1/M8 rows, docs/topo.md §2.9-18 struck (lead), TODO §27. Runs after §26 (parser/format/bind collide); no parallel lane. - [x] P1 grammar (real nodes behind `Rewind`, byte-exact fallback, nothing reserved) - [x] P2 declarations + action blocks; `expect`, `cover sequence`, `default clocking`/`default disable iff` as nodes or explicitly left verbatim (say which) — all four are nodes; `default clocking` already was one (`clocking-wave`), the other three are this round's - [x] P3 canonical layout — one rule, stated in the README; corpus moves only in assertion text (QA reads every diff) - [x] P4 semantics — `SymbolKind::{Property, Sequence}`, formals and locals scoped, instances resolve; `FACTS_FORMAT` 15 → 16; rename of a signal named inside a property edits it (pin), references list it, document symbols show the declaration. The `unused-signal` half of the pin could not be written as stated and is pinned inverted: that rule's mention guard already shielded a name inside a verbatim region, so it never fired; the rule that *does* change verdict is `undriven-net`, exactly as in `covergroup-bodies`. - [x] P5 verbatim-SVA rename warning (pin: a fallback region spelling the old name warns, never silent) - [ ] P6 §2.9-18 wiring (pin: a file whose only relationship to the name is a macro argument still warns) — the **engine half is done and pinned**; the server fan-out (`Workspace::rename_sources`, outside the round's file list) is filed as Handshake request 1 in `docs/features/sva-bodies/README.md`, with the unbounded-read-set objection that makes it a lead's call rather than a mechanical wiring - [x] P7 SVA gap fuzzer at zero (705 gaps, 0 failures); the 12 assertion attack pairs kept plus 46 new ones; `verify.rs` untouched - [x] Measurement: opentitan **79/79 declarations and 97/97 assertions** structured, **zero fallbacks**, and corpus 8/8 and 63/63 the same (the brief's 82/106 are grep counts and include files that do not parse and `` `ASSERT* `` macro uses, which are directive tokens); corpus 13 files moved and opentitan 36, all inside assertion text; both sweeps otherwise byte-identical; the 4 854 `` `ASSERT* `` invocations byte-identical - [ ] QA on opentitan (read-only): structured counts re-derived; every moved file's diff read; rename of a signal used in `hw/ip/*/rtl/*_assert*.sv` properties; sweep unchanged ## 28. Decomposition (planned 2026-09-02) — the file-size rule applied to the eight files over 1 200 lines The rule (CLAUDE.md "File and function size"): 300–600 production lines per file, split at 800+, a written reason above 1 200; functions 10–50, a reason above 150. Measured on 2026-09-02: thirteen files over 800, eight over 1 200, led by `parser.rs` 8 786 production lines (+5 044 test), `format.rs` 5 444, `ast.rs` 3 313, `server.rs` 2 559 (+6 293 test), `bind.rs` 2 378, `workspace.rs` 1 975, `ports.rs` 1 778, `completion.rs` 1 716 (+2 463 test). These are also exactly the files every feature lane collides in — after this round, lanes that touch different grammar domains can run in parallel. **Rules for every lane in this round** (the merge contract): a split is a **pure move** — no behaviour change, no renamed public item, every public path preserved by re-exports from the old module (`pub use`), so no other crate's imports change; doc comments travel with their items; `#[cfg(test)]` blocks move with the code they test or to a sibling `tests.rs`/`tests/` file, and the **test count per crate does not drop** (the summed `cargo test` counts are pinned in each README); byte-identity of every corpus and opentitan file against a baseline build of the trunk commit the lane branched from (the same `--stdout` comparison QA runs); `cargo fmt -p`, clippy clean; no `#[allow]` introduced. Function splitting is *allowed* only where a function exceeds 150 lines and is not a dispatch table over an enum; each such split is named in the work log. `git blame` continuity is lost for moved code — accepted, and the work log says which module each old line range went to. Lanes (each in its own worktree; disjoint crates; run in parallel): - **Lane A — `vlog_parser`**: `parser.rs` → `parser/mod.rs` (the `Parser` struct, token cursor, `Rewind`, comment plumbing — `bump`/`take_meta`/`take_gap`/`gap_before`, error/recovery) plus `parser/{expr, decl (data types, declarators, typedef/enum/struct, params), module (header, ports, items, generate, instantiation, bind), stmt, class (classes, constraints, covergroups, DV items), sva, directive (macros, conditionals, includes, fragment mode), and recovery/opaque capture}.rs`; `ast.rs` → `ast/{mod (Meta, Comment, spans, RawText), expr, decl, module, stmt, class, sva}.rs` with `pub use` so `vlog_parser::ast::*` is unchanged; the 5 044 test lines move beside the code they test (`parser/tests/*.rs` or per-module `#[cfg(test)]`). `lexer.rs` (996) stays. - **Lane B — `vlog_formatter`**: `format.rs` → `format/mod.rs` (`Fmt`, `Doc` builders, comment slots `slot_comments`/`inline_comments`, settings) plus `format/{item, decl, module (headers, ports, instantiations, connections, bind), stmt, expr, class (constraints, covergroups), sva, list (the shared list/alignment machinery), directive}.rs`; `stmt_kind` (280) and `expr` (240) are dispatch tables — they stay whole with the reason commented. - **Lane C — `lucisv_server`**: `server.rs` — first move its 6 293 test lines to `server/tests.rs` (`#[cfg(test)] mod tests;`), then split `server/{dispatch (answer_request — a dispatch table, stays whole), lifecycle (initialize/shutdown/documents), diagnostics, workspace (events, watchers, config), progress, client (transport, logging)}.rs`; `completion.rs` → `completion/{mod, members, modules, templates, keywords, symbols, fuzzy}.rs` with its tests beside each provider; `perf.rs` (1 190) split by what it measures if a one-sentence description needs an "and". - **Lane D (after A/B/C, or in parallel if truly disjoint — check topo)** — `vlog_semantic`: `bind.rs` → `bind/{mod, items, stmts, exprs, types, classes, sva}.rs`; `workspace.rs` → `workspace/{mod, index, scan, resolve_external, persistence}.rs`. `vlog_refactor`: `ports.rs` → `ports/{mod, plan, execute, warnings}.rs`; `rename.rs` (1 044) → `rename/{mod, occurrences, warnings}.rs`. Docs: one `docs/features/decomposition/README.md` for the round (each lane a subsection with its module map, line-range table and pinned counts), `docs/topo.md` §3.1 primary-home matrix updated to the new module names, `README.md`'s architecture section updated. Runs AFTER §27 (every lane touches its files). - [x] Lane A `vlog_parser` — parser/ and ast/ module maps; tests moved; counts pinned; byte-identity proven - [x] Lane B `vlog_formatter` — format/ module map; counts; byte-identity - [x] Lane C `lucisv_server` — server/ and completion/ module maps; tests out of server.rs first; counts; e2e unchanged; vsix smoke - [x] Lane D `vlog_semantic` + `vlog_refactor` - [x] Docs: decomposition README (one per lane: decomposition-{parser, formatter,server,semantic}), topo §1.3/§3.3, README.md architecture - [x] QA per lane: `cargo test` counts equal to the lane's baseline, corpus + opentitan `--stdout` byte-identical (0 differing), no public path changed (`cargo doc` item list diffed against the baseline), longest-function census reported before/after ## 29. Small items, round 1 (planned 2026-09-02) — `Scope` promotion, the macro-word census for rename warnings (§2.9-18 server half), `lucisv check --rules-doc` (§2.9-5, M12's second half) Three independent items in one lane; disjoint from §30's files. Dev Opus 5, QA Sonnet 5. Feature README: `docs/features/macro-word-census/ README.md` (Goal names all three; Work log per item). **29.1 `vlog_refactor::rename::scope` → crate root.** `rename/scope.rs` (69 production lines) holds `Scope`/`Analysis`/`display` — the in-scope files, the index built from them, the analyses computed so far — and its own `//!` says nothing in it is rename-specific; `ports/`, `references` and `instantiate` reach it through `rename`. Pure move: `git mv crates/vlog_refactor/src/rename/scope.rs crates/vlog_refactor/src/scope.rs`; `lib.rs` gains `mod scope;` (crate-private); `rename/mod.rs` keeps `pub(crate) use crate::scope::{display, Scope};` so every in-crate path (`crate::rename::Scope`, `super::scope::…` in `warnings.rs`) still resolves — change the importers to `crate::scope::` where you touch them anyway and leave the re-export for the rest; the `//!` loses its "it lives under `rename` because …" sentence. Proof: `cargo test -p vlog_refactor` counts identical (86/5/52/63/0), workspace green, no public path changes (`Scope` is `pub(crate)`). **29.2 Macro-word census, and the rename warning it enables.** Today `FileFacts::words` (§24) is one sorted list of every identifier-shaped word in a file, plain tokens and raw text (macro invocations, directive lines, attributes) folded together, so it cannot say *where* a word was seen. Rename's `macro_use_warnings` (engine, pinned in §27 by `a_file_whose_only_relationship_to_the_name_is_a_macro_argument_is_warned_about`) only runs over the files `Workspace::rename_sources` hands the engine, and a file whose only relationship to the name is a macro argument is in none of its rungs — the lead's ruling in `docs/topo.md` §2.9-18: no `files_mentioning` rung (untagged, so it would re-read every file spelling `clk` and bring back the 2.5–3.0 s `prepareRename` cost), but a separate census the server can *warn from without reading*. Plan: (a) `vlog_semantic::words`: alongside `harvest`, a `harvest_raw(tokens) -> Vec` (sorted, deduped) of the words `raw_words` finds inside macro-invocation `Ident`s, `Directive` and `Attribute` tokens only — factor the raw-token match out of `harvest` so the two cannot drift; pin `harvest_raw ⊆ harvest` and that a word seen only as a plain identifier is absent from it. (b) `FileFacts::macro_words: Vec` written and read beside `words` (tag `M`), `FACTS_FORMAT` 16 → 17 with the reason in the doc comment (a 0.33.0 store has no `M` records and would answer "no file names it in a macro"), `fingerprint` unchanged (the census is derived from the same text). (c) `WorkspaceIndex:: files_naming_in_macros(name) -> impl Iterator` by binary search, the twin of `files_mentioning`; `update_file`/`remove_file`/ `absorb` carry the field the way they carry `words` (they do, if it lives in `FileFacts`; say so). (d) `lucisv_server/src/rename.rs`: after the engine returns `(edit, warnings)`, append one warning per file in `files_naming_in_macros(old_name)` that is **not** among the paths the engine was handed (`rename_sources` result) and not an open buffer: "`old` also appears inside a macro invocation in , which this rename did not read; check it by hand — a macro argument cannot be edited." Same for `prepareRename`? No — a prepare answers a range, not warnings. (e) Pins: `vlog_semantic` unit tests for `harvest_raw` and the codec round-trip (FACTS 17 record with and without `M`); a server test with three files — `sub.sv` declares `wire sig`, `top.sv` uses `u.sig`, `far.svh` contains only `` `uvm_info("x", $sformatf("%0d", sig), UVM_LOW) `` and nothing else naming `sub` — asserting the rename edits `sub.sv` and `top.sv`, that `far.svh` is not in `rename_sources`, and that the returned warnings name `far.svh`; a control where `far.svh` also instantiates `sub` (then it IS a source and the engine's own warning appears exactly once — no double warning). (f) `docs/topo.md` §2.9-18 struck by the lead; the refactor-rename and semantic-lints-on READMEs amended; index-persistence README notes format 17. **29.3 `lucisv check --rules-doc`.** `vlog_linter::rules_markdown()` has existed since lint-rules-2 with only an example binary (`crates/vlog_linter/examples/rules_markdown.rs`) to print it. Plan: `args.rs` — `Options::rules_doc: bool`, parsed from `--rules-doc`, listed in `check_flag_scopes` as lint-only, documented in the usage text under `lucisv check`; `main.rs::run_check` — when set, print `rules_markdown()` to stdout and return exit 0 before `select_rules` and before any path is gathered (paths given alongside are an error: "--rules-doc takes no files"); a `crates/lucisv/tests/` case running the binary with `--rules-doc` and asserting the first line and that every registered rule name appears once; if `docs/lint-rules.md` (or the docs-site rules page) is checked in, a drift test that it equals the generated text, and regenerate it in this round; the example binary's doc comment updated (or the example removed — the lead prefers removed, the flag is the tool now). `docs/topo.md` §2.9-5 struck by the lead; the lint-rules-2 README's handshake ticked. Files: crates/vlog_refactor/src/{lib.rs, scope.rs (moved), rename/mod.rs, rename/warnings.rs, ports/*.rs, references.rs, instantiate.rs (imports only)}, crates/vlog_semantic/src/{words.rs, facts.rs, workspace/{mod,index,update,record}.rs} + tests, crates/lucisv_server/src/rename.rs (+ state.rs only if `rename_sources` must expose its path set — prefer returning it from the existing function rather than a new rung) + tests/e2e.rs, crates/lucisv/src/{args.rs, main.rs} + tests, crates/vlog_linter/ examples/rules_markdown.rs (removed), docs/lint-rules.md (regenerated if present), docs/features/macro-word-census/README.md (new), amendments in refactor-rename / semantic-lints-on / index-persistence / lint-rules-2 READMEs, TODO §29. Runs in parallel with §30 (disjoint files; topo: §29 touches the FACTS handshake, §30 the AST — no shared edge). - [ ] 29.1 `Scope` at the crate root, counts identical - [ ] 29.2 `harvest_raw` + `FileFacts::macro_words` (FACTS 17) + `files_naming_in_macros` + the server warning; the three-file pin and its control - [ ] 29.3 `--rules-doc`; usage text; tests; example removed; `docs/lint-rules.md` regenerated if present - [ ] Gates: fmt/clippy/`cargo test --workspace`; corpus gate 814/820; store measurement (+bytes for `M` on corpus and opentitan, expect small); opentitan read-only sweep unchanged - [ ] QA: rename of `clk` in an opentitan IP with the server, timing before/after (must not regress; the warning list must name only files outside the source set), the pins re-derived ## 30. Small items, round 2 (planned 2026-09-02) — M13: modport method prototypes, `const` tf arguments, unnamed DPI formals Three grammar arms `docs/coverage_gaps.md` M13 lists as "each a small grammar arm"; zero corpus population, so the value is that an interface or DPI file written by the book opens without an error node. Dev Opus 5, QA Sonnet 5. Feature README: `docs/features/interface-dpi-arms/README.md`. **30.1 Modport method prototypes** (IEEE 1800-2017 §25.5.4, `modport_tf_port ::= method_prototype | tf_identifier`). Today `parse_modport` (`parser/module.rs`) reads `import`/`export` followed by a name list; `import task drive(int x)` errors at `task`. Plan: (a) `ast/module.rs`: `ModportPort` gains `prototype: Option>` where `TfPrototype { kind: TfKind (Function|Task), ret: Option, name: Name, ports: TfPorts, after_kw/before_name/ before_args comment slots }` — one struct, since a modport prototype is a header with no body; `names` is empty when `prototype` is `Some`. (b) `parser/tf.rs`: factor the header parse — keyword, lifetime qualifiers, return type, name, `parse_tf_ports` — out of `parse_function_decl`/`parse_task_decl` into `parse_tf_header(kind) -> PResult`-shaped code both call (a pure refactor inside the file; counts unchanged), and call it from `parse_modport` when the token after `import`/`export` is `task` or `function`; the prototype ends at the `,`/`)` of the modport list, never at `;`. Comments in every new gap get an owner (the comment-slots rule); a `/*c*/` before `task`, before the name, inside `()` are the cases. (c) `format/ module.rs`: print `import task name(args)` through the same header printer `routine.rs` uses (factor it the same way), one prototype per list element, alignment untouched. (d) `bind/item.rs`: the prototype's name is a use (`Target::Lexical`, resolving to the interface's task or function) and its formals are declared in a `ScopeKind::Block` opened for the prototype so they neither leak nor go unbound; types bind as types. (e) `tests/spans.rs` arm; parser tests; `interfaces.cases` entries (import and export, task and function, with and without formals, mixed with `input` groups, comments); a semantic test that hover on `drive` in the prototype lands on the interface's task. **30.2 `const` task/function arguments.** `parse_tf_ports` already accepts `const ref` (tf.rs:177, the corpus shape). Verify with a probe whether anything M13 meant is still missing — `const ref int q[$]` formats today; a bare `const` direction is not legal (LRM 13.5.2 only has `const ref`) — and close the item with a pinned case rather than code, unless the probe finds a real gap (then fix it in the same arm). Correct the M13 row in `docs/coverage_gaps.md` either way. **30.3 Unnamed DPI formals** (§35.5.5: `import "DPI-C" function int f(int, chandle);` — a formal may omit its name in a DPI import prototype only). Today `parse_tf_ports` does `expect_name` and errors at `,`. Plan: (a) `parse_tf_ports(allow_unnamed: bool)` — the DPI path (`parse_dpi_import` → `parse_function_decl(Some(dpi))`/`parse_task_decl`) passes `true`, every other caller `false`; when allowed and the token after the type is `,` or `)`, the formal has **no name**. (b) AST: keep `TfArg::name: Name` and use the crate's existing empty-name convention (`foreach (arr[, j])`, `declare` ignores an empty name) — `name.text` empty, `name_span` empty — rather than an `Option` that would touch every consumer (formatter, binder, ports refactoring, signature help); document it on the field. (c) Formatter: an unnamed formal prints its direction and type only; `tf_args` alignment treats the missing name as zero width. (d) Binder: `declare` already ignores empty names — pin it. (e) Signature help (`lucisv_server/src/signature.rs`) shows the type alone for such a parameter — check and pin. (f) Cases in `dpi.cases` (or the file DPI imports live in): `int`, `chandle`, `logic [7:0]`, a mix of named and unnamed, `input int` unnamed, and the negative: an unnamed formal in a non-DPI function is still an error naming the position. Files: crates/vlog_parser/src/{ast/module.rs, ast/decl.rs (TfArg doc), parser/module.rs, parser/tf.rs, parser/item.rs}, tests/spans.rs + parser tests, crates/vlog_formatter/src/format/{module.rs, routine.rs}, tests/cases/{interfaces.cases, dpi.cases or where DPI lives}, crates/vlog_semantic/src/bind/item.rs + tests, crates/lucisv_server/ src/signature.rs (check + pin only) + tests, docs/coverage_gaps.md (M13 row), docs/features/interface-dpi-arms/README.md (new), amendments in interfaces / dpi-export READMEs, TODO §30. Runs in parallel with §29. - [ ] 30.1 modport prototypes end to end (parse, format, bind, spans, hover pin) - [ ] 30.2 `const` arguments verified and pinned (or fixed), M13 row corrected - [ ] 30.3 unnamed DPI formals (parse behind the DPI flag, format, bind, signature help pin, negative pin) - [ ] Gates: fmt/clippy/`cargo test --workspace`; `cargo test -p vlog_formatter`; corpus 814/820 byte-identical to 0.33.0 (zero population, so nothing may move); opentitan read-only sweep unchanged - [ ] QA: hand-written interface + DPI files in every listed shape, idempotent, comments kept; the negative pin; sweep unchanged