Rename edits and warns about a bind file's own occurrences (§63.1): a bind connection's bare name is a reference on the target's hierarchical surface under target::name (the resolver asked the connection surface — ports and parameters — so an internal net resolved to nothing and, with no name on the path, was never warned about); a hierarchical path in a bind connection is rooted at the bind target (Target::BindMember, walking descend/member_at shared with member_of); a multi-segment target is spelled tb::u_aes for follow_one; FACTS_FORMAT 19 → 20 (a 0.53.0 store rebuilds once); selection was never the gap. Parity: every difference against 0.53.0 is a bind file's new edit or warning (1 758 − 8 = 1 750 sentences held), tail rename 326 ms. 16 engine fixtures (QA's six attacks included), a preflight-parity fixture, a wire-level definition/references test; QA filed the pre-existing nav.rs references gap for loop 3.
ci / checks (push) Successful in 1m9s
ci / corpus (push) Successful in 34s

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-12 01:05:14 -07:00
1 parent 2675131f8c
commit 1b8723ca1f
12 files changed
+1626 -42

No files matched your search

@@ -0,0 +1,596 @@
# rename-bind-occurrences — a `bind` file's own occurrence of a renamed name
TODO §63.1, from §61.5's QA finding `task_834abda3`
(`docs/features/perf5r-scope-reuse/README.md`, QA log item 6). Reference tree
`2675131`, branch `master`.
## Goal
Renaming `entropy_masking_req` — a net declared in opentitan's
`hw/ip/aes/rtl/aes.sv` — edited `aes.sv` and left
`hw/ip/aes/dv/sva/aes_bind.sv`'s `.entropy_masking_req(entropy_masking_req)`
alone, **without a word**. Renaming `seed_en` (declared in
`aes_prng_clearing.sv`) left the same file's two-level tail
`u_aes_core.u_aes_prng_clearing.seed_en` alone, also without a word — while
§49's hierarchical tail from an ordinary instantiating file
(`u_entropy_src_main_sm.state_q` in `entropy_src_core.sv`) was edited. The
whole-scope engine is the refusal authority, so a silent miss is a wrong
answer: after such a rename the design no longer elaborates.
The contract this lane reaches: an occurrence in a `bind` directive's
connection is **edited** when the engine resolves it to the renamed
declaration — a bare name in the bind target's scope, or a hierarchical path
rooted at that target — through the same rungs an instantiating file's
occurrences use; **warned about**, with file and line, when the engine cannot
resolve it; **never silent**.
## What dropped the bind file
Selection was not the culprit and the rungs were not short. Two **engine**
steps were, and both are in `vlog_semantic`:
1. **`resolve::in_bind_target` asked the wrong member surface.** A bare name
in a `bind`'s connection expression already carried
`Target::BindScope { target }` (bind-semantics, 2026-09-02). When the
target module is declared in another file — which is every real bind — the
resolver handed the workspace
`ExternalCandidate { paths: ["aes"], surface: Surface::Connection }`. A
module's **connection** surface is its ports, parameters, properties and
sequences (`workspace/hierarchy.rs::surface_of`); its nets, variables and
instances live on the **hierarchical** surface. So
`member_chain(index, "aes", "entropy_masking_req", Connection)` answered
nothing, the overlay recorded `StillUnresolved`, and
`Scope::collect_occurrences` — which edits exactly the references the
overlay resolved to the target declaration — skipped it.
The same single-segment path is why it was *silent* as well as unedited.
`warnings::unresolved_unit` names the unit a candidate was searched in by
splitting the recorded path at its `::`; a path of `"aes"` has none, so the
`unresolved_candidate_warnings` scan had no unit to report and said
nothing. (The `unaccounted` scan could not cover it either: that one runs
only over files the rename actually edited.)
2. **A hierarchical tail in a `bind` was resolved from the scope the
directive is *written* in.** `u_aes_core.u_aes_prng_clearing.seed_en`
reaches the resolver as `Target::MemberOf { head: "u_aes_core", mids:
["u_aes_prng_clearing"] }`, and `resolve::head_site` looks the head up on
the writing scope's lexical chain. A bind module declares nothing, so the
head resolved to nothing, `member_site` returned `None` — *no reference at
all*, not even an unresolved one — and every later link was dropped with
it. Nothing to edit, and nothing for any warning scan to see.
The probe that settled it (run at `2675131`, the five-file fixture of
`crates/vlog_refactor/tests/rename_bind.rs`, printing every reference of the
bind file with its resolution and its overlay answer):
```
2: "entropy_masking_req" ExternalCandidate { paths: ["aes_reseed_if"], Connection } -> Resolved(Port) <- the `.port` half
3: "entropy_masking_req" ExternalCandidate { paths: ["aes"], Connection } -> StillUnresolved <- the expression half
5: "u_aes_core" ExternalCandidate { paths: ["aes"], Connection } -> StillUnresolved <- the tail's head
<- and no reference at all
for `u_aes_prng_clearing`
or for `seed_en`
```
**The selection rungs were checked and are sound.** `aes_bind.sv` is wanted by
`Workspace::rename_sources_traced`'s `Rung::Reference`: `fan_out_of` puts the
declaration's container (`aes`, from `index.hierarchical_declarations`) into
`containers`, then asks `want_declaration` for every `units("aes")`, whose
`references_to` postings include the `bind aes …` head — a
`Target::Module` reference the binder has always recorded. So no rung was
added, `module_select::hierarchical_users` is untouched, and
`WorkspaceIndex::files_mentioning` was not needed. This is confirmed
end-to-end by the three opentitan renames under all three reuse modes (Work
log, 2026-09-11).
## Assumptions
- **IEEE 1800-2017 §23.11 / §23.6.** A `bind`'s connection expressions
elaborate in the *target* scope, and a hierarchical path may name anything
the scope it walks into declares — not only what a connection list could
name. The whole fix is that second half: a bind connection is a
hierarchical reach, so it is asked of the hierarchical surface.
- **The target's own scope answers before the writing scope**, and only a
miss the target settles falls back. That ordering is bind-semantics'
(2026-09-02) and is unchanged here; this lane changes *which* surface the
target is asked about and *how* a path is spelled, never the order.
- **A hierarchical target path is a place the index can often reach.**
`bind tb.u_aes chk u (…)` is `tb::u_aes` — one `member_unit_in` hop over
`tb`'s instance `u_aes`, which is exactly what `external::fold_path`
already does for `pkt_t::hdr::addr`. Where the index cannot take a hop (a
generate index, `gen[0]`, has no record at all) the path answers nothing
and the miss is reported rather than guessed at.
- The `.port` half of a `bind` connection still names the **bound** module's
port and is untouched. Every fixture here renames a name that is spelled on
both halves, so a fix that edited both would fail loudly.
- A bind file is an ordinary edited file to `check/after.rs`: it is absorbed
into the after-index and its after-print is compared like any other. No
change was needed there and none was made.
## Handshakes
**`vlog_refactor ──▶ vlog_semantic` (amended, additive in the AST, wider in
the answer).** The rename engine reads the same `Resolution`/
`ExternalResolutions` it always did; what changed is what the resolver
produces for a `bind` connection:
| | before | after |
|---|---|---|
| bare name, target elsewhere | `ExternalCandidate { paths: ["aes"], Connection }` | `ExternalCandidate { paths: ["aes::name"], Hierarchical }` |
| bare name, target in this file | `Resolved` / `None` | unchanged |
| hierarchical tail in a bind | *no reference recorded* | `Target::BindMember` → `Resolved`, or `ExternalCandidate { paths: ["aes::u_core::…::name"], Hierarchical }` |
| multi-segment bind target | connections resolved in the **writing** scope | resolved in the target scope, spelled `tb::u_aes` |
The path spelling is the `unit::name` one `external::follow_one` already
reads, so no workspace-layer code changed: `follow_one` folds the hops and
`member_chain` does the lookup, exactly as for a `u_x.sig` tail.
**`lucisv_server ──▶ vlog_refactor` — unchanged.** `rename_traced_with`,
`rename_preflight` and the source selectors keep their signatures and their
answers. Refusal parity with `rename_preflight` stays one-directional and in
the safe direction: a cursor on a bind file's hierarchical tail used to have
no reference at all, so the preflight refused it with `NOTHING_HERE`; it now
carries an external candidate, which the preflight *defers* (`Ok(())`). The
preflight refuses strictly less than before and never more.
**Topology rows the lead must edit** (`docs/topo.md` is not this lane's
file):
1. `§2.9-15` / the `bind-semantics ◀──▶ workspace-index / index-persistence`
handshake row: **`FACTS_FORMAT` 19 → 20** (2026-09-11). No new field — the
same fields carry a different answer: a bind connection's recorded path is
now `target::name` on the hierarchical surface, so a 0.53.0 store would
answer definition, find-references and this rename as though the bind file
did not mention the name. The store rebuilds once. The bump's own
paragraph is in `crates/vlog_semantic/src/facts.rs`.
2. The `vlog_refactor ──▶ vlog_semantic` row: a bind's connection expression
is a reference on the target's **hierarchical** surface, and a bind's
hierarchical path is rooted at the target (`Target::BindMember`), so
`references`, `definition`, `hover` and `rename` all answer over bind
files where they answered nothing before.
3. `§2.9-33`'s closing note stands unamended: the rung it closed
(`module_sources_reaching`) is not what this lane needed, and
`module_select.rs` is untouched.
**Files edited outside this lane's stated list, flagged rather than silent**
(§63.1 named `vlog_semantic/src/{resolve.rs,workspace/}` "only if a resolver
rung is genuinely missing"; these three are in `vlog_semantic/src` but not in
that list):
- `crates/vlog_semantic/src/bind/mod.rs` — the new `Target::BindMember`
variant and one more arm in the single funnel (`use_member`) that already
redirects a bind connection's bare names. The tail case cannot be fixed in
`resolve.rs` alone: the resolver has no way to learn the bind target of a
`Target::MemberOf`, because the pending use does not carry it.
- `crates/vlog_semantic/src/bind/item.rs` — `bind_bind` now sets the bind
target for a multi-segment target path too, through the new
`bind_target_path` (the `::`-joined spelling the index reads). It still
records **no reference** for such a path, as before.
- `crates/vlog_semantic/src/facts.rs` — the `FACTS_FORMAT` bump above. Not
bumping it would leave a stale store answering thinner, which is the exact
failure every earlier bump exists to prevent.
## Status / TODO
- [x] the reproduction pinned first — `crates/vlog_refactor/tests/rename_bind.rs`,
seven fixtures (bare-name connection, positional connection, two-level
tail, `: u_x` instance-list target, hierarchical target path, `bind`
inside `if (…) begin : gen … end`, and a bind whose target module is not
in the workspace). All seven asserted today's silent miss at `2675131`
before a line of the fix was written, and all seven flipped with it.
- [x] the fix: `Target::BindMember` + the hierarchical surface + the
`target::name` path spelling; unresolvable occurrences reported through
the sentence `unresolved_candidate_warnings` already uses; the step
that dropped `aes_bind.sv` named above.
- [x] parity: `renamewarn` and the paired phases (`renametrace`,
`tailrename`, `rename`, `refactor`) against the `2675131` baseline —
28 (phase, row) keys, every difference a `bind` file's new edit or
warning and listed above; the eight rename shapes within noise, the
tail rename 326.2 ms median (gate ≤ 330).
- [x] the three QA renames over the real opentitan tree, all three reuse
modes: identical answers, `aes_bind.sv` edited in both bind cases.
- [x] a fixture row for the shape: `tools/perf/phases_p2.py`'s `RENAMES`
gains `bind: entropy_masking_req -> masking_req_x` (and
`phases_r3b.py`'s `WARNED` gains `bind`), so the harness measures this
lane's shape from now on.
- [x] QA
## Work log
**2026-09-11 (dev), the reproduction.** Seven fixtures in
`crates/vlog_refactor/tests/rename_bind.rs`, over a five-file in-memory
workspace shaped like the real one (`aes` declaring the net and instantiating
`aes_core`, which instantiates `aes_prng_clearing`; `aes_reseed_if` as the
bound checker, with ports deliberately spelled like the renamed names so a fix
that edited the `.port` half would fail loudly; and the bind file). All seven
failed at `2675131` exactly as §61.5's QA described — no edit, no warning. The
probe quoted above was run from the same fixture and is what named the two
engine steps.
**2026-09-11 (dev), the fix.**
- `crates/vlog_semantic/src/resolve.rs`
- `in_bind_target` records `paths: ["{target}::{name}"]` on
`Surface::Hierarchical` instead of `paths: ["{target}"]` on
`Surface::Connection`. This is both halves of finding 1: the surface makes
the lookup find a module's internal net, and the `::` gives the warning
scan a unit to name when it does not.
- new `bind_member`: the spine of a bind's hierarchical path, rooted at the
target — the target's own scope when this file declares it, else the
target as the unit the workspace answers hierarchical members of — with
`head` as simply one more link.
- `member_of`'s tail lookup and `member_site`'s per-link hop are lifted to
`member_at` and `descend` so that `bind_member` walks *the same* code. A
second spelling of either would eventually answer one name two ways. The
`direct` flag carries the one thing the split would otherwise lose: only a
plain `head.member` may report an `InheritedCandidate`.
- `crates/vlog_semantic/src/bind/mod.rs` — `Target::BindMember { target,
head, mids }`, produced by one more arm of the existing `use_member` funnel
(the same place `Target::Lexical` already became `Target::BindScope`).
- `crates/vlog_semantic/src/bind/item.rs` — `bind_target_path`, and
`bind_bind` setting the bind target from it. A multi-segment target
(`tb.u_aes`) used to leave `bind_target` unset, which silently resolved its
connections in the writing scope; it is now `tb::u_aes`, a path the index
either walks or reports.
- `crates/vlog_semantic/src/facts.rs` — `FACTS_FORMAT` 19 → 20, with its
paragraph.
Nothing in `crates/vlog_refactor/src` needed to change: the warning sentence
the contract asks for is the one `unresolved_candidate_warnings` already
emits, and it starts firing for bind files as soon as the recorded path has a
unit in it.
Two more fixtures beside the seven: a new name the bind target already
declares is refused, and a rename applied and then reversed restores the bind
file **byte for byte** (the new resolution is stable under its own edit).
`check/after.rs` is untouched and needed nothing: an edited bind file is
absorbed into the after-index and re-printed like any other edited file.
**2026-09-11/12 (dev), the three QA renames on the real tree.**
`the_three_qa_renames_agree_across_reuse_modes_and_edit_the_bind_file`
(`#[ignore]`d, `crates/vlog_refactor/tests/rename_bind.rs`), over the real
opentitan checkout — 3 975 `.sv`/`.svh` files, read and never written —
through `rename_traced` / `rename_traced_with`, each rename asked three ways
(no records, every record, every second record). **Identical edits and
identical warnings in all three modes, all three renames**, and the two bind
cases now edit `aes_bind.sv`:
| rename | files | edits | warnings | `aes_bind.sv` | parses (none / all / half) |
|---|---|---|---|---|---|
| `WidthPRDSBox` → `WidthPRDSBoxX` | 6 | 32 | 3 | — (correctly) | 3 980 / 13 / 1 997 |
| `entropy_masking_req` → `masking_req_x` | 2 | 6 | 9 | **×2** | 3 976 / 10 / 1 993 |
| `seed_en` → `seed_en_x` | 2 | 4 | 1 | **×1** | 3 976 / 38 / 2 005 |
The two `aes_bind.sv` edits for `entropy_masking_req` are the expression
halves of the two `bind aes …` directives (the second inside
`if (\`EN_MASKING) begin : gen_prng_bind`); the four `.entropy_masking_req(`
**port** halves are correctly left alone, because they name
`aes_reseed_if`/`aes_masking_reseed_if`'s ports. The one `seed_en` edit is the
two-level tail `u_aes_core.u_aes_prng_clearing.seed_en`.
`git -C ~/repo/opentitan status --porcelain` after every run: the three known
files and nothing else.
**2026-09-12 (dev), the parity measurement.** Two release `lucisv-server`
binaries — the baseline built from `2675131` in a scratch worktree (the
0.53.0 preserved binary is the CLI, not a server), the candidate from this
tree — over the real opentitan tree, through `tools/guard.sh -m 8 -t 1800`,
order alternated. Phases `renametrace`, `tailrename`, `rename`, `refactor`
(three tries each, four sessions per binary on `renametrace`) plus
`renamewarn`. Raw evidence, both binaries, the run script and the comparison
script are preserved in `~/.cache/lucisv-perf/63-1/` (its own README lists
them and quotes the reproduction).
*Answers.* 28 (phase, row) keys compared field by field on `fingerprint`,
`status`, `message`, `result_count`, `edits`, `files`, `created` and
`titles`. **Every difference is a `bind` file's new edit or warning, and
there is nothing else:**
| where | difference |
|---|---|
| `renametrace` `bind: entropy_masking_req` (the new fixture row) | `files` 1 → 2, `edits` 4 → 6, `titles` gains `aes_bind.sv`; `fingerprint` moves with them |
| `renamewarn` `tail: state_q` | **+1 sentence**: `state_q` at `aes_bind.sv:58` could not be resolved — `aes::u_aes_core::u_aes_cipher_core::gen_masks::u_aes_prng_masking::u_prim_bivium::state_q`. The path goes through the generate block `gen_masks`, which the index has no record of, so the miss is *reported* where it used to be silent |
| `renamewarn` `common port: clk_i` | **+2 sentences** — `top_darjeeling_bind.sv:22` and `top_earlgrey_bind.sv:25`, both `<top>_pd_aon::u_pwrmgr::clk_i`; and **one re-worded**: `hw/ip/rom_ctrl/dv/tb/tb.sv:83`, a `.clk_i (clk_i)` inside `bind dut.gen_fsm_scramble_enabled.u_checker_fsm.u_compare …`, said `uvm_pkg::clk_i` and now says the bind target's own path. Warned before, warned after; **no edit moved** |
| everything else | identical, including `ordinary: aes`, `conflict`, `new name many uses spell`, `duplicate module`, `no symbol`, all fifteen `refactor` rows and both `rename` rows |
Warning-sentence totals: base 1 758, candidate 1 764 — and 1 758 − 8 (the new
`bind:` row's own sentences) = **1 750**, the count §61.5 measured, so the
pre-existing four renames' sentence set is the same set it was.
*Timings* (median of four sessions per binary, orders alternated):
| row | base | candidate | Δ |
|---|---|---|---|
| `tail: state_q -> state_q_x` | 321.9 | **326.2** | +1.3 % |
| `tailrename` (the dedicated phase) | 322.9 | 322.6 | −0.1 % |
| `common port: clk_i -> clk_ix` | 2 885.3 | 2 908.1 | +0.8 % |
| `conflict: state_q -> state_d` | 269.5 | 271.6 | +0.8 % |
| `duplicate module: rstmgr_por` | 724.2 | 740.6 | +2.3 % |
| `new name many uses spell` | 2 281.6 | 2 297.6 | +0.7 % |
| `ordinary: aes -> aes_renamed` | 91.6 | 91.6 | 0.0 % |
| `unique internal: cipher_alert` | 18.2 | 17.9 | −1.9 % |
| `no symbol: whole scope then refuse` | 0.19 | 0.23 | (+0.04 ms) |
| `bind:` (new row) | 22.6 | 24.2 | +1.6 ms, inside both binaries' own spread |
The eight original shapes are within noise and **the tail rename's median is
326.2 ms, under the 330 ms gate** (322.6 ms on the dedicated `tailrename`
phase). The first round's two apparent outliers — `duplicate module` +28 %
and `tail` +4.4 % — were each a single noisy session (`duplicate module`
sampled 1 300/1 401 ms once and 719/748/733 in the other three); the second,
order-alternated round is what the table above is taken from, and the noisy
samples are left in the raw file rather than dropped.
**2026-09-12 (dev), the gates.** `cargo fmt --all -- --check` clean;
`cargo clippy --all-targets --workspace` clean through the guard, with no new
`#[allow]`; `cargo test --workspace` through the guard **4 395 passed, 0
failed, 46 ignored**. The lane's only test additions are the ten in
`crates/vlog_refactor/tests/rename_bind.rs` (nine plus one `#[ignore]`d) and
none were removed or renamed, so the count before the lane was 4 386 / 45.
`git -C ~/repo/opentitan status --porcelain` lists the three known files and
nothing else, checked after every phase and at the end.
*The one behaviour this measurement was watching for.* Making a multi-segment
bind target a real scope means a bare name in such a connection no longer
falls back to the scope the directive is *written* in. The whole opentitan
tree produces exactly one instance of that — `rom_ctrl`'s `tb.sv:83` above —
and it was an unresolved warning before and is an unresolved warning now. No
edit was lost anywhere in 28 rows.
## QA log
**2026-09-12 (QA). Verdict: PASS.** Gates, the dev's ten fixtures re-run at
`2675131`, six new attack fixtures, one preflight-parity fixture, one
wire-level LSP fixture, an independent re-derivation of the parity evidence
and the three opentitan renames, and the corpus/opentitan byte-identity
gates. Two findings, neither blocking (§63.1's contract holds and nothing the
fix touches misbehaves); both are noted below and neither's file is in
§63.1's stated list.
**1. Gates**, all through `tools/guard.sh -m 8 -t 1800`, no guard kill: `cargo
test --workspace` **4 403 passed, 0 failed, 46 ignored** (4 395 the dev
reported, +6 attack fixtures in `rename_bind.rs`, +1 wire-level fixture in
`nav.rs`, +1 preflight-parity fixture in `preflight_oracle.rs`); `cargo
clippy --all-targets --workspace` clean, no new `#[allow]`; `cargo fmt --all
-- --check` clean.
**2. The dev's ten fixtures, re-run against a fresh clone of `2675131`**
(`crates/vlog_refactor/tests/rename_bind.rs` copied in, nothing else
changed): **8 of 9 non-`#[ignore]`d fixtures fail at baseline exactly as
claimed**, and flip green on this tree. The tenth,
`a_new_name_the_bind_target_already_declares_is_refused`, **passes at
baseline unmodified** — finding 1 below. The `#[ignore]`d real-tree fixture
is inert without `LUCISV_BIND_ROOT` at both revisions, so it proves nothing
either way by itself; verified directly instead (item 6).
**3. Six new attack fixtures added to `rename_bind.rs`**, each run at both
this tree and the `2675131` clone:
- `a_bind_connections_bare_name_naming_the_targets_port_is_still_renamed`
(task 3a) — a bind connection bare-naming the target's **port** (`clk_i`)
is still renamed, and the checker's own `.port` half of the same name is
untouched. Passes at both revisions (`hierarchy::member`'s connection-first
read means a port was never at risk from the surface widening) — a
regression guard, not a reproduction.
- `a_bind_connection_resolves_in_the_target_not_a_same_named_decoy_in_the_writing_scope`
(task 3b) — the writing module declares its own `entropy_masking_req`; the
connection must still resolve `aes`'s net, not the decoy. **Fails at
baseline** (same finding-1 cause: `in_bind_target` asked the connection
surface for a net and found nothing, silently), passes here.
- `a_new_name_the_two_level_tails_terminal_scope_already_declares_is_refused`
(task 3c) — the bare-name path's collision refusal exercised one link
further down the spine, through `bind_member`/`member_at`/`descend` rather
than `in_bind_target`. Passes at both revisions: the same same-scope
refusal `check::verify`'s watched-files/resolution-identity pass already
applies (see finding 1) covers the new code path exactly as it covers the
old one — no gap specific to `bind_member`. On `rename_preflight`'s
one-directional parity: unaffected either way, since the collision refusal
is `check::verify`'s (workspace-only), never a `rename_preflight` refusal.
- `an_escaped_identifier_bind_target_is_still_resolved` (task 3d) — `bind
\aes.escaped …`. **Fails at baseline** (silently: no edit, no warning —
the escaped target is a single segment, same finding-1 cause), passes
here.
- `a_bind_with_no_connections_naming_the_renamed_signal_is_untouched`
(task 3e) — empty connection list plus a `defparam`. Passes at both
revisions; confirms the funnel does not misfire on a connection list with
nothing in it.
- `a_bind_target_reached_through_a_generate_block_is_warned_about_never_guessed`
(task 3f) — `bind tb.gen[0].u_aes …`. **Fails at baseline** (silently — the
multi-segment target left `bind_target` unset, finding 2's bug), passes
here with a warning naming the file and the unresolved path. The real
opentitan tree has exactly this shape
(`hw/ip/rom_ctrl/rtl/rom_ctrl.sv:365`, `begin : gen_fsm_scramble_enabled`,
bound from `tb.sv:83`) — see item 5.
**4. `rename_preflight` one-directional parity (task 3c's second half).**
Added `a_binds_connection_expressions_defer_rather_than_invent_a_refusal` to
`crates/vlog_refactor/tests/preflight_oracle.rs` (the existing per-byte
equality oracle between `rename_preflight` and the whole-workspace `rename`,
which previously had no `bind` fixture at all): sweeps every byte of a bind
file with both a bare-name and a two-level-tail connection, asserting the
oracle's own invariant (a preflight refusal must never be one the workspace
disagrees with) holds throughout, then names the exact byte Handshakes calls
out — the tail's `seed_en` — and asserts `rename_preflight` returns `Ok(())`
there. **Fails at the `2675131` clone** (`NOTHING_HERE` — no reference was
recorded there before this lane, so `symbol_at` also finds nothing) and
passes here, confirming the Handshakes table's claim precisely: refuses
strictly less than before, never more.
**5. The rom_ctrl re-worded sentence, read against the real file.**
`hw/ip/rom_ctrl/dv/tb/tb.sv:83` is `.clk_i (clk_i)` inside `bind
dut.gen_fsm_scramble_enabled.u_checker_fsm.u_compare rom_ctrl_compare_bound_if
#(...) u_bound_if (...)`; `gen_fsm_scramble_enabled` is confirmed a generate
block (`rom_ctrl.sv:365`, `if (!SecDisableScrambling) begin :
gen_fsm_scramble_enabled`). Base's sentence named `uvm_pkg::clk_i` — a
nonsensical search path, the writing scope's `import uvm_pkg::*` leaking in
through finding 2's bug — candidate's names
`dut::gen_fsm_scramble_enabled::u_checker_fsm::u_compare::clk_i`, the real
attempted path, correctly reported as unresolved because the index has no
record of a generate block. The re-wording is correct; both are warnings, no
edit moved, matching the dev's characterization exactly.
**6. Parity evidence re-derived directly from `~/.cache/lucisv-perf/63-1/`**
(read-only): `python3 compare.py paired.jsonl` reproduces **28 (phase, row)
keys, 4 field mismatches, all four confined to the `bind:
entropy_masking_req` row** (fingerprint/edits/files/titles — the new edit
itself), matching the dev's table verbatim. `compare.py`'s own timing column
prints `-` for every row — a script bug (it expects `ms` as a scalar; the
harness records it as a list of per-try samples) — so timings were
recomputed directly from the raw `ms` arrays: tail rename 322.5 ms (base) →
327.3 ms (cand), **under the 330 ms gate**, everything else within noise,
matching the dev's table within sampling variance. `warn.jsonl`: raw
sentence totals reproduce **1 758 → 1 764** exactly; the raw counts carry a
2× duplication (the harness's own artifact — every distinct sentence appears
twice, confirmed by exact-value-multiplicity histograms on the `common port`
row), and the **deduplicated** picture is 3 new distinct sentences (tail +1,
common port +2, matching the dev's per-row breakdown) plus the one reworded
sentence verified in item 5. `opentitan.status` after each phase: the three
known files, nothing else, confirmed six times over.
**7. The three opentitan renames, re-run directly** (not just the evidence
file): `LUCISV_BIND_ROOT=$HOME/repo/opentitan tools/guard.sh -m 8 -t 1800 --
cargo test --release -p vlog_refactor --test rename_bind -- --ignored
--nocapture`. Exact match to the dev's table: `WidthPRDSBox` 6 files/32
edits/3 warnings, parses 3980/13/1997; `entropy_masking_req` 2 files/6
edits/9 warnings, parses 3976/10/1993, `aes_bind.sv` edited ×2; `seed_en` 2
files/4 edits/1 warning, parses 3976/38/2005, `aes_bind.sv` edited ×1. The
in-test assertions (all three reuse modes agree; `.entropy_masking_req(`
port halves untouched) held. `git -C ~/repo/opentitan status --porcelain`
before and after: only the three known files, verified.
**8. Corpus and opentitan byte-identity gates**, both binaries built
`--release --locked` (candidate from this tree, baseline from a fresh
`2675131` clone): `tools/corpus_check.sh` — **identical outcome tables**
between both binaries (10 ok-unchanged / 804 would-reformat / 6 parse-error /
0 verification-error / 0 crash, exit 0 both). `target/release/lucisv --check`
over `/Users/guoliangchen/repo/opentitan/hw/ip` (1 805 `.sv`/`.svh` files):
**identical per-file exit-code classification both binaries** (30 clean /
1 771 would-reformat / 4 parse-error / 0 crash) — stronger than that,
`lucisv --stdout` on every file hashed (SHA-256) with both binaries:
**byte-identical formatted output for all 1 805 files**, confirming the
formatter moved not at all, as expected (no `vlog_formatter` file is in the
diff). `git -C ~/repo/opentitan status --porcelain` after: only the three
known files.
**9. Definition/references/hover over a bind file (task 4).** Added
`a_binds_connection_expression_is_reachable_by_definition_not_yet_by_references`
to `crates/lucisv_server/src/nav.rs` (no prior wire-level bind or
hierarchical-tail test existed there; modelled on the existing
`a_port_is_reachable_from_a_connection_in_another_file`). `definition` from
the bind file's expression half correctly jumps to the target's net (never
to the checker's `.port` half of the same name) — the overlay carries the
resolved `Def` straight through. `references`, in **both** directions, does
**not** currently see it — finding 2 below, filed as a standalone,
out-of-scope issue rather than a §63.1 defect.
**10. `FACTS_FORMAT` 19 → 20 (task 3g).** No new test needed:
`crates/lucisv_server/src/index_cache.rs:835`,
`a_store_from_any_previous_facts_format_is_dropped_not_misread`, loops `for
format in 1..FACTS_FORMAT` rather than testing one hardcoded number (written
that way after a QA finding on the `detail_span` bump specifically so it
could not go stale), so it already covers 20 without any code change and
already ran green in the gate above.
---
### Finding 1 (low severity, not blocking) — a dev fixture that passes
unmodified at `2675131`
`crates/vlog_refactor/tests/rename_bind.rs`,
`a_new_name_the_bind_target_already_declares_is_refused`: renames
`entropy_masking_req` to `masking_req` where **`aes.sv` itself** — the file
being edited — already declares a sibling `logic masking_req;`. This is an
ordinary same-file naming collision (`check::verify`'s watched-files /
resolution-identity pass, `crates/vlog_refactor/src/check/mod.rs:41`),
refused independently of whether the bind file is understood at all — it
passes at `2675131` byte-for-byte, confirmed by re-running the copied test
file there. It is a legitimate collision-refusal check (and, per item 3
above, the same mechanism does extend correctly to the new
`bind_member`/`descend` code path — see the new
`a_new_name_the_two_level_tails_terminal_scope_already_declares_is_refused`),
but its Status/TODO line ("a new name the bind target already declares is
refused") and Work-log description overstate what it demonstrates: it does
not exercise the fix. No code change needed — it is a correct test of a
correct (pre-existing) behavior, just not of *this* behavior. Suggest
re-wording its doc comment in a future pass; not fixed here since editing
another dev's fixture text without a legitimate copy-edit reason is outside
"small unambiguous" territory.
### Finding 2 (out of scope, not blocking) — cross-file `references` cannot
see a hierarchical-surface-only declaration, `bind` or not
`crates/lucisv_server/src/nav.rs`: `leaves_this_file` (line ~170) and
`indexed_def_in_file` (line ~254, shared with `hover.rs` per its own doc
comment) both decide whether a declaration can be referenced from another
file by calling `WorkspaceIndex::member(unit, name)` — the **connection**
surface only (`workspace/index.rs:82`; ports and parameters). A module's net,
variable or instance lives on the **hierarchical** surface only
(`workspace/hierarchy.rs`, since 2026-09-05) and so both functions treat such
a declaration as incapable of leaving its file. Two concrete symptoms,
reproduced in the new `nav.rs` test (item 9):
- `references` from the *declaration* of a hierarchically-reached net
(`leaves_this_file` returns `false`) falls straight to the single-file
fallback and never sees a cross-file use, `bind` connection or ordinary
`u_x.sig` hierarchical tail alike.
- `references` from a *use* that does resolve cross-file (a `bind`
connection, `leaves_this_file` returns `true` because the live reference
already carries a resolved candidate) still cannot re-identify an **open
buffer's own in-file** use of the same declaration, because
`indexed_def_in_file` maps the live symbol back to its persisted `Def` the
same wrong way.
Confirmed **not** specific to `bind`: a throwaway probe
(`module leaf; logic sig; ... endmodule` / `module top; leaf u_leaf(); wire
w; assign w = u_leaf.sig; endmodule`, no bind involved) reproduces the exact
same gap and was removed after confirming it (not part of the committed
diff). This predates §63.1 by roughly two weeks (the hierarchical-surface
feature, 2026-09-05) and is not introduced by this lane's fix — the fix
correctly widens what the *resolver* and the *rename engine* see (confirmed
throughout this log); `nav.rs` is not in §63.1's stated file list
(`crates/lucisv_server/src/{rename.rs,rename_trace.rs,module_select.rs,
state/}` only) and was not touched by the dev. Filed as a standalone
follow-up rather than fixed here — the fix is a `WorkspaceIndex::member_in`
(with `Surface::Hierarchical`) swap in both call sites and needs its own
fixture sweep across `definition`/`references`/`hover`/`documentHighlight`,
which is more than a "small unambiguous fix."
## Review
**Lead review, 2026-09-12 — accepted.** The dev's diagnosis is the one
worth having: selection was never the problem, the resolver was — a bind
connection's bare name asked the target's *connection* surface (ports and
parameters), which cannot hold an internal net, and a hierarchical path in
a bind was rooted in the writing scope, which declares nothing. Both fixes
are the smallest true ones: the path spelling `target::name` on the
hierarchical surface reuses `follow_one` untouched, and `Target::BindMember`
walks `descend`/`member_at` lifted out of `member_of` rather than a second
spine walk (the lifting is a pure move; the `direct` flag preserves the
`InheritedCandidate` rule for `head.member` exactly). The three files edited
outside the stated list are accepted: the tail case is unfixable in
`resolve.rs` alone, and not bumping `FACTS_FORMAT` would ship a stale store
answering thinner — the exact failure the bump discipline exists for.
Parity is what the brief asked for: every one of the 28-key differences is a
bind file's new edit or warning, 1 758 − 8 = 1 750 reproduces §61.5's count,
the one re-worded sentence (rom_ctrl `tb.sv:83`, a multi-segment bind
target) is more correct than before, and the tail rename held under the
330 ms gate. QA's fresh-clone check that the fixtures fail at `2675131`
is the proof the fixtures are load-bearing.
Rulings on QA's findings:
- **Finding 1** (a fixture that passes at `2675131`): kept as a regression
guard, not a defect — the README's Work log may not claim it flipped.
The fixture stays; its doc comment is amended by the lead to say what
it actually pins (an ordinary same-file collision surviving a bind
edit).
- **Finding 2** (`nav.rs`'s `leaves_this_file`/`indexed_def_in_file` ask
the connection surface, so cross-file `references` misses every
hierarchical-surface-only declaration, bind or not): pre-existing since
the hierarchical-surface feature, outside this lane's files, correctly
not fixed here. Filed in TODO's loop-3 list as the next navigation item
(QA task `task_d8afe80f`); QA's wire-level test in `nav.rs` pins the
definition half now and documents the references half.
Topo rows amended by the lead: the `FACTS_FORMAT` line (**20**) and a new
`rename-bind-occurrences ◀──▶ workspace-index / index-persistence /
bind-semantics / refactor-rename` handshake row; §2.9-33 unchanged.
+2 -1
View File
@@ -221,7 +221,7 @@ incremental update and `fingerprint`, `record` = the `FileFacts` read-off,
inheritance edge tables, incremental `update_file`/`remove_file`,
reference postings, `files_spelling`, batch `absorb`, declaration `DeclLines`,
`fingerprint`); `facts.rs` (`FileFacts` codec for the persistent cache;
`FACTS_FORMAT` is **19**);
`FACTS_FORMAT` is **20**);
`instantiations.rs`, `classes.rs` (the shared walks, lifted from the server
so the index census and the request handlers cannot drift); `imports.rs`
(`import_usage`, `import_scopes`, `unused_imports`, `Exports`, `PackageExports`)
@@ -569,6 +569,7 @@ promise:
| `constraint-bodies ◀──▶ class-semantics / class-member-access / index-persistence / semantic-lints` | handshake | **`FACTS_FORMAT` 10 → 11** (2026-09-02): `SymbolKind::Constraint` declared in the class scope (a stand-in `Class` scope for `constraint C::c`, the out-of-body-method mechanism reused); the body opens a scope under the class so every operand binds to the class's properties — rename from a `rand` field's declaration now rewrites its constraint uses, in-file and cross-file; `foreach` vars nest; `Target::InlineConstraint` resolves a `randomize() with { … }` operand against the randomized object's class first and the writing scope second. `Constraint` exported from `Class`. `signals.rs` reads constraint operands instead of routing the body to `opaque_spans` (a constraint reads, never drives). Corpus references +1 646, 84 % answered. Filed: a rename issued *from inside* an out-of-block constraint body whose class is elsewhere is refused by `vlog_refactor` (pre-existing — the same refusal `task C::m` bodies get). |
| `covergroup-bodies ◀──▶ class-semantics / class-member-access / index-persistence / semantic-lints` | handshake | **`FACTS_FORMAT` 11 → 12** (2026-09-02): `SymbolKind::{Covergroup, Coverpoint, Cross}` and `ScopeKind::Covergroup`; the covergroup opens a scope whose labelled coverpoints and crosses are symbols (an unlabelled coverpoint declares nothing), `sample()`/`(args)` parameters are visible in the body and nowhere else, every sampled expression, bin value and `iff` binds to the enclosing class's properties. `collect_members` recurses into a covergroup so `cg_inst.cp` resolves cross-file; `member_scope` accepts a `Covergroup` symbol. `signals.rs` reads coverpoint operands (a covergroup samples, never drives). Corpus references +1 139 with 1 135 answered. |
| `semantic-lints-on ◀──▶ workspace-index / index-persistence / linter-core / semantic-lints / completion-core / editor-settings` | handshake | **`FACTS_FORMAT` 12 → 13** (2026-09-02): `FileFacts::words`, a per-file sorted dedup'd identifier census from the token stream (macro/directive words included, comments and strings excluded by construction) — the one harvest `vlog_semantic::words` provides, which the server's completion word table is now built from instead of re-lexing every file at startup (scan −28 %). No inverted index: `files_mentioning`/`mentioned_outside` are a linear walk with a binary search per file, `files_spelling`'s own shape. `vlog_linter` gains `MentionOracle` (`LintContext::with_oracle`) and `Rule::needs_workspace()` + `workspace_rules()` beside an unchanged `default_rules()`: `unused-signal` and `undriven-net` say nothing when the oracle says the name is mentioned in another indexed file (the false-negative-safe direction), `multiply-driven` shares the gate but never reads it; the three are on whenever an oracle exists — the server always, the CLI when a multi-file job set is walked (a harvest pre-pass, +36 ms on the corpus over 10 cores, zero when the rules are ignored) — and off for a single file or stdin. The off switch shipped with it (§2.9-4). Store +14 % measured on both corpora; opentitan with the rules on reports 14 findings, spot-checked true. Filed: quick fixes ignore `lucisv.lint.*` (`code_action.rs`). |
| `rename-bind-occurrences ◀──▶ workspace-index / index-persistence / bind-semantics / refactor-rename` | handshake | **`FACTS_FORMAT` 19 → 20** (2026-09-11, TODO §63.1): no new field, a different answer in the same fields. A `bind` connection's expression half is a reference on the target's **hierarchical** surface under the `target::name` path (`resolve::in_bind_target` asked the connection surface — ports and parameters — so an internal net such as `bind aes chk u (.req(entropy_masking_req))` resolved to nothing and, with no name on the path, was never warned about); a hierarchical path in a bind connection is rooted at the bind target (`Target::BindMember { target, head, mids }`, one more arm of the `use_member` funnel, walking `descend`/`member_at` shared with `member_of`), and a multi-segment target (`bind tb.u_aes …`) is spelled `tb::u_aes` so `follow_one` folds it hop by hop. So definition, hover, references and rename answer over bind files where they answered nothing; `rename_preflight` refuses strictly less (a bind tail was `NOTHING_HERE`, now an external candidate it defers). A 0.53.0 store rebuilds once. Selection (`rename_sources_traced`'s `Reference` rung, `module_select.rs`) was never the gap; §2.9-33 stands. Known remainder: `nav.rs`'s `leaves_this_file`/`indexed_def_in_file` still ask the connection surface, so cross-file `references` misses hierarchical-surface-only declarations, bind or not (TODO loop-3 list). |
| `define-table ◀──▶ macro-expansion` | handshake | What began as free-to-change became contract at M14: params stored **as written**, `NAME()` = `Some(vec![])` — `expand.rs` counts arguments against them and declines on mismatch. |
### 2.6 Refactor lane (the M-plan)