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]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-05 13:35:57 -05:00
1 parent 9ef1058059
commit f476c31483
59 files changed
+2031 -479

No files matched your search

@@ -39,7 +39,7 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
also protect statement scopes, and verification covers the complete output.
- **Lint:** `ParsedSource` bundles one tokenization and tolerant parse;
`LintContext` supplies source facts and lazy semantics. The registry selects
73 rules with severities and validated options. Inline waivers filter findings,
73 rules with severities and validated options. Inline and external waivers filter findings,
and the front ends protect fenced bytes before applying fixes.
- **Refactor:** parsed spans and resolved references produce an edit plan;
the engine checks the whole candidate edit before returning it. Server source
@@ -47,7 +47,7 @@ lucisv follows the same separation of concerns that makes ruff fast and maintain
edit or refuse over. No formatter dependency is involved.
- **Editor:** one ordered synchronous loop owns `Workspace`; open documents
overlay disk facts. Scans publish index/include/completion batches together.
Closed-file facts persist under codec 17; a bounded file-view cache serves
Committed closed-file facts persist under codec 18, including package re-exports; a bounded file-view cache serves
queries that still need source text. Lazy port actions defer the edit until
selection; recorded file-scope definition positions avoid a closed-file read.
@@ -63,6 +63,22 @@ verification, persisted semantic facts, server state/ordering, and matching
server/editor setting names. Source modules are split by grammar domain under
`parser/`, `ast/`, `format/`, `bind/`, `workspace/`, `ports/`, and `server/`.
## Recent changes and release boundary
v0.42–0.44 added external waiver files, exclusive atomic temp files with
canonical CLI deduplication, shared project/editor lint configuration,
cycle-aware directory walks with recoverable warnings, and inline aggregate
overrides. The v0.44.0 `undriven-net` fix asks the workspace mention census only
after local guards, reducing editor open/flush latency without changing the
rule's findings or the synchronous request-ordering contract.
Two accepted changes are committed after v0.44.0: type names now carry exact
AST spans (`scan.rs` is retired), and package re-exports are references and
cycle-guarded member edges in codec 18. Re-exporting a name does not import it
into the exporting package's local scope. DPI-export names remain unbound.
The separate hierarchical-tail work proposes codec 19 and a module member
surface for instance paths; it is still under QA and is not a released API.
## Design invariants
- **Source fidelity:** comments and blank-line intent survive the parser.
@@ -60,6 +60,13 @@ Filelist paths bypass `--exclude` and `.gitignore`, just like direct command-lin
Directory walks read `.gitignore` in each directory. Deeper rules override shallower rules; the last matching line wins. Supported syntax includes comments, blank lines, `*` within a component, anchored `/`, directory-only trailing `/`, and `!` negation. `**`, `?`, character classes, escapes, global excludes, and tracked-file exceptions are not implemented.
A directory is visited once by identity, so symlink cycles terminate. CLI
inputs resolving to the same canonical path are processed once. An unreadable
directory or `.gitignore`, or a dangling source-file link encountered while
walking, produces `warning: <path>: <message>` on stderr and the walk continues;
these warnings do not change the exit code. A missing explicitly named input
remains an error.
## Exit codes
| Code | Meaning |
@@ -11,7 +11,7 @@ Every `error`-class rule is held to one discipline: it goes **silent whenever th
This page is hand-written prose. The generated truth is `lucisv check --rules-doc`, which prints every rule with its class, default, fix and rationale straight from the registry — **and every option a rule takes, with its kind and default**.
A configurable rule is configured in a `[lint.<rule-name>]` table of a `lucisv.toml`, or from an editor in the `lucisv.lint.options` object; the option names are Verible's wherever it has the same option. An unknown rule or option name, a value of the wrong kind, an out-of-range integer or a pattern that does not compile fails a CLI run naming the file and the line. Invalid editor option settings are logged and dropped; invalid project-file option entries are currently dropped silently by server linting.
A configurable rule is configured in a `[lint.<rule-name>]` table of a `lucisv.toml`, or from an editor in the `lucisv.lint.options` object; the option names are Verible's wherever it has the same option. An unknown rule or option name, a value of the wrong kind, an out-of-range integer or a pattern that does not compile fails a CLI run naming the file and the line. Rejected project entries are logged once with file and line and dropped by server linting; invalid editor options and unknown editor select/ignore names are also logged. Valid entries continue to apply.
```toml
[lint.line-length]
@@ -7,7 +7,9 @@ description: Navigational index of the main public APIs in lucisv’s reusable R
This is a navigational API index, not source documentation. It summarizes the main public callable surface of the six reusable library crates in the workspace; command-line and language-server binaries are documented in their dedicated references.
The workspace baseline is v0.41.0. For the complete signatures and fields,
The latest release is v0.44.0. This index includes the accepted type-name-span
and package-re-export additions committed at `9ef1058` for the next release;
it excludes the in-progress hierarchical-tail API and codec 19. For the complete signatures and fields,
run `cargo doc --workspace --no-deps`; this hand-maintained index is not an
exhaustive replacement for rustdoc. The parser's strict and tolerant entry
points share one grammar; tolerant errors do not imply formatter acceptance.
@@ -50,7 +52,7 @@ The CLI and server configure their worker threads accordingly.
| `Module` | `end_kw` |
| `ClassDecl` | `is_interface_class` |
| `BindDirective` | `target_path`, `head` |
| `DataType` | `is_implicit`, `params`, `inline` |
| `DataType` | `is_implicit`, `params`, `inline`, `name_span`, `segments` |
| `VirtualKw` | `text` |
| `CallComments` | `is_empty` |
| `WithComments` | `is_empty` |
@@ -93,7 +95,8 @@ The CLI and server configure their worker threads accordingly.
| Function | Purpose |
|---|---|
| `run` | Parse and lint source in one call |
| `lint` | Run enabled rules against a prepared context |
| `lint` | Run enabled rules against a prepared context with inline waivers |
| `lint_with` | Apply inline and external waivers and return external usage alongside findings |
| `all_rules` | Return the complete rule registry |
| `default_rules` | Return rules enabled for a single-file run |
| `workspace_rules` | Return defaults plus project-aware semantic rules |
@@ -117,6 +120,8 @@ The CLI and server configure their worker threads accordingly.
| `Severity` | `as_str`, `from_name`, `describes`; classes `Error`, `Warning`, `Style` |
| `RuleOptions` | `new`, `is_empty`, `set_raw`, `set`, `overlay`, `is_set`, `bool`, `int`, `str`, `list` |
| `OptionKind` / `OptionDefault` | `as_str`, `vocabulary` / `value`, `as_written` |
| `ExternalWaivers` | `read`, `parse`, `absorb`, `is_empty`, `unused` |
| `WaiverUse` | `merge` (aggregate usage across a complete run before reporting unused waivers) |
| editor settings functions | `vscode_lint_settings`, `rule_setting`, `severity_setting` |
## `vlog_semantic`
@@ -145,8 +150,8 @@ The CLI and server configure their worker threads accordingly.
| `index_order` | Sort workspace inputs into their deterministic index order |
| `words::harvest` / `harvest_text` / `harvest_raw` | Build the shared identifier census from tokens or source text |
`FACTS_FORMAT` is **17**. Cached facts include normal and macro identifier
censuses; `Def::lines.positions` can carry `DeclPositions` with UTF-16 ranges
`FACTS_FORMAT` is **18** in the committed snapshot. Cached facts include
normal/macro identifier censuses and package re-export edges (the `RX` group); `Def::lines.positions` can carry `DeclPositions` with UTF-16 ranges
for file-scope declarations. Any persisted shape or fact-census change needs
a codec-version decision so stale caches cannot silently omit answers.
@@ -190,14 +195,14 @@ a codec-version decision so stale caches cannot silently omit answers.
| `config::parse` | Parse strict lucisv configuration text |
| `Discovery` | `new`, `for_input`, `for_file`, `for_dir` |
| `filelist::read` | Resolve a nested EDA filelist |
| `walk::collect_files` | Walk inputs with ignores and exclusions |
| `walk::collect_files` | Walk inputs with ignores, exclusions and directory-cycle detection; accepts a `FnMut(Warning)` sink for recoverable failures |
| `walk::is_excluded` | Test a path against exclusion patterns |
### Atomic writes and cache
| Function or type | Public methods |
|---|---|
| `atomic::write_atomic` | Replace file contents through a sibling temp file and rename; callers must coordinate concurrent writes to one target |
| `atomic::write_atomic` | Replace contents using an exclusively created per-operation temp file; concurrent replacements publish one whole buffer, last writer wins |
| `content_hash` | Compute the cache’s FNV-1a content fingerprint |
| `Cache` | `load`, `disabled`, `is_clean`, `record`, `store` |
@@ -96,13 +96,15 @@ setting is non-empty and the project's `[lint] select` otherwise; `ignore`
is decided the same way and independently. The severity switches and
per-rule toggles are editor-only — a `lucisv.toml` has no such keys — and
apply over whichever selection stands. Editor rule options overlay project
rule options key by key. An entry that cannot be used is dropped and logged
once per configuration file and entry, in the same `<file>:<line>:
<message>` wording `lucisv check` fails with: an invalid editor option, an
invalid `[lint.<rule>]` entry, an unknown rule name in `[lint]
select`/`ignore`, or an unreadable waiver file. `lucisv check` treats each
of these as a configuration error and exits 2; the server keeps linting with
the entry dropped.
rule options key by key. An invalid project option, unknown project rule name,
or bad waiver entry is dropped and logged once with the same
`<file>:<line>: <message>` wording the CLI reports. The CLI treats those
project errors as exit 2; the server keeps linting with the valid entries.
Editor-only settings are validated separately: bad options are logged, and an
unknown select/ignore name is logged once as
`lucisv.lint.select: unknown rule: <name>` (or `ignore`). Changing that list
re-arms logging for newly introduced mistakes. An empty editor selection is
the fallback sentinel, so it does not clear a non-empty project selection.
## Cache