204 lines
14 KiB
Markdown
204 lines
14 KiB
Markdown
# Repository analysis
|
||
|
||
Refreshed **2026-09-07** against committed snapshot **`df4e714`**. Latest
|
||
release: **v0.49.0** (`4c2dae3`). The working tree was clean at the start of
|
||
this review. Loop 2 is closed; no uncommitted feature work is included.
|
||
|
||
## Assessment and current status
|
||
|
||
lucisv remains an eight-crate toolchain: six reusable Rust libraries, CLI 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.
|
||
This refresh reproduced a new cache-key omission, documented below alongside
|
||
the remaining refactor limits.
|
||
|
||
| 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 |
|
||
|
||
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, 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`, `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.rs`, capability handlers including `imports.rs`, `extract.rs`, `inline_module.rs`; project lint validation/logging in `lint/project.rs` |
|
||
| `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. Cache codec 19 prevents older stores
|
||
from silently omitting this information.
|
||
|
||
The delivered hierarchical-tail contract uses `Surface::{Connection,
|
||
Hierarchical}`, a second member table, surface tags on persisted declarations
|
||
and references, and codec 19. 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.
|
||
|
||
`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:** 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**). The verifier also has a bounded testability gap for
|
||
same-file relocation of protected pieces (**32**); no current planner produces
|
||
that edit shape. See the [extract/inline QA record](features/extract-inline-module/README.md).
|
||
|
||
TODO **§55** defers `state.rs` decomposition to Loop 3. The September 7
|
||
measurement in `CLAUDE.md` reports 958 production lines there, `perf.rs` 900
|
||
with a recorded reason, `lexer.rs` 763, and `format/stmt.rs` 604. TODO §57
|
||
still has remote-artifact and memory bookkeeping unchecked; this review does
|
||
not certify remote releases or manual editor acceptance.
|
||
|
||
Remaining constraints include generate-block-scoped hierarchical paths,
|
||
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. Shared path normalization (1) and structured formatter
|
||
error output (11) 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
|
||
|
||
Checks ran against an isolated archive of committed `df4e714`, with a separate
|
||
build directory and the repository resource guard. This validates a fixed
|
||
source snapshot without sharing another task’s build directory.
|
||
|
||
- `cargo fmt --all -- --check`: passed.
|
||
- `cargo clippy --offline --workspace --all-targets -- -D warnings`: passed.
|
||
- `cargo test --offline --workspace`: **4,163 passed, 0 failed, 44 ignored**,
|
||
across 55 harnesses, under `tools/guard.sh`. The archive did not include the
|
||
ignored/untracked corpus checkout, and ignored measurement tests were not run.
|
||
- `node --test editors/vscode/*_test.js`: **5 test files passed** (extract
|
||
input, hierarchy model/sections/view, restart behavior). The cache probe
|
||
above also ran under the resource guard.
|
||
- `ASTRO_TELEMETRY_DISABLED=1 npm run build` in `docs/site`: passed;
|
||
13 pages, Pagefind search and sitemaps rebuilt.
|
||
- Generated-site validation: **836** local links, assets and anchors checked,
|
||
zero errors. All **26** relative file links in README, analysis, topology and
|
||
coverage docs also passed. `git diff --check` passed for these documentation changes.
|
||
|
||
Earlier test totals describe earlier snapshots; the results above were
|
||
measured again for this revision. This refresh changes documentation only and leaves feature QA logs and backlog checkboxes to their
|
||
owners. No corpus/OpenTitan sweep, new benchmark, release packaging or
|
||
publishing was performed.
|