DPI-export names are semantic references. verify_move reconstructs the result independently and checks equation 3 per edit, with 16 attack tests. Interface generate-block members are reachable through a port or virtual interface; bind to a bare instance name is found; nested struct members get their container key. Escaped identifiers join FileFacts::words (FACTS_FORMAT 23); generate-scoped bind shorthand resolves. Scope reuses index_order. Files topo #68-#70. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
semantic & refactor edge cases (Round 8)
Goal
Close docs/topo.md §2.9 rows 12, 31 and 32 and oct_review.md L-5, L-6
and L-10, plus the two parked edge cases the Round 7–12 handoff names: an
escaped identifier missing from FileFacts::words (so a census pre-filter
never opened a file that only wrote the escaped spelling — lucisv_mcp
qa_m7.rs R2) and a generate-scoped instance mistaken for the enclosing
module's own by a bind u shorthand rename (vlog_refactor
qa_rename_implicit.rs QA note 1). A bug-fix round: no features beyond the
six items. The persisted census changes three ways, so FACTS_FORMAT goes
22 → 23 once for all of them.
Assumptions
- #12.
index_ordersorts withPath'sOrdand keeps the first copy of a repeated path. Making it generic in the path type (P: AsRef<Path>) orders a&Pathexactly as thePathBufit borrows from, soScope's sources are byte-identical to before. - #31. A DPI export's subroutine is declared in the scope the export is
written in (IEEE 1800 §35.5.4), so the name is bound
Target::InScope— a miss records nothing rather than an unresolved use to warn about. Thec_name =half is a C linkage name and is never a reference.*::*package exports are unchanged. - #32. Every real move today (
extract_moduleto a new file,inline_module) writes one edit per file it names inmoving, so the per-edit rule cannot refuse a real plan; the same-file extraction passes nomovingand keeps the per-file contract. A refactoring that stays in one file may still carry a comment from one edit to another (the ANSI conversion does), so the per-edit rule applies only to files a move names. - #32. A piece is inside an edit's window only when it lies wholly inside it; a piece straddling a window edge counts nowhere and so fails the rule — the conservative direction.
- L-5. Hierarchical references through an interface port and through a virtual interface into a named generate block of the interface are legal; only blocks move to the interface's connection surface — its instances stay hierarchical, as before.
- L-5 (fix round 1). Only an interface's named blocks (and blocks
nested in them) export their members on the connection surface
(
hierarchy::surface_in, rooted at the unit the block chain hangs off). A module's block members stay hierarchical-only, exactly as on trunk. The first cut filed every block's members on the connection table, which leaked module generate-block internals into the workspace-symbol listing (QA-R8-1). - L-6. The bare-instance shape is recognised lexically, in the text that
holds the
bind:unit nameorunit #(…) name. A bare target naming an instance declared in another file (upward resolution past the file) is not recognised — the same scope as every other lexical H3 scan; such abindis still covered by the engine'sconnections.rswalk, which resolves instances through the index. - L-10.
member_keyof a scope owned by aStructMemberis its container's key,., its name —record::nested_key's spelling. Only a struct member that opens a scope owns one, which is exactly the setnested_keykeys. - Escaped words. An escaped identifier is spelled in the census as its
token is: backslash included, terminating whitespace not (
\my.sig), the spelling every symbol and pre-filter uses. Completion — the one reader that inserts a word — filters escaped words out of its table. - Generate-scoped
bind u. "The enclosing module's own instance" is the declaration upward lookup from thebindfinds (sites::nearest). An instance in a generate block is not found from outside the block, and is found from inside it.
Handshakes
vlog_semantic::index_orderis now generic in the path:index_order<P: AsRef<Path>, T>(impl IntoIterator<Item = (P, T)>) -> Vec<(P, T)>. Source-compatible for every existing caller (PathBufinfers as before);vlog_refactor::Scope::assemblecalls it with&Path.FACTS_FORMAT22 → 23. No field changes; three census changes: theWgroup holds escaped identifiers; a DPI export's name is a reference; an interface's named generate block, and the members of blocks inside an interface, are filed on the connection surface (a module's blocks are unchanged). Fix round 1 changed which records carry which surface tag relative to the first cut; nothing was ever committed or released at 23, so 23 names exactly one layout — this one — and needs no second bump. Every store written by 0.66.x is discarded whole by the header check (lucisv_server::index_cache,lucisv_mcp::cache); the existing "every other format" loops (index_cache.rs1..FACTS_FORMAT,qa_m6.rsFACTS_FORMAT - 1) now cover 22.FileFacts::words/words::harvestnow include escaped identifiers. Readers:lucisv_mcpdeclared.rsanddiagnostics.rs(pre-filter and census — wanted),lucisv_server::rename_trace(census — wanted), the semantic-lint mention guard inlucisvandlucisv_server(an escaped name another file writes is now seen as mentioned — fewer false positives), and completion. Out-of-scope edit, flagged:lucisv_server/src/candidates.rsgainsinsertable, applied infrom_wordsandset_words, so completion never offers an escaped word, plus one test.Semantics::member_keynow answersreg2hw_t.ctrlfor an inline nested struct member's scope (wasctrl). Consumers:lucisv_servernav.rs,same_file.rs,completion/related.rs— each passes the key tomember_in, which now finds what the index filed.- Interface block members in the symbol listings (fix round 1,
deliberate). An interface's own signals are connection members and so
workspace_symbolsentries,declared_names, part ofsymbol_view, and exported references. An interface's block members are now the same kind of member and are treated the same way:seenofbus_if.g_monis listed with containerbus_if.g_mon,g_monwith containerbus_if, and neither is inhierarchical_declarations. A module's block members are unchanged from trunk on all four queries (pinned intests/semantic_r8.rs). OpenTitanhw/ipworkspace-symbol count: see the fix-round-1 work log. - Key collision (QA LOW). A typedef
mwith an inline nested memberg_laneand a modulemwith blockg_laneshare the keym.g_lane, as on trunk; the module's block members are again on the hierarchical table only, somember_in("m.g_lane", "lane_q", Connection)is empty as on trunk. An interfacemwith a blockg_lanebeside such a typedef would merge both on the connection table — the same by-name merge the member table already has for every unit name, not new. - Pre-existing OpenTitan test failures, for the lead (identical on trunk
e229ff9, not fixed here): see the fix-round-1 work log for each one's outcome on this tree against trunk. check::verify_move(and soverify_splice) refuses edits that are out of order, overlap, run past the end or split a character; no caller in the workspace produces such a plan (the fullvlog_refactorsuite is green).- Sync points touched for the number:
crates/vlog_semantic/src/facts.rs,docs/topo.md(lines stating the number only: the header paragraph, thevlog_semanticmodule note, the package-reexports row's "codec is N now", the ownership table, the workspace contract row),docs/site/src/content/docs/reference/rust-api.md,docs/repository-analysis.md(current-state lines; the historical "top-rooted … = 22" left alone),crates/vlog_semantic/src/words.rs,crates/lucisv_server/src/candidates.rs(doc). Tests assert the number via the constant everywhere;tests/semantic_r8.rspins 23.
Status / TODO
- #12
Scope::assembleusesindex_order(pure refactor). - #32 independent reconstruction + per-edit equation 3 for move-named files; Finding QA-1 pair proven accepted before, refused after.
- L-6 bare-instance
bindtarget inscoped::binds_into. - Generate-scoped
bind ushorthand (connections.rs); test un-ignored. - #31 DPI-export names bound as
InScopereferences. - L-5 interface generate blocks on the connection surface.
- L-10
member_keyfor inline nested struct members. - Escaped identifiers in the word census; completion filters them;
qa_m7.rstest un-ignored. FACTS_FORMAT22 → 23 and every sync point.- Gates (fmt, clippy, guarded crate tests, OpenTitan ignored tests, stamp) — see Work log.
- Fix round 1: QA-R8-1 (module blocks back to trunk, interface blocks only), architecture.md codec, article, QA's attack shapes as tests, real OpenTitan runs compared with trunk.
Work log
2026-11-26 — dev. Order: the vlog_refactor-only items first (#12, #32,
L-6, generate-scoped bind u), then every vlog_semantic census change
together so FACTS_FORMAT moved once.
- #12.
index_ordermade generic in the path type;Scope::assemblereplaces its hand-written sort/dedup with it. No new test (pure move); thevlog_refactorsuite is unchanged and green. - #32. New
check/ledger/windows.rs.reconstructsplices the edits in from the last backwards and refuses out-of-order, overlapping, out-of-range or mid-character edits —applyskips such an edit silently, so the two disagreeing is now a refusal (unplaceable). The ledger reads the reconstructed text.Split::windows_matchholds equation 3 per edit in a file the move names: each edit's window is located in the reconstructed text by offsets alone, and the never-dropped pieces the re-lexed file holds there must equal what the edit deleted outside the region (sender;>=forgeneratedtext) or at least that (receiver). It is asked afterTransit::check, so every existing refusal keeps its sentence. Attack modulecheck/in_place_attacks.rs(8 tests): the QA-1 pair, a destination relocation, a sender inventing a comment, overlapping and past-the-end edits, and three accept controls (the real extraction, an edit rewriting around its own comment, a one-file splice carrying a comment between edits). Proof of tightening: within_place?and the reconstruction disabled, four of the eight fail (both relocations, overlap, past-end). No check loosened. - L-6.
scoped::binds_intoalso counts abindwhose bare target the same text instantiates asunit(instantiates_as,past_parens). Testqa_warning_scope::l6_…(failed first: no warning; also pins that a bind onto another module's instance stays silent). - Generate-scoped
bind u.connections.rsasksvisible_target— the declarationsites::nearestfinds from thebind— and counts an enclosing-module instance as the bind's own only when it is that one.qa_rename_implicit::qa_b_a_generate_scoped_instance_is_not_the_enclosing_modules_ownun-ignored (failed first); addeda_bind_inside_the_generate_block_sees_the_blocks_own_instance. - #31.
bind/item.rs:ExportDecl::Dpibindsdpi.nameasTarget::InScope. Tests invlog_semantic/tests/semantic_r8.rs(resolution, task withc_name =, package scope, no outward reach) andvlog_refactor/tests/rename_dpi_export.rs(rename from either end, the C name untouched,find_referencesincludes the export). - L-5.
hierarchy::surface_of:Interface→BlockisConnection;Block→ members areConnection(the second hop failed without it — a block has one surface). Tests: resolution through an interface port and a virtual interface, a module's block still off the connection surface, andqa_warning_scope::l5_…(the rename edits both paths, no "could not be resolved"). - L-10.
Semantics::member_keykeys aStructMember-owned scope as{container key}.{name}. Test:reg2hw_t.ctrl, andmember_infindsq. - Escaped words.
words::harvestkeeps escaped identifiers;words.rs's own test flipped to the new contract;lucisv_server::candidates::insertablekeeps them out of completion (testan_escaped_identifier_is_never_offered_as_a_word).qa_m7::qa_rework_an_escaped_local_outline_lists_is_foundun-ignored. FACTS_FORMAT23 with its history entry infacts.rs; sync points as listed in Handshakes.
2026-11-26 — dev, fix round 1 (QA-R8-1 and the lead's rulings).
- QA-R8-1.
Block→ members are back toHierarchicalinhierarchy::surface_of. Newhierarchy::surface_in(root, unit, member)puts a block's members on the connection surface only when the block chain hangs off an interface;record::collect_memberscarries thatroot(the unit itself, kept through nested blocks and inline struct members, reset at a nested class/typedef/covergroup). Tests intests/semantic_r8.rs, three of which fail against the first cut:a_modules_block_internals_are_not_workspace_symbols(workspace_symbolsempty,hierarchical_declarations=m.g_lane),…_not_declared_names_or_in_the_symbol_view(declared_names, anddeclares_the_sameacross a block-internal rename),a_typedef_named_like_a_module_does_not_share_its_blocks_connection_key(QA's LOW collision:member_in("m.g_lane","lane_q",Connection)empty), andan_interfaces_block_members_are_listed_like_its_own_signals(the deliberate choice, see Handshakes).bus.g_mon.seen/vif.g_mon.seenstill resolve (semantic tests) and rename (qa_warning_scope::l5_…). - OpenTitan
hw/ipworkspace symbols (temporary probe, removed after measuring:WorkspaceIndex::buildover every.sv/.v/.svh/.vhunderhw/ip, 1,870 files,workspace_symbols("").len(), release, guarded): trunke229ff941,621 (QA's number), this tree 41,684, first cut 43,670. The 63 extra entries were diffed by(name, container, kind): none removed, and every addition belongs to one of nine interfaces (adc_ctrl_fsm_sva_if,csrng_cov_if,edn_cov_if,keymgr_dpe_if,lc_tx_cov_array_if,otbn_trace_if,rom_ctrl_{,compare_,fsm_}bound_if): 26 blocks (container the interface) and 37 block members (33 variables, 4 instances; containeriface.block). That is exactly the L-5 change with the listing rule an interface's own signals already follow. FACTS_FORMAT23 still names one layout: this one. Nothing was committed or released at 23, so the first cut's layout was never stored by anything the lead ships.- LOW:
architecture.mdcurrent-state sentence → codec 23 (its v0.61–0.66 history line keeps 22);windows.rsrefusal no longer says "take a attribute" (pinned byan_attribute_relocated_between_two_edits_is_rejected). - Test quality.
a_sender_edit_that_invents_a_comment_is_rejectedrenamedcontrol_…_keeps_its_old_refusaland documented as a control (it also asserts the new rule's sentence does not replace the old one). Added QA's uncovered shapes as permanent tests: relocation into the receiver's own insertion (two receiver edits), a dropped comment replaced by an identical-text copy, the same laundered through the other copy's edit, an attribute relocation, a swap of two comments between two edits, and the unplaceable shapes (out of order, mid-character, reversed range; overlap and past-end were already there). Withreconstructandwindows_matchdisabled, 12 of 16 fail; the other 4 are the three accept controls and the old-refusal control. (The first identical-copy draft put the copy on the same line, where// dup // duplexes as one comment and the old checks already refused it; moved to its own line.) - OpenTitan ignored tests, run for real (
LUCISV_OPENTITAN/LUCISV_BIND_ROOT=/Users/lucio/repo/opentitan, guard-t 1200because these index all of OpenTitan; none was killed), each also run on a detached trunk worktree (e229ff9, separate target dir, removed afterwards) and diffed (test names, panics, assertion text, warnings; thread ids and timings masked):lucisv_server --test opentitan_references: 2/2 pass, as on trunk.vlog_refactor --test opentitan_top_rooted: 1 pass, assertion failure at line 110, stack overflow inthe_whole_tree_…— identical to trunk (warnings included).lucisv_mcp --test opentitan: 1 pass, 2 failures (:209earlgrey instance set,:122navigationentropy_src_core.sv:3092) — identical to trunk.vlog_refactor --test rename_bind(ignored test): stack overflow — identical to trunk. All four are pre-existing and not fixed here (lead ruling).
QA log
2026-11-26 — QA (Opus 5.5). Verdict: FAIL (one blocking finding,
QA-R8-1; everything else passes). Experiments ran in a scratch copy of the
working tree and in a detached trunk worktree (e229ff9), each with its own
target dir. Nothing experimental was left in this tree, and OpenTitan
status --porcelain was empty at the end.
Gates: cargo fmt --all -- --check clean; cargo clippy --workspace --all-targets clean; guarded cargo test -p all green: vlog_semantic 449/0
(4 ignored), vlog_refactor 785/0 (5), vlog_linter 711/0, lucisv 162/0,
lucisv_server 2196/0 (52), lucisv_mcp 400/0 (3). stamp_author.py --check
clean. Release lucisv check opentitan/hw: 1,178, and the output is
byte-identical to trunk's (the mention guard did not move any rule).
lucisv --check --no-cache opentitan/hw: 3,967 would reformat + 72
unchanged = 4,039 / 4,046 (7 parse failures), 0 verification failures.
OpenTitan ignored tests, run with LUCISV_OPENTITAN set (without it,
opentitan_top_rooted and opentitan_references skip silently in
0.00 s): opentitan_references 2/2 pass. opentitan_top_rooted (1
assertion failure plus 1 stack overflow), lucisv_mcp --test opentitan (2
failures) and rename_bind (stack overflow) fail identically on trunk.
They are pre-existing, not this round's.
#32 verifier: compared every check before and after. Nothing is loosened.
The same refusals run in the same order, reconstruct must equal apply's
text, and in_place? only adds a refusal. Re-attack: 16 new pairs in a
scratch module. Ten of them are relocations: across two receiver edits, into
the receiver's insertion, a dropped // dup "replaced" by an identical-text
copy, the same thing laundered through the other dup's edit, an attribute, a
line comment, a generated /* TODO: connect */, a move into the region's
replacement text, and a swap of two comments between two edits. With the
pieces-match cases and the unplaceable shapes (unsorted, mid-character,
reversed), that is 11 refused that the new checks catch: all 11 are accepted
with reconstruct and windows_match disabled. Five more were already
refused by the old rules: duplicated transit (×2), moving naming only one
file (×2), and generated text laundering a moved comment. The dev's 8 tests
were confirmed the same way: 4 fail without the new code, 3 are accept
controls, and a_sender_edit_that_invents_a_comment_is_rejected was refused
before too. A directive relocated between two edits is still accepted, the
same as trunk: a directive is not a never-dropped piece. No false refusals:
all 13 public planners over LF / CRLF / non-ASCII / CRLF+non-ASCII
(add/remove port, propagate, expand .*, ANSI, organize imports including
offset 0, extract NewFile/SameFile ending at EOF, inline, rename) give the
same outcome as trunk. Hand-built splices with two inserts at one offset, an
edit at offset 0, an edit at EOF and adjacent edits verify. Plan::settle
sorts by (start, end), and extract/inline write one edit per moved file.
#31: function and task, export before and after the declaration, exported
twice, c_name = (including a c_name spelled like a signal in scope),
interface, package and generate block, an undeclared name (records nothing,
rename at it refused), DPI imports unchanged, *::* unchanged. OpenTitan
otbn_* exports: 1 → 2 references and a clean rename (trunk 1 + warning).
L-10: nested-in-nested, union, interface typedef, and a same-named outer
typedef ctrl (trunk resolved the inner q to it) all improve; enum
unchanged. Generate-scoped bind u: nested, sibling, same name in the block
and the module (each side), and for-generate all behave per upward lookup. A
format-22 index-cache-mcp written by the trunk binary is discarded and
rebuilt by the new binary; the escaped find succeeds, and warm reuse works.
Findings:
- QA-R8-1 (MEDIUM, blocking, this round) —
workspace/hierarchy.rs:133(Block→ membersConnection) files the members of every module's named block on the connection table. That puts them inworkspace_symbols,declared_namesandsymbol_view. Input:module m; if (1) begin : g_lane logic lane_q; end endmodule. Expected (trunk, andindex.rs:139-147: "A module's internal net is not a workspace symbol"):workspace_symbols("lane_q")empty andlane_qinhierarchical_declarations. Actual:[email protected]_lanelisted andhierarchical_declarationsempty. On OpenTitanhw/ipthe listing grows 41,621 → 43,670. The Handshakes section names noworkspace/symbolconsumer. - LOW (this round):
docs/site/.../reference/architecture.md:55still says "codec 22" in a current-state sentence.docs/topo.md:376still says "DPI-export names remain unbound" (the lead's file). - LOW (this round):
ledger/windows.rs:122produces "take a attribute". - LOW (this round): a typedef
mwith an inline nested memberg_laneand a modulemwith blockg_lanenow share the Connection keym.g_lane(trunk merged them on the Hierarchical surface only). - INFO (pre-existing):
\fooandfooare not one identifier anywhere. A rename offoosilently missesu.\fooin another file. The MCP log calls a format-22 store "not written by lucisv 0.66.2".verify_moveis 115 lines (99 on trunk). - Largest changed production files:
rename/connections.rs503,facts.rs467,check/mod.rs444,candidates.rs440,bind/item.rs408. None of them is over 600.
2026-11-26 — QA re-check of fix round 1 (Opus 5.5). Verdict: PASS.
QA-R8-1 is closed, and every lesser item is fixed or accepted. A detached
trunk worktree (e229ff9) and a scratch copy of the tree were used, each with
its own target dir, and both were removed afterwards. OpenTitan
status --porcelain is empty.
-
QA-R8-1 closed. The module-block input matches trunk on
workspace_symbols,hierarchical_declarations,member_inon both surfaces and the in-file postings (posts [0], as on trunk), sonav.rshierarchical_onlytakes the trunk path for a module block. The typedef-m/ module-mkey collision is back to trunk. -
rootthreading. 13 shapes were diffed against trunk: a block inside a for-generate in an interface, blocks nested two deep, a module instantiated inside an interface block, a class / typedef / covergroup / localparam / procedural block inside an interface block, an interface nested in a module, a program, an interface instance inside a module's block, modport and virtual-interface paths, abindinto an interface block, and a direct interface instance next to one inside a block.- Every difference is an interface block or an interface block's member.
- The internals of
leaf(inner,leaf.lg.leaf_blk) are unchanged. - Class, typedef and covergroup members are unchanged, as on trunk.
- Program and module-with-class cases are identical to trunk.
-
OpenTitan
hw/ip. Workspace symbols go from 41,621 to 41,684. The diff is additions only, all in nine interfaces: 26 blocks, 33 vars and 4 instances. -
L-5.
bus.g_mon.seenandvif.g_mon.seenare posted (2 uses). Connection listings are sane:bus_iflists[d, g_mon, mp], andbus_if.g_monlists[seen].qa_warning_scope::l5_…(rename edits both paths, no "could not be resolved") is green. -
LOW items.
architecture.md:55now says codec 23 (:89is historical). Thewindows.rsrefusal now reads "take one elsewhere". The collision is back to trunk. Withreconstructandwindows_matchdisabled in the scratch copy, 12 ofin_place_attacks.rs's 16 tests fail and the 4 labelled controls pass, as claimed. -
Gates. fmt clean, clippy 0 warnings, stamp clean. Guarded
cargo test -p, all green:crate passed ignored vlog_semantic 453 4 vlog_refactor 793 5 lucisv_server 2196 52 lucisv_mcp 400 3 lucisv 162 0 vlog_linter 711 0 -
OpenTitan sweeps.
lucisv checkgives 1,178 findings, byte-identical to trunk.--check --no-cachegives 3,967 + 72 = 4,039 / 4,046 with 0 verification failures. -
OpenTitan ignored tests (
LUCISV_OPENTITANset).opentitan_referencespasses 2/2.opentitan_top_rooted,lucisv_mcp --test opentitanandrename_bindfail identically to trunk.guard -t 1200killed nothing. -
LOW (this round). An instance inside an interface's block goes on the connection surface and is listed as a workspace symbol (
bus_if.g.u_inblk; 4 on OpenTitan). The interface's direct instances stay hierarchical-only and unlisted (u_direct). So the claim "listed like the interface's own signals" holds for signals and parameters, but not for instances. This is not a regression: a block instance is only reachable through a connection read that trunk could not make at all. -
INFO (pre-existing).
bus.mp.g_mon.seenis not posted (a modport is not a path scope). A modport does not restrict which block members abus_if.mpport reaches, just as it does not restrict the interface's signals.
Review
2026-11-26 — lead: accepted after two QA passes.
- Delivered: §2.9 #12, #31 and #32 (closed in
docs/topo.md),oct_review.mdL-5, L-6 and L-10, escaped identifiers inFileFacts::words(FACTS_FORMAT23), and the generate-scopedbindshorthand; both previously ignored tests are un-ignored and pass. - #32 tightens the verifier and loosens nothing: QA compared every check against trunk, ran 13 real planners over LF/CRLF/non-ASCII text with identical outcomes, and wrote 16 attack pairs of its own, 11 of which trunk accepted.
- The first cut of L-5 moved every module's block members onto the connection
surface (QA-R8-1); fix round 1 restricted it to interface blocks. OpenTitan
hw/ipworkspace symbols: 41,621 → 41,684, additions only, all under nine interfaces. - Out-of-lane edit accepted:
lucisv_server/src/candidates.rskeeps escaped words out of the completion table, forced by the shared word census. - Filed for later: §2.9 #68 (three ignored OpenTitan tests that fail on trunk
once
LUCISV_OPENTITANis set — the dev's first report counted their silent skip as a pass), #69 (instances inside interface blocks are listed, direct ones are not), #70 (\\foovsfooacross files). - OpenTitan:
lucisv check hwbyte-identical to trunk (1,178); format 4,039/4,046 with 0 verification failures.