TODO section 25; closes docs/topo.md 2.9-20, 2.9-21, 2.9-22; opens 2.9-23. A comment written where no AST node had a field was never deleted: bump queued it and take_meta handed it to the next node, so it printed one node later and verify.rs refused the whole file. About seventy named comment fields now own those gaps - SegmentComments on member/scope/ index/range segments (one parse_postfix_segment replacing three hand-copied loops), one [a:b] grammar, BinaryComments on inside, casts, unary/postfix, if/case/for/foreach/do-while headers, @ and # timing, Stmt::before_semi with StmtKind::takes_semi() as the single owner of the ; (debug_assert enforced), labels on ten nodes, qualifier runs as Vec<Qualifier>, function/task/module/package/class/typedef/enum/struct headers, declarators, ports, connections, instantiations. Each prints through Fmt::slot_comments, a no-op when empty: 860 corpus and 3 975 opentitan files are byte-identical to v0.30.0 (QA reproduced from an independent baseline build). Four exhaustive gap fuzzers at zero - covergroup 329, fragment 153, constraint 395 (committed at last), RTL 352 (new) - are the regression gate. verify.rs untouched, ten attack pairs. Expression slots are boxed so Expr stays 96 bytes; ast::size_pins asserts it (QA's one finding). Also: nav::definition gains the macro branch hover already had (H5); a cast's type binds as a type via bind_type_expr, FACTS_FORMAT 13 -> 14 (M11); rename reports the candidate references that stayed unresolved through the overlay, one line per file and unit (2.9-20); the scoped name join keeps an escaped segment's terminator (2.9-21). One flagged edit outside scope: a .. in vlog_linter/src/signals.rs patterns. docs/features/comment-slots/README.md. Co-Authored-By: Claude Fable 5 <[email protected]>
980 lines
60 KiB
Markdown
980 lines
60 KiB
Markdown
# overlay-promotion
|
||
|
||
## Goal
|
||
|
||
An unqualified name nothing in a file binds — `bus_if bus;`, `my_cls h;`,
|
||
`virtual clk_rst_if vif;` — used to die inside `vlog_semantic`. `resolve.rs`'s
|
||
lexical walk ended in `Resolution::NotFound` when the file had collected no
|
||
import paths, or in `Resolution::InheritedCandidate` when the miss happened
|
||
inside a class with an `extends`, and neither spelling reached
|
||
`resolve_external`, so the workspace overlay never saw the name. That is
|
||
exactly how an `interface` is written (interfaces live at file scope, never in
|
||
a package) and how a package-less `class` is used, and the `InheritedCandidate`
|
||
half covers nearly every UVM class, since almost all of them extend something.
|
||
This feature makes both spellings carry the **bare name** as their last
|
||
candidate path **when the name was written in a type position**, so the
|
||
workspace's unit table — the one that already answers `sub u_sub (...)` — gets
|
||
asked. An identifier in a value position is left alone: it makes no claim about
|
||
a file-scope declaration, and matching one on name alone is how `rename` came
|
||
to rewrite an unrelated file (QA finding 1, fixed in the round below).
|
||
`textDocument/definition`, `typeDefinition`,
|
||
`references` and `rename` all gain the answer at once, because all four read
|
||
the same overlay; and `lucisv_server`'s stopgap `type_def::indexed_type`, which
|
||
asked the index directly under a three-condition fence, is deleted whole (the
|
||
Handshake `docs/features/type-definition/README.md` filed, delivered here).
|
||
|
||
## Assumptions
|
||
|
||
- **A bare miss *in a type position* is a name the workspace could declare.**
|
||
Nothing in the file binds it and no import path in scope can supply it, so
|
||
the only remaining source is a file-scope declaration in another file. This
|
||
is what makes the promotion honest rather than a guess: the alternative
|
||
answer is no answer at all, and the name really is spelled the way a
|
||
cross-file `interface`/`class`/`module`/`typedef` use is spelled. The
|
||
qualifier "in a type position" is load-bearing and was missing from the
|
||
round's first cut — see the fourth assumption below.
|
||
- **A qualified miss is not one of these, and is never promoted.**
|
||
`p::missing_t` names something *inside* `p`; sweeping the bare tail through
|
||
the unit table would discard the qualifier and jump somewhere the source
|
||
never pointed (the lead's ruling on the deleted fence, 2026-08-26). This is
|
||
structural, not a check: `resolve.rs`'s `unit_member` returns its own
|
||
`NotFound`/`InheritedCandidate` and never calls `miss`, so the bare name is
|
||
added on exactly the two paths that should have it (`lexical`, `unit`).
|
||
- **The unit table has no kind filter, here as everywhere.** `units(name)`
|
||
returns every file-scope `module`, `package`, `typedef` and `class` of that
|
||
name, and the overlay offers all of them — the documented duplicate policy
|
||
(`docs/features/workspace-index/README.md`). A promoted miss therefore *can*
|
||
answer with a `package` of that name, which the deleted `indexed_type`
|
||
excluded. That exclusion was a property of a fourth, private resolution
|
||
layer; with the answer coming from the shared overlay,
|
||
`typeDefinition` gives what `definition` gives on the same token, and
|
||
disagreeing would mean building the fourth layer again. The source that
|
||
provokes it (`thing t;` where the workspace's only `thing` is a package) does
|
||
not compile either way.
|
||
- **Only a name written where a type goes is offered to the unit table.**
|
||
~~An identifier in a value position that nothing declares — a name a
|
||
`` `define`` would have produced, a typo — now resolves to a same-named unit
|
||
if the workspace has one. That is the same exposure `Target::Module` and
|
||
`Target::Unit` have always had.~~ **Both halves of that were wrong, and QA
|
||
disproved them (finding 1, 2026-08-26).** The exposure was *not* the same:
|
||
`Target::Module`/`Unit`/`Package` are emitted only where the source names a
|
||
unit — an instantiation, an `extends` base, the head of `p::x` — so their
|
||
bare-name sweep asks a question the source actually asked. `Target::Lexical`
|
||
is emitted for two unrelated things: a declaration's type window
|
||
(`bind.rs`'s `bind_data_type`) and every plain expression identifier
|
||
(`ExprKind::Ident`). Promoting it promoted both, and a value-position typo
|
||
became an `ExternalCandidate` that `rename` rewrote across files on nothing
|
||
but a name collision. Nor was it bounded by anything: the unit table holding
|
||
only file-scope declarations is what makes the collision *plausible*, not
|
||
what makes it safe. The fix round split the target — `Target::Type`, emitted
|
||
by `bind_data_type`'s unqualified arm alone — so the promotion asks the unit
|
||
table only about names the source wrote as types. A value-position miss keeps
|
||
its pre-round spelling and `rename` goes on refusing it. `rename` still gains
|
||
the ability to rename an interface from its use as a type — the intended win,
|
||
and the only one claimed.
|
||
- **The overlay is consulted after the in-file layer, always.** A name this
|
||
file declares never reaches the promotion at all, so shadowing needs no code
|
||
and cannot regress.
|
||
|
||
## Handshakes
|
||
|
||
**Consumed from `vlog_parser`:** nothing new.
|
||
|
||
**Changed in `vlog_semantic` (this crate), and what each consumer sees:**
|
||
|
||
0. `bind.rs` gains `Target::Type`, emitted by `bind_data_type`'s unqualified
|
||
arm and by nothing else. It is resolved exactly like `Target::Lexical` —
|
||
same walk, same shadowing, same import precedence — and differs only in what
|
||
its miss carries. Every type position in the language reaches it, because
|
||
every one of them goes through `bind_data_type` (call-site map in the fix
|
||
round's work log).
|
||
1. `resolve.rs::lexical` pushes the reference's own name onto the candidate
|
||
paths before the miss is spelled, **for `Target::Type` only** and **last**,
|
||
after every import collected on the way out, so an import that can supply
|
||
the name still wins (unchanged precedence, pinned by a test).
|
||
2. An unqualified **type** miss is therefore
|
||
`ExternalCandidate { paths: [..imports.., name] }`, or
|
||
`InheritedCandidate { base, paths: [..imports.., name] }` inside an
|
||
extending class. `base` is untouched: the inherited semantics every consumer
|
||
reads are exactly what they were. An unqualified **value** miss is
|
||
unchanged from `3bc61f9`: `ExternalCandidate { paths: [..imports..] }`,
|
||
`InheritedCandidate { base, paths: [..imports..] }`, or `NotFound` when
|
||
there are no imports at all.
|
||
3. `Resolution::NotFound` keeps its meaning and its reachability. It is what a
|
||
miss with no path to offer says: a member of a package this file fully
|
||
declares, a `.port` of a module it declares, a `this.x`/`super.x` with no
|
||
class or base, and a plain expression identifier with no import in scope.
|
||
Over the 860-file corpus it is reached 1 256 times (was 1 418 before the
|
||
round; the 162-reference difference is exactly the type-position misses).
|
||
4. `workspace.rs::resolve_external` answers an `InheritedCandidate` from its
|
||
paths, and records an entry **only when one of them lands**. An inherited
|
||
candidate is not an external candidate: when the sweep finds nothing, the
|
||
reference stays exactly what it was, absent from the overlay, and
|
||
`ExternalResolutions::counts()` does not grow. `ExternalTarget`,
|
||
`Definition` and every other overlay type are unchanged.
|
||
**Amended 2026-09-01 by class-member-access** (topo §2.9-9): when the paths
|
||
find nothing, the recorded **`base` is chased** — `member(base, name)`, then
|
||
up the workspace's `extends` edges (`WorkspaceIndex::base_of`) with a
|
||
visited set. The "record an entry only when something lands" rule is
|
||
unchanged and is what still keeps an unanswerable inherited candidate out
|
||
of the overlay; what changed is that the paths are no longer the only thing
|
||
tried. The order matters and is the one stated here: an import path that
|
||
can supply the name still wins over the base.
|
||
|
||
**Promised to consumers:** the overlay answers more references and invents
|
||
nothing. Every `Def` it returns is still a real file-scope declaration whose
|
||
`name_span` slices back to the name the use spells (the corpus test asserts
|
||
this over all 860 files, unchanged).
|
||
|
||
**Requested of other modules:** nothing. The parser gap the type-definition
|
||
feature filed (an ANSI header whose first port has no direction does not parse)
|
||
is still open and still not this feature's; the rename test added here writes
|
||
the interface in the body and says why.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] `crates/vlog_semantic/src/bind.rs`: `Target::Type`, emitted by
|
||
`bind_data_type`'s unqualified arm only (fix round, 2026-08-26).
|
||
- [x] `crates/vlog_semantic/src/resolve.rs`: the bare name as the last path of
|
||
every unqualified **type-position** miss, both spellings; a
|
||
value-position miss keeps its pre-round spelling, `NotFound` included.
|
||
- [x] `crates/vlog_semantic/src/workspace.rs`: `resolve_external` answers an
|
||
inherited candidate opportunistically, entry only on a hit.
|
||
- [x] `crates/vlog_semantic/src/model.rs`: the three `Resolution` doc comments
|
||
say what each variant now means.
|
||
- [x] `crates/lucisv_server/src/type_def.rs`: `indexed_type` deleted, qualifier
|
||
guard and kind filter included; `type_definition` is the pure two-layer
|
||
answer; module doc updated.
|
||
- [x] Consumer audit across the workspace (work log below): every match site on
|
||
`NotFound`/`InheritedCandidate` reviewed, no code change needed anywhere.
|
||
- [x] 9 new `vlog_semantic` tests (7 promotion + 2 value-position twins), 1 new
|
||
`vlog_refactor` test plus the fix round's refusal test, 6 existing
|
||
`vlog_semantic` assertions restored to their pre-round values once the
|
||
promotion narrowed, 1 `lucisv_server` expectation updated and 3 tests
|
||
there renamed (one of them a real behavior change, argued below).
|
||
- [x] Corpus re-measured three times with one harness — `3bc61f9`, the
|
||
unrestricted first cut, and the shipped type-only promotion; both README
|
||
tables carry all three columns and the survived/given-back split.
|
||
- [ ] **Not done, deliberately:** `rename` still refuses an
|
||
`InheritedCandidate` even when the overlay answered it. The refusal
|
||
message is about the base class, which is still true, and widening rename
|
||
to act on a best-effort sweep deserves its own round with its own
|
||
collision tests.
|
||
- [ ] **Not done:** chasing a base class. Nothing here resolves inheritance;
|
||
when something does, those references become `Resolved` and the promotion
|
||
is simply never reached for them.
|
||
|
||
## Work log
|
||
|
||
### 2026-08-26 — dev agent
|
||
|
||
- **The design, chosen after reading all three call sites.** The brief offered
|
||
a new `Resolution` variant or a promotion to `ExternalCandidate`. The
|
||
promotion wins, and the reason is that `ExternalCandidate { paths: [name] }`
|
||
is not a new concept here — it is *the same shape* `Target::Module` emits for
|
||
an instantiation of a module declared elsewhere and `Target::Unit` emits for
|
||
an `extends Base`, both of which already mean "a workspace unit of this name
|
||
could be it". A fourth variant would have spelled an existing idea twice.
|
||
It also makes `NotFound`'s own doc comment true for the first time: it says
|
||
"no external unit could", which was false for every unqualified lexical miss.
|
||
The implementation is two lines of behavior — `lexical` pushes the name,
|
||
`miss` loses its `NotFound` arm — which is what the boring version of this
|
||
should cost.
|
||
- **Where the qualified/unqualified fence lives, and why that is not a check.**
|
||
The lead's guard in `indexed_type` tested the text before the reference for
|
||
`::`, because at the server layer the `Target` that produced a resolution is
|
||
gone. In `resolve.rs` it is right there: `unit_member` (the `x` of `p::x`)
|
||
builds its own `NotFound`/`InheritedCandidate` and never calls `miss`, so
|
||
adding the bare name inside `miss` reaches exactly `lexical` and `unit` and
|
||
nothing else. The guard is deleted with the function and nothing replaces it;
|
||
`a_qualified_miss_is_never_promoted_in_either_spelling` pins both spellings.
|
||
- **The `InheritedCandidate` half is answered without being converted.** The
|
||
brief's constraint was that the overlay must not erase the inherited
|
||
semantics, and the corpus makes it concrete: 7 800-odd inherited candidates
|
||
exist, and most of them are ordinary member misses (`held = 1` inside a class
|
||
that extends) that no unit table can answer. So `resolve_external` tries the
|
||
paths and inserts an entry **only on a hit** — 520 hits over the corpus.
|
||
Consequences: `Resolution` still says `InheritedCandidate { base, .. }` for
|
||
every one of them, so `rename`'s refusal message and `check.rs`'s anchor
|
||
logic are untouched; `overlay.get(id)` still means "the workspace had
|
||
something to say"; and `counts()` does not acquire a denominator of names
|
||
nobody expected it to answer. The alternative — inserting `StillUnresolved`
|
||
entries for all of them — would have moved the corpus answer rate from 89.3 %
|
||
to roughly 60 % without a single extra answer, which is a measurement
|
||
artifact, not a result.
|
||
- **It also closes a finding the class-semantics QA round filed and left as a
|
||
design call.** That log offered two honest fixes for inherited candidates the
|
||
overlay never got to answer: suppress the inheritance fallback for *unit*
|
||
lookups, or "let the overlay chase `InheritedCandidate.paths`"
|
||
(`docs/features/class-semantics/README.md`). The first was taken earlier —
|
||
`miss` already exempts `Target::Unit` — and this round takes the second.
|
||
- **Consumer audit** (`grep -rn 'InheritedCandidate\|NotFound' crates
|
||
--include='*.rs'`), every site and its verdict:
|
||
- `vlog_refactor/src/rename.rs:231-240` — `locate` matches all four
|
||
variants. `NotFound` → "not resolved to any declaration"; a promoted miss
|
||
now takes the `ExternalCandidate` arm instead, reaching
|
||
`declaration_across_files`, which either finds the declaring file (the
|
||
interface rename this round pins) or returns "declared outside the files
|
||
lucisv indexes". Both are honest; no code change. The
|
||
`InheritedCandidate` arm is unreachable-by-design for a name the overlay
|
||
answered, and deliberately left refusing (Status/TODO).
|
||
- `vlog_refactor/src/check.rs:533` (`Anchor::Unresolved`'s doc) and
|
||
`:618-640` (`anchor_of`) — reads `reference.resolved()` and the overlay,
|
||
never the variant. A newly answered reference becomes `Anchor::External`
|
||
on **both** sides of the verification (the pre-edit analysis is shifted
|
||
forward and re-anchored the same way), so the fingerprint still compares
|
||
like with like. No change; the whole rename suite is green including the
|
||
resolution-identity tests.
|
||
- `vlog_linter/src/signals.rs:260,573` — `reference.resolved()` only, which
|
||
is `Some` for `Resolved` and `None` for everything else, before and after.
|
||
Semantic lints cannot see this change. `cargo test -p vlog_linter`: green.
|
||
- `lucisv_server/src/nav.rs:191` (`symbol_at`) — same `resolved()`
|
||
accessor; `definition`/`references`/`highlights` go through
|
||
`ExternalResolutions`, which is where the new answers arrive.
|
||
- `lucisv_server/src/tokens.rs:202` — `resolved()`; semantic tokens
|
||
unaffected.
|
||
- `lucisv_server/src/type_def.rs` — the whole `indexed_type` match site is
|
||
deleted.
|
||
- `vlog_semantic/src/model.rs:119` (`is_inherited_candidate`) — still true
|
||
of exactly the same references; the corpus inherited-candidate rate is
|
||
unchanged at 8.3 %, which is the check that the promotion did not
|
||
reclassify anything.
|
||
- Test-only sites (`tests/semantics.rs`, `tests/classes.rs`,
|
||
`tests/rename.rs:368`) — reviewed individually below.
|
||
- `lucisv_server/src/server.rs`'s `MethodNotFound` — an LSP error code, an
|
||
unrelated grep hit.
|
||
- **Six existing assertions re-pointed, each because the paths grew by the
|
||
bare name, none because behavior regressed**: `semantics.rs`'s genvar-escape
|
||
miss (`NotFound` → `ExternalCandidate { ["i"] }`, plus a new assertion that
|
||
`resolved()` is still `None`) and its wildcard-import miss (`["other_pkg::*"]`
|
||
→ `+ "SOMETHING"`); `classes.rs`'s `set_name` inheritance miss, `UVM_LOW`
|
||
import-carrying miss, and `member_miss`. `super.x`/`this.x` assertions in the
|
||
same tests are untouched, which is the point: a member access names no unit
|
||
and gains no path.
|
||
`inherited_candidates_are_not_the_workspace_overlays_business` keeps its name
|
||
and its verdict — the overlay still holds nothing for `held` — and gained the
|
||
reason (a class property is not a unit).
|
||
- **The type_def fence tests, one by one.** The suite is the acceptance suite,
|
||
so each is named with what happened to it:
|
||
- `a_local_declaration_of_the_same_name_wins_over_the_workspace_type`,
|
||
`a_local_typedef_in_the_extending_class_itself_wins_over_the_workspace_type`
|
||
— unchanged, pass. Shadowing is enforced by `lexical` resolving first,
|
||
which the promotion happens after.
|
||
- `a_qualified_name_the_overlay_refused_is_not_retried_against_the_index`,
|
||
`a_qualified_member_miss_never_falls_back_to_a_bare_name_sweep` —
|
||
unchanged, pass. The qualifier guard's job is now `unit_member`'s.
|
||
- `an_inherited_candidate_reaches_a_same_named_module_exactly_like_not_found_did`,
|
||
`a_uvm_shaped_member_type_resolves_cross_file_from_an_extending_class`,
|
||
`a_class_scoped_type_reference_in_an_extending_class_is_found_cross_file`,
|
||
`an_in_file_bases_nested_typedef_does_not_beat_the_workspace_type_because_nothing_finds_it`
|
||
— unchanged, pass, now through the overlay. The third and fourth still
|
||
assert the resolution is `InheritedCandidate`, which is now a statement
|
||
about the promotion preserving it.
|
||
- `a_module_declared_twice_returns_both_declarations`,
|
||
`a_type_nothing_declares_answers_nothing`,
|
||
`a_non_type_inherited_reference_is_still_never_a_type_site`,
|
||
`corpus_spot_check_real_uvm_files_no_panic_and_known_jumps` and the other
|
||
30 — unchanged, pass.
|
||
- `a_plain_expression_use_of_a_workspace_module_name_is_never_a_type_site` —
|
||
kept, expectation updated: the reference is now an `ExternalCandidate` and
|
||
`nav::definition` *does* answer it, which the test now asserts explicitly
|
||
before asserting that `type_definition` still does not. That makes it a
|
||
stronger test than it was: it pins the confinement rather than an accident.
|
||
- `indexed_type_returns_every_workspace_declaration_when_the_name_is_ambiguous`
|
||
→ `a_promoted_miss_returns_every_workspace_declaration_when_the_name_is_ambiguous`.
|
||
Renamed because it named a deleted function; same fixture, same assertion
|
||
(two interfaces, both offered), same convention.
|
||
- `the_other_two_fence_conditions_still_hold_under_an_inherited_candidate`
|
||
→ `an_inherited_candidate_answers_only_what_the_workspace_unit_table_holds`.
|
||
Two of its three arms are unchanged and pass (a package *member* is not in
|
||
the unit table; a qualified miss is never swept). The first arm — a
|
||
`package` of that name — now answers, and asserts so.
|
||
- `a_package_of_the_same_name_is_not_a_type`
|
||
→ `a_package_of_the_same_name_answers_exactly_as_definition_answers_it`.
|
||
**The one behavior change in the suite**, argued in Assumptions above and
|
||
asserted as literal equality with `nav::definition` at the same offset, so
|
||
the two handlers can never drift apart on it again.
|
||
- **Measured before and after with one harness, both on the 860-file corpus.**
|
||
The tables in `docs/features/vlog-semantic/README.md` and
|
||
`docs/features/workspace-index/README.md` were **stale by several rounds**
|
||
before this one (they described 73 708 references and an 87.0 % answer rate;
|
||
the tree measured 94 685 and 89.3 % at `3bc61f9`, because class support and
|
||
the parser rounds since moved both). The numbers quoted in the brief
|
||
(94.0 % / 1.2 %) come from `docs/features/directives-in-instances/README.md`
|
||
and are older still. So the "before" column below is a fresh measurement of
|
||
`3bc61f9` — taken by stashing only the three changed `src` files and
|
||
re-running the same instrumented test — not a quote.
|
||
- **The reporting change that made the comparison honest.** Re-bucketing a miss
|
||
moves it between the columns these tables report, so the per-bucket rates
|
||
move without anything getting better or worse. `tests/workspace.rs`'s `Tally`
|
||
now also prints **references with nowhere to jump after both layers**
|
||
(`references − resolved in-file − answered by the overlay`), which is the
|
||
number that cannot be gamed by a re-spelling, plus how many of the overlay's
|
||
entries came from inherited candidates. `tests/corpus.rs` prints the raw
|
||
unresolved count beside its percentage. Both assertions are textually
|
||
unchanged.
|
||
|
||
Clean-file population (853 files, 94 384 references):
|
||
|
||
| metric | before | after |
|
||
|---|---:|---:|
|
||
| resolved in-file | 73.3 % | 73.3 % |
|
||
| external candidates | 17.1 % | **18.4 %** |
|
||
| inherited candidates | 8.3 % | 8.3 % |
|
||
| unresolved (`NotFound`) | 1.3 % | **0.00 % (0)** |
|
||
| handed to the workspace layer | 16 133 | **17 877** |
|
||
| …of which inherited candidates | 0 | **520** |
|
||
| answered | 89.3 % | 83.7 % |
|
||
| still unresolved (of those handed) | 10.7 % | 16.3 % |
|
||
| **nowhere to jump, both layers** | **10 794 (11.4 %)** | **10 235 (10.8 %)** |
|
||
|
||
All-files population: nowhere to jump 10 992 (11.6 %) → **10 431 (11.0 %)**.
|
||
|
||
Read honestly: **559 references on clean files gained a jump target and none
|
||
lost one** — 520 of them inherited candidates (the UVM shape this round
|
||
exists for) and 39 in the external bucket, where the bare name landed after
|
||
every import path in scope had missed. The answer *rate* falls only because
|
||
1 224 previously-invisible misses joined the denominator; they were counted
|
||
in the other table's "1.3 % unresolved" before, and they are the same names
|
||
either way. No cell that measures "this reference has nowhere to go" rose.
|
||
Index counts, build time (0.78 s), determinism and the span-slices-back
|
||
assertion are all unchanged.
|
||
- **Scope.** Files edited: `crates/vlog_semantic/src/{resolve,workspace,model}.rs`,
|
||
`crates/vlog_semantic/tests/{workspace,semantics,classes,corpus}.rs`,
|
||
`crates/lucisv_server/src/type_def.rs`,
|
||
`crates/vlog_refactor/tests/rename.rs`, this README, and the three READMEs
|
||
named above. No new dependency, no version bump, no parser change,
|
||
no `TODO.md` change (§6 and §9c both claim capabilities that were true before
|
||
and are more true after).
|
||
- **Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets
|
||
--workspace`: 0 warnings. `cargo test --workspace`: green (871 passed /
|
||
4 ignored in `lucisv_server`'s own suite, 0 failed anywhere).
|
||
`cargo test -p vlog_formatter`: green. `cargo test -p vlog_linter`: green.
|
||
`cargo test -p vlog_refactor`: green (49 rename tests, +1).
|
||
`cargo build && node editors/vscode/smoke.js target/debug/lucisv-server`:
|
||
`smoke: OK`. No `git commit`, no `git push`.
|
||
|
||
### 2026-08-26 — dev agent, fix round (QA finding 1)
|
||
|
||
- **What was wrong, in one sentence.** `Target::Lexical` is two things wearing
|
||
one name — a declaration's type window and every plain expression identifier
|
||
— so promoting it promoted both, and a value-position typo became an
|
||
`ExternalCandidate` that `rename` acted on across files. The round's
|
||
Assumptions claimed this was "the same exposure `Target::Module` and
|
||
`Target::Unit` have always had"; QA disproved it by reading `3bc61f9`, and
|
||
the claim is now struck through and corrected in place rather than quietly
|
||
edited.
|
||
- **The mechanics, and why this one.** The brief offered a new target variant
|
||
or a flag at the `use_name` call sites. The variant wins, for the reason the
|
||
bug had: the information "this name was written where a type goes" exists at
|
||
exactly one place in `bind.rs` and is thrown away one line later. A flag
|
||
threaded through `use_name` would put the same fact in the same place while
|
||
making every unrelated call site name it; a variant lets `resolve.rs`'s
|
||
dispatch — the function whose whole job is "what kind of lookup is this" —
|
||
carry it. So: `Target::Type`, dispatched to the same `lexical` walk with
|
||
`promote: true`, and `Target::Lexical` with `promote: false`. `miss` gets its
|
||
pre-round body back verbatim, including the `external.is_empty() → NotFound`
|
||
arm the first cut had deleted as unreachable. Behavior delta is four lines.
|
||
- **The call-site map — every `Target::Lexical` site in `bind.rs`, and its
|
||
verdict.** All four, and only these four, exist:
|
||
- `bind.rs:1223`, `bind_data_type`'s unqualified `None` arm — **the type
|
||
position, changed to `Target::Type`.** Every type in the language funnels
|
||
here, verified by reading all eleven `bind_data_type` callers: ANSI module
|
||
ports (385), header `#()` param ports (409), typedef aliases (442) and
|
||
enum bases (448), struct members (467), the shared declarator path that
|
||
serves nets/vars/params/port decls (508), function return types (615),
|
||
task/function arguments (650), out-of-body method return types (829), the
|
||
typed `for`-init declaration (928), and `ExprKind::Type` (1184), which is
|
||
how `#(virtual bus_if)` and a `type` parameter's default arrive. A
|
||
`virtual`/`virtual interface` prefix is held separately by the parser
|
||
(`DataType::virtual_kw`), so `ty.name` is the bare interface name and the
|
||
UVM `virtual clk_rst_if vif;` shape is covered by the same one line — the
|
||
cross-file interface rename test exercises exactly it.
|
||
- `bind.rs:1082`, `ExprKind::Ident` — the value position, **left as
|
||
`Target::Lexical`.** The regression's source.
|
||
- `bind.rs:1009`, `disable blk;` — a block label, a value position. Left.
|
||
- `bind.rs:128`, a re-declaration of a name already bound in the scope —
|
||
recorded as a use of the first declaration. Not a type window (the type
|
||
window was already bound separately by the time `declare` is called), and
|
||
the name is by construction one this file *does* bind, so it resolves and
|
||
never reaches `miss` anyway. Left.
|
||
- ~~**Not a call site, worth recording:** a cast's type.~~ **Picked up
|
||
2026-09-02 by `docs/features/comment-slots/README.md` (M11).** The note as
|
||
written: `ExprKind::Cast` binds only its operand, so the casting type is
|
||
dropped and produces no reference at all — `state_t'(0)` needs no
|
||
promotion, it needs a reference first. It has one now.
|
||
`Binder::bind_type_expr` mirrors `bind_data_type`'s three shapes: a bare
|
||
name is a `Target::Type` (so the promotion this round installed applies to
|
||
it), `pkg::t` is `Target::Unit` + `Target::UnitMember`, and a size, a
|
||
parenthesized width or a `$bits(...)` call binds its own operands as
|
||
ordinary uses. `FACTS_FORMAT` went 13 → 14 with it.
|
||
- **Consumer audit, the additions.** `bind::Target` is `pub(crate)` and
|
||
`grep -rn 'Target' crates --include='*.rs'` finds exactly one match site for
|
||
it, `resolve.rs::resolve` — every other hit is `ExternalTarget` (the overlay
|
||
enum, untouched), `vlog_refactor`'s unrelated `rename::Target`/`RenameTarget`,
|
||
or prose. Adding a variant therefore cannot silently fall through anywhere:
|
||
the one `match` is exhaustive and the compiler checked it. The main round's
|
||
audit of `NotFound`/`InheritedCandidate` consumers stands unchanged and is
|
||
now *more* true — `NotFound` is reachable again, which is the spelling
|
||
`rename.rs:233` and `type_def.rs` were already written against.
|
||
- **`type_def.rs` needed nothing, as predicted.** Its whole suite is green
|
||
unchanged: the fence tests, the cross-file interface/class/typedef jumps, the
|
||
ambiguity convention, the qualified-miss fence. The one exception is the test
|
||
the main round flipped, flipped back — below.
|
||
- **The read-only side, given back deliberately.**
|
||
`a_plain_expression_use_of_a_workspace_module_name_is_never_a_type_site` now
|
||
asserts the value-position typo is `NotFound` and that **`nav::definition`
|
||
answers nothing**, where the main round asserted it answered. That read-only
|
||
behavior was defensible on its own — F12 landing on a same-named module is
|
||
surprising but harmless — but one promotion serves both the read and the
|
||
write path, and there is no honest way to keep the jump while refusing the
|
||
rename without building the fourth resolution layer this round exists to
|
||
delete. The write side wins the argument. The test is stronger for it: it now
|
||
pins two independent fences (the model never offers the coincidence, and the
|
||
handler builds no `Site` for an expression statement) instead of one.
|
||
- **The QA repro, flipped and rehomed.**
|
||
`qa_a_bare_value_position_typo_reaches_an_unrelated_same_named_module` →
|
||
`a_bare_value_position_typo_never_reaches_an_unrelated_same_named_module`,
|
||
moved into `rename.rs`'s refusals section where its siblings live, and it now
|
||
asserts the refusal message (`not resolved to any declaration`) instead of
|
||
panicking on success. Same fixture, same two files, same cursor.
|
||
- **Value-position twins added**, alongside the promotion tests they mirror:
|
||
`a_value_position_miss_is_never_promoted_even_onto_a_same_named_unit` (the
|
||
same word, the same workspace, only the position differs — `NotFound`, no
|
||
overlay entry, no defs) and
|
||
`a_value_position_miss_inside_an_extending_class_gains_no_path_either`
|
||
(`InheritedCandidate` with empty `paths` despite a same-named interface in
|
||
the workspace). Six assertions the main round had re-pointed at grown paths
|
||
went back to their pre-round values, each with the reason written in: they
|
||
were all value positions (`set_name` a callee, `UVM_LOW` a call argument,
|
||
`member_miss` a call, `held = 1` an assignment LHS, `i` a genvar out of
|
||
scope, `SOMETHING` an assignment RHS).
|
||
- **Measured a third time, same harness, same corpus.** Resolution buckets over
|
||
all 860 files, raw counts, the three states side by side:
|
||
|
||
| bucket | `3bc61f9` | promote everything | type positions only |
|
||
|---|---:|---:|---:|
|
||
| `Resolved` | 69 274 | 69 274 | 69 274 |
|
||
| `ExternalCandidate` | 16 152 | 17 570 | **16 314** |
|
||
| `InheritedCandidate` | 7 841 | 7 841 | **7 841** |
|
||
| `NotFound` | 1 418 | 0 | **1 256** |
|
||
|
||
`InheritedCandidate` is bit-identical in all three, which is the strongest
|
||
form of "nothing was reclassified"; 16 152 + 162 = 16 314 and 1 418 − 162 =
|
||
1 256, so exactly 162 references moved, all of them type positions with no
|
||
import in scope (153 of them on clean files).
|
||
- **The split, stated honestly.** Against `3bc61f9`, on clean files: **418
|
||
references gained somewhere to jump and none lost one** (420 over all files —
|
||
nowhere-to-jump 10 992 → 10 572). The unrestricted first cut gained 559 on
|
||
clean files (561 over all), so **141 gains were given back** — the same 141
|
||
on both populations. Composition of the give-back: 117 inherited-candidate
|
||
answers (the landed count falls 520 → 403) and 24 external-bucket answers.
|
||
Every one was a value-position identifier answered on a name collision, which
|
||
is precisely the thing that made `rename` unsafe; the round is worth less
|
||
without them and would have been worth nothing with them. The type-position
|
||
wins — the cross-file `interface`, the package-less `class`, the file-scope
|
||
`typedef`, the UVM `virtual iface` inside an extending class — all survive,
|
||
and their tests are green unchanged. The no-reference-loses-a-target property
|
||
holds: the last row of the workspace table fell against the baseline in both
|
||
populations, and every promotion test still finds its declaration.
|
||
- **Scope of the fix round.** `crates/vlog_semantic/src/{bind,resolve,model}.rs`,
|
||
`crates/vlog_semantic/tests/{workspace,classes,semantics}.rs`,
|
||
`crates/vlog_refactor/tests/rename.rs`,
|
||
`crates/lucisv_server/src/type_def.rs` (one test), this README and the two
|
||
measured READMEs. `workspace.rs` untouched by the fix. No new dependency, no
|
||
parser change, no `TODO.md` change.
|
||
|
||
## QA log
|
||
|
||
### 2026-08-26 — QA agent
|
||
|
||
**Verdict: not committable as-is.** Attack surface 1 (rename) is a real
|
||
regression — a bare-name coincidence in a plain *value* expression is now
|
||
write-reachable and `rename` will cross into an unrelated file's declaration.
|
||
Everything else audited below is clean. A repro test for the regression is
|
||
committed (failing, on purpose) at
|
||
`crates/vlog_refactor/tests/rename.rs::qa_a_bare_value_position_typo_reaches_an_unrelated_same_named_module`.
|
||
|
||
**1. Rename write-reachability — REGRESSION, not preexisting.**
|
||
|
||
Repro: workspace of two files —
|
||
|
||
```verilog
|
||
// typo_name.sv
|
||
module typo_name;
|
||
endmodule
|
||
|
||
// top.sv
|
||
module top;
|
||
assign typo_name = 1'b1;
|
||
endmodule
|
||
```
|
||
|
||
Renaming `typo_name` at its use in `top.sv` **succeeds** and rewrites
|
||
`typo_name.sv`'s module declaration to the new name (verified by direct
|
||
`vlog_refactor::rename()` call; test panics showing both files' post-edit
|
||
text). `check::verify` does not catch it — the edit *is* self-consistent (the
|
||
new name resolves the same way the old one did before the edit), so
|
||
"resolution identity" has nothing to flag. The bug is one layer up: the model
|
||
now treats an unbound plain-expression identifier as if it names a workspace
|
||
unit.
|
||
|
||
Traced the claim in Assumptions ("the same exposure `Target::Module` and
|
||
`Target::Unit` have always had") against `git show 3bc61f9:.../resolve.rs`:
|
||
true for `Target::Module`/`Target::Unit`/`Target::Package` — `unit()` and
|
||
`named_at_file_scope()` already appended the bare name unconditionally on a
|
||
miss, pre-round (module instantiations, `extends` bases, `p::x` heads,
|
||
`typedef class` forward decls). **False for `Target::Lexical`** — pre-round,
|
||
`lexical()`'s `external` list held only import paths (no bare name), so a
|
||
`Target::Lexical` miss with no import in scope was `Resolution::NotFound`,
|
||
which `rename.rs:233` explicitly refuses ("not resolved to any declaration").
|
||
Confirmed by reverting only the three `src` files (`git stash push --`) and
|
||
re-running the same repro: the pre-round rename call errors with exactly that
|
||
message; instrumented `resolution()` on the same offset returns `NotFound`.
|
||
|
||
The regression is that `Target::Lexical` is not exclusively the "type name in
|
||
a declaration" case the feature is built for
|
||
(`bind.rs:1223`, `bind_data_type`'s `None` arm — `bus_if bus;`, the intended
|
||
win). It is *also* the plain-expression-identifier case
|
||
(`bind.rs:1082`, `ExprKind::Ident => Target::Lexical` — `assign typo_name = 1;`,
|
||
a function-call name, any bare read/write). Both dispatch through the exact
|
||
same `resolve.rs::lexical`/`miss` path and produce an indistinguishable
|
||
`Resolution::ExternalCandidate { paths: [name] }` — there is no signal left
|
||
anywhere for a consumer to tell "this was a type position" from "this was a
|
||
value position". The dev's own new assertion in
|
||
`crates/lucisv_server/src/type_def.rs`'s
|
||
`a_plain_expression_use_of_a_workspace_module_name_is_never_a_type_site`
|
||
confirms the *read* side of this is deliberate and known
|
||
(`nav::definition` now jumps a value-position typo to a coincidentally-named
|
||
module — asserted, not refused). For **read-only** navigation that is a
|
||
defensible (if surprising) trade griped about nowhere in the brief but at
|
||
least non-destructive. For **rename**, which writes files, the same
|
||
coincidence is a silent cross-file edit with no relationship to programmer
|
||
intent, and CLAUDE.md invariant 1 ("never corrupt code... or emits the input
|
||
unchanged with an error") is squarely about not producing output the source
|
||
never asked for.
|
||
|
||
`rename.rs`'s own refusal machinery does not defend against this: `locate`'s
|
||
match arms only ask "did the file's own resolution report `NotFound` /
|
||
`InheritedCandidate` / `ExternalCandidate`?" — and this case is, faithfully,
|
||
an `ExternalCandidate`, so it takes the honest-cross-file-rename branch.
|
||
Whole-edit-or-nothing verification, collision detection and the resolution-
|
||
identity re-parse check all ran and all passed, because none of them encode
|
||
"was this identifier ever meant as a type/unit name" — that information does
|
||
not exist past `bind.rs`.
|
||
|
||
This is the top risk the round was flagged for, and it is real. **Not
|
||
committable until this is closed.** Two shapes of fix that stay inside this
|
||
round's scope, for the dev's follow-up (not prescribing — QA doesn't
|
||
redesign): distinguish "type position" from "value position" at bind time
|
||
(a new `Target` variant, or a flag `bind_data_type` sets) so only the type-
|
||
name spelling of `Target::Lexical` gets the bare-name push; or narrow the
|
||
promotion in `resolve.rs::lexical` to fire only when the reference was built
|
||
by `bind_data_type`'s `None` arm. Either way, rename's collision tests need a
|
||
new case pinning this exact repro as a refusal.
|
||
|
||
**2. `base`-semantics preservation and `counts()` — clean.**
|
||
|
||
Re-derived the corpus numbers independently (own harness, not the dev's
|
||
printed one): dumped every reference's exact `Resolution` variant, both
|
||
before (`git stash push --` the three `src` files, keep the test harness) and
|
||
after, over the full 860-file corpus:
|
||
|
||
| resolution bucket | before | after |
|
||
|---|---:|---:|
|
||
| `Resolved` | 69 274 | 69 274 |
|
||
| `ExternalCandidate` | 16 152 | 17 570 |
|
||
| `InheritedCandidate` | 7 841 | 7 841 |
|
||
| `NotFound` | 1 418 | 0 |
|
||
|
||
`InheritedCandidate`'s resolution-bucket count is **exactly** 7 841 in both
|
||
states — not just "flat at 8.3%" by rounding, bit-for-bit identical — which
|
||
is the strongest form of "no reclassification" the claim could ask for. And
|
||
16 152 (before external) + 1 418 (before `NotFound`) = 17 570 (after
|
||
external), exactly: every re-bucketed reference is accounted for and nothing
|
||
else moved. `base` itself is untouched by construction (`resolve.rs`'s `miss`
|
||
still sets it the same way; `workspace.rs::resolve_external`'s new arm reads
|
||
`paths` and never touches `base`), confirmed by the passing
|
||
`a_miss_inside_an_extending_class_is_answered_without_losing_its_base` and
|
||
`an_inherited_member_the_unit_table_cannot_hold_stays_exactly_what_it_was`.
|
||
|
||
"Records only when one lands" verified structurally (`workspace.rs`'s new
|
||
match arm: `StillUnresolved => continue`, nothing inserted) and empirically —
|
||
`an_inherited_member_the_unit_table_cannot_hold_stays_exactly_what_it_was`
|
||
asserts `!in_overlay(...)` for a member miss the sweep cannot answer, and the
|
||
corpus-wide inherited-landed count (520) is far below the total inherited
|
||
count (7 841), i.e. most misses correctly get no entry at all.
|
||
|
||
**3. Baseline honesty — reproduced exactly, "559 gained / none lost" verified
|
||
per-reference, not just by aggregate delta.**
|
||
|
||
Reproduced the before-measurement myself: `git stash push -- resolve.rs
|
||
workspace.rs model.rs` (keeping the dev's extended `tests/workspace.rs`
|
||
harness), ran `the_corpus_index_finishes_most_external_references`. Output
|
||
matched the README's "before" row to the digit: clean-file handed 16 133
|
||
(17.1 %), inherited-landed 0, nowhere-to-jump 10 794 (11.4 %); all-files
|
||
nowhere 10 992 (11.6 %). Popped the stash, re-ran: after-numbers matched the
|
||
README's "after" row to the digit (17 877 handed, 520 inherited-landed,
|
||
10 235 clean-nowhere / 10.8 %, 10 431 all-files-nowhere / 11.0 %).
|
||
|
||
Went one step further than re-running the dev's aggregate: added a temporary
|
||
per-reference dump (keyed by file + byte offset, since `bind.rs` is untouched
|
||
by this round so `ReferenceId` ordering is stable across the two states —
|
||
confirmed by both dumps having exactly 94 685 lines) recording "does this
|
||
reference have an answer anywhere" for every reference in the corpus, ran it
|
||
in both states, and joined the two dumps on (file, offset, name). Result:
|
||
**0 references regressed from answered to unanswered; 561 references gained
|
||
an answer, over the whole 860-file corpus** (used the full population, not
|
||
the 853-file clean subset the README table quotes — 561 is consistent with
|
||
the all-files nowhere-delta of 10 992 − 10 431 = 561, and the README's
|
||
559-on-clean-files is 2 fewer, i.e. 2 of the 561 gains are on the 7 files that
|
||
still fail to parse — never checked those 2 individually beyond the aggregate
|
||
arithmetic, but nothing else in the numbers leaves room for a hidden loss).
|
||
This dump was removed from the working tree after use — it was diagnostic
|
||
only (behind an opt-in env var, a no-op otherwise), not something that should
|
||
ship in the test suite.
|
||
|
||
**4. Import-beats-bare-name ordering — verified, real collision.**
|
||
|
||
`an_import_that_can_supply_the_name_still_wins_over_a_same_named_unit`
|
||
(`crates/vlog_semantic/tests/workspace.rs`) does construct a genuine
|
||
collision, not a vacuous one: package `tdp` exports `state_t`, an unrelated
|
||
`module state_t` sits in a decoy file, `top.sv` does `import tdp::*; state_t
|
||
s;`. Confirmed by reading `resolve.rs::lexical`: the wildcard import path
|
||
(`tdp::*`) is pushed to `external` before the loop ends, the bare name is
|
||
pushed once after the loop — so paths are always `[..imports.., name]`, and
|
||
`workspace.rs::follow_paths` (unmodified by this round) tries them in that
|
||
order and stops at the first hit. Test asserts both the resolution's path
|
||
order (`["tdp::*", "state_t"]`) and the actual answer (the package's
|
||
`typedef`, not the decoy module) — ran it, passes.
|
||
|
||
**5. The changed package test — defensible, recorded for lead's Review.**
|
||
|
||
`a_package_of_the_same_name_answers_exactly_as_definition_answers_it`: yes,
|
||
this is exactly what `nav::definition` gives on the same cursor (asserted as
|
||
literal equality in the test, and confirmed independently — `type_def.rs`'s
|
||
handler is now three lines that end in `nav::definition`, nothing else). My
|
||
own view on the substance, for Review: this is the right call *given* the
|
||
"no fourth resolution layer" constraint and the documented no-kind-filter
|
||
policy of the shared overlay (`workspace-index/README.md`). A `typeDefinition`
|
||
request on `thing t;` where the workspace's only `thing` is a package is a
|
||
request against source that does not compile either way, and giving a
|
||
different answer than `definition` for the same token would need a resolution
|
||
layer nobody else has. Severity if the lead disagrees: low — it is one
|
||
disagreeable-but-arguable UX choice on non-compiling input, not a
|
||
correctness or safety issue, and it is trivially reversible (a kind filter in
|
||
`type_def.rs` alone, no `vlog_semantic` change) if the lead wants F12 and
|
||
type-F12 to diverge here.
|
||
|
||
**6. Qualified-miss fence — verified structurally intact, both spellings.**
|
||
|
||
Read `unit_member` (`resolve.rs:129-174`) end to end: it never calls `miss`,
|
||
builds its own `Resolution::NotFound`/`InheritedCandidate` directly in every
|
||
arm, and the bare-name push lives only in `lexical` (line 76) and `unit`
|
||
(line 120) — `unit_member` has no code path that could reach it. Ran
|
||
`a_qualified_miss_is_never_promoted_in_either_spelling`
|
||
(`vlog_semantic/tests/workspace.rs`) directly: pins both spellings (a
|
||
package-qualified miss with a same-named decoy module, and a class-qualified
|
||
miss inside an extending class with a same-named decoy module) and asserts
|
||
`Resolution::NotFound` / `InheritedCandidate { paths: Vec::new() }`
|
||
respectively, `!in_overlay(...)`, and `external_defs(...).is_empty()` for
|
||
both. Also re-ran `lucisv_server`'s
|
||
`a_qualified_name_the_overlay_refused_is_not_retried_against_the_index` and
|
||
`an_inherited_candidate_answers_only_what_the_workspace_unit_table_holds`
|
||
(the type_def suite, post-`indexed_type`-deletion) — both pass, confirming no
|
||
path from a qualified miss reaches a bare-name overlay answer now that the
|
||
old `::`-text-scan guard in `indexed_type` is gone: the fence moved from a
|
||
server-layer text check to a `resolve.rs` structural property, and it holds.
|
||
|
||
**7. CLAUDE.md compliance / docs — clean, one drive-by fix.**
|
||
|
||
Re-derived every printed corpus number in `vlog-semantic/README.md` and
|
||
`workspace-index/README.md` independently (own dump of raw resolution-bucket
|
||
and answered/unanswered counts, not a re-run of the dev's own printed
|
||
`Tally`) — all match to the stated precision (see items 2 and 3 above); the
|
||
resolution-bucket percentages in `vlog-semantic/README.md`'s table
|
||
(73.2/18.6/8.3/0.0 after, summing to 100.0 from the raw counts) check out
|
||
exactly. Feature README has each required section exactly once. Consumer-
|
||
audit table's file:line citations: `rename.rs:231-240`, `check.rs:533`,
|
||
`check.rs:618-640`, `signals.rs:260,573`, `nav.rs:191`, `tokens.rs:202` all
|
||
land within a line or two of the cited construct; `model.rs:119` for
|
||
`is_inherited_candidate` is off — the actual `impl` line is 126 (the doc
|
||
comment starts around 124). Minor, not fixed (it's prose in another feature's
|
||
work log, out of this round's file scope to edit further than necessary).
|
||
|
||
Fixed directly (typo/formatting, per QA's small-fix allowance): a stray
|
||
100-column line in `docs/features/class-semantics/README.md` (line 57, "The
|
||
overlay may now answer such a reference from `paths`...") that broke the
|
||
file's ~78-80 column wrap; rewrapped to match the surrounding paragraph. No
|
||
content change.
|
||
|
||
**Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets
|
||
--workspace`: 0 warnings. `cargo test --workspace`: every test green except
|
||
the QA-added regression repro (1 failed, by design — see item 1).
|
||
`cargo test -p vlog_formatter`, `-p vlog_linter`, `-p vlog_refactor`: green
|
||
apart from the same repro. `cargo build && node editors/vscode/smoke.js
|
||
target/debug/lucisv-server`: `smoke: OK`.
|
||
|
||
**Corpus regression net (formatter).** `tools/corpus_check.sh` is not
|
||
actually a committed artifact — `corpus-check-results.tsv` is gitignored, so
|
||
there is no checked-in baseline TSV to diff against; the file on disk at
|
||
session start was a stale local leftover from an older parser, not this
|
||
round's baseline (its `parse-error`s on `` `assume``/`$error`/`(* async *)``
|
||
constructs are gone even at `3bc61f9`, unrelated to this round). Built the
|
||
release binary at `3bc61f9` (stashing the three `src` files) and at the full
|
||
working tree, ran `corpus_check.sh` both times: **813/820 (99.1%) both times,
|
||
byte-identical results TSV (`diff` empty), 0 verification errors, 0 crashes,
|
||
both runs.** Expected and confirmed: this round touches no file under
|
||
`vlog_formatter` or `vlog_parser`.
|
||
|
||
**Tests added.** `crates/vlog_refactor/tests/rename.rs::qa_a_bare_value_position_typo_reaches_an_unrelated_same_named_module`
|
||
— kept, failing on purpose, as the regression repro for item 1.
|
||
|
||
### 2026-08-26 — QA agent, fix-round re-verification
|
||
|
||
**Verdict: committable.** The fix closes finding 1 exactly as claimed, every
|
||
type-position win from the main round still resolves, the call-site map is
|
||
complete (read every `bind_data_type` caller myself, found nothing it
|
||
misses), and every corpus number in both READMEs re-derives to the digit from
|
||
a harness independent of the dev's own `Tally` printer. All gates green,
|
||
zero failing tests anywhere.
|
||
|
||
**1. Gates.** `cargo fmt --all -- --check`: clean. `cargo clippy --all-targets
|
||
--workspace`: 0 warnings (confirmed by grepping the output for
|
||
`warning`/`error` — none). `cargo test --workspace --no-fail-fast`: **0
|
||
failed** (871 passed / 4 ignored in `lucisv_server`'s own count, every other
|
||
crate's suite green, including the QA repro from the previous round, now
|
||
flipped and passing). `cargo test -p vlog_formatter`, `-p vlog_linter`,
|
||
`-p vlog_refactor`: green. `cargo build && node editors/vscode/smoke.js
|
||
target/debug/lucisv-server`: `smoke: OK`.
|
||
|
||
**2. The regression, attacked from three shapes beyond the shipped repro —
|
||
all refused, both write and read.** Ran the flipped
|
||
`a_bare_value_position_typo_never_reaches_an_unrelated_same_named_module`
|
||
directly: passes, asserts the pre-round refusal message. Then wrote three
|
||
throwaway probes (added, run, and removed after use — not shipped, per the
|
||
previous round's own precedent with its diagnostic dump) exercising shapes
|
||
the shipped suite does not:
|
||
- An `if` condition (`always @* if (typo_name) w = 1;`) instead of an
|
||
assignment LHS — `rename` refused with "not resolved to any declaration";
|
||
`nav::definition` and `type_definition` both empty; `doc_reference_kind`
|
||
reported `NotFound`.
|
||
- A named port-connection value (`sub u0(.p(typo_name));`) — same three
|
||
assertions, all held. Read `bind.rs:557` (`bind_connection`) to confirm
|
||
this is the same `bind_opt_expr` → `ExprKind::Ident` → `Target::Lexical`
|
||
path as the shipped repro, not a coincidence of one syntax.
|
||
- `disable typo_block;` — the `bind.rs:1013` block-label site the dev's
|
||
call-site map named explicitly as "left as `Target::Lexical`". Same three
|
||
assertions, all held.
|
||
|
||
All three: `rename` refuses, `nav::definition` empty, `type_definition`
|
||
empty. The regression is dead from every angle I could construct, not just
|
||
the one shape the shipped test pins.
|
||
|
||
**3. The type-position wins, alive from every angle.** `cargo test -p
|
||
lucisv_server type_def::` — 45 pre-existing tests green, unchanged verdicts,
|
||
plus my 2 nav-emptiness probes and 1 new-win probe (47 total, see below).
|
||
`cargo test -p vlog_refactor an_interface_renames_from_the_declaration_it_types_in_another_file`
|
||
— green: the cross-file interface rename (declared in `bus_if.sv`, typed via
|
||
`virtual bus_if vif;` and instantiated via `bus_if other ();` in `top.sv`,
|
||
because the ANSI-header parser gap forces the body spelling) renames both the
|
||
declaration and every use. New probe,
|
||
`qa_probe_an_ansi_port_type_resolves_cross_file` (run, then removed): a
|
||
genuine ANSI port — `module top(input logic clk, bus_if b);`, the interface
|
||
port second because a directionless first port doesn't parse yet
|
||
(`docs/features/type-definition/README.md` Handshake 2) — resolves the
|
||
`bus_if` at `b`'s type through `doc_reference_kind == ExternalCandidate`,
|
||
`nav::definition` non-empty, and `type_definition` non-empty, cross-file.
|
||
This is the ANSI-port shape the call-site map claims (`bind.rs:393`) but no
|
||
existing test exercised directly.
|
||
|
||
**4. Call-site map — verified by direct grep and read, not by trusting the
|
||
prose.** `grep -n 'Target::Lexical\|Target::Type' crates/vlog_semantic/src/bind.rs`
|
||
after excluding doc comments: **3** `Target::Lexical` construction sites
|
||
(line 136 — a redeclaration inside `declare`, resolves before ever reaching
|
||
`miss`; line 1017 — `disable`'s block label; line 1090 — `ExprKind::Ident`)
|
||
and **1** `Target::Type` site (line 1231 — `bind_data_type`'s unqualified
|
||
arm). This is a discrepancy worth flagging precisely: the brief characterized
|
||
this as "exactly four `Target::Lexical` sites, twelve `bind_data_type`
|
||
callers" and the work log's own heading says "all four, and only these four,
|
||
exist" — but that "four" is the count of sites that *used to be*
|
||
`Target::Lexical` before the fix (1223/1082/1009/128 in the pre-fix line
|
||
numbering), one of which (1223) the fix moved to `Target::Type`. Read
|
||
literally against the current tree, the count is 3 Lexical + 1 Type = 4
|
||
combined, not 4 Lexical. The work log's own per-site bullets say this
|
||
correctly ("changed to `Target::Type`" for the first one); only the summary
|
||
sentence overstates it if read out of context. Not a defect in the code —
|
||
the compiler-checked exhaustive match is what actually matters and it holds
|
||
(next item) — but the phrasing should say "four sites total, three of which
|
||
remain `Lexical`" rather than "four `Target::Lexical` sites" if the README is
|
||
touched again.
|
||
|
||
`grep -rn '\bTarget\b' crates --include='*.rs'` excluding `ExternalTarget`/
|
||
`rename::Target`/`RenameTarget`/prose: exactly one match site,
|
||
`resolve.rs:12`'s `match &p.target`, confirmed exhaustive (compiles with no
|
||
wildcard arm and no `#[allow]`).
|
||
|
||
`grep -n 'fn bind_data_type\|bind_data_type(' crates/vlog_semantic/src/bind.rs`
|
||
finds **11** call sites, not 12 — matching the 11 categories the work log's
|
||
prose actually lists (ANSI ports, header param ports, typedef alias, enum
|
||
base, struct member, the shared declarator path, function return, tf args,
|
||
out-of-body return, typed for-init, `ExprKind::Type`); "twelve" in the prose
|
||
appears to be an off-by-one in the summary count, not a missing call site —
|
||
I could not find a twelfth. Read all 11 callers end to end plus their
|
||
transitive callers (`bind_declarators` is reached from `bind_data_decl`,
|
||
`bind_port_decl`, and two `ParamDecl` sites at both item- and statement-level;
|
||
`bind_tf_args` serves both `bind_function` and `bind_task`) looking
|
||
specifically for the four shapes the task asked me to probe:
|
||
- **`virtual interface` variables** — `virtual clk_rst_if vif;` is an
|
||
ordinary `VarDecl` → `bind_data_decl` → `bind_declarators` →
|
||
`bind_data_type` (line 516); the `virtual` keyword is held on
|
||
`DataType::virtual_kw` separately by the parser so `ty.name` is the bare
|
||
interface name. Covered — this is literally the shape the interface
|
||
rename test exercises.
|
||
- **`parameter type` defaults** — a `type` parameter's default type value
|
||
parses as `ExprKind::Type`, reaching `bind_data_type` at line 1192.
|
||
Covered, per the dev's own comment there.
|
||
- **`struct packed` member types** — `TypedefKind::Struct`'s per-member
|
||
loop calls `bind_data_type` on `m.ty` at line 475 before declaring each
|
||
of the struct's declarators. Covered.
|
||
- **tf args** — `bind_tf_args` (line 656) calls `bind_data_type` on `a.ty`
|
||
for every task/function argument, called from both `bind_function` and
|
||
`bind_task`. Covered.
|
||
|
||
I could not find a call site of `DataType` binding that bypasses
|
||
`bind_data_type`. **Verdict: the map is exhaustive** for the four probed
|
||
shapes and, as far as a full read of the file shows, for the language's
|
||
type positions generally. The "twelve" vs. eleven count is the only
|
||
inaccuracy found and it overstates rather than understates the coverage.
|
||
|
||
**5. Corpus numbers — every figure in both READMEs re-derives to the digit,
|
||
independently.** Built a raw per-Resolution-variant counter (bypassing the
|
||
dev's `Tally` entirely — counts `Resolution::Resolved`/`ExternalCandidate`/
|
||
`InheritedCandidate`/`NotFound` directly off `sem.references()`), ran it at
|
||
three states and popped/reapplied a `git stash` of the three `src` files
|
||
between them (`bind.rs`/`resolve.rs`/`model.rs`/`workspace.rs`), then removed
|
||
the probe:
|
||
|
||
| bucket | `3bc61f9` (mine) | shipped (mine) | README |
|
||
|---|---:|---:|---:|
|
||
| `Resolved` | 69 274 | 69 274 | 69 274 / 69 274 |
|
||
| `ExternalCandidate` | 16 152 | 16 314 | 16 152 / 16 314 |
|
||
| `InheritedCandidate` | 7 841 | 7 841 | 7 841 / 7 841 |
|
||
| `NotFound` | 1 418 | 1 256 | 1 418 / 1 256 |
|
||
|
||
Bit-for-bit match, both states, both non-`InheritedCandidate` claims (the
|
||
inherited bucket's bit-identical 7 841 reproduces independently) and the
|
||
arithmetic join (16 152 + 1 418 = 17 570 = the promote-everything external
|
||
count; 16 152 + 162 = 16 314; 1 418 − 162 = 1 256).
|
||
|
||
Went further than the minimum bar and reproduced the **middle** "promote
|
||
everything" column too, by temporarily patching `resolve.rs`'s
|
||
`Target::Lexical` arm to pass `promote: true` (mechanically the same
|
||
behavior the first-cut round shipped, since `Target::Type` didn't exist yet
|
||
to distinguish them) — ran, recorded, reverted the one line from a saved
|
||
copy, and confirmed `git diff` showed zero net change to `resolve.rs`
|
||
afterward:
|
||
|
||
| bucket | promote-everything (mine) | README |
|
||
|---|---:|---:|
|
||
| `ExternalCandidate` | 17 570 | 17 570 |
|
||
| `InheritedCandidate` | 7 841 | 7 841 |
|
||
| `NotFound` | 0 | 0 |
|
||
|
||
Also re-ran `the_corpus_index_finishes_most_external_references` at all three
|
||
states (before/promote-everything/shipped) and matched every printed figure
|
||
to the README's workspace-index table: handed 16 152→18 090→16 717 (all
|
||
files), inherited-landed 0→520→403, nowhere-to-jump (all files)
|
||
10 992→10 431→10 572, nowhere-to-jump (clean files) 10 794→10 235→10 376.
|
||
|
||
**The 141-given-back split (117 + 24), reproduced exactly.** Wrote a second
|
||
throwaway probe splitting `resolve_external`'s landed overlay entries by
|
||
`reference.is_inherited_candidate()`, ran at promote-everything and shipped:
|
||
|
||
| | promote-everything | shipped | delta |
|
||
|---|---:|---:|---:|
|
||
| inherited-landed | 520 | 403 | **117** |
|
||
| external-landed | 14 460 | 14 436 | **24** |
|
||
|
||
117 + 24 = 141, matching the README's split exactly, independently derived
|
||
(not by re-running the dev's own numbers, by counting landed overlay entries
|
||
directly). Both throwaway probes (`qa_probe_raw_resolution_bucket_counts`,
|
||
`qa_probe_landed_split_external_vs_inherited` in
|
||
`crates/vlog_semantic/tests/workspace.rs`, and three more in
|
||
`crates/vlog_refactor/tests/rename.rs` / `crates/lucisv_server/src/type_def.rs`
|
||
for items 2–3 above) were removed from the working tree after use —
|
||
diagnostic only, confirmed by `git diff --stat` returning to the dev's
|
||
original fix-round shape before this entry was written.
|
||
|
||
**6. The six re-pointed assertions — all six checked against `3bc61f9`, not
|
||
just three.** `git diff crates/vlog_semantic/tests/{semantics,classes}.rs`
|
||
(default diff base is `3bc61f9`, since everything here is uncommitted on top
|
||
of it) shows, for all six the work log names (`set_name`, `UVM_LOW`,
|
||
`member_miss`, `held = 1`, the genvar `i`, `SOMETHING`): **either zero diff
|
||
at all** (`member_miss`'s test has no diff whatsoever against `3bc61f9`) **or
|
||
a comment-only diff** — the assertion lines themselves (`Resolution::
|
||
InheritedCandidate { .. }`, `Resolution::NotFound`, the exact `paths` vectors)
|
||
are byte-identical to `3bc61f9` in every one of the six; only explanatory
|
||
comments were added, and in one case (`held = 1`) an assertion failure
|
||
message string. None of the six assertion *values* are new inventions —
|
||
every one is provably the pre-round value.
|
||
|
||
**7. README honesty.** The struck Assumptions bullet reads as an honest
|
||
correction (strikethrough kept, correction inline, attributed to "QA finding
|
||
1, 2026-08-26") rather than a silent edit. Both measured READMEs'
|
||
resolution-bucket tables match my independent re-derivation to the digit
|
||
(item 5). The cast-binds-no-reference gap is recorded explicitly in the fix
|
||
round's work log ("Not a call site, worth recording: a cast's type...",
|
||
"Out of scope here, noted for whoever picks it up") — confirmed by reading
|
||
`bind.rs:1177`'s `ExprKind::Cast { expr, .. } => self.bind_expr(expr, scope)`,
|
||
which indeed binds only the operand, dropping the casting type with no
|
||
reference produced, unchanged by this round.
|
||
|
||
**8. Minor finding, not fixed (out of scope, prose-only).** The work log's
|
||
call-site-map summary sentence says "exactly four `Target::Lexical` sites"
|
||
where the current tree has three (plus one `Target::Type` the fourth became)
|
||
— see item 4. Cosmetic; the per-site bullets underneath already say the
|
||
right thing, and the exhaustive-match property the claim is *for* holds
|
||
regardless. Left for the lead to wave through or ask for a one-word fix.
|
||
|
||
**Verdict: committable.** Finding 1 is closed and dead from every angle
|
||
tested (assign RHS, if-condition, port-connection value, disable-label; both
|
||
`rename` and `nav::definition`/`type_definition`). No new regression found.
|
||
Every type-position win from the main round still resolves, including one
|
||
shape (ANSI port) no existing test exercised directly. The call-site map is
|
||
functionally exhaustive despite one prose miscount. Corpus arithmetic
|
||
reproduces to the digit across all three states and the full given-back
|
||
split. Gates are green with zero failing tests anywhere.
|
||
|
||
## Review
|
||
|
||
### 2026-08-26 — lead
|
||
|
||
Reviewed both rounds' diffs, work logs and QA logs; re-ran all gates
|
||
myself, clean. This feature is the workflow's best argument for itself.
|
||
The main round delivered the Handshake and honestly re-measured stale
|
||
baselines — and QA's adversarial pass then found the one thing that
|
||
mattered: the promotion had quietly made rename, a write operation,
|
||
reachable from a value-position name coincidence, disproving the work
|
||
log's "same exposure as always" claim against the pre-round source. The
|
||
fix round's answer is the right kind: a `Target::Type` variant that
|
||
records where the fact "this is a type position" actually exists (one
|
||
line in `bind_data_type`), a four-line behavior delta, `miss` restored
|
||
verbatim, and the write path's refusal back — while every type-position
|
||
win survives, the corpus join shows 418 clean-file references gained a
|
||
target with none lost, and the 141 coincidence-answers given back are
|
||
exactly the ones no one should want.
|
||
|
||
I read the promoted `lexical` and restored `miss` myself; the doc
|
||
comment now argues the value/type asymmetry better than either brief
|
||
did. QA's re-check killed the regression from three angles (assign,
|
||
expression context, disable label), verified the call-site map by
|
||
independent grep and caller reading, and reproduced every corpus figure
|
||
to the digit including the 117+24 split. I fixed the two prose
|
||
miscounts QA flagged (the four-Lexical-sites summary, twelve→eleven
|
||
callers) in the work log directly, and un-clobbered one QA quotation my
|
||
first fix had edited by mistake. The cast-binds-no-reference gap stays
|
||
filed as pre-existing. `indexed_type` is gone, its guard with it, and
|
||
the two handlers cannot drift because only one resolution path remains.
|
||
Accepted as shipped.
|