# Repository analysis Refreshed **2026-11-26** against committed snapshot **`69383ea`** (Round 3 landed). Latest tagged release: **v0.66.2** (`71d13b5`, released 2026-11-24). This refresh reconciles `CHANGELOG.md`, the feature READMEs (`docs/features/*`), `TODO.md`, `docs/topo.md`, `oct_review.md`, and live Rust/Node inspection, with test and doc suites executed through `./tools/gates.sh --only suites,docs,node`. ## Assessment and current status lucisv is a nine-crate toolchain (six reusable Rust libraries plus `lucisv`, `lucisv-server`, and `lucisv-mcp`), VS Code / Neovim integrations, release/corpus tooling, and an Astro/Starlight docs site. Syntax, formatting, semantics, linting, refactoring, and project inputs stay cleanly separated. Releases `v0.50.0`–`v0.66.2` and post-tag **Rounds 1–3** (`8f5a4fb`, `4d384ec`, `69383ea`) retired performance bottlenecks, delivered the MCP server (`--read-only`, dir/glob `check`, hash-cached references), completed top-rooted path resolution (`FACTS_FORMAT = 22`), range/selection formatting, sticky scroll (`ifdef` branches + instantiations), the eight-item overnight queue (TODO §71), `instance-folding` (TODO §72), and the Round 1–3 correctness, server-ordering, index-lifecycle, and MCP hardening fixes. | Change | Status at this refresh | Implementation and contract | |---|---|---| | External waiver files & conditional headers | Released in v0.42.0 | `ExternalWaivers`, `WaiverUse`, and `lint_with`; CLI, project config, and editor waivers union cleanly; split units verbatim, net delays keep written position | | Atomic-write coordination & cycle-aware walks | Released in v0.43.0–v0.44.0 | Exclusive per-operation temp files; directory identity dedup + recoverable walk warnings; `undriven-net` checks mention oracle after local guards | | Type-name spans, re-exports, hierarchical tails | Released in v0.45.0 | `DataType::name_span()` / `segments()`; package re-export `RX` graph; `Surface::{Connection, Hierarchical}` | | Wildcards, ANSI, imports, extract, DUT tree | Released in v0.46.0–v0.48.2 | `ports/{expand,ansi,merge}.rs`, `vlog_semantic::imports` (`74` lint rules incl. `unused-import`), `extract/`, client-side DUT hierarchy sections | | Inline module, coverage gaps, UVM indent | Released in v0.49.0 | Separate-file body substitution with collision renaming; real `randsequence` nodes; opt-in `uvm-utils-indent` | | Format cache key; performance round 5 | Released in v0.50.0–v0.53.0 | `uvm-utils-indent` in cache key (§2.9-34 closed); `module_sources_reaching` (§2.9-33 closed); buffer-only rename preflight; symlink-aliased discovery dedup | | `bind`, hierarchical refs, MCP (`--read-only`) | Released in v0.54.0–v0.59.0 | `bind` target surfaces (codec 20); cross-file hierarchical refs; `.name`/`.*` expansion under rename; `lucisv-mcp` 9 tools (`--read-only` offers 5) | | Generate-block labels; scoped rename warnings | Released in v0.60.0 | Block path segments resolve & rename all-or-nothing (`module.label`, codec 21); module/interface rename warnings scoped to home set | | Call hierarchy & References full-line view | Released in v0.61.0 | `prepareCallHierarchy` / `incomingCalls` / `outgoingCalls`; VS Code Lucisv References tree view shows trimmed lines (`lucisv.references.fullLineView`) | | Top-rooted paths & release gate script | Released in v0.62.0 | Unknown path heads root at unique top modules (`tb.dut.sig`), codec **22**; TODO §65.2 (`#36`) ruled scope-relative by design; `tools/gates.sh` added (§65.3) | | Range/selection formatting & sticky scroll | Released in v0.63.0–v0.63.1 | `format_selection` (`textDocument/rangeFormatting` + `rangesFormatting`); nested `begin`/`case`/block folding + 10-layer sticky scroll | | Completion UX (`autoEnd`) & port-entry grace | Released in v0.64.0 | Keyword ghosts (`lucisv.inlineKeywords`) & `begin`→`end` auto-insert (`lucisv.autoEnd`); relaxed empty-list completion/hover tolerance while typing port connections | | Instantiation highlighting | Released in v0.65.0 | Syntactic+semantic token classes for module types, `#`/params, instance names, and `.port` names (`tokens/instantiation.rs`, unchanged 14-type legend) | | Release gates (`cross`), Linux CI & MCP stamp | Released in v0.65.1, v0.65.7, v0.65.9 | `tools/gates.sh` `cross` check; Linux `ci.yml` + `tools/linux_check.sh`; `Stamp` racy window (`3 s`) covers mtime+ctime and clock step-backs | | Overnight queue (`TODO §71`): UX, styles, reindex, fast actions | Released in v0.65.2–v0.65.8, v0.65.10–v0.66.0 | Hierarchy current path (`0.65.2`), comment keywords (`0.65.3`), `ifdef` folding (`0.65.4`), 6 named styles + `auto` (`0.65.5`), localized reindex (`0.65.6`/`0.65.7`), ordered notifications & cursor-after-name (`0.65.8`), viewport highlight (`0.65.10`), buffer-first `same_file` fast actions + related completion tier (`0.65.11`/`0.66.0`) | | Sticky scroll instance folding & author stamps | Released in v0.66.1–v0.66.2 | `folding/instances.rs` pins multi-line `#(` and `) u_name (` headers; `tools/stamp_author.py` stamps tracked files (no runtime change) | | Round 1: Refactor correctness & server ordering | Landed at `8f5a4fb` | UTF-8 `skip_string`, deterministic `carry.rs`, duplicate-unit `enclosing_unit` guard (`#53` + F2b `same_file::renamed_here`), `ports/remove.rs` `item.span` (`#38`), `extract` CRLF (`#39`), `Document::version` + `DocumentChanges::Edits` (`#52`), `after_scan` whole-scan hold (`#53`), startup push drain (`#61`), exact `applied_changes` oracle (`#62`) | | Round 2: Index lifecycle & tombstones | Landed at `4d384ec` | Tombstoned `WorkspaceIndex::remove_file` + `live_files()` + `didClose` reconciliation (`#49`), mid-scan buffer absorption (`ScanAbsorbed`, `#50`), `(dev, ino)` canonical symlink spelling across discovery/overlays/widen/handlers (`#51`), disk record preserved for `doc.large` (`#63`); `#48` ruled won't-fix by owner | | Round 3: MCP hardening & references cache | Landed at `69383ea` | `find_references_{with,batch,batch_with}` + `Project` `KnownFacts` (`#37`/`#40`), `Stamp::first_mono` future-mtime settlement (`#54`), Windows `--all-targets` `qa_m3.rs` fix (`#56`), L-9 `after_dot` + `home_set_for`/`home_sets_for` parity, qualified `find`, `check` dir/glob support, `"prompts": {}` removed, RO `2,000/330 B` & full `3,800/440 B` budgets | The current source of truth for feature acceptance is each feature's QA/review log and [TODO.md](../TODO.md). The [topology](topo.md) records the interfaces that future changes must preserve. ## Repository map | Location | Responsibility and starting point | |---|---| | `crates/vlog_parser` | Lexer/trivia, strict and tolerant recursive descent, AST/spans; `src/lib.rs`, `parser/`, `ast/` | | `crates/vlog_formatter` | AST → document IR → printer, presets/auto styles (`style.rs`, `auto.rs`), alignment, fences/selection ranges, equivalence & convergence; `format/mod.rs`, `verify.rs` | | `crates/vlog_semantic` | File binding/resolution, workspace facts (`FACTS_FORMAT = 23`) and member lookup; `bind/`, `resolve.rs`, `workspace/{mod,index,update,reexport,hierarchy,path_units}.rs`, `facts.rs`, `imports.rs` | | `crates/vlog_linter` | 74-rule registry (`registry.rs::all_rules`: 7 Error, 24 Warning, 43 Style; 51 always on, 6 workspace-default, 17 opt-in; 10 Safe + 1 Unsafe fix), lazy semantics, options, inline/external waivers; `lib.rs`, `context.rs`, `registry.rs`, `waiver_file.rs` | | `crates/vlog_refactor` | Rename/references (`find_references_{with,batch,batch_with}`, `after_dot`, `home_set_for`/`home_sets_for`, `enclosing_unit`, deterministic `carry.rs`), ports, imports, extract/inline module (`extract/` CRLF-aware), instantiation plans, whole-edit verification; `scope.rs`, `rename/`, `ports/`, `imports.rs`, `extract/`, `inline/`, `check/` | | `crates/lucisv_core` | Config (`STYLE_NAMES`, `FileConfig`), filelists, cycle-aware tracked walks and warning channel, format cache (7-field `Entry` incl. `style` & `uvm_utils_indent`), unified diffs, atomic replacement; no language-engine dependency | | `crates/lucisv` | CLI argument handling, input discovery/dedup, worker pool (`rayon`), reports, `--rules-doc`, and source writes | | `crates/lucisv_server` | Ordered LSP loop (`after_scan`, `answer_from_the_buffer` fast actions in `ahead.rs`/`same_file.rs`, versioned `DocumentChanges`), overlays & tombstoned incremental reindex (`state/{discover,rescan,reconcile,incremental,watched}.rs`), folding (`directives.rs`, `instances.rs`), semantic/instantiation tokens; composes all six libraries | | `crates/lucisv_mcp` | Model Context Protocol server for coding agents over stdio: `project/` (`KnownFacts` cache, `Stamp::first_mono`), `tools/` (9 tools in full mode — `hierarchy`, `find`, `outline`, `read`, `check` w/ dir/glob, `rename`, `port`, `edit_item`, `format`; `--read-only` offers the first five), `rpc.rs` (no `"prompts": {}`), `apply.rs`; composes the six libraries, never `lucisv_server` (`docs/mcp/PLAN.md`) | | `editors/` | VS Code client (`extension.js`), TextMate grammar, `commentKeywords.js`, `hierarchyCurrent.js`, `hierarchySections.js`, `referencesView.js`, 8 commands + 37 non-rule & 74 per-rule settings; Neovim config docs | | `tools/`, `scripts/`, `.gitea/workflows/` | Guard (`guard.sh`), release gates (`gates.sh`), Linux helper (`linux_check.sh`), author stamp checker (`stamp_author.py`), corpus & release automation | | `docs/features/` | Implementation contracts, dated measurements, QA and acceptance records | | `docs/site/` | User-facing Starlight static documentation sources (`src/`) and tracked build artifacts (`dist/`) | Dependency architecture remains strict: `vlog_parser` and `lucisv_core` depend on no workspace crates; `vlog_formatter` and `vlog_semantic` depend on `vlog_parser`; `vlog_linter` and `vlog_refactor` depend on `vlog_parser` and `vlog_semantic` (plus `lucisv_core` for linter waivers, and `vlog_formatter` in tests only). `lucisv` composes core/parser/formatter/linter; `lucisv_server` and `lucisv_mcp` each compose all six libraries independently. External Rust dependencies stay pinned in `Cargo.toml` (`rayon` for CLI; `lsp-server` + `lsp-types` for `lucisv_server`; `serde` + `serde_json` for `lucisv_server` and `lucisv_mcp`). ## Runtime contracts worth preserving **Formatting:** strict parse, layout (`Config` incl. `style`, `auto_style`, `uvm_utils_indent`), normalized token comparison (including comments), then a second parse/format and convergence check. Failure returns an error, never a candidate output. `format_selection` expands ranges cleanly around statement/item boundaries and fences protect statement and class scopes; verification still covers the whole output. Cache entries key on content hash, `line-length`, `indent`, `uvm-utils-indent`, `style`, and lucisv version. **Linting:** one prepared tokenization/tolerant parse (`ParsedSource`) feeds all 74 rules and lazy semantics. Six semantic rules (`multiply-driven`, `undeclared-identifier`, `undriven-net`, `unknown-parameter`, `unknown-port`, `unused-signal`) run automatically when a project/workspace oracle is present and stay off for single files or stdin unless explicitly selected. `apply_fixes` stays fence-blind; front ends (`lucisv` and `lucisv_server`) filter edits through `vlog_formatter::fence::protected_regions`. **Editor, index lifecycle & refactors:** one ordered loop owns workspace mutation; `server/ahead.rs` permits read-only `same_file` and viewport token answers ahead of settled indexes only when buffer/settings preconditions hold, while workspace mutators (`rename`, `codeAction/resolve`, `executeCommand`, `willRenameFiles`) wait in `after_scan` across active scans (`self.scanning`). `rename.rs` and `ports.rs` emit versioned `DocumentChanges::Edits` when advertised. `WorkspaceIndex::remove_file` tombstones closed out-of-scope buffers in-place while keeping slot IDs stable until `merge`/`absorb` (callers iterate `live_files()`), symlinked files resolve deterministically by `(dev, ino)` / canonical path without basename gating, and open `doc.large` buffers retain their on-disk index record (subject to `maxFileSize`). `FACTS_FORMAT` is **23** (`20` bind connections, `21` generate blocks, `22` top-rooted paths, `23` Round 8's escaped words, DPI-export references and interface generate blocks). **MCP & refactor parity:** `lucisv-mcp` checks disk stamps (including `first_mono` settlement for future mtimes) before serving answers, implements `KnownFacts` on `Project` keyed by FNV-1a `content_hash`, shares `after_dot` and bind-aware `home_set_for`/`home_sets_for` with `vlog_refactor`, accepts files/directories/globs in both `check` and `format`, and enforces protocol byte budgets (`3,800 B` / `440 B` in full mode, `2,000 B` / `330 B` in `--read-only` mode; actual Round 3 measurements: `3,469 B` / `398 B` full, `1,826 B` / `297 B` read-only). ## Codebase size, resolved issues, and open work - **Production file sizes (re-measured 2026-11-26 at `69383ea`):** counting non-blank, non-comment lines before `#[cfg(test)]` / `mod tests` (excluding `*/tests/`), only test-only `crates/lucisv_server/src/perf.rs` (907 lines, `#[cfg(test)]` module in `main.rs`) exceeds 600 lines. Every non-test production file is under 600 (`vlog_semantic/src/resolve.rs` 587, `vlog_parser/src/parser/item.rs` 582, `parser/instance.rs` 569, `parser/module.rs` 560, `vlog_formatter/src/format/stmt.rs` 556, `parser/sva.rs` 542, `vlog_parser/src/lexer.rs` 540, `vlog_refactor/src/extract/flow.rs` 535, `lucisv_server/src/server/dispatch.rs` 522, `state/discover.rs` 510). - **Closed since the 2026-10-14 (`58520e5`) refresh:** - `TODO §55` (`decomposition-state`, 2026-10-14), `TODO §65.1–§65.4`, and `TODO §65.8` (`tb.` completion — closed **WON'T FIX 2026-11-26** per Owner Decision #3: "no"). - `docs/topo.md §2.9` handshakes `#33` (v0.51.0), `#34` (v0.50.0), `#36` (v0.62.0 scope-relative ruling), `#37–#40`, `#48` (won't-fix by owner ruling), `#49–#54`, `#56`, and `#61–#63` (plus `#35` moot since M7). - `oct_review.md`: L-1–L-4, L-12, L-13 fixed `2026-10-14`; **L-9** (MCP/engine dotted-spelling & K2 `bind` home-set parity) closed in Round 3 (`69383ea`). - **Remaining open work (tracked in [topo.md](topo.md) §2.9, `TODO.md`, and `oct_review.md`):** - Open handshakes in `docs/topo.md §2.9`: `#1` (`lucisv_core::path::normalize`), `#11` (structured JSON format errors), `#12` (`Scope::build` reusing `index_order`), `#31` (DPI-export name binding), `#32` (refactor verifier same-file relocation), `#41` (non-ANSI body-port deletion lint), `#42` (parser leniency cases), `#44–#47` (format-styles edge cases around `generate` `end`/`else`, ANSI attributes, multi-instance hanging layout), `#55` (`cli.rs:2149` stdin exit assertion), `#57` (macOS-only release gating), `#58–#60` (resumable discovery walk, rescan `range` guess flag, cross-file semantic-token colour refresh), `#64` (40k rescan variance), `#65` (bare `cargo test` in `ci.yml`), `#66` (`cross` gate step skipping when toolchain absent). (`#57`, `#65`, `#66` remain open awaiting Lead sign-off after Round 4A merges.) - Open `TODO.md`: `§65.6` (`` `include ``-fragment standalone analysis), `§71` unclosed follow-ups noted above; `oct_review.md`: L-5–L-8, L-10, L-11. - Known runtime constraint: cross-file macro expansion / full compiler elaboration remain intentional non-goals (`99.3%` — 814/820 — on the frozen corpus). - Manual VS Code extension-host acceptance ([manual-acceptance.md](manual-acceptance.md)): 0.65.x overnight features (`§71`) and Round 1–3 fixes remain pending a human VS Code walkthrough (only `0.66.1` instance folding was spot-checked by the owner in running VS Code). ## Validation of this refresh Executed live on `69383ea` (prior to docs-only edits; no `.rs`, `.js`, or build files modified): - `./tools/gates.sh --only suites,docs,node`: **PASS** - **Rust suites (9/9 crates, guarded):** **5,637 passed, 0 failed, 68 ignored** (`vlog_parser`: 521/0 [2 ign]; `vlog_semantic`: 438/0 [4 ign]; `vlog_refactor`: 769/0 [6 ign]; `vlog_formatter`: 376/0 [0 ign]; `vlog_linter`: 672/0 [0 ign]; `lucisv_core`: 119/0 [0 ign]; `lucisv`: 151/0 [0 ign]; `lucisv_server`: 2,192/0 [52 ign]; `lucisv_mcp`: 399/0 [4 ign]). - **Rust doc tests (`docs`):** **1 passed, 0 failed**. - **VS Code Node tests (`node`):** **37 passed, 0 failed**. - `python3 tools/stamp_author.py --check`: verified author stamps after final doc edits. - `fmt`, `clippy`, `corpus`, and `cross` gates were not separately re-run in this docs-only pass (verified clean in Round 3 at `69383ea`; no code or Cargo inputs changed). - `docs/site/dist/` was **not** rebuilt locally because `docs/site/node_modules` and global `astro` are absent (`@astrojs/starlight` required); `docs/site/src/` sources were updated and `dist/` must be rebuilt cleanly in an environment with Node dependencies installed.