Rename keeps implicit connections bound (TODO-MCP M3.5): .name and .* rewritten explicitly, verified by a binding print; the LSP hands the engine one more hop

vlog_refactor: a rename used to cut a `.name` shorthand or a `.*` wildcard binding — port d → din of leaf left `leaf u (.*)` binding nothing and turned `.d` into `.din` against a parent with no net din; renaming the parent's net cut both — and verified clean, because the semantic layer records the port half of `.name` and nothing of `.*` (M3 QA finding 1; the LSP shared it). rename/{connections,sites,layout}.rs: an AST walk over every named connection list finds the implicit bindings and looks each name up the way the language does (nearest declaration outward; a bind's target module; a bare instance name resolved through the instantiation table with the bind's enclosing module's own instances winning, §23.11); `.p` becomes `.q(p)`, a `.*` that bound the name gains `.q(p)` / `.n(m)` appended in the list's own layout (comma before a trailing // comment, CRLF kept); every rewrite listed in warnings; refused by name: a `.*` into a module lucisv cannot read or finds declared twice, a list split by ifdefs or holding unparsed text, a hierarchical bind target, a `.*` that would start binding the new name, a package variable an import might hand to a `.*`. check/implicit.rs: the verifier learns the shape — a file with insertions passes only if every replacement is the old name becoming the new and every insertion is one of four connection templates at the exact slot the rewrite writes (a shorthand's name end; between a `.*` list's last element and its `)`), the comma and its `.X(Y)` only as a pair in one list, no slot at all in a list holding an error element — and every implicit binding (port half and net half) is printed before and after and must match. lucisv_server: rename_sources_traced hands the engine one more hop — the declaring files of every module a handed-over file instantiates (module_select::instantiated_by, index edges only) — so a `.*` into a module declaring neither name is read, not refused. lucisv_mcp: the rename tool's known-limit sentence replaced; the M3 QA finding-1 test un-ignored.

Three QA rounds (Opus) attacked the widened verifier and found, in order, position-blind insertions, a lone trailing comma, and a slot after an error element — each fixed (the last by the lead) and pinned by 40+ qa_* tests incl. masked-corruption pairs; opentitan copies: prim_count err_o/clr_i, aes_core clk_i, entropy_src clk_i, prim_packer_fifo wready_o rename cleanly with their .* cov binds written out; prim_fifo_sync clr_i refused over the FPV binds that really target fifo instances. Accepted gap: a bind onto an instance that exists only inside a generate block of the enclosing module. Filed to vlog_parser: trailing `,` / `{d,, d}` / `type(x)'(y)` in a connection list parse without a diagnostic. Gates through tools/guard.sh: fmt, clippy, workspace 4 762 passed.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
lucioandClaude Fable 5.1 committed 2026-09-23 11:41:46 -07:00
1 parent 14b72f2862
commit 4edada583f
21 files changed
+4226 -20

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ VS Code setting that restarts the server.
| `textDocument/foldingRange` | `pairs::analyze` + comment trivia | One `Region` per matched scope pair, folded through the line *before* the closer so `end`/`endmodule` stays visible, plus one `Comment` per multi-line block comment. An unmatched opener folds nothing. Same feature README |
| `textDocument/documentSymbol` | `Semantics::document_symbols` | Hierarchical |
| `textDocument/prepareRename` | `vlog_refactor::prepare_rename` | Declines with the engine's own sentence (`RequestFailed`), so the box never opens on a rename that would fail |
| `textDocument/rename` | `vlog_refactor::rename` | Cross-file `WorkspaceEdit` (`changes`); warnings go out on `window/logMessage`; refusals are `RequestFailed`. See `docs/features/refactor-rename/README.md` |
| `textDocument/rename` | `vlog_refactor::rename` | Cross-file `WorkspaceEdit` (`changes`); warnings go out on `window/logMessage`; refusals are `RequestFailed`. See `docs/features/refactor-rename/README.md`. Since 2026-09-23 the fan-out also hands over, one hop down, every module a handed-over file instantiates (`module_select::instantiated_by`), so a `.*` into a module declaring neither name is read rather than refused |
| `textDocument/completion` | `vlog_refactor::instantiation_plan` | Module hinting: one item per indexed module, inserting the whole instantiation skeleton as a snippet (plain text for a client that did not advertise `snippetSupport`). Capped at 64 items, `isIncomplete` when truncated; declines every position that is not module-item. See `docs/features/refactor-instantiate/README.md` |
| `textDocument/signatureHelp` | `vlog_refactor::instantiation_plan` | The instantiated module's ports (or, inside `#( ... )`, its parameters) with the active one highlighted — by name for a named list, by position for an ordered one. Triggers: `(` and `,`. Same feature README |
| `textDocument/inlayHint` | `vlog_refactor::instantiation_plan` | Ghost port names on an **ordered** connection list (`u1 (clk, rst_n)`) and parameter names on ordered `#( ... )` overrides, read from the instantiated module's declaration. Range-scoped; named lists, `.*`, omitted positions, connections past the last port, gate primitives and modules the index cannot resolve get nothing at all — a hint is decoration and never guesses. No `resolveProvider`. See `docs/features/inlay-hints/README.md` |
+740 -1
View File
@@ -138,7 +138,17 @@ sites, `.port(...)` connection names, and `#(.PARAM(...))` overrides.
identifier tokens spell the new name — same count, same kinds, same texts,
same attached comments, same spans after shifting.
Rules 12 and 13 are checked over the *whole* edit; either one fails the entire
14. **Implicit connections lucisv cannot read** (added 2026-09-23, see
"Implicit connections"): a `.*` or `.name` that binds — or could bind —
the renamed name through a module lucisv cannot read or finds declared
twice, a connection list split by compiler directives or holding text a
tolerant parse could not read, a hierarchical `bind` target, a `.*` that
would start binding the new name, and a package variable an import might
hand to a `.*`.
15. **Binding verification** (2026-09-23): what any `.name` or `.*` in a
watched file binds — port half and net half — differs before and after.
Rules 12, 13 and 15 are checked over the *whole* edit; any one fails the entire
rename, never part of it (`RefactorEdit` is all-or-nothing, hard invariant 1's
shape for refactorings).
@@ -543,6 +553,138 @@ implemented:
- `a label lucisv records no declaration for`, and
`an occurrence lucisv cannot attribute to any declaration` for the rest.
## Implicit connections (2026-09-23)
**The defect this closes** (TODO-MCP M3.5, M3 QA finding 1, reproduced with
`vlog_refactor::rename` directly). `.name` and `.*` (IEEE 1800 §23.3.2.3–4)
bind a port to the *same-named* declaration where the instance is written.
The semantic layer records a reference for the port half of `.name` and
nothing at all for its net half or for `.*` — so renaming a port `d` → `din`
of `leaf` left `leaf u_leaf (.*)` binding nothing and turned `.d` into `.din`
against a parent with no net `din`, and renaming the parent's net cut both
bindings. Every one verified clean: the token check saw one identifier change,
and the resolution print saw no reference move, because none was ever
recorded. A silent CLAUDE.md invariant-1 corruption in a shipped engine; the
LSP's rename shared it.
**What a rename does now** (`rename/connections.rs`):
| Renamed | Written at an instance | Becomes |
|---|---|---|
| port `p` → `q` of `M` | `M u (.p)` | `M u (.q(p))` — one edit, `p` → `q(p)` |
| port `p` → `q` of `M` | `M u (.*)` and a net, variable, port or instance named `p` visible | `M u (.*, .q(p))` |
| port `p` → `q` of `M` | `M u (.*)`, nothing named `p` or `q` visible | unchanged — the wildcard bound nothing and still binds nothing |
| net/var/port/instance `n` → `m` | `C u (.n)` where `n` is the renamed one | `C u (.n(m))` |
| net/var/port/instance `n` → `m` | `C u (.*)`, `C` declares port `n` | `C u (.*, .n(m))` |
| either | `.*` beside an explicit `.p(...)` / `.n(...)` | nothing added — the explicit one wins, and the rename's own edit handles it |
Every such rewrite is listed in `RefactorEdit.warnings` — "`u_leaf` at
top.sv:2 bound `d` through `.*`; added `.din(d)`." and "`u_leaf` at top2.sv:2
connected `d` by the shorthand `.d`; wrote `.din(d)` so it still binds the
same net." — so both the LSP and the MCP show it. A port of a module that is
itself instantiated gets both directions at once: renaming `mid`'s port `d`
adds `.din(d)` to `top`'s `mid u_mid (.*)` and `.d(din)` to `mid`'s own
`leaf u_leaf (.*)`.
**Where an implicit connection binds** (`rename/sites.rs`): an ordinary
instance, at the nearest declaration of the name walking outward from the
scope the instance is written in (generate blocks included); a `bind` whose
target is one plain module name, at that module's own top-level
declaration (`WorkspaceIndex::member_in(.., Surface::Hierarchical)`, the
table the semantic layer resolves a bind connection's bare name through).
Which instances are walked: for a port, every instance of its module in the
in-scope files that spell the module's name; for a net, every instance in its
own file from whose position the name resolves to it, plus every `bind` into
its module when it is declared at the module's top level; for a package
variable, every instance in a file that names the package — refused, not
rewritten (lucisv does not follow an import into a `.*`).
**Layout.** An insertion only — nothing the source wrote is replaced, so no
comment can move. A `.*` addition goes after the last connection element,
before the `)`, in the list's own style: `, .q(p)` on the same line for an
inline list; its own line at the last element's indentation for a list
written one per line; when the last element carries a `//` comment, the comma
goes before the comment and the connection on the next line (a `,` after `//`
is inside the comment). The newline is the list's own, so a CRLF file stays
CRLF. An escaped identifier gets the blank that terminates it. Nothing adds a
trailing comma.
**Refused, never guessed** — each sentence names the instance and its line:
- a `.*` whose module lucisv cannot read ("`u_x` at top.sv:4 connects with
`.*` to `ghost`, which lucisv cannot read, so it cannot tell whether `d` is
bound implicitly; the rename was abandoned."), or finds declared in more
than one indexed file, or whose port list carries compiler directives;
- a connection list split by compiler directives (when it holds `.*`), or
holding text a tolerant parse could not read that spells either name or a
`*`;
- a `bind` whose target is a hierarchical path, or a lone **instance** name
that may be an instance of the renamed module: resolved upward from the
bind's own scope first (the enclosing module's instances of that name),
else through every indexed instance of that name; refused when one of them
is the renamed module's or none is indexed, skipped when all are other
modules' (rework, QA finding 2);
- a `.*` whose module declares a port spelled like the **new** name, not
connected explicitly — the rename would make the wildcard start binding it;
- a package variable a `.*` or `.name` might reach through an import.
**How the verifier accounts for it** (`check/implicit.rs`; `check/` had to
learn the shape, because the whole point is that its reference print could
not see it). Two additions, both inside the existing `verify`:
1. **A file whose edits insert is held to the splice contract plus a shape
rule.** The token-identity check allows no insertion at all, so such a file
is checked by the port refactorings' piece comparison (`ledger::Split`,
`pieces_match`: every piece in place, no comment or attribute dropped or
duplicated) plus: every replacement is exactly one identifier token
spelling the old name, replaced by the new name; every insertion lexes to
`(X)`, `,`, `.X(Y)` or `, .X(Y)` with `X`, `Y` the old or the new name and
no comment, **at a place a connection list takes it** (rework, QA finding
1): `(X)` only right after a shorthand connection's name, `,` only right
after the last element of a named list holding `.*`, `, .X(Y)` between
that element — past blanks and comments — and the list's `)`, and a bare
`.X(Y)` only there behind such a `,`; the places are read off the
before-tree with the same `sites` walk the engine plans with. Anything
else: "the rename would write `…` outside a connection list in <file>; no
edits were made." And the file gains no parse diagnostic. The resolution print
excludes the inserted ranges (their names are the next check's to account
for).
2. **The binding print.** For every watched file that could write an
implicit connection of either name (a cheap text prefilter,
`sites::may_connect_implicitly`, which is a superset — a `.` that starts a
list element followed by `*` or one of the names — and every file the edits
insert into), every instance's bindings are printed before and after:
`(instance, what the port half names, what the net half names)`, for every
named connection whose port or bare-name net spells one of the two names,
and every port spelling one of them that a `.*` reaches. The net half of
`.name`/`.*` is looked up the way the language looks it up (above); a `.*`
into a module that cannot be read prints a *probe* of what each of the two
names finds there. Before-side spans are shifted through the edit map. The
two prints must be equal. Why only the two names: a rename adds and
removes declarations of those two names alone, so no other lookup and no
other port can move — the watched-file argument applied one level down.
The attack pairs (`check::implicit::tests`, CLAUDE.md invariant 4 — the
binding print is a new *strictness*, not a forgiveness, but the insertions it
admits are a widening of what a rename may write, so they ship with attacks):
the QA finding itself (`.d` → `.din`, `.*` untouched) and the wildcard alone;
a shorthand written out with the wrong net (`(din)` — spells only the two
names, so only the binding print sees it); a wildcard connection to a third
name and to the swapped halves (`.d(din)`); insertions that are not connection
text (a comment, `; wire din;`, a doubled connection, an unclosed one); a
connection added beside an explicit one of the same port; an insertion into
the wrong instance; a net rename that leaves `.*` alone, and one with swapped
halves; a `.*` that starts binding the new name; a net rename behind an
unreadable `.*`. Sabotage-checked: with the binding print disabled, seven of
the eleven fail (the rest are caught by the shape rule or the piece ledger
as well).
**What it costs.** A rename with no implicit connection of the name anywhere
parses nothing extra: the engine and the verifier both parse only files that
pass the prefilter (`the rename parses each input file once and each edited
file once more` still holds verbatim). A file that does pass costs the engine
one parse and the verifier one per side.
## Assumptions
- The caller hands over the same file set the workspace index was built from,
@@ -573,6 +715,23 @@ implemented:
- Refactored output is *edited source*, not reformatted source (umbrella
Handshakes): the edits are minimal, and the user runs the formatter
separately.
- **Implicit connections (2026-09-23).** `.*` and `.name` bind a port to a
net, a variable, a port or an instance of the same name
(`sites::binds_implicitly`: `ports/expand.rs`'s reading plus the instance,
because an interface port binds to an interface instance and writing a
module instance's connection out is exactly as wrong as the implicit one);
the nearest declaration of the name shadows, so a parameter or a type of
that name is a binding to nothing. The lookup is lexical and local — the nearest declaration
walking outward from the instance — so a name a `.*` could reach only
through a package import is not seen: a rename of a *package* variable is
refused wherever a file naming the package writes a candidate implicit
connection, and a rename that would make an import-reached name newly
visible to a `.*` is caught only when the local lookup moves. A `bind` into
a module the fan-out does not hold is outside the rename exactly as any
other use in such a file is (the staleness premise); a `bind` whose target
is a hierarchical path is refused whenever it writes a candidate implicit
connection of the name, since lucisv cannot name its scope. The
compilation unit (`$unit`) is treated as one file.
## Handshakes
@@ -678,6 +837,49 @@ the only alternative — matching the label textually — would have broken this
feature's one structural rule, that every edit comes from a resolved
reference.
**Requested 2026-09-23 (implicit connections), not blocking — each has a
workaround in this crate:**
- **`vlog_refactor::ports` (`ports/list.rs`, `ports/find.rs`).**
`append_to_list`, `after_same_line_comments`, `line_indent`,
`walk_instantiations` and `declared_ports` are `pub(super)` to the port
refactorings; the rename needed the same five, and M3.5 did not own the
files. Workaround: `rename/layout.rs` and `rename/sites.rs` restate them
(with two differences the rename needed: a CRLF-aware line break, and the
`bind` directive handed to the visitor rather than a bool). Request: lift
them to `pub(crate)` and let the rename call them, so there is one list
layout rule.
- **`vlog_semantic`.** Recording an implicit connection's net half as a
reference (`.name` → a use of the net; `.*` → one use per port the module
declares, when it can be read) would let `collect_occurrences`, find-all-
references and the resolution print see these bindings directly, and would
retire most of `rename/sites.rs`. Workaround: the AST walk here, which
both the engine and the verifier read.
- ~~**`lucisv_server` (`state/mod.rs::rename_sources_traced`) — the one that
matters for the LSP.**~~ **Delivered 2026-09-23 inside M3.5 (lead ruling):
see the work log's fan-out entry.** The original request, kept as filed: The rename's fan-out holds every file declaring
either name, so a module `C` a `.*` instantiates is in it exactly when `C`
declares a port spelled like one of them — which is the case that needs a
rewrite. When it does not, `C`'s file is not handed over, and the engine,
which cannot tell "not in this subset" from "not in the workspace", reports
`C` as a module it cannot read and **refuses**. Safe, and the whole-scope
callers (the MCP, the CLI, the tests) never see it; but an LSP rename of a
net in a module whose instances use `.*` into modules that do not declare
the name is refused where it could succeed. Request: a seventh rung — for
every file in the set that writes `.*`, add the declaring file of each
module instantiated there (`WorkspaceIndex::units` of the instantiation
edges the index already records). No engine change is needed for it.
- **`vlog_parser` (filed 2026-09-23, QA M3.5 finding 3 and round one's
`{d,, d}`).** The tolerant parser accepts a trailing `,` in a named
connection list (`other u_o (.*,)`) and an empty concatenation element
(`{d,, d}`) without a diagnostic, so the verifiers' "no new parse
diagnostic" rule cannot see either. The rename's position check refuses
both on its own (a lone comma is not a place a connection list takes);
the request is that the parser report them, so every refactoring's
splice contract gets the same net for free. Not this lane's to fix.
**Requested of nobody else.** Hierarchical tails and `defparam` paths remain
unresolved by design (`vlog_semantic` non-goal: "resolving a tail needs
instance elaboration"), so they stay warned-not-edited; making them edits is
@@ -718,6 +920,11 @@ a much larger change than an end label and is not part of M2.
the new name, which closes the one refusal the first draft lost. The
old name's exemption is argued under "The dangling-use case" and pinned
by its own test
- [x] Implicit connections (2026-09-23, TODO-MCP M3.5): `.name` and `.*`
rewritten explicitly in both directions (port and net), every rewrite
warned about, the unreadable cases refused, and the verifier taught the
shape (insertions under the splice contract + a shape rule; the binding
print) with eleven attack pairs
- [ ] Deferred: rename in comments and strings (rope's `docs=True`) — the
umbrella lists it as an option, off by default, "until asked for"
- [ ] Deferred: renaming a module together with its file
@@ -1031,6 +1238,137 @@ Gates after the rework: `cargo fmt --all -- --check` clean,
`cargo clippy --all-targets` clean workspace-wide, `cargo test --workspace`
green, `node editors/vscode/smoke.js` OK against the release binary.
**2026-09-23 — dev agent (M3.5, implicit connections).** The engine rewrote
nothing it could not see a reference for, and `.name`/`.*` bindings have no
reference — see "Implicit connections" for the contract, the refusals and the
verifier's new half. Key decisions:
- **AST walk, not semantic references.** The semantic layer records the port
half of `.name` (so a port rename already edited `.d` → `.din`) and nothing
of the net half or of `.*` (`bind/item.rs::bind_connection` skips `*` and
binds `expr: None` to nothing). `vlog_semantic` is not this lane's to
change, so the bindings are re-derived from the parse — one walk
(`rename/sites.rs`) that the engine and the verifier both read, so the two
cannot disagree about where an implicit connection is or where its name
binds. Filed as a Handshake request.
- **Insertions only.** The shorthand's port half is already the rename's
edit; the net half is an insertion right after it, fused into one
`TextEdit` (`p` → `q(p)`) only after verification, so the verifier sees a
pure rename edit plus a pure insertion. A `.*` gets an appended element, so
nothing the source wrote is replaced and no comment can move.
- **`check/` learned the shape rather than being bypassed.** A file with
insertions is checked by the splice contract the port refactorings already
use plus a four-template shape rule; the binding print is a new check, and
it is strictly *more* than the rename had (every file it prints was
already compared by the reference print). Sabotage-verified.
- **Prefilter.** `sites::may_connect_implicitly` keeps the engine and the
verifier from parsing files that cannot hold an implicit connection of
either name; the parse-budget tests (`K + E`) are unchanged and pass.
- **OpenTitan, read-only, on a scratch copy of `hw/ip/prim` + `hw/ip/aes`
(393 files, release, whole-scope).** `prim_fifo_sync`'s port `clr_i` →
`clr_q` is **refused**: `prim_fifo_sync_bind_fpv.sv` writes
`bind i_nopass1 prim_fifo_sync_assert_fpv … (.clk_i, .rst_ni, .clr_i, …)`,
a `bind` into an *instance* named `i_nopass1` — which is a
`prim_fifo_sync` in `prim_fifo_sync_tb`, so the old engine would have cut
those twelve bindings silently. With that one file left out of scope the
same rename succeeds (115 ms, 3 files, 16 edits): eleven `.clr_i` →
`.clr_q(clr_i)` in `prim_fifo_sync_tb.sv`, and `prim_fifo_sync`'s own
`u_fifo_cnt (.clr_i, …)` → `.clr_i(clr_q)` — both directions in one
rename. Renaming the testbench's own port `clr_i` → `clr_tb` writes
`(clr_tb)` after the eleven shorthands. A `.*` user: renaming
`fi_control_fsm_wrapper`'s port `aes_ctrl_cs` → `ctrl_cs` adds
`, .ctrl_cs(aes_ctrl_cs)` to `bind aes_control_fsm … u_fi_ctrl_fsm (.*)`
(the bind's target declares `aes_ctrl_cs`) and `, .aes_ctrl_cs(ctrl_cs)` to
the wrapper's own `fi_control_if fi_if (.*)`; renaming `aes_control_fsm`'s
variable `aes_ctrl_cs` → `ctrl_state_q` adds `.aes_ctrl_cs(ctrl_state_q)`
to the same bind. Each rename ~110 ms.
- **The server's fan-out step (2026-09-23, lead ruling on Handshake 1).**
`Workspace::rename_sources_traced` now adds, after the open buffers, the
declaring file of every module instantiated in a handed-over file — one hop
down the index's `instantiations()` edges, `bind` included
(`module_select::instantiated_by`, a walk over records; nothing is read).
So a `.*` into a module that declares neither name is handed over and read
as binding nothing, instead of refused as unreadable; a `.*` into a module
the workspace does not hold is still refused. The added files count in
`selected` and in the indirect census (as `instantiation`) but not in the
per-rung counts: `SelectionTrace`'s counter is private to `rename_trace.rs`,
which this lane does not own. Pinned by two wire tests
(`server/tests/rename_implicit.rs`: an open-buffer net rename beside
`quiet u_quiet (.*)` and `leaf u_leaf (.*)` succeeds with `, .d(x)` and no
edit to `u_quiet`; the same with `quiet` absent is refused naming `u_quiet`)
and one unit test of the helper. The engine is unchanged by it.
- **Deviation from the brief:** the MCP tool description's known-limit
sentence was replaced by one saying what happens now (the connection is
written out and listed in `warnings`), rather than only deleted.
**2026-09-23 — dev agent (M3.5 rework after QA's FAIL).**
- **Finding 1 — insertions checked for their text, never their place.**
`check/implicit.rs::insertions_match` now also asks `Slots::takes`: each
insertion's offset must be a place the before-tree's `sites` walk (the
engine's own) says a connection list takes that template — see "How the
verifier accounts for it", item 1. QA's three tests
(`check/qa_implicit.rs`, registration kept in `check/mod.rs`) are
un-ignored and pass unchanged; two attacks of my own pin that the check
keys on the file's sites, not on a byte: `(d)` at an offset that is a
shorthand's end in `top2.sv` is refused in a file where the same offset
ends a positional element, and in one file `(d)`/`,` after the positional
`d` of a second instance is refused beside the honest shorthand rewrite of
the first. Sabotage-checked: with the position check off, those two and
QA's three fail.
- **Finding 2 — a `bind` into a bare instance name refused unrelated
renames.** `connections.rs::bind_reaches` classifies each bind (module /
maybe / elsewhere); `instance_owners` resolves a lone instance name
through `WorkspaceIndex::instantiations()` — the enclosing module's own
instances of that name first (upward resolution, IEEE 1800 §23.11, which
is what opentitan's `bind dut … (.*)` in `sram_ctrl`'s and `entropy_src`'s
`tb.sv` means), every indexed instance of that name otherwise. All owned by
other modules → skipped; one is the renamed module's, or none is indexed →
refused as before. QA's test un-ignored and passing; two of mine: an
instance name owned by both `fifo` and `cnt` refuses a `cnt` rename (and
is skipped with `cnt`'s bench removed), and a bind written beside its own
`fifo dut` is `fifo`'s even though another bench has a `cnt dut`. **One
step past the ruling**, stated: the enclosing-module preference. Without
it `entropy_src`'s `clk_i` stays refused over `sram_ctrl`'s `bind dut`,
since opentitan has eight modules named `dut`; with it that rename
succeeds, and the refusal still fires wherever the bind's own module
declares an instance of the renamed module. **Known gap (QA note 1,
accepted):** a `bind` onto an instance that exists only inside a generate
block of the enclosing module is treated as that instance's module's and,
when that is another module, skipped silently — upward resolution would not
see into the generate block and would look further up.
- **Size.** `check::verify` 94 → 79 lines: step 1 (token check) is now
`tokens_verified`, the per-file inserted ranges `implicit::inserted_in`,
step 3's call a two-liner. Pure moves; no behaviour change, and the same
tests pass.
- **Rework 2 (QA re-check, finding 3).** `Slots::takes` admitted a lone
`,` at the end of any `.*` list; `other u_o (.*)` → `(.*,)` verified clean
where the list binds neither name, since the tolerant parser reports no
error. The comma is now accepted only when the same file's edits also
insert a bare `.X(Y)` into the same list — the comma-before-`//` pair as a
pair, mirroring the requirement the bare connection already had. QA's
`qa_r_a_lone_trailing_comma_on_a_wildcard_binding_neither_name` is
un-ignored; `a_comma_and_its_connection_in_different_lists_are_refused`
(mine) crosses two lists' halves and is refused. The parser gap is filed
in Handshakes.
- **OpenTitan re-run** (scratch copy grown to 489 files: `prim`, `aes`,
`entropy_src`, `sram_ctrl`; release, whole-set engine): `prim_count.err_o`
→ `error_o` OK (14 files, 17 edits; two shorthands written out);
`prim_count.clr_i` OK; `aes_core.clk_i` OK (3 files, 24 edits);
`entropy_src.clk_i` OK (5 files, 10 edits, among them the
`entropy_src_cov_bind.sv` `.*` gaining `.clk_i(clock_i)`);
`prim_packer_fifo.wready_o` OK; `prim_fifo_sync.clr_i` still **refused**
over `bind i_nopass1 …` (those instances are `prim_fifo_sync`s); the two
`aes_ctrl_cs` renames unchanged.
**2026-09-23 (lead, after the final re-check).** QA finding 4 fixed by the
lead: `check/implicit.rs::Slots::of` registers no slot for a list holding
an error element (the engine already refuses such lists); QA's test
un-ignored, and QA's own pin of the old behaviour in
`qa_p_a_pair_after_an_error_element` flipped to the stricter rule. Gates
through `tools/guard.sh`: fmt, clippy, vlog_refactor 616 passed, workspace
4 761 passed.
## QA log
**2026-08-24 — QA agent.**
@@ -1750,6 +2088,384 @@ OpenTitan with no measurable end-to-end regression. No new findings. The
macro-invocation warning residue is unchanged and remains the lead's
already-accepted, separately-tracked call.
**2026-09-23 — QA agent, M3.5 QA (implicit connections: `.name` / `.*`).**
Charter: TODO-MCP §M3.5 — attack the widened rename verifier first
(CLAUDE.md invariant 4), then the rewrite, LSP parity, opentitan copies,
sizes, gates. Worked on the uncommitted master checkout; every experiment in a
scratch copy of the repo and of opentitan `hw/ip/{prim,aes,entropy_src}`.
### Verdict: FAIL — one BLOCKING finding (verifier), one BLOCKING false refusal
### Finding 1 (BLOCKING) — an insertion is checked for its text, never its place
`check/implicit.rs::insertions_match` holds every inserted string to the four
templates (`(X)`, `,`, `.X(Y)`, `, .X(Y)`, X/Y the two names) but never asks
*where* it was inserted; the resolution print then skips every inserted range
(`inserted_after`) and the binding print only reads named connection lists'
connections. So a template placed anywhere else that still parses is seen by
nothing. Driven through the crate-internal `check::verify` (the dev exposed no
public hook) with the honest edits of a `d` → `din` port rename plus one extra
insertion — **each of these verifies `Ok(())`**:
- `,` into a positional list: `leaf u_p (clk,, d, q)` — every later port
shifts by one (silent rewiring);
- `, .din(d)` into a parameter override `#(.W(8), .din(d))`;
- `(d)` after a net in an expression `f(d, d(d))`; `(d)` after a task call
`initial t(d)`; `,` / `, .din(d)` into call arguments;
- `,` into a concatenation `{d,, d}` (the tolerant parser reports no
diagnostic for the empty element, so the "no new parse error" guard is
silent too);
- inside a named list, inside an explicit connection's expression:
`.clk(clk(d))`, `.q({q(d), q})`, `.q({q,, q})` (`net_half` prints nothing for
a non-name expression of a port spelling neither name).
The engine never writes these today, which is why nothing corrupted in the
engine-level tests — but the verifier is the safety net that is supposed to
refuse exactly this, and the history note in invariant 4 is this shape.
Tests: `crates/vlog_refactor/src/check/qa_implicit.rs` —
`qa_a_comma_inserted_into_a_positional_list_is_refused`,
`qa_connection_text_outside_a_connection_list_is_refused`,
`qa_connection_text_inside_an_explicit_connection_is_refused`, all
`#[ignore = "QA finding 1"]` (registered with one `#[cfg(test)] mod
qa_implicit;` line in `check/mod.rs`, outside my file list — needed because
`verify` is crate-internal; the lead may move it into `implicit.rs`'s tests).
**Fix:** tie each insertion to the place `layout.rs` writes it, read off the
*before* tree's `sites`: `(X)` only at `c.name_span.end` of a shorthand
connection (`c.expr.is_none()`); `,`, `.X(Y)` and `, .X(Y)` only at/after the
last element's end of a named list holding `.*`, before its `)` (with the
`,`-before-`//` pair as the one two-piece shape). Anything else refused.
### Finding 2 (BLOCKING — false refusal on a common opentitan shape)
`connections.rs::binds_into` treats a `bind` target that is a lone name no
indexed module answers to as "possibly an instance of the renamed module" and
refuses whenever its list writes `.old` or a `.*` reaching `old`. opentitan's
`hw/ip/prim/fpv/tb/prim_fifo_sync_bind_fpv.sv` has ten `bind i_nopass1
prim_fifo_sync_assert_fpv … (.clk_i, .rst_ni, .clr_i, .wvalid_i, .wready_o,
… .err_o)` — so on the scratch copy (449 files) renaming `prim_count`'s
`err_o` or `clr_i`, `aes_core`'s `clk_i`, `entropy_src`'s `clk_i` or
`prim_packer_fifo`'s `wready_o` is **refused**, over a bind into a
`prim_fifo_sync` instance none of them touches (whole-set engine and LSP
alike). The refusal is new in M3.5. Any module-level
declaration named `clk_i`/`rst_ni`/`err_o`/… in any module is affected while
that file is in the workspace; `hw/ip/sram_ctrl/dv/tb.sv`'s `bind dut … (.*)`
is the same shape. Test: `tests/qa_rename_implicit.rs::
qa_a_bind_into_an_instance_of_another_module_does_not_refuse`
(`#[ignore = "QA finding 2"]`). **Fix:** resolve the lone name as an instance
name through `WorkspaceIndex::instantiations()` (edges carry their instance
names): if every instance so named instantiates a module other than the
renamed declaration's, skip the site; refuse only when one is the renamed
module's or none is found.
### Attacks that held
Verifier (`check/qa_implicit.rs::qa_insertions_the_verifier_already_refuses`,
plus scratch experiments): an insertion inside a string, a comment, an
attribute; an empty named element `(.a(b),, …)`; `(d)` after `.*` or after an
explicit connection; `.din(d)` before the first element with no comma; a
second `, .din(d)` beside the honest one (two separate insertions); a
case-only different net `(D)` (refused by the template: `D` is neither name);
`.d(x)` added to an instance in a generate block whose own `d` shadows the
renamed one (binding print); `(d)` written after another module's `.d`
shorthand (harmless, `.d(d)`, accepted — same binding); `(din)` there (refused).
Rewrite (`tests/qa_rename_implicit.rs`, 20 passing, public `rename` only):
port rename over `.p` / `.*` / explicit / `.clk, .*` / `.d, .*` in one file;
two instances in one instantiation; an instance array `leaf u[3:0] (.*)`; a
non-ANSI port; one-per-line list with a `//` comment on the last element
(comma before the comment, element on its own line at the element's
indent); an inline list with a trailing `//` (element lands at column 0 — no
indent to copy; legal, cosmetic); an attribute on a connection and a block
comment after `.*`; an escaped net `\d$x ` renamed to a plain name (the
terminating blank stays where it was, `.\d$x (dd) )`); a leaf port under
nested `.*` (only the direct parent changes); a net rename reaching a `bind`
in a file spelling neither name (the whole-set caller); a hierarchical-bind
net rename refused; `bind top : u_t …` (instance-list form) rewritten; an
interface port bound to an interface instance by `.*`; a generate-scoped
shadow (module-level rename touches only the outer instance, the block's net
only the inner two); module declared twice, `ifdef`-split list, parent `.*`
capturing the new name — all refused with the instance named; a parameter
named like the port is no binding; a shorthand into an unreadable module is
still written out. **Round trip:** `d`→`din`→`d` leaves the declaring file
byte-identical; the parent differs only in the written-out connections —
`(.*)` becomes `(.*, .d(d))` and `.d` becomes `.d(d)`; no warnings on the way
back.
### LSP parity (`server/tests/qa_rename_implicit.rs`, 3 passing)
Port rename with the users on disk only — the same edits as the engine; an
unsaved open buffer using `.*` over an on-disk file connecting explicitly —
the buffer's text is the one rewritten; a net rename reaching a bind file that
spells neither name — handed over by `leaf`'s instantiation sites (the bound
module declares the port, so it is a container of the name). `instantiated_by`
reads only `self.index`, and `current_text` drops anything not held, so it
cannot hand over a file outside the workspace. **One-hop cost on opentitan**
(scratch copy, release, `QA_NO_HOP` toggle in a scratch build): `key_len_q` in
`aes_core.sv` selected 4 → 23 files, select 0.6 → 1.2 ms, request 4 → 22 ms —
and without the hop that rename is *refused* (`u_fi_ctrl_fsm … connects with
.* to fi_control_fsm_wrapper, which lucisv cannot read`), as are the three aes
fault-injection renames below; `prim_count.err_o` 121 → 181 files, 46 → 59 ms.
No explosion.
### Opentitan dry runs (scratch copy, whole-set engine and LSP agree)
- `fi_control_fsm_wrapper`'s port `aes_ctrl_cs` → `aes_ctrl_state`:
`bind aes_control_fsm … u_fi_ctrl_fsm (.*)` gains
`.aes_ctrl_state(aes_ctrl_cs)` (binds `aes_control_fsm`'s own state
variable — what `.*` bound) and the wrapper's `fi_if (.*)` gains
`.aes_ctrl_cs(aes_ctrl_state)`. Correct by hand.
- `aes_control_fsm`'s variable `aes_ctrl_cs` → `aes_ctrl_cs_q`: the bind gains
`.aes_ctrl_cs(aes_ctrl_cs_q)`. Correct; the `PRIM_FLOP_SPARSE_FSM`/`ASSERT`
invocations still spelling the old name are warned (existing macro policy).
- `fi_control_if`'s port `aes_ctrl_cs` → `ctrl_state`: the wrapper's `.*`
gains `.ctrl_state(aes_ctrl_cs)`. Correct.
- `entropy_src_fsm_cov_if`'s `state_i` → `st_i`: tb.sv's
`bind prim_sparse_fsm_flop : dut.… (.clk_i, .state_i, .state_o)` becomes
`.st_i(state_i)`. Correct.
- `prim_fifo_sync`'s `clr_i`: refused over `prim_fifo_sync_bind_fpv.sv`'s
`.clr_i` — a *correct* refusal (those binds target `prim_fifo_sync`
instances). `prim_count`/`aes_core`/`entropy_src`/`prim_packer_fifo`: the
false refusals of finding 2.
- Every rewrite was listed in `warnings`, one sentence each.
### Sizes / style
Production lines (non-blank, non-`//` lines before `#[cfg(test)] mod tests {`):
`rename/connections.rs` 434, `rename/sites.rs` 168, `rename/layout.rs` 82,
`rename/mod.rs` 433 (HEAD 423), `check/implicit.rs` 318, `check/mod.rs` 420
(HEAD 405), `module_select.rs` 36, `state/mod.rs` 985 (HEAD 981 — already over,
§55). Functions over 50 lines: `check::verify` 94 (HEAD 75 — now past the
"investigate at 80" mark), `check::implicit::bindings_match` 60,
`rename::renaming` 56 (HEAD 50); `verify_move` 101 is pre-existing. No
`unwrap`/`expect`/`panic!`/`#[allow]` in the new production code.
### Gates (all through `tools/guard.sh`, one at a time)
- `cargo fmt -p vlog_refactor -p lucisv_server -p lucisv_mcp -- --check` — clean
(after formatting my three files).
- `cargo clippy -p vlog_refactor -p lucisv_server -p lucisv_mcp --all-targets` —
`Finished`, no warnings.
- `cargo test -p vlog_refactor` — 587 passed, 0 failed, 6 ignored.
- `cargo test -p lucisv_server` — 1713 + 99 + 3 passed, 0 failed.
- `cargo test -p lucisv_mcp` — 0 failed; `qa_rename_never_breaks_an_implicit_port_connection`
(M3 finding 1, un-ignored) passes.
- `cargo test --workspace` — **4 732 passed, 0 failed, 52 ignored**
(4 707 + 25 QA tests; 4 new ignored findings tests).
**2026-09-23 — QA agent, M3.5 re-check (after the dev's rework).** Charter:
re-derive both blocking findings against the fix (`Slots` in
`check/implicit.rs`; `bind_reaches`/`instance_owners` in
`rename/connections.rs`), confirm the three moves out of `verify` are pure,
re-run the opentitan copy, gates.
### Verdict: FAIL — findings 1 and 2 closed; one new BLOCKING finding (3); one non-blocking note
### Finding 3 (BLOCKING, new) — a lone `,` at the end of any `.*` list verifies
`Slots::takes` admits `Template::Comma` at the end of every `.*` list, alone.
The engine only ever writes it as the first half of the comma-before-`//`
pair, whose second half (`.X(Y)`, `Template::Connection`) is already required
to have the comma (`comma_at`) — but not the other way round. Where the list
binds one of the two names the binding print refuses the cut; where it binds
neither (a `.*` into a module declaring neither name, in a file the rename
edits for another reason) nothing refuses: the tolerant parser reports no
diagnostic for `(.*,)` (the same leniency as `{d,, d}` in round one), the
pieces match, and the binding print has nothing to compare. Reproduction:
`check/qa_implicit.rs::qa_r_a_lone_trailing_comma_on_a_wildcard_binding_neither_name`
(`#[ignore = "QA finding 3"]`) — `other u_o (.*)` becomes `other u_o (.*,)`
beside an honest `.d` → `.din(d)` rewrite in the same file, and `verify`
returns `Ok(())`. Not a shape the engine writes today; a masked corruption the
safety net accepts, the class invariant 4 is about. **Fix** (a few lines in
`Slots::takes`): admit `Comma` at a list's end only when the same edit list
also inserts a `Connection` into that list (after trivia, before its `)`) —
the mirror of `comma_at`. Worth also filing against the tolerant parser: a
trailing `,` in a named connection list and an empty concatenation element
parse without a diagnostic.
### Finding 1 re-derived — the position rule (9 new tests + finding 3, `check/qa_implicit.rs::qa_r_*`)
All verifier-direct (`check::verify`, crate-internal), each a corrupt edit set
beside a control that verifies `Ok`:
- `, .din(d)` appended to a named list **without** `.*` — refused "outside a
connection list";
- `(d)` after an **explicit** connection's name (`.clk(d)(clk)`,
`.din(d)(d)`) — outside;
- `, .din(d)` **between** `.*` and a later `.clk(clk)` — outside (the same
text after the last element verifies);
- `, .din(d)`, `(d)`, `,` **after the `)`** — outside;
- a `.*` list **inside a generate-for**: the honest append verifies, a bare
`.din(d)` without its comma is outside, nothing added is a cut;
- a **lone trailing `,`** at a `.*` list's end (`(.*,)`, a legal *slot* for the
comma-before-`//` shape) where the list binds `d` — refused, but by the
binding print (`din` loses its binding), not by the position rule; where the
list binds neither name it verifies — finding 3;
- **shift accounting**: `d` → `dnew` in `(.clk,.d,.q)` grows the line by
exactly the distance from `.d`'s end to `.q`'s end, so a tail computed in
after-coordinates lands on `.q`'s shorthand slot in before-coordinates.
The before-coordinate tail verifies; the shifted one (`.dnew,.q(d)`) is
refused by the binding print. Slots and edits are both in before-coordinates
(`Slots::of(before)`, `edit.range.start`), so there is no mixed accounting;
- an append **inside the trailing `//` comment** (mid-comment and at its end):
`Slots::takes` admits it (the gap is trivia), the piece ledger refuses it; the
honest `,` + `\n .din(d)` pair verifies; the bare connection without the
comma is outside; the pair with the connection written mid-comment is
refused;
- a **shorthand in a `bind`** (net rename): `(x)` after `.d` verifies,
nothing is a cut, `(x)` after `.clk` (a legal slot) is refused by the binding
print, `(d)` after `.d` is refused.
My three round-one tests and the dev's two same-offset tests pass un-ignored.
### Finding 2 re-derived — the enclosing-module rule (5 new tests + 1 note, `tests/qa_rename_implicit.rs::qa_b_*`)
Renaming `cnt`'s `err_o`, with `chk` bound by `.clk_i, .err_o` shorthands:
- a bind in module `a` onto `u`, where `a`'s own `u` is a `fifo` and `b`'s `u`
is a `cnt` — **skipped**, `a.sv` untouched, `b`'s own `.err_o` written out;
- swapped (`a`'s `u` is the `cnt`) — **refused**, naming `c_u` at a.sv:4;
- a bind at **file scope** onto `u` where only `tb`'s `u` exists, a `fifo` —
skipped, no warning; the same where `tb`'s `u` is a `cnt` — refused;
- a bind onto a name no indexed instance has — refused.
### Note 1 (non-blocking, lead-accepted) — the generate-block gap, reproduced
`module a` with `fifo u` only inside `if (1) begin : g`, `bind u chk c_u
(.clk_i, .err_o)` in `a`, and a parent `p` holding `a u_a ()` and `cnt u`.
Upward resolution from `a` does not see `a.g.u`, so the bind reaches `p.u`, a
`cnt`. The engine counts `a.g.u` as `a`'s own, returns `Elsewhere`, and the
rename **succeeds** with `a.sv` untouched — the bind's `.err_o` is cut. Note the
direction: this is a silent skip, not a refusal, and the verifier cannot catch
it (a bind onto an instance prints `Opaque` on both sides). Exotic shape (a
same-named instance in a generate block of the binding module *and* in its
parent). Pinned as `qa_b_a_generate_scoped_instance_is_not_the_enclosing_modules_own`
`#[ignore = "QA note 1: accepted generate-block gap"]`, asserting the refusal.
Cheapest fix if the lead wants it: count an edge as local only when its
instance is declared in the module's own scope, or refuse whenever a local
same-named instance sits inside a generate block.
### `verify`'s three moves — pure
Compared the round-one body with the current one line by line: step 1's loop
moved verbatim into `tokens_verified` (same `measure` stage — `trace.tokens` —
per file, `names[1]` is `new_name`); the `inserted` lookup became
`implicit::inserted_in(edits, i)`, the same `find` + `inserted_after` +
`unwrap_or_default`; step 3 binds `names` to a local before the same call. No
behaviour change. `verify` is 79 lines.
### Opentitan copy, re-run (engine whole-set and LSP fan-out agree on every edit count)
| rename | result |
|---|---|
| `fi_control_fsm_wrapper.aes_ctrl_cs` → `aes_ctrl_state` | 2 files, 3 edits (bind `.*` + wrapper `.*`), as round one |
| `aes_control_fsm.aes_ctrl_cs` → `aes_ctrl_cs_q` | 2 files, 4 edits, as round one |
| `fi_control_if.aes_ctrl_cs` → `ctrl_state` | 2 files, 3 edits, as round one |
| `entropy_src_fsm_cov_if.state_i` → `st_i` | 2 files, 3 edits, as round one |
| `prim_fifo_sync.clr_i` → `clear_i` | refused over `prim_fifo_sync_bind_fpv.sv`'s `.clr_i` — correct, those binds target fifo instances |
| `prim_count.err_o` → `error_o` | **now succeeds**: 13 files, 16 edits; `.err_o` written out in `prim_count_tb.sv` and `prim_packer.sv` |
| `prim_count.clr_i` → `clear_i` | **now succeeds**: 13 files, 16 edits; three `.clr_i` shorthands written out (tb, `prim_fifo_sync_cnt` ×2) |
| `aes_core.clk_i` → `clock_i` | **now succeeds**: 3 files, 24 edits |
| `aes_core.key_len_q` → `key_len_qq` | 1 file, 3 edits |
| `entropy_src.clk_i` → `clock_i` | **now succeeds**: 5 files, 10 edits; `.clk_i(clock_i)` in three internal instances and two `bind entropy_src` asserts, `, .clk_i(clock_i)` on the cov bind's `.*` |
| `prim_packer_fifo.wready_o` → `wready_q` | **now succeeds**: 5 files, 13 edits; the two `bind prim_packer_fifo : dut.…` lists get `.wready_o(wready_q)` |
Each rewrite checked by hand against what the implicit connection bound; each
is listed in `warnings`. LSP fan-out sizes: 14–312 files, 9–213 ms per
request (`clk_i` of `aes_core`/`entropy_src` are the 312-file ones).
### Gates (each through `tools/guard.sh`, one at a time)
- `cargo fmt -p vlog_refactor -p lucisv_server -p lucisv_mcp -- --check` — clean.
- `cargo clippy -p vlog_refactor -p lucisv_server -p lucisv_mcp --all-targets` — `Finished`, no warnings.
- `cargo test -p vlog_refactor` — 609 passed, 0 failed, 4 ignored.
- `cargo test -p lucisv_server` — 1713 + 99 + 3 passed, 0 failed.
- `cargo test -p lucisv_mcp` — 206 passed, 0 failed, 2 ignored.
- `cargo test --workspace` — **4 754 passed, 0 failed, 50 ignored** (4 740 +
14 new QA tests; the two new ignored tests are note 1 and finding 3).
**2026-09-23 — QA agent, M3.5 final re-check (finding 3 fix: the comma/connection pair).**
Charter: re-derive finding 3, attack the pair rule in `Slots::takes`, confirm
my finding-3 test is unchanged, re-run the opentitan copy, gates.
### Verdict: FAIL — finding 3 closed; one new BLOCKING finding (4), same class
### Finding 3 — closed
`qa_r_a_lone_trailing_comma_on_a_wildcard_binding_neither_name` now passes
un-ignored. Diffed against the text I wrote (reconstructed from my own edit):
**byte-identical apart from the removed `#[ignore = "QA finding 3"]` line**.
The dev's cross-list test passes.
### Pair-rule attacks (`check/qa_implicit.rs::qa_p_*`, 4 new passing tests)
- `,` in one file's list and its `.din(d)` in another file's list, both ways —
refused "outside a connection list" (each file's edits are checked alone).
The honest pair in both files verifies.
- two `,` and one `.din(d)` in one list — refused (the tolerant parser does
flag `.*,,` followed by a connection); one `,` and two `.din(d)` — refused
(binding print).
- `.din(d)` before its `,` at the same offset (`.*\n .din(d), // …`) and
glued (`.*.din(d),`) — refused (parse). In source order at the same offset
(`.*,\n .din(d) // the rest`) it verifies: a legal list, the same
bindings, the comment kept (it now ends the new line) — accepted, harmless.
- a pair in a `.*` list whose last element is an error element: see finding 4.
Where the "error element" is not SV at all (`+.din(x)`) the before file
already does not compile; the verifier admits the pair after it (pinned).
### Finding 4 (BLOCKING by the rule; loud, not silent) — a slot at an error element's end
`Slots::of` registers a `.*` list whose last element is `ListElem::Error`,
with the element's end as the append point. `.d(type(q)'(q))` is valid SV (a
cast through a type reference — 1800-2017 A.8.4 `constant_primary ::=
type_reference`) that the tolerant parser reads as the error element
`.d(type(q)'(q)`, one byte short of the connection's own `)`. An append there
lands **inside** that connection: `leaf u_e (.*, .din(type(q)'(q), .din(d)));`
— valid input, output that does not compile — and `verify` returns `Ok(())`:
the parse check compares diagnostic *counts* (one before, one after), and the
binding print cannot see into an error element. The engine never writes it
(`unreadable_elements` refuses a list whose error element spells either
name), so nothing ships broken today; it is the verifier accepting what it
exists to refuse, the class of findings 1 and 3. Reproduction:
`check/qa_implicit.rs::qa_p_an_append_at_an_error_elements_end_is_refused`
(`#[ignore = "QA finding 4"]`); the same append after the connection's `)` is
refused (`qa_p_a_pair_after_an_error_element`). **Fix** (a few lines in
`Slots::of`): register no list slot — and no tail — for a site whose `conns`
hold an error element (or, mirroring the engine exactly, one whose error text
spells either name or `*`). Worth adding to the vlog_parser handshake: `type(x)'(y)`
in a port connection parses as an error element.
### Opentitan copy, re-run — identical
All 11 renames of the previous table, whole-set engine and LSP fan-out:
the per-edit and per-warning output is **identical** to the previous run
(diffed with timings stripped).
### Gates (each through `tools/guard.sh`, one at a time; no guard kill)
- `cargo fmt -p vlog_refactor -p lucisv_server -p lucisv_mcp -- --check` — clean.
- `cargo clippy -p vlog_refactor -p lucisv_server -p lucisv_mcp --all-targets` — `Finished`, no warnings.
- `cargo test -p vlog_refactor` — 615 passed, 0 failed, 4 ignored.
- `cargo test --workspace` — **4 760 passed, 0 failed, 50 ignored**, 135 s
(4 756 + 4 new QA tests; the new ignored test is finding 4).
**2026-09-23 — QA agent, M3.5 final confirmation (finding 4 fix, lead-applied).**
Read the change: `Slots::of` skips every site with `site.unreadable()` — no
shorthand tail, no append point — with the finding cited; the only change to
my file is the junk-list pin in `qa_p_a_pair_after_an_error_element` flipped to
`outside` (correct: that list has no slot now). Re-derived against the built
verifier: the cast-list append inside the connection (`.din(type(q)'(q),
.din(d)))`) is refused; the same append after the connection's `)` is
refused; new `qa_p_a_clean_list_beside_an_error_element_list_still_verifies`
— an honest `.*` append and `.d` → `.din(d)` in clean lists verify beside an
untouched `other u_x (.*, .clk(type(clk)'(clk)))` in the same file, and an
append into that list is refused "outside a connection list". Consequence
noted, non-blocking: a `.*` list holding an error element that genuinely needs
a rewrite is now refused by the verifier even where the engine would append
(error text spelling neither name) — a refusal, never a corruption, and only
for lists lucisv cannot parse. `tools/guard.sh -- cargo test -p vlog_refactor`:
617 passed, 0 failed, 3 ignored. **Verdict: PASS** — findings 1–4 closed; QA
note 1 (generate-block gap) stands as the lead's accepted known gap.
## Review
**2026-08-29 — lead, performance-wave Lane A.** Reviewed after QA's
@@ -1848,3 +2564,26 @@ engine's more precise words (pinned by the control test
costs under 0.2 ms over all 3 979 OpenTitan files and reads nothing, so the
`prepare_rename_here` cost stays gone. Details and measurements:
`docs/features/macro-word-census/README.md`.
**Lead, 2026-09-23 (M3.5).** The defect was a CLAUDE.md invariant-1
corruption in a shipped engine — a rename cut `.name`/`.*` bindings and
verified clean because nothing records what an implicit connection binds —
found only when the MCP block put `rename` in front of an adversarial QA.
The fix is the right shape: insertion-only rewrites through four spelled
templates, every rewrite in the warnings, every unreadable case refused by
name, and a verifier that prints every implicit binding before and after
(`check/implicit.rs`). That verifier is a widening of the rename's safety
contract, so invariant 4's discipline applied: three QA rounds attacked it
and found, in order, that it checked what an insertion spells but not where
it lands (fixed: slots keyed on the before-tree's sites), that a lone `,`
at the end of a `.*` list passed (fixed: the comma and its `.X(Y)` are
accepted only as a pair in one list), and that a list holding an error
element registered a slot at the element's end (fixed by the lead: such a
list has no slot; QA's pin flipped to the stricter rule). Rulings: the
enclosing module's own instances win a bare-name `bind` (§23.11); the
generate-scoped instance is an accepted, documented gap; the LSP hands the
engine one more hop of instantiated modules so a `.*` into a module
declaring neither name is read, not refused. Filed for the owner: the
tolerant parser's leniency on a trailing `,` and `{d,, d}`, and
`type(x)'(y)` in a connection parsing as an error element (vlog_parser).
Committed as M3.5; ships in 0.56.0.