Files
lucisv/docs/repository-analysis.md
T
lucioandClaude Fable 5.1 f476c31483 Cross-file instance-member tail: a module's hierarchical surface, read only behind an instance head; rename edits the tail
TODO §49 (docs/features/hierarchical-tail). Closes topo §2.9-23 and
comment-slots finding 2. The first dev was cut off by an outage with the
library half complete; a second finished the tests, README and gates.

`Surface { Connection, Hierarchical }` on `Resolution::ExternalCandidate`
and `MemberSite::Unit`, set by `resolve.rs::head_surface` for an instance
head. `workspace/hierarchy.rs`: `surface_of` (the export rule, re-ruled)
and the two surface-taking reads; the index keeps two disjoint tables —
`members` (connection: ports, parameters; byte-identical to before for
every existing reader) and `hier_members` (nets, variables, instances) —
and a hierarchical read consults the connection table first, so a port
has one record. `FACTS_FORMAT` 18 → 19. `assign w = u_x.sig;` in another
file now resolves to `sub`'s `wire sig`; rename edits both files (nested
`u_a.u_b.sig` included); the §2.9-20 warning is retired for a resolved
tail; a generate-scoped net is still refused honestly. Completion after
`u_x.` in an expression lists the hierarchical surface; a connection
list's does not.

Census: single-file numbers unmoved; 12 939 connection + 5 239
hierarchical-only members; 335 corpus references newly resolve, 514 over
opentitan `hw/` (20 sampled by QA, all genuine). 0 of 860 corpus files
differ. Also: §50/§51 planned, §55 (state.rs size) filed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 13:35:57 -05:00

151 lines
10 KiB
Markdown

# Repository analysis
Refreshed **2026-09-05**. Latest release: **v0.44.0** (`66f3898`). This
review uses committed snapshot **`9ef1058`**, which also includes accepted
type-name-spans and package-reexports work intended for v0.45.0. The active
hierarchical-tail changes are described separately; their QA is still open.
## 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 three issues raised by the September 4
audit have been fixed; they should no longer be treated as open priorities.
| 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 | Committed, accepted for v0.45.0 | `DataType::name_span()` / `segments()` and disable-target spans replace semantic name scanning; `scan.rs` is deleted |
| Package re-exports | Committed, accepted for v0.45.0 | Export name halves are references; the shared member walk follows cycle-guarded re-export edges; persisted facts gain `RX`, codec **18** |
| Hierarchical tails | **Working tree, QA pending** | Proposed codec **19**, tagged member/reference surfaces, instance-tail resolution and completion, and cross-file rename updates |
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`; committed `workspace/reexport.rs`, active `workspace/hierarchy.rs` |
| `crates/vlog_linter` | 73-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, port edits, instance plans; shared `scope.rs`, whole-edit verification in `check.rs` |
| `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; project lint validation/logging in `lint/project.rs` |
| `editors/` | VS Code client/grammar/settings/hierarchy UI and configuration for other editors |
| `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 |
The crate dependency graph is unchanged. Parser and core have no dependencies;
formatter and semantics each depend on parser; linter and refactor depend on
parser and semantics. The linter depends 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.
**New committed 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 18 prevents older stores
from silently omitting this information.
## Active work and remaining limits
TODO §49 owns hierarchical-tail resolution. At this refresh, its working tree
adds `Surface::{Connection, Hierarchical}`, a second member table, surface tags
on persisted declarations/references, and codec 19. Connection completion and
port propagation retain the existing ports/parameters view; paths behind an
instance can additionally reach internal nets, variables and nested instances.
Member completion and rename fan-out are part of the same contract. The feature
README reports development checks; independent QA is still pending, so topology
handshake 23 remains open. No working-tree API is treated as released here.
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 `9ef1058`, with a separate
build directory and the repository resource guard. This avoids the live agents'
target directory and does not certify their uncommitted changes.
- `cargo fmt --all -- --check`: passed.
- `cargo clippy --offline --workspace --all-targets -- -D warnings`: passed.
- `cargo test --offline --workspace`: **3,829 passed, 0 failed, 44 ignored**,
across 49 harnesses, under `tools/guard.sh`. The archive did not include the
ignored/untracked corpus checkout, and ignored measurement tests were not run.
- `ASTRO_TELEMETRY_DISABLED=1 npm run build` in `docs/site`: passed;
13 pages, Pagefind search and sitemaps rebuilt.
- Generated-site validation: **820** local links, assets and anchors checked,
zero errors. Relative links in the root analysis/topology/coverage docs also
passed. `git diff --check` passed for these documentation changes.
The previous audit's 3,745 passing tests describe its September 4 snapshot;
they are not reused as the test result 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.