Files
lucisv/docs/repository-analysis.md
lucioandClaude Opus 5.5 41a90917bb
ci / checks (push) Successful in 1m33s
ci / corpus (push) Successful in 33s
Housekeeping: package-lock version follows the release and release.sh checks it; repository analysis refreshed to 0.60.0
editors/vscode/package-lock.json said 0.10.2 since 0.10.2; it is 0.60.0
now, and tools/release.sh refuses to build when package.json or either
package-lock.json version differs from `lucisv --version`.
docs/repository-analysis.md: refreshed against 58520e5 (v0.60.0) — a status
row per release 0.50.0-0.60.0, nine MCP tools (five read-only), codec 21,
the generate-block and home-set contracts, the §55 split, and the current
open limits (§65.2-§65.6, review L-5-L-11, handshakes 31/32).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 13:38:04 -07:00

265 lines
20 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Repository analysis
Refreshed **2026-10-14** against committed snapshot **`58520e5`**. Latest
release: **v0.60.0** (tag `v0.60.0` at `58520e5`, released 2026-10-08). This
is a documentation refresh written from `CHANGELOG.md`, the feature READMEs,
`TODO.md`, `docs/topo.md`, `oct_review.md` and reading the code; it ran no
builds or tests. Work landed after v0.60.0 (the `oct_review.md` low findings, the §55
split) is noted where it changes a statement below, and is not yet released.
## Assessment and current status
lucisv is a nine-crate toolchain (2026-09-23: `lucisv_mcp` joined): six reusable Rust libraries, CLI, MCP and
LSP binaries, editor integration, corpus/release tools, and a static docs site.
The architecture still separates syntax, formatting, semantics, linting,
refactoring, and project inputs. The September 4 audit findings are fixed, and
the cache-key omission the September 7 refresh reproduced shipped fixed in
v0.50.0. Releases 0.50.0–0.60.0 were performance rounds, rename/references
correctness, and the MCP server; the remaining limits are listed below.
| Change | Status at this refresh | Implementation and contract |
|---|---|---|
| External waiver files | Released in v0.42.0 | `ExternalWaivers`, `WaiverUse`, and `lint_with`; CLI, project config and editor paths add together; inline/external suppression is a union; unused external waivers are reported only after a complete CLI run |
| Rival conditional headers and net-delay position | Released in v0.42.0 | Split units stay verbatim; delays print before or after the type according to their original position |
| Atomic-write coordination | Released in v0.43.0 | Exclusive per-operation temp files, permissions applied before bytes, CLI dedup by canonical path; separate processes remain last-writer-wins |
| Project/editor lint agreement | Released in v0.43.0 | Non-empty editor select/ignore lists override project lists independently; rejected project entries log once with file and line; valid entries continue to apply |
| Cycle-aware walks and net-delay comment slots | Released in v0.43.0 | Directory identity prevents cycles; comments around a delay's `#` are preserved |
| Walk warnings, editor rule-name warnings, aggregate overrides and delay-list comments | Released in v0.44.0 | Recoverable walk problems warn and continue; editor name typos log once; aggregate override expressions and delay-list comment slots are handled |
| didOpen cost | Released in v0.44.0 | `undriven-net` asks the workspace mention oracle after local guards; findings and synchronous request ordering stay unchanged |
| Type-name spans | Released in v0.45.0 | `DataType::name_span()` / `segments()` and disable-target spans replace semantic name scanning; `scan.rs` is deleted |
| Package re-exports | Released in v0.45.0 | Export name halves are references; the shared member walk follows cycle-guarded re-export edges; persisted facts gain `RX`; current codec **19** |
| Hierarchical tails | Released in v0.45.0 | Codec **19**, tagged member/reference surfaces, instance-tail resolution and completion, and cross-file rename updates |
| Expand wildcard; convert ports to ANSI | Released in v0.46.0 | `.*` expands in declaration order with `.p()` and a warning for unmatched ports; legacy header/body declarations merge with comments and attributes preserved |
| Organize imports; unused-import; extract module | Released in v0.47.0 | Shared semantic import usage feeds linter and refactor; **74 rules**; extraction infers ports/parameters/imports and creates a file when supported, or appends below the source module |
| DUT hierarchy | Released in v0.48.0; packaging corrected in v0.48.2 | Client-only children/parents/other sections over the existing snapshot; saved workspace choices plus configured DUTs |
| Inline module; final coverage additions | Released in v0.49.0 | Separate-file body copy with connection substitution and collision-aware renaming; six grammar gaps closed; real `randsequence` nodes; optional UVM indentation, default off |
| Format cache key; performance take 4 | Released in v0.50.0 | `uvm-utils-indent` is in the cache entry and store line (handshake 34 closed); a 0.49.0 store is rebuilt, never trusted; measurement harness in `tools/perf/` |
| Performance take 5 | Released in v0.51.0 | Code actions lint only when quick fixes are requested; rename analyses each file once (verifier unchanged); one-parse CLI package census; settings before first scan; inline-module's hierarchical-use refusal sees every writing file (handshake 33 closed) |
| Performance take 5, review round | Released in v0.52.0 | Buffer-only rename preflight for cheap refusals; one lint pass per buffer revision; open file's folders indexed first; rename reuses hash-matched index records |
| Symlink-aliased startup scan | Released in v0.53.0 | Startup and remaining walks share one directory identity, so an aliased directory is indexed once |
| Rename through `bind` files; faster first edit | Released in v0.54.0 | A bind connection is a reference on the target's hierarchical surface, bind paths root at the target; unresolved occurrences are warned; codec **20**; fused lexer phases |
| References on the hierarchical surface | Released in v0.55.0 | Cross-file uses of a module's internal nets/variables/instances are references; a closed declaring file's own uses are parsed on demand; every index-time span is re-checked against the rendered text or dropped |
| Implicit connections under rename; MCP preview | Released in v0.56.0 | `.name`/`.*` bindings a rename would cut are written out (`.din(d)`) or refused with a reason, and the verifier compares implicit bindings; `lucisv-mcp` preview binary; `--diff` printer moved to `lucisv_core::diff` |
| MCP packaged; structural edits; cache reuse | Released in v0.57.0 | Server ships in every platform package and registers per workspace folder; item-level edits with their own verifier; read-only reuse of the editor's index store via `--index-cache` |
| Lean MCP catalogue | Released in v0.58.0 | Nine tools (`hierarchy`, `find`, `outline`, `read`, `check`, `rename`, `port`, `edit_item`, `format`); catalogue and instructions byte budgets pinned by `tests/wire.rs`; capped answers |
| MCP read-only mode | Released in v0.59.0 | `--read-only` offers the five read tools; edit calls are unknown-tool errors; a snapshot test proves no write inside a root; extension setting `lucisv.mcp.mode` |
| Generate-block labels; scoped rename warnings | Released in v0.60.0 | A path segment naming a block is a reference to its label, renamed all or nothing; blocks on the hierarchical surface; codec **21**; rename warnings scoped to the declaration's home set, unscoped on any doubt; `duplicate-declaration` covers block labels |
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. A missing documented edge is not proof that
two edits have disjoint ownership.
## 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, alignment, fences/ranges, equivalence and convergence; `format/mod.rs`, `verify.rs` |
| `crates/vlog_semantic` | File binding/resolution, workspace facts and member lookup; `bind/`, `resolve.rs`, `workspace/`, `facts.rs`; `workspace/reexport.rs`, `workspace/hierarchy.rs`, shared import usage in `imports.rs` |
| `crates/vlog_linter` | 74-rule registry (`registry.rs::all_rules`), lazy semantics, options, severities, inline/external waivers and fixes; `lib.rs`, `context.rs`, `registry.rs`, `waiver_file.rs` |
| `crates/vlog_refactor` | Rename/references, ports, imports, extract/inline module, instance plans; `scope.rs`, `rename/` (preflight, implicit connections, home set, scoped warnings, carried macro arguments), `ports/`, `imports.rs`, `extract/`, `inline/`, whole-edit verification and piece ledger in `check/` |
| `crates/lucisv_core` | Config, filelists, cycle-aware walks and warning channel, format cache, atomic replacement; no language-engine dependency |
| `crates/lucisv` | Argument handling, input discovery/dedup, worker pool, reports and source writes |
| `crates/lucisv_server` | Ordered LSP loop and workspace overlays; `server/`, `state/`, capability handlers including `imports.rs`, `extract.rs`, `inline_module.rs`; project lint validation/logging in `lint/project.rs` |
| `crates/lucisv_mcp` | Model Context Protocol server for coding agents over stdio: `project/` (roots, filelist-or-walk, freshness sweep), `tools/` (nine tools in full mode — `hierarchy`, `find`, `outline`, `read`, `check`, `rename`, `port`, `edit_item`, `format`; `--read-only` offers the first five; item edits keep their own verifier in `tools/item/`), `apply.rs` (one all-or-nothing write path), `resources.rs`; composes the six libraries, never `lucisv_server` (`docs/mcp/PLAN.md`) |
| `editors/` | VS Code client/grammar/settings/hierarchy UI and other editor configuration; `hierarchySections.js` models DUT sections, `extract.js` supplies the module-name prompt |
| `tools/`, `scripts/`, `.gitea/workflows/` | Resource guard, corpus evaluation, artifact checks and releases |
| `docs/features/` | Implementation contracts, dated measurements, QA and acceptance records |
| `docs/site/` | User-facing static documentation and tracked generated output |
Parser and core have no dependencies; formatter and semantics each depend on
parser; linter and refactor depend on parser and semantics. Linter also consumes
core’s path matcher for external waivers. Both linter and refactor depend on
the formatter **only in tests**.
The CLI composes core/parser/formatter/linter; the server composes all six
libraries. External Rust dependencies stay in the CLI worker pool and server
LSP/JSON stack.
## Runtime contracts worth preserving
**Formatting:** strict parse, layout, normalized token comparison (including
comments), then a second parse/format and convergence check. Failure returns
an error, not a candidate output. These are lexical/layout checks, not design
elaboration or proof of hardware equivalence. Fenced text must still parse;
ranges select items, while fences also protect statement and class scopes.
**Linting:** one prepared tokenization/tolerant parse feeds rules and lazy
semantics. Malformed AST elements remain opaque. Front ends call `lint_with`
when applying external waivers and filter automatic edits through the formatter's
fence API; `apply_fixes` alone does not protect fenced bytes. Editor actions
continue to offer only safe fixes. The mention oracle is a pure predicate;
asking it after cheap local guards avoids repeated workspace scans.
**Editor and refactors:** one loop owns workspace mutation; buffers overlay
disk facts and scans publish related index/include/completion state together.
Lazy port actions defer edits until selection. File-scope definition positions
can come from the index; members and open buffers use text-based positions.
Refactor source selectors must include every file an engine might edit or
refuse over, even when completion or navigation can answer from fewer files.
**Semantic contracts:** a type-name segment is derived from AST
span data and verified against the source by `Binder::exact_or_empty`. The
source parameter to analysis remains necessary even though `scan.rs` is gone.
A package re-export records reference edges without adding a local import.
`export *::*` expands the package's imports into re-export facts; member lookup
follows those edges with cycle guards. Codec 19 introduced this (and the
hierarchical tails below) so older stores could not silently omit it; the
current codec is **21** (`vlog_semantic/src/facts.rs::FACTS_FORMAT`): 20
(v0.54.0) records bind connections on the target's hierarchical surface, 21
(v0.60.0) records generate blocks on it. Each bump rebuilds an older store
once.
The delivered hierarchical-tail contract uses `Surface::{Connection,
Hierarchical}`, a second member table, surface tags on persisted declarations
and references, and codec 19 (now 21). Connection completion and port propagation retain
the ports/parameters view; instance tails additionally reach internal nets,
variables and nested instances. Topology handshake 23 is closed. Since
v0.55.0, find-references and hover ask the hierarchical surface too, so a
cross-file use of an internal net is listed; an index-time span is dropped
rather than rendered on a line that no longer spells the name.
The v0.60.0 generate-block contract
([generate-label-rename](features/generate-label-rename/README.md)): a path
segment naming a block — bare, indexed, nested, or behind an instance path in
another file — is a reference to its label, so references list it and a
rename rewrites it with the label and closing label, all or nothing. A `for`
block's label belongs to the enclosing module, `generate … endgenerate` is not
a scope, and a module's named blocks sit on its hierarchical surface with
their members under the synthesized `module.label` key. For a member of a
module or interface, rename warnings and mentions are scoped to the
declaration's home set (declaring file, its includes and includers, and the
files the rename edits); any doubt — an unresolvable include, a declaration
outside a module, a package member — falls back to the unscoped behaviour.
`vlog_semantic::imports` supplies the shared usage judgement for organize-imports
and the Style, default-off `unused-import` rule. Package re-exports count as use;
unknown packages, macro/conditional uses and external inheritance are treated
conservatively. Refactor `check/ledger.rs` tracks comment/attribute text,
counts and positions for moves and copies, separately from formatter
normalization. `RefactorEdit::created` lists new paths whose initial contents
also appear as offset-zero insertions in `edits`; server resource operations
honor client file-creation support. Inline copies leave their source file
unchanged.
## Remaining limits and open work
**Cache omission (topology handshake 34, fixed in 0.50.0).** The CLI applies the new
`Config::uvm_utils_indent` field, but `lucisv/src/main.rs::entry_for` and
`lucisv_core::cache::Entry` omit it from cache equality and serialization.
A private-cache probe using the archived CLI and this class reproduced:
```systemverilog
class c extends uvm_object;
`uvm_object_utils_begin(c)
`uvm_field_int(a, UVM_DEFAULT)
`uvm_object_utils_end
endclass
```
1. `[format] uvm-utils-indent = false`, `--check`: exit **0**, unchanged.
2. Change only the option to `true`, `--check`: exit **0**, one cache hit.
3. Same config, `--no-cache --check`: exit **1**, would reformat.
**Fixed 2026-09-07 (TODO §59, ships in 0.50.0):** the option is in the key
and in the store line, a 0.49.0 store is rebuilt rather than trusted, and the
probe above is a CLI regression test in both toggle directions
(`changing_uvm_utils_indent_invalidates_the_entry`). The paragraph is kept as
the record of the finding.
**Refactor limits** (as recorded at v0.49.0; handshake 33 has since closed):
inline-module requires a separate-file source module and
simple named connections. It refuses wildcards, positional/expression or
unconnected ports, unsupported port types, generate, initial/final,
macros/directives, and hierarchical uses found in its inputs. QA recorded a
source-selection gap: `module_sources` can omit a file reaching the instance
through an intermediate module, bypassing the hierarchical-use refusal
(**handshake 33**, closed in v0.51.0 by an opt-in transitive rung). The
verifier's bounded testability gap for same-file relocation of protected
pieces (**32**) is still open at this refresh; no current planner produces
that edit shape. See the [extract/inline QA record](features/extract-inline-module/README.md).
TODO **§55**, the decomposition of `lucisv_server/src/state/`, landed after
v0.60.0 (2026-10-14, a pure move; `docs/features/decomposition-state`):
`state/mod.rs` went from 986 production lines to 63 beside `document.rs`,
`buffers.rs`, `views.rs`, `scope.rs`, `rescan.rs` (411), `incremental.rs`
and `sources.rs`, and its 3 944-line inline test module moved to
`state/tests/`. Measured 2026-10-14 (production lines, outside tests), the
files over 600 are `perf.rs` 907 (reasoned), `lexer.rs` 771 and
`format/stmt.rs` 604. This refresh does not certify manual editor
acceptance.
Open work recorded in `TODO.md` at this refresh:
- **§65.2** — LSP `references` omits the three `aes` instantiations in the
opentitan `*_pd_main.sv` tops that the whole-set engine lists (topology
handshake 36); root cause not yet named.
- **§65.3** — guarded test gates stall and are cut by the guard; the
generate-label-rename work log records three such cuts while launching
freshly linked test binaries with macOS `syspolicyd` busy, each identical
re-run passing. The TODO entry still lists the cause as unnamed and asks
for a gate script with separately guarded steps.
- **§65.4** — a hierarchical path rooted at a top module declared in another
file (`tb.dut.…`, the DV `force` shape) resolves nothing; since v0.60.0 a
rename warns about such a path instead of leaving it silently.
- **§65.6** — a bare use inside an included body fragment is analysed as its
own file, so a rename warns rather than edits it.
- **`oct_review.md` low findings** — L-1–L-4, L-12 and L-13 were fixed
after v0.60.0 (2026-10-14, marked FIXED in the file); L-5–L-11 are open (interface-port and virtual-interface paths
into generate blocks, `binds_into` on bare instance targets, macro names as
arguments, child calls to parent functions, MCP/engine disagreement on
dotted spellings and the home set, `member_key` for inline nested struct
members, and the `generate … endgenerate` scope change).
Remaining constraints include cross-file macro expansion and compiler
elaboration. Package re-export support
does not bind a DPI-export function name; that residue is now separated into
topology handshake 31, still open. Shared path normalization (1),
structured formatter error output (11), and the MCP-era engine requests
(36–42, e.g. a parser silent on a trailing `,` in a connection list) also
remain open. Inline aggregate override arguments are
supported, but instance templates still omit a type default written across
multiple lines. These are narrower limits than the old audit's unresolved
entries 2, 16 and 17 suggested.
## Historical audit findings and evidence
The **2026-09-04** audit reproduced a temp-file collision at the old revision:
100 errors in 200 concurrent helper calls, with no mixed final bytes observed.
That is historical evidence, not a current failure. The
[atomic-write-coordination QA](features/atomic-write-coordination/README.md)
records the committed regression test and successful 2/4/8-thread checks.
[Lint-config-contract](features/lint-config-contract/README.md) records CLI/LSP
selection parity and once-only logging checks.
[Walk-cycles](features/walk-cycles/README.md) and
[small-items-4](features/small-items-4/README.md) record cycle handling, recoverable
warnings and the closed delay-comment gaps.
[Performance take 3](performance_take3.md) measures v0.43.0 and predates the
v0.44.0 fix. The later [didOpen-cost report](features/didopen-cost/README.md)
records 1,742 ms → 117 ms on the large pinmux file at workspace scope, with
unchanged diagnostics. These are feature measurements on one machine, not
fresh measurements by this documentation refresh. The 814/820 frozen-corpus
result likewise remains attributed to feature QA; no corpus or OpenTitan sweep
is part of this refresh.
## Validation of this refresh
This is a documentation refresh. It ran no build, test, corpus sweep,
benchmark or site build; every number below is quoted from the lead's
release gate for v0.60.0, not re-measured here.
- `cargo fmt --all -- --check` and `cargo clippy --workspace --all-targets
-- -D warnings`: clean.
- Workspace lib/bins/tests under `tools/guard.sh` (2026-10-07): **80 suites,
5 078 passed, 0 failed, 51 ignored**.
- `node --test` editor tests: **6/6** passed.
- CI green on `58520e5` (checks, and the corpus gate at its 814 baseline).
- Release v0.60.0 published with 8 assets; the darwin-arm64 `.vsix` was
checksum-verified.
The 2026-09-07 refresh's own measurements (4,163 tests at `df4e714`, 836
site links) are historical and describe that snapshot only. Relative links
in this file were checked to exist; feature QA logs and backlog checkboxes
remain their owners'.