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]>
533 lines
30 KiB
Markdown
533 lines
30 KiB
Markdown
# hierarchical-tail
|
||
|
||
TODO.md §49 — the cross-file instance-member tail in rename. `docs/topo.md`
|
||
§2.9 row 23. Ships in 0.45.0.
|
||
|
||
## Goal
|
||
|
||
With `module sub` in `sub.sv` and `assign w = u_x.sig;` in `top.sv`, renaming
|
||
`sub`'s internal `wire sig` used to edit `sub.sv` alone and warn about the
|
||
tail in `top.sv` — a rename that hands back a design which no longer
|
||
elaborates, with an apology. The same shape in one file resolved and was
|
||
edited. The cause was the export rule in `workspace/record.rs::is_exported`:
|
||
a module exported its ports and its parameters and nothing else, so the
|
||
cross-file member walk could not see `sig` through `u_x`.
|
||
|
||
The lead's ruling, implemented here: a module gains a **second, distinct
|
||
member surface**. Its *connection* surface stays what it was — ports and
|
||
parameters, what a connection list may name (IEEE 1800 §23.3). Its
|
||
*hierarchical* surface is that set **plus** its nets, its variables and its
|
||
instances, which is what a hierarchical path may name from anywhere in the
|
||
design (§23.6). The index records both, tagged; only the tail walk behind an
|
||
**instance** head reads the hierarchical one. Rename's reference set then
|
||
includes the cross-file tail, the edit lands in both files, and the §2.9-20
|
||
"the rename says so" warning is no longer raised for a tail that resolved (it
|
||
stays, unchanged, for one that did not).
|
||
|
||
## Assumptions
|
||
|
||
- **A hierarchical path is what an instance head opens, and nothing else
|
||
is.** `resolve.rs::head_surface` returns `Surface::Hierarchical` for exactly
|
||
`SymbolKind::Instance` and `Surface::Connection` for every other link of a
|
||
spine. A class handle, a struct field, a virtual interface and a package
|
||
path are all the connection surface, and for those units the distinction is
|
||
noise anyway — a package, a class, a struct and a covergroup have one
|
||
surface each.
|
||
- **The hierarchical surface contains the connection one.** A record is
|
||
tagged with the *narrowest* surface it joins, and a hierarchical read
|
||
consults the connection table first. So a tail naming a port has exactly one
|
||
answer, from one record, and it is the same declaration a connection-list
|
||
lookup finds. This is asserted, not assumed:
|
||
`a_tail_naming_a_port_is_one_answer_and_one_edit`.
|
||
- **A unit's members are the symbols of its own scope.** `collect_members`
|
||
walks `unit.child_scope` and no deeper (except into a nested class, struct
|
||
or covergroup, whose members are keyed under their own name). A net declared
|
||
inside a **generate block** therefore joins neither surface: its scope is
|
||
the block's. `u_x.gen_b.sig` does not resolve, and the rename leaves the
|
||
tail alone and says so — the honest refusal, pinned by
|
||
`a_generate_block_scoped_net_named_through_an_instance_is_refused_honestly`.
|
||
Widening that means teaching the index about generate scopes and their loop
|
||
indices (`u_x.gen[0].sig`), which §49 deliberately did not do.
|
||
- **An interface is unchanged.** Its signals *are* its connection surface
|
||
(the 2026-09-01 ruling: `virtual bus_if vif; vif.data` is how every DV
|
||
testbench reaches `data`, and `vif` is a variable, not an instance). It
|
||
gains only its **instances** on the hierarchical surface, for the same hop
|
||
reason a module does.
|
||
- **Two instances of a name in one module cannot happen**, so the
|
||
hierarchical table's `Vec<Def>` per name holds duplicates only across files
|
||
— the same ambiguity rule, and the same refusal, the connection table has
|
||
always had.
|
||
|
||
## Handshakes
|
||
|
||
### What this consumes
|
||
|
||
- `vlog_semantic::Semantics` — `member_site` / `unit_site` return the site a
|
||
tail is walked from, and a `Symbol`'s `kind` is what says whether a link is
|
||
an instance.
|
||
- `vlog_parser` — unchanged; nothing in the parser moved.
|
||
|
||
### What this promises
|
||
|
||
**`vlog_semantic` (the surface encoding).**
|
||
|
||
- `pub enum Surface { Connection, Hierarchical }` in `model.rs`, re-exported
|
||
from the crate root.
|
||
- `Resolution::ExternalCandidate { paths, surface }` — a new field. Every
|
||
construction site outside a hierarchical tail passes `Surface::Connection`;
|
||
`resolve.rs::head_surface` is the one place that can return the other.
|
||
- `MemberSite::Unit { path, surface }` — was `MemberSite::Unit(String)`. The
|
||
surface is `Hierarchical` exactly when the head of the spine was an
|
||
instance, and it stays that for every further hop: `u_a.u_b.` is one
|
||
hierarchical path.
|
||
- `WorkspaceIndex` gains `member_in(unit, member, surface)`,
|
||
`members_of_chain_in(path, surface)`, `member_unit_in(unit, member,
|
||
surface)` and `hierarchical_declarations(name)`. **Every existing method
|
||
reads the connection surface and answers exactly what it answered before**:
|
||
`member`, `members_of`, `members_of_chain`, `member_unit`,
|
||
`workspace_symbols`.
|
||
- `IndexCounts` gains `hierarchical_members`, disjoint from `members`, so the
|
||
whole member census is the two added.
|
||
- `FACTS_FORMAT` 18 → 19. Two new fields — a one-letter surface on every
|
||
declaration and on every `External` reference fact — so an older record
|
||
would be read field-shifted, and `index_cache` drops a store by format as it
|
||
already does.
|
||
|
||
**`lucisv_server`.** `Workspace::rename_sources`' fan-out gains one rung:
|
||
every file declaring the name on a module's hierarchical surface. `state.rs`
|
||
is the only server file whose *behaviour* changed;
|
||
`completion/member.rs` follows the site's own surface (below).
|
||
|
||
**`vlog_refactor`.** No behaviour of its own changed. `rename/warnings.rs`
|
||
took a mechanical `..` in one pattern for the new `ExternalCandidate` field;
|
||
the §2.9-20 warning retires itself, because it is raised only when the overlay
|
||
answers `StillUnresolved` and a resolved tail no longer does.
|
||
|
||
### The completion decision, said plainly
|
||
|
||
Behind `u_x.` **in an expression**, completion lists the module's
|
||
**hierarchical** surface — its nets, its variables and its instances as well
|
||
as its ports and its parameters. That is what the user is reaching for, it is
|
||
exactly what the tail resolution will find, and it is what the *in-file* half
|
||
of the same function has always offered for an instance this file declares
|
||
(`MemberSite::Scope` pushes every symbol of the module's scope). Making the
|
||
two halves disagree would have been the odd choice.
|
||
|
||
Behind the `.` of a **connection list** it is the connection surface and
|
||
nothing more. `.internal_net(w)` is not a legal connection, so an item there
|
||
would be one the resolution could not answer — a wrong answer rather than a
|
||
generous one. That path is `connection_members`, which reads
|
||
`WorkspaceIndex::members_of` (the connection table) and filters to `Port` or
|
||
`Param`; it never reaches `members_at`. Both halves are pinned in one test:
|
||
`an_instance_head_lists_the_hierarchical_surface_and_a_connection_list_does_not`.
|
||
|
||
The `propagate-ports` engine reads `member`/`members_of` and is untouched.
|
||
|
||
### What did not widen
|
||
|
||
- **Reference postings.** `facts_from_analysis` records a `Local` posting only
|
||
for a use whose declaration is on the **connection** surface. Posting a
|
||
module's every internal-net use would multiply the reference table by the
|
||
size of an RTL body for an answer nothing reads: the only consumer is a
|
||
rename, which re-analyses the declaring file anyway. The *cross-file* half —
|
||
the tail in the other file — is an `External` fact, and that is what makes
|
||
the rename work.
|
||
- **`workspace/symbol`.** An internal net is still not a workspace symbol: the
|
||
request answers what a user can name from outside, and a design with 20 000
|
||
modules has hundreds of thousands of internal signals.
|
||
`hierarchical_declarations` is the separate, map-only question the rename
|
||
fan-out asks instead.
|
||
- **`verify.rs`.** Untouched. No normalization was added or broadened, so no
|
||
masked-corruption attack tests are owed.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] 49.1 surface bit in facts, `FACTS_FORMAT` 18 → 19, index member walk
|
||
- [x] 49.2 `MemberOf` behind an instance reads the hierarchical surface;
|
||
rename edits the tail; the warning retired for resolved tails
|
||
- [x] `workspace/hierarchy.rs` — `surface_of` (the old `is_exported`,
|
||
re-ruled) plus the two surface-taking reads; `record.rs`'s export doc
|
||
comment rewritten to say the ruling moved
|
||
- [x] Completion decision made, said here, and pinned both ways
|
||
- [x] Tests: the cross-file twin of the rename pin; nested `u_a.u_b.sig`; a
|
||
tail naming a port (one answer, one edit); a parameter; the
|
||
generate-block refusal; the interface tail unchanged; the ambiguous
|
||
`sub` still refused; the connection list unchanged; the census delta
|
||
- [x] Gates (guarded); census delta explained; opentitan before/after
|
||
- [ ] QA
|
||
|
||
## Work log
|
||
|
||
### 2026-09-05 — dev (agent 2, resuming)
|
||
|
||
**The state I found.** The first dev agent on this lane was cut off by a
|
||
network failure mid-round, leaving uncommitted work in the tree: 20 modified
|
||
files plus a new `crates/vlog_semantic/src/workspace/hierarchy.rs`, and no
|
||
feature README at all. `cargo check --workspace --all-targets` passed; the
|
||
agent's last words were "now the test compile errors across the workspace",
|
||
and that is exactly where it stood — the *library* half of §49 was complete
|
||
and coherent, the test suite was not green, and no new tests had been written.
|
||
|
||
What the first agent had already built, and which I kept unchanged: the
|
||
`Surface` enum and its two carriers (`Resolution::ExternalCandidate`,
|
||
`MemberSite::Unit`), `head_surface` in `resolve.rs`, `hierarchy.rs` with
|
||
`surface_of` and the two surface-taking reads, the second `hier_members` table
|
||
in `WorkspaceIndex` with its update/clear paths, the `FACTS_FORMAT` 18 → 19
|
||
encoding, `hierarchical_declarations` and the fan-out rung in the server's
|
||
`state.rs`, and the completion follow-the-site change in
|
||
`completion/member.rs`. It is a good design and I did not redo any of it.
|
||
|
||
**What I finished.**
|
||
|
||
1. Made the workspace suite green. Four failures, each a real consequence of
|
||
the change rather than a bug:
|
||
- `lucisv_server` `a_local_only_symbol_sharing_the_new_names_spelling_is_not_a_bogus_refusal`
|
||
— its fixture was a module's `wire`, which is now a hierarchical
|
||
declaration and joins the fan-out by the new rung, so the test would have
|
||
passed for the wrong reason ever after. The fixture is now a **function's
|
||
local**, which is on neither surface, and the rung-6 attack it exists for
|
||
is intact. The behaviour it used to pin got its own test beside it,
|
||
`a_module_net_sharing_the_new_names_spelling_joins_the_fan_out_and_refuses_nothing`:
|
||
the file *is* pulled in, and the rename still succeeds and still writes
|
||
nothing there.
|
||
- `vlog_semantic` `a_format_3_record_with_two_declarations_is_rejected_not_misread`
|
||
— the record stripper counts a decl's fields. `MEMBER_DECL_FIELDS`
|
||
11 → 12, `UNIT_DECL_FIELDS` 19 → 20, and one more `drain` for the surface
|
||
letter.
|
||
- `vlog_semantic` `an_instance_head_reaches_a_module_in_another_file` — its
|
||
`u.internal` assertion was the old ruling. It now asserts the net
|
||
resolves, *and* that the connection table still does not hold it, *and*
|
||
that a port has one record on it.
|
||
- `lucisv_server` e2e `an_instance_heads_port_is_hovered_across_files` —
|
||
hover of `u.internal` across files now answers with the net's own
|
||
declaration. The test asserts the file and line it names.
|
||
2. Wrote the plan's tests (all passed first time against the first agent's
|
||
library code, which is the strongest evidence I have that it was finished):
|
||
the cross-file twin driven from **both** ends, nested `u_a.u_b.sig` over
|
||
three files, the port, the parameter, the generate-block refusal, the
|
||
interface tail, the ambiguous-`sub` refusal from both ends, and the
|
||
two-way completion pin.
|
||
3. Added the census-delta measurement as a corpus test rather than a prose
|
||
claim, and put the hierarchical count into the index census line.
|
||
4. Wrote this README, which the first agent had not started.
|
||
|
||
**Deviations and files touched outside the plan's expected set.** The plan
|
||
named `crates/vlog_semantic/{facts.rs,workspace/*}`,
|
||
`crates/vlog_refactor/src/rename/*`,
|
||
`crates/lucisv_server/src/{completion/*,state.rs}`, tests, this README and
|
||
`TODO.md`. Beyond those I touched:
|
||
|
||
- `crates/lucisv_server/src/rename.rs` — **tests only** (the `#[cfg(test)]`
|
||
block): the fixture swap and the new sibling test above. No production line
|
||
in that file changed.
|
||
- `crates/lucisv_server/tests/e2e.rs` — the hover assertion above.
|
||
- `crates/vlog_semantic/src/{lib.rs,model.rs,resolve.rs}` — the first agent's
|
||
work, and unavoidable: `Surface` has to live in the model and be exported,
|
||
and `resolve.rs` is where a spine's head is visible.
|
||
|
||
**One size flag for the lead.** `crates/lucisv_server/src/state.rs` is **957
|
||
production lines outside its test module** — already well over the 800
|
||
threshold before this lane, and CLAUDE.md's post-§28 measurement (which names
|
||
only `perf.rs` and `lexer.rs` as over 600) is stale for it. This lane added
|
||
**13** production lines there: the fan-out's new rung, seven lines inside
|
||
`fan_out_of` plus its doc bullet. The rule says a dev adding to a file near
|
||
600 puts the code in a new module; I did not, because the rung reads
|
||
`self.index`, `want_declaration` and the caller's `containers` set and a
|
||
module holding seven lines of it would be worse than the disease. The file
|
||
wants a split of its own, which is a decomposition round, not a paragraph in
|
||
this one. Every other file this lane touched is inside the rule:
|
||
`workspace/hierarchy.rs` 80 production lines, `workspace/index.rs` 283,
|
||
`workspace/record.rs` 315 (it *lost* the 60-line `is_exported`),
|
||
`model.rs` 161, `resolve.rs` 520, `facts.rs` 526. Every function added or
|
||
changed is under 50 lines.
|
||
|
||
**The gates.** `cargo fmt -p vlog_semantic -p lucisv_server -p vlog_refactor`
|
||
(never `--all`) and `cargo clippy --all-targets` clean; `cargo test
|
||
--workspace` **3 839 passed / 0 failed / 44 ignored** (baseline 3 829, +10:
|
||
seven new rename tests, one new server fan-out test, one new completion test,
|
||
one new census test); `tools/corpus_check.sh` **814/820**, the same six
|
||
pre-existing parse errors (`compare_helper.sv`, `riscv_core_setting.tpl.sv`,
|
||
`latch_map.v`, `riscv_instr_cover_group.sv`, `romload/testbench.v`,
|
||
`smtbmc/mulcmp.v`); `format --stdout` over all **860** corpus files
|
||
**byte-identical** to `~/.cache/lucisv-baselines/lucisv-0.44.0`, 0 differing;
|
||
`cargo build --release -p lucisv_server` + `node editors/vscode/smoke.js` OK.
|
||
Everything through `tools/guard.sh`; no guard kill, no limit raised.
|
||
|
||
**The census delta.** The single-file corpus census does not move at all —
|
||
860 files, 27 486 symbols, 103 875 references, 1 197 unresolved, 0 unplaced,
|
||
identical to the number the brief carried. It cannot move: §49 adds a tag to
|
||
a resolution, not a resolution. What moves is the *workspace* census:
|
||
|
||
| | before | after |
|
||
|---|---|---|
|
||
| exported members (connection surface) | 12 939 | 12 939 |
|
||
| hierarchical-only members | — | **5 239** |
|
||
| corpus references only the hierarchical surface answers | 0 | **335** |
|
||
|
||
The connection count is unchanged **by construction**: `surface_of`'s
|
||
`Surface::Connection` arms are the old `is_exported`'s `true` arms, name for
|
||
name, with the hierarchical kinds added as new arms. The 5 239 new records are
|
||
the corpus's modules' and interfaces' nets, variables and instances. Over the
|
||
whole corpus 707 references carry a hierarchical candidate and 668 of them
|
||
resolve; **335** of those land in the hierarchical-only table, which is the
|
||
slice that could not resolve before.
|
||
`the_hierarchical_surface_is_what_answers_a_measurable_slice_of_the_corpus`
|
||
prints the three numbers on every run and pins the direction, not the
|
||
constants.
|
||
|
||
A note on how that 335 is counted, because the obvious way is wrong. "The
|
||
declaration's kind is `Net`, `Var` or `Instance`" over-counts by 216 on this
|
||
corpus: an **interface's** signals are `Net`/`Var` and are on the *connection*
|
||
surface, so they resolved before §49 as well. The exact test is membership of
|
||
the hierarchical-only table itself
|
||
(`WorkspaceIndex::hierarchical_declarations`), which is what the test does.
|
||
|
||
### opentitan (read-only, scratch index store)
|
||
|
||
Everything below is a `textDocument/rename` **request** whose returned edit
|
||
was inspected and never applied.
|
||
`git -C ~/repo/opentitan status --porcelain` reported the same three
|
||
pre-existing files (`hw/ip/aes/dv/tb/tb.sv`,
|
||
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`)
|
||
before and after every run. Baseline binary: `lucisv-server` built
|
||
`--release` from the `v0.44.0` tag in a scratch `git worktree` under the
|
||
scratchpad, removed afterwards. Guard on every command; **no guard kill**.
|
||
|
||
**The headline — a DV bench reaching an IP module's internal variable.**
|
||
`hw/ip/lc_ctrl/dv/tb.sv:229` writes
|
||
`assign #1ps lc_ctrl_if.lc_ctrl_fsm_state = dut.u_lc_ctrl_fsm.fsm_state_q;`,
|
||
and `fsm_state_q` is declared at `hw/ip/lc_ctrl/rtl/lc_ctrl_fsm.sv:173`.
|
||
Renaming it (root `hw/ip/lc_ctrl`, cursor on the declaration):
|
||
|
||
| | 0.44.0 | this branch |
|
||
|---|---|---|
|
||
| files in the returned edit | `rtl/lc_ctrl_fsm.sv` (8 edits) | `rtl/lc_ctrl_fsm.sv` (8) **+ `dv/tb.sv` (1)** |
|
||
| `rename`, three tries | 10 / 9 / 10 ms | 22 / 23 / 22 ms |
|
||
| `prepareRename`, three tries | 1 / 0 / 1 ms | 0 / 0 / 1 ms |
|
||
|
||
That is the whole feature in one row: 0.44.0 edited the RTL and left the
|
||
bench spelling the old name, and now the bench moves with it. It is also the
|
||
whole cost: the tail's file is in the rename's fan-out now, so it is read,
|
||
parsed and verified — 10 ms → 22 ms on this cursor. `prepareRename` does not
|
||
move, because it does not fan out.
|
||
|
||
**`hw/ip/aes`, the tree the brief named.** Rename of
|
||
`hw/ip/aes/rtl/aes_core.sv:87`'s `logic key_touch_forces_reseed`, root
|
||
`hw/ip/aes`: **the same answer before and after** — `rtl/aes_core.sv`, 3
|
||
edits — at 40 / 41 / 41 ms before and 53 / 55 / 57 ms after; `prepareRename`
|
||
≈ 1 ms in both. And the count of newly resolved `MemberOf` references over
|
||
`hw/ip/aes` is **0**, before and after. That is not a disappointment to hide,
|
||
it is the shape of the IP: `aes`'s 5 hierarchical candidates all reach through
|
||
a **generate block** (`u_aes_core.u_aes_control.gen_fsm[i]. … `,
|
||
`u_aes_core.gen_ghash.u_aes_ghash. … ` in `rtl/aes.sv`) or sit inside a
|
||
`bind aes …` in `dv/sva/aes_bind.sv`, where the head is resolved in the bind
|
||
target's scope in another file and is therefore not an instance symbol this
|
||
file can see. Neither is on either surface, and §49 said so in advance.
|
||
|
||
Over **all of `hw/`** (3 979 files) the picture is the one the corpus
|
||
predicts: 91 930 connection members + **71 849** hierarchical-only ones;
|
||
1 611 references carry a hierarchical candidate, 1 290 resolve, and **514**
|
||
of those are answers only the hierarchical surface can give — `lc_ctrl`,
|
||
`otbn`, `keymgr`, `dma` and `entropy_src` benches reaching into their DUTs.
|
||
|
||
**Store size** (the scratch `initializationOptions.storagePath`, the whole
|
||
index cache for that root):
|
||
|
||
| root | 0.44.0 | this branch | delta |
|
||
|---|---|---|---|
|
||
| `hw/ip/aes` (124 files) | 1 459 576 B | 1 615 179 B | +155 603 B, **+10.7 %** |
|
||
| `hw/ip/lc_ctrl` | 765 347 B | 813 065 B | +47 718 B, **+6.2 %** |
|
||
|
||
Two things are in that delta and they are not the same size: the one-letter
|
||
surface field on every declaration and every external reference fact (small,
|
||
and paid whether or not a module has internals), and the hierarchical member
|
||
records themselves (the bulk).
|
||
|
||
## QA log
|
||
|
||
### 2026-09-05 — QA
|
||
|
||
**Diffs read in full**: `resolve.rs`, `model.rs`, `workspace/{hierarchy.rs (new),
|
||
external.rs, index.rs, mod.rs, record.rs, reexport.rs, update.rs}`, `facts.rs`,
|
||
`lib.rs`, `rename/warnings.rs`, `completion/member.rs`, `state.rs`, `rename.rs`,
|
||
`e2e.rs`, all touched test files. Traced `head_surface` end to end — a link
|
||
opens `Surface::Hierarchical` exactly when the *head symbol's own kind* is
|
||
`SymbolKind::Instance` (`resolve.rs::link_type`/`head_surface`), never off a
|
||
type name's spelling; a same-file spine stays on `MemberSite::Scope`
|
||
untouched by any surface at all, exactly as before this feature. The `Local`
|
||
reference-posting filter to `Surface::Connection` only in `record.rs` is by
|
||
design and doesn't widen anything: an internal net's own-file uses are found
|
||
by re-analysing its declaring file directly (which rename always does for
|
||
the file it edits), not through the posting table that filter narrows.
|
||
|
||
**Gates (guarded, `tools/guard.sh` throughout).** `cargo fmt --check` clean;
|
||
`cargo clippy --all-targets` clean; `cargo test --workspace`: **3 839 passed
|
||
/ 0 failed / 44 ignored** — matches the dev's claim exactly (re-verified
|
||
twice: once with the QA attack tests added, once after removing them, same
|
||
count both times save for the attacks themselves). `tools/corpus_check.sh`:
|
||
**814/820**, the same six pre-existing parse errors. `format --stdout` over
|
||
all 860 corpus files vs `~/.cache/lucisv-baselines/lucisv-0.44.0`: **0
|
||
differing**. Release build (`lucisv`, `lucisv_server`) + VS Code smoke
|
||
(`node editors/vscode/smoke.js target/release/lucisv-server`): OK. Census:
|
||
`the_corpus_index_finishes_most_external_references` prints 860 files,
|
||
103 875 references, 12 939 connection members + **5 239** hierarchical-only —
|
||
matches the README's table exactly.
|
||
|
||
**Rename matrix, driven through the public engine API (`vlog_refactor`) and
|
||
confirmed by the dev's own tests plus attacks I added and then removed
|
||
(temporary `qa_49_*` tests, run green, then deleted — the tree is back to
|
||
exactly the dev's diff):**
|
||
|
||
- Cross-file twin from both ends, nested `u_a.u_b.sig` over three files, a
|
||
port (one answer, one edit — checked the tail's edit range fires once, not
|
||
once per surface), a parameter, the generate-block-scoped net refused
|
||
honestly with no edit, an interface instance tail unchanged, the ambiguous
|
||
two-`sub` case refused from both ends: all the dev's own tests, read and
|
||
re-run green.
|
||
- **New attack — rename onto a name already in the module, via the
|
||
hierarchical tail, from both ends**: refused (`"would change what..."`).
|
||
The live cross-file tail does not bypass the ordinary same-module capture
|
||
check.
|
||
- **New attack — rename a hierarchically-reached net onto a sibling port's
|
||
name**: refused. A capture across the connection/hierarchical surface
|
||
boundary is caught exactly like one within a surface.
|
||
- **New attack — a non-instance head whose *type name* happens to spell a
|
||
module name** (`sub h;` with no parens, a data declaration, not an
|
||
instantiation): `head_surface` correctly reads the head symbol's own kind
|
||
(`Var`, not `Instance`), so `h.internal` reads the connection surface and
|
||
refuses the net. No crash.
|
||
- **New attack — a hierarchical path inside a `bind` connection expression,
|
||
through an instance declared *inside the bind target's module* in another
|
||
file** (the shape behind the aes `bind` zero-count in the README): no
|
||
crash, and the tail never resolves through the wrong scope — the head is
|
||
looked up (if at all) in the writing scope, never the target's, exactly as
|
||
the README predicts. Pinned with a temporary test, then removed.
|
||
- **New attack — `didChange` promotes an internal net to a port**: before,
|
||
hierarchical-only (1 record); after, on the connection table (1 record,
|
||
not 2 — the hierarchical read still finds exactly one), and the cross-file
|
||
tail still resolves exactly once, now to the port. **New attack —
|
||
`didChange` removes the net entirely**: the hierarchical table drops the
|
||
record and the cross-file tail goes back to unresolved. Both via
|
||
`WorkspaceIndex::update_file` at the library level (no server session
|
||
needed) — the incremental-update code path (`update.rs`) is exercised
|
||
identically for hierarchical and connection tables, which is by
|
||
construction from the diff (same `absorb`/`update_file` code, dispatched
|
||
on `decl.surface`) and confirmed by these two round-trips.
|
||
- **New attack — a hierarchical declaration's own reference postings
|
||
include the cross-file tail** (`WorkspaceIndex::references_to` on a net's
|
||
`Def`, gotten via `hierarchical_declarations`): confirmed — this is the
|
||
exact mechanism `state.rs::want_declaration` stands on to pull the tail's
|
||
file into a rename's fan-out.
|
||
|
||
**Completion.** The dev's own two-way pin
|
||
(`an_instance_head_lists_the_hierarchical_surface_and_a_connection_list_does_not`)
|
||
read and re-run. **New attacks, run green then removed**: `u_a.u_b.`
|
||
(nested) lists `u_b`'s module's own hierarchical surface, not `u_a`'s and
|
||
not empty; an instance of an **unknown** module in *expression* position
|
||
(not just the connection-list shape the dev's own
|
||
`a_module_the_workspace_does_not_declare_answers_nothing` already covered)
|
||
answers empty, no panic.
|
||
|
||
**Opentitan (read-only; every`textDocument/rename` a request, inspected,
|
||
never applied).** Built `v0.44.0`'s `lucisv-server` in a scratch worktree
|
||
(`git worktree add`, removed after). `git -C ~/repo/opentitan status
|
||
--porcelain` showed only the three pre-existing files
|
||
(`hw/ip/aes/dv/tb/tb.sv`, `hw/top_darjeeling/.../ast.sv`,
|
||
`hw/top_earlgrey/.../ast.sv`) before and after every run — reproduced
|
||
independently, not assumed from the dev's log.
|
||
|
||
- `lc_ctrl_fsm.sv:173`'s `fsm_state_q`, renamed from the declaration: 0.44.0
|
||
→ `rtl/lc_ctrl_fsm.sv` alone, 8 edits, 9–10 ms rename / 0–1 ms
|
||
prepareRename. This branch → **+ `dv/tb.sv`, 1 edit**, same 8 in the rtl
|
||
file, 22–24 ms rename / 0–1 ms prepareRename. Matches the README exactly.
|
||
Dumped every edit's range and the *exact source text at that range* on
|
||
both files: **every one reads `"fsm_state_q"`**, character-for-character,
|
||
new file included (`dv/tb.sv:229`, columns 63–74).
|
||
- `aes_core.sv:87`'s `key_touch_forces_reseed`: **identical answer** before
|
||
and after — `rtl/aes_core.sv`, 3 edits — 38–41 ms → 55–56 ms. Matches.
|
||
- Sampled the newly-resolved references over `hw/` with an independent
|
||
read-only tool (not the dev's — built fresh against the library API):
|
||
**1611 hierarchical candidates, 1290 answered, 514 hierarchical-only** —
|
||
matches the README's table exactly. Printed 20 of the 514 with the
|
||
occurrence line, the resolved declaration's file:line, and the
|
||
declaration's own source text. All 20 are genuine DV-bench-into-DUT
|
||
reaches (`dut.reg2hw...`, `dut.u_x.state_q`, `dut.lfsr_en`, …), every
|
||
declaration's source text actually spells the referenced name at the
|
||
claimed location, and every one is a plausible member of the instance's
|
||
module — no false positive found in the sample.
|
||
|
||
**Findings.** None at HIGH or MEDIUM severity. Two LOW observations, neither
|
||
blocking:
|
||
|
||
- LOW — `crates/lucisv_server/src/state.rs` is already flagged by the dev
|
||
(957 production lines) and separately filed by the lead as TODO §55; no
|
||
new action from this QA pass beyond confirming the number.
|
||
- LOW — the `Local`-reference-posting filter to the connection surface
|
||
(`record.rs::facts_from_analysis`) is a quiet, easy-to-miss line to
|
||
re-derive from first principles (it looks at first glance like it could
|
||
under-post same-file hierarchical uses). Traced it through
|
||
`merge_references`/`want_declaration` and confirmed by the incremental
|
||
`didChange` attacks above that nothing is actually lost — worth a comment
|
||
pointer from `record.rs` to `hierarchy.rs::surface_of` for the next reader,
|
||
but not a functional gap.
|
||
|
||
**Verdict: PASS.** Rename correctness, the completion split, the verifier's
|
||
refusals, the two-table index mechanics, the census delta and the opentitan
|
||
before/after all hold under attack, including several shapes beyond the
|
||
dev's own plan (own-scope and cross-surface capture through a hierarchical
|
||
tail, a non-instance head sharing a module's name, a bind-through-target
|
||
scope, and both `didChange` directions). Every temporary QA test was
|
||
removed after running green; the tree's diff against master is byte-for-byte
|
||
the dev's original plus this log entry and the TODO.md checkbox below.
|
||
|
||
## Docs to apply at merge (lead)
|
||
|
||
**`docs/topo.md` §2.9 row 23** — strike, with:
|
||
|
||
> ~~A **cross-file instance-member tail does not resolve for rename** …~~ —
|
||
> **delivered 2026-09-05 by hierarchical-tail (TODO §49):** a module now has
|
||
> two member surfaces. Its *connection* surface is unchanged — ports and
|
||
> parameters, what a connection list may name and what `member` /
|
||
> `members_of` / `members_of_chain` / the `propagate-ports` engine /
|
||
> connection-list completion read. Its *hierarchical* surface is that set plus
|
||
> its nets, variables and instances (§23.6), recorded in a second index table
|
||
> and tagged on the fact (`FACTS_FORMAT` 18 → 19), and read **only** by the
|
||
> tail walk behind an instance head (`Resolution::ExternalCandidate` carrying
|
||
> `Surface::Hierarchical`, set by `resolve.rs::head_surface`). `assign w =
|
||
> u_x.sig;` in `top.sv` now resolves to `sub.sv`'s `wire sig`, the rename
|
||
> edits both files, and the §2.9-20 warning is retired for a tail that
|
||
> resolved. A generate-block-scoped net (`u_x.gen[0].sig`) is on neither
|
||
> surface and is still refused honestly — the one gap this row leaves behind.
|
||
|
||
**`docs/features/comment-slots/README.md`, "Findings" item 2** — the gap it
|
||
flagged is closed. **Already applied by this lane** (the one line the brief
|
||
allowed); nothing for the lead to do, it is recorded here so the merge sees
|
||
it:
|
||
|
||
> **Closed 2026-09-05 by TODO §49 / `docs/features/hierarchical-tail`:** a
|
||
> module's hierarchical surface makes the cross-file tail resolve, so the edit
|
||
> lands in both files and the warning is retired for it.
|
||
|
||
**`README.md`** — no change needed; it does not describe the member tables at
|
||
this depth.
|
||
|
||
## Review
|
||
|
||
**2026-09-05 — lead.** Accepted; ships in 0.45.0 with §47 and §48. The
|
||
first dev was cut off by the outage with the library half complete and
|
||
sound; the second kept all of it and finished the tests, the README and
|
||
the gates — the right call. The ruling is implemented as ruled: two
|
||
disjoint tables, the hierarchical one read by exactly one walk, and the
|
||
connection surface byte-identical for every existing reader (the census's
|
||
12 939 connection members unchanged by construction). QA's matrix is the
|
||
proof that matters for a rename: refusals on capture across the surface
|
||
boundary, on an ambiguous module, on a generate-scoped net; the lc_ctrl
|
||
edit inspected range by range; 20 of the 514 newly resolved opentitan
|
||
references sampled and all genuine. The completion decision (hierarchical
|
||
members behind `u_x.` in an expression, ports only in a connection list)
|
||
is what a user typing a hierarchical path wants. The rename cost of one
|
||
more file's read is the feature. QA's two LOWs: `state.rs` is filed as
|
||
§55; the `Local`-posting doc pointer is added at review.
|
||
|
||
*(reserved for the lead — do not write here)*
|