Round 12: pure-move splits and hygiene

Splits resolve.rs, parser/item.rs, parser/instance.rs, format/stmt.rs and
lexer.rs (really 771 lines); moves 23 inline test modules of lucisv_server
to their own files; reasons on all 12 bare #[ignore]; the giant-line
references test times the real request; sites.py default root.
Output over 4,046 OpenTitan files byte-identical to a479faf.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
This commit is contained in:
Guoliang ChenandClaude Mythos 5.2 committed 2026-11-26 20:39:56 -08:00
1 parent a479faf029
commit aa2259bfe1
71 files changed
+24443 -23852

No files matched your search

+612
View File
@@ -0,0 +1,612 @@
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
# hygiene-splits-r12 — Round 12: pure-move splits and codebase hygiene
## Goal
Give every production file comfortable headroom under the 600-line ceiling
and clear the hygiene backlog the round names, **without changing what any
binary does**. Five files are split by responsibility (the four the plan
lists, plus `lexer.rs`, which the re-measurement showed is the one file
really over the ceiling); the inline `mod tests` blocks that dwarf their
file in `lucisv_server` move out to `<module>/tests.rs`; every bare
`#[ignore]` says why; one timing test stops timing a copy of the code it
guards; one tool stops defaulting to another machine's home directory; and
the size measurement in `CLAUDE.md` is refreshed. The proof is the gates,
the per-crate test counts and names, the line-multiset check of every
move, and byte-identical formatter and linter output over OpenTitan.
## Assumptions
- "Production lines" is the `CLAUDE.md` metric: non-blank, non-comment
lines before the first `#[cfg(test)]` / `mod tests`, files under
`*/tests/` excluded. Where that rule is misled by a `#[cfg(test)]`
attribute that is not the test module (see the `lexer.rs` finding in the
work log) the **refined** count is given too: the same, but a
`#[cfg(test)]` item or an out-of-line `#[cfg(test)] mod x;` is skipped
rather than ending the count, and a file declared under `#[cfg(test)]`
is test code.
- A split is a pure move: function bodies byte-for-byte, no item renamed,
no signature changed, public paths kept by re-export. What a move may
add is `use`/`mod` lines, a visibility keyword, a module doc, the stamp
lines and — for a new file that continues an `impl` — the `impl … {`
wrapper and its `}`.
- `pub(super)` on a method or function is the only widening a production
move needed; nothing became `pub(crate)` or `pub` that was not already.
Where `pub(super)` pushed a signature past 100 columns, `rustfmt`
re-broke that one signature (two cases, listed below). The body under
it is untouched.
- An inline test module that "dwarfs its file" is taken to mean: the
file's inline test modules total at least 500 lines **and** at least
twice its production lines. 21 files of `lucisv_server` meet it; the
ones that do not are listed in the work log.
- A moved test module keeps its module name, so every test keeps its full
path (`nav::tests::…`) and the test list is comparable line for line.
Its body loses four spaces of indent — except lines that begin inside a
string literal, which are test *inputs* and stay byte-exact — and
`cargo fmt` then re-joins what fits at the new indent.
- Intra-doc links in the docs of crate-private items (`` [`member_of`] ``
written in `resolve.rs`, the item now in `resolve/member.rs`) are not
resolved by any gate: the items are private and `cargo test --doc` does
not check links. The moved docs are left byte-identical.
- `lucisv` (the CLI) does not link `lucisv_server`, so the OpenTitan
byte-identity proves the parser, semantic, formatter and linter moves;
the server-side moves are proven by the test list and counts.
## Handshakes
- **Consumes / promises: unchanged.** Every path another module imported
still resolves: `crate::resolve::{resolve, member_site, unit_site,
extends_chain, is_instantiable, owning_scope}` (re-exported from
`resolve.rs`), `vlog_parser::lexer::{tokenize, LexError}`, and the
`Parser` / `Fmt` methods, which are methods whatever file their `impl`
block is in.
- **Note for the lead — stale wording left byte-identical on purpose.**
`format/stmt.rs`, the doc of `stmt_kind`: "the forms that grew a layout
of their own (`if`, `case`) are the functions after it". `case` is now
`format/case.rs` (and `if` was already `branch.rs`). The module doc of
`stmt.rs` says where each lives; the function doc is moved text and was
not edited.
- **Note for the lead — parser tests not re-homed.** `parser/mod.rs` says
tests live in `parser/tests/`, "one file per grammar file they
exercise". The tests of the three new parser files stay where they were
(`tests/items.rs`, `tests/instance.rs`): moving them would be a second
move nobody asked for.
- **Request to the lead (not this lane's file):**
`crates/lucisv_mcp/tests/opentitan.rs:25` falls back to
`/Users/guoliangchen/repo/opentitan`, the same stale default
`tools/perf/sites.py:16` had. Only `sites.py` was in scope.
- **`TODO.md`**: no item names this round, so nothing was ticked.
## Status / TODO
- [x] Baseline pinned from `target/gates/r11/*.log` (trunk `a479faf`).
- [x] Split `vlog_semantic/src/resolve.rs` → `resolve.rs`, `resolve/member.rs`, `resolve/types.rs`.
- [x] Split `vlog_parser/src/parser/item.rs` → `item.rs`, `package.rs`, `generate.rs`.
- [x] Split `vlog_parser/src/parser/instance.rs` → `instance.rs`, `connection.rs`.
- [x] Split `vlog_formatter/src/format/stmt.rs` → `stmt.rs`, `case.rs`, `timing.rs`.
- [x] Split `vlog_parser/src/lexer.rs` (really 771, not 540) → `lexer.rs`, `lexer/number.rs`, `lexer/define_params.rs`, `lexer/attach.rs`.
- [x] 23 inline test modules of 21 `lucisv_server` files moved to `<module>/<name>.rs`.
- [x] `perf.rs` inspected, left whole (work log).
- [x] 12 bare `#[ignore]` given a reason (the handoff counted 11).
- [x] `large.rs` QA finding 4 fixed (test only) and shown to trip.
- [x] `tools/perf/sites.py:16` fixed.
- [x] `CLAUDE.md` measurement paragraph appended; `docs/topo.md` module lists updated.
- [x] `cargo fmt --all -- --check`, `cargo clippy --workspace --all-targets`, guarded `cargo test` for every crate touched, `tools/gates.sh --only cross`, `--only corpus`.
- [x] OpenTitan byte-identity against `a479faf`.
## Work log
### 2026-11-26 — the round (refactor dev, Fable)
**Baseline** (`target/gates/r11/suite-*.log`, the lead's gate run on
`a479faf`), passed / ignored per crate: `vlog_parser` 527 / 2,
`vlog_semantic` 453 / 4, `vlog_refactor` 793 / 5, `vlog_formatter`
383 / 0, `vlog_linter` 710 / 0, `lucisv_core` 129 / 0, `lucisv` 162 / 0,
`lucisv_server` 2263 / 53, `lucisv_mcp` 400 / 3.
#### 1. The splits
Production lines after the move in brackets (rule = refined unless both
are given).
**`vlog_semantic/src/resolve.rs`** (587) →
| file | holds |
|---|---|
| `resolve.rs` [294] | Pass two's dispatch (`resolve`) and the walks that answer a name written by itself: on the lexical chain (`lexical`, `this_member`, `super_member`, `miss`), as a unit (`unit`, `unit_member`, `unit_site`, `unit_scope`), at file scope (`named_at_file_scope`, `owning_scope`, `file_symbol`). |
| `resolve/member.rs` [196] | The spine of a dotted path: where `head.mids…` puts the cursor and the member looked up there — `member_of`, `member_at`, `member_site`, `spine_site`, `descend`, `head_site`, `link_type`, and the two walks that share it, `type_member` and a `bind`'s (`in_bind_target`, `bind_member`). |
| `resolve/types.rs` [115] | What this file says about a type: a written type name looked up here (`TypeHere`, `type_here`, `alias_target`), the scopes a symbol opens (`container_scope`, `member_scope`), and a class's `extends` chain (`extends_chain`, `member_in_chain`). |
| `resolve/root.rs` [38] | untouched. |
Forced `pub(super)`: `member::{member_of, type_member, in_bind_target,
bind_member}`; `types::{TypeHere, type_here, container_scope,
member_scope, last_segment, member_in_chain}`. Re-exported from
`resolve.rs`: `member_site`, `extends_chain` (both already `pub(crate)`).
`root.rs` still imports `super::{file_symbol, is_instantiable, lexical,
owning_scope}`, which stayed in `resolve.rs` — no edit there.
**`vlog_parser/src/parser/item.rs`** (589) →
| file | holds |
|---|---|
| `item.rs` [322] | From the file down to one item: the file loop, the item loop, the keyword → item dispatch, the identifier-led item, and the member-qualifier prefix. |
| `package.rs` [113] | Packages and what crosses their boundary: `package … endpackage`, the `import`/`export` path lists, DPI imports and exports. |
| `generate.rs` [160] | The `if`/`for`/`case` generate forms and the block each governs. |
Forced `pub(super)`: `parse_package`, `parse_dpi_import`, `parse_export`,
`parse_gen_if`, `parse_gen_for`, `parse_gen_case`, `parse_gen_block` (the
dispatch in `item.rs` calls them).
**`vlog_parser/src/parser/instance.rs`** (565) →
| file | holds |
|---|---|
| `instance.rs` [353] | The items that instantiate or drive: continuous assignments, module and gate instantiations with their parameter overrides, `bind`; drive strengths and delay values. |
| `connection.rs` [218] | The connection list of an instantiation: named and ordered connections, the comments before the closing bracket, and the tolerant-mode read of a value whose bracket never closes. |
Forced `pub(super)`: `parse_connections`.
**`vlog_formatter/src/format/stmt.rs`** (570) →
| file | holds |
|---|---|
| `stmt.rs` [400] | Statements: the `begin … end` block, a statement as the body of a header, and the `StmtKind` dispatch table (`stmt_kind`, 294 lines, whole on purpose). |
| `case.rs` [94] | `case` items: the label head (shared with generate `case` and `randsequence`), an item with its body, the `case … endcase` body, the optional `:` after `default`. |
| `timing.rs` [89] | Timing controls and sensitivity lists. |
Forced `pub(super)`: `body_after` (called by `case_item`),
`timing_control`, `case_body` (called by `stmt_kind`).
**`vlog_parser/src/lexer.rs`** (771 — see the finding below) →
| file | holds |
|---|---|
| `lexer.rs` [497] | The raw phase's scanner (`RawLexer`, `next_raw`) and the entry point that fuses the two phases (`tokenize`). |
| `lexer/number.rs` [114] | Numeric literals: plain and real numbers, sized and based literals, time-unit suffixes. |
| `lexer/define_params.rs` [105; rule 6] | The formal-argument list of a function-like `` `define``, tracked incrementally (`DefineParams`). |
| `lexer/attach.rs` [54] | The attachment phase: a comment folded onto the real token it leads or trails. |
Forced `pub(super)`: `lex_number`, `lex_based_part`, `is_base_intro`,
`DefineParams` with `new` and `open`, `Attaching`, `attach`. Forced **by
the inline tests of `lexer.rs`**, which re-derive the scan as an oracle
and read the walk counter: `define_params_start`, `ScanMode`, and the
fields `DefineParams::{scanned, walked}`; the test module gained one line,
`use super::define_params::{define_params_start, ScanMode};`. The lexer's
tests were not moved (700 lines against 497: not dwarfed).
**Finding — `lexer.rs` was never under 600.** The 2026-11-26 paragraph in
`CLAUDE.md` gives `lexer.rs` 540; the three before it give 762, 763 and
771. Nothing was removed in between: `DefineParams` has a
`#[cfg(test)] walked: usize` **field** at line 723, and a count that stops
at the first `#[cfg(test)]` stops there, 230 production lines early. The
count to the test module is 771. It was the one production file over the
ceiling, so it is the fifth split. `lto = true` in the release profile,
so which module a function sits in does not decide what is inlined.
The same artifact, both under the ceiling and only reported:
`vlog_refactor/src/rename/warnings.rs` (rule 80, refined 521) and
`rename/mod.rs` (rule 10, refined 494); `lucisv_server/src/state/rescan.rs`
(rule 12, refined 483); `candidates.rs` (rule 29, refined 443).
**Move purity** (`purity.py` in the scratch dir: multiset of non-blank
lines of the old file at `a479faf` against the union of the new files).
For all five splits every residual line is a stamp, a module-doc line, a
`use`/`mod` line, a `pub(super)` prefix, or the `impl<'a> … {` / `}`
wrapper of a new file that continues an `impl` — plus exactly these:
- `resolve/types.rs`: `pub(super) fn type_here(…)` is 102 columns on one
line, so `rustfmt` broke the signature over six lines.
- `parser/connection.rs`: `pub(super) fn parse_connections(…)`, 109
columns, broken over four lines.
- `parser/generate.rs`: the three-line `// Generate constructs` section
banner is gone; it is the file's `//!` doc now. (The
`// DPI … and package export` banner in `package.rs` is kept.)
How: `split.py` slices the old file (read from `git show a479faf:`) by
line range into the new files and asserts every non-blank old line is
carried exactly once or is a dropped header/wrapper line; imports and
widenings were then taken from the compiler.
#### 2. Inline test modules, `lucisv_server`
Moved, test module lines / production lines of the file before the move:
`nav` 2 697 / 423, `inline` 1 709 / 332, `hover` 933 + 100 + 340 / 323
(three modules: `tests`, `qa_findings`, `qa_hover_declarations`, each its
own file), `pairs` 1 335 / 316, `type_def` 1 190 / 212, `ports`
1 177 / 377, `file_ops` 1 177 / 279, `index_cache` 1 167 / 397, `rename`
1 134 / 89, `tokens` 1 043 / 305, `type_hierarchy` 961 / 189, `settings`
866 / 295, `completion/member` 829 / 209, `hierarchy` 783 / 212, `format`
750 / 139, `completion/tiers` 709 / 162, `inlay` 701 / 122, `linked`
632 / 180, `lens` 627 / 68, `large` 593 / 199, `completion/module`
588 / 152. Each `#[cfg(test)] mod tests { … }` became
`#[cfg(test)] mod tests;` + `<module>/tests.rs`, the convention
`same_file/tests.rs` and `state/port_grace/tests.rs` already follow.
Not moved (under 2x, or under 500 lines), largest first: `candidates`
744 / 483, `main` 739 / 400, `on_type` 640 / 361, `lint` 607 / 362,
`includes` 499 + 112 / 341, `sync` 408 / 31, `completion/mod` 372 / 301,
`selection` 358 / 159, `convert` 343 / 102, `design_hierarchy` 335 / 117,
`code_action` 300 / 109, and everything smaller.
**`perf.rs`** (907 lines, the whole file `#[cfg(test)]` from `main.rs`):
no inline test module; 19 `#[ignore]`d measurement tests, every one
already carrying a reason, over eight helpers (`mean`, `scratch` and six
generators of the trees they measure). Its one sentence is still its
first line. Left whole, as the decomposition-server README reasoned.
**Proof.** `check_tests_move.py` compares each old module body with its
new file as token streams (string and char literals byte-exact, comments
exact but for leading whitespace, a `,` before a closing bracket
ignored): 23 modules, 151 982 tokens, **one** difference — in
`format/tests.rs` `rustfmt` dropped the braces of a closure that now fits
on one line (`|tab| { settings_with(…).config }` →
`|tab| settings_with(…).config`). The production remainder of each of the
21 files is byte-identical to the old file with the block replaced by
`mod <name>;`. The sorted `test … ok|ignored` lines of
`cargo test -p lucisv_server --all-targets` are **identical** to the
baseline log's, 2 316 lines (taken before the two hygiene edits below).
#### 3. Hygiene
**a. `#[ignore]`** — 12 bare ones, not 11: `lucisv_server` 8
(`hierarchy`, `file_ops`, `includes`, `lens`, `inlay` x2,
`type_hierarchy`, `state/tests/incremental.rs`), `vlog_parser`
`tests/census.rs` x2, `vlog_refactor` `tests/rename_bind.rs` and
`tests/corpus.rs`. Each test was read; each reason says what the test
needs (`corpus/`, a generated tree, `CENSUS=<absolute dir>`,
`SVA_LINES=<file of paths>`, the tree `LUCISV_BIND_ROOT` names) and how
it is run. No other byte of those tests changed. Zero bare `#[ignore]`
remain.
**b. `large.rs` QA finding 4** is finding 4 of the QA log in
`docs/features/linux-test-portability/README.md`: "(low, pre-existing)
`large.rs` `references_on_one_giant_line…` times a copy of the
`Server::large_scan` loop (`server/large_file.rs:151`), not the production
code, so a regression there is not caught." **The one change in this
round that is not a move**, and test-only: the test now lives in
`server/tests/large_file.rs` (same name) and times the real
`textDocument/references` request through `Session`, at the same four
widths, under the same `assert_grows_linearly` / `fastest_of_five`. To
share those two helpers `large::tests` is `pub(crate) mod tests` and the
helpers `pub(crate)` (both still `#[cfg(test)]`; `perf::mean` is the
precedent). No production code changed. Count unchanged (one test moved
module); the test list differs from the baseline in exactly that one
path.
*Shown to trip:* with `large_scan` temporarily mapping each hit through
`positions.range(span)` instead of the walker, the test fails in all three
attempts at **58x** for 8x the input (limit 24x): 6.7 / 25.2 / 98.2 /
389.6 ms. Restored (`git diff` of `server/large_file.rs` empty) it reads
3.7 / 7.4 / 14.9 / 30.3 ms, 8.1x, three runs alike.
**c. `tools/perf/sites.py:16`** defaulted `ROOT` to
`/Users/guoliangchen/repo/opentitan`, a home directory that exists on one
machine. Now `os.path.expanduser("~/repo/opentitan")` — the path
`tools/perf/README.md` already tells the reader to use (`OT=$HOME/repo/opentitan`),
and the same string as before on the machine it was written on. Verified:
`import sites` gives `/Users/lucio/repo/opentitan` here (a directory, and
`sites.path(sites.AES)` is a file), `/Users/guoliangchen/repo/opentitan`
under `HOME=/Users/guoliangchen`, and `OPENTITAN=…` still wins;
`bench.py --help` still parses.
**d. `CLAUDE.md`**: one paragraph appended after the 2026-11-26 one.
`docs/topo.md`: the three module lists of §1.3 name the new modules and
the §3.3 measurement sentence is brought up to date; nothing else.
#### 4. Verification
- `cargo fmt --all -- --check`: clean. `cargo clippy --workspace
--all-targets -- -D warnings`: clean.
- Guarded `cargo test -p <crate> --all-targets`
(`tools/guard.sh -m 8 -t 600`, every run exit 0, no guard kill), passed
/ ignored, on the final tree: `vlog_parser` 527 / 2, `vlog_semantic`
453 / 4, `vlog_refactor` 793 / 5, `vlog_formatter` 383 / 0,
`lucisv_server` 2263 / 53 — each equal to the baseline. The sorted test
names of all five equal the baseline log's but for the one test of
§3b, which changed module. (`vlog_linter`, `lucisv_core`, `lucisv`,
`lucisv_mcp` have no changed file and were not re-run; the lead's full
gate covers them.)
- `tools/gates.sh --only corpus`: 814 / 6. `--only cross`: pass.
`python3 tools/stamp_author.py --check`: "would stamp 0 files" — it
reads tracked files only, so the 34 new files (33 `.rs`, this README)
were stamped by hand and their first and last lines checked by a
script against the two stamp lines.
- **OpenTitan, read-only** (`/Users/lucio/repo/opentitan/hw`, 4 046
files; `--diff`, `--check` and `check` only, `--no-cache`, run from the
scratch dir): the release binary of `a479faf` (a detached worktree in
the scratch dir) against this tree's. `format --diff` in the default
style, `--style lowrisc` and `--style auto`; `format --check` in the
three styles; `format --check --output-format json`; `check`; `check
--output-format json` — stdout and stderr of all nine **byte-identical**
between the two binaries (SHA-256 in the dev's report). Both: 3 967
would reformat + 72 unchanged + 7 failed = 4 046 (4 039 format cleanly;
3 976 / 63 / 7 under `lowrisc`); `check`: 1 178 findings, 1 file not
checkable. `git -C /Users/lucio/repo/opentitan status --porcelain`:
empty before and after. Not a benchmark, only a sanity check on the
lexer move: `format --no-cache --check` over the tree, five runs each,
1.03–1.07 s for the `a479faf` binary and 1.03–1.09 s for this one.
## QA log
### 2026-11-26 — QA (Opus 5.5)
**Verdict: PASS-with-findings** (three low findings, none touches behaviour).
I wrote my own tools for this; I did not reuse the dev's scripts. Trunk is
`a479faf`, checked out as a detached worktree in the scratch dir. Every
cargo test, sweep and server run went through `tools/guard.sh`. No guard
killed anything.
**1. Move purity, item by item.** I wrote a small Rust tokenizer. It
handles raw and byte strings, chars and lifetimes, and nested block
comments, and it keeps comments as tokens. On top of it sits an item
extractor for `fn`/`struct`/`enum`/`trait`/`type`/`const`/`static`. Each
item is keyed by kind and name. Its value is its attributes plus preceding
comments, then its body from the keyword to the closing brace, token for
token. Old file at `a479faf` against the union of the new files:
| split | items old/new | items that differ | why they differ |
|---|---|---|---|
| `resolve.rs` | 40/40 | `type_here` | the `pub(super)` prefix, and the trailing `,` rustfmt added when it re-broke the signature |
| `parser/item.rs` | 23/23 | `parse_gen_if` | the three-line `// Generate constructs` banner is gone; everything else is equal |
| `parser/instance.rs` | 20/20 | `parse_connections` | `pub(super)`, and the re-break `,` |
| `format/stmt.rs` | 16/16 | none | — |
| `lexer.rs` | 95/95 | `DefineParams` | `pub(super)` on the struct and on the fields `scanned` and `walked` |
The comparison covers every match arm, attribute and comment inside a
body. Besides the items, the only new tokens are stamps, `//!` module
docs, `use`/`mod` lines and `impl<'a> Parser<'a> {}` / `impl Fmt {}`
wrappers. The only tokens dropped outside items are the old module-doc
lines that the new docs replace, plus the one banner. No other comment
was lost.
**2. Visibility.** I compared every `pub…` declaration per crate,
before and after. The only additions are the `pub(super)` items the
README lists, two `pub(crate) use` re-exports (`member_site` and
`extends_chain`, which were already `pub(crate)`), and in `lucisv_server`
`pub(crate) mod tests` plus the helpers `fastest_of_five` and
`assert_grows_linearly`. That module sits under `#[cfg(test)]`
(`large.rs:366-367`), so those three are test-only. No new `pub` and no
production `pub(crate)`. Every file in `git diff --stat` is accounted
for: moves, `mod` lines and docs, the 12 `#[ignore]` lines,
`server/tests/large_file.rs`, `CLAUDE.md`, `topo.md` and `sites.py`.
**3. The 23 moved test modules.** I cut each `mod NAME { … }` out of
the trunk file and compared it with `<module>/NAME.rs` token by token.
Every string literal was compared byte for byte, and each file's
production remainder was compared with trunk after replacing the block
by `mod NAME;`. 23 modules, 149 946 tokens, 171 multi-line string
literals: **every literal is byte-identical**, including the `\`
continuation lines in `large/tests.rs` that keep their old indent. The
token differences are:
- trailing commas that rustfmt dropped (`completion/member`, `file_ops`,
`format`, `hierarchy`, `hover`, `inline`, `large`, `linked`, `nav`,
`pairs`, `rename`, `tokens`, `type_def`);
- the closure braces in `format/tests.rs`;
- the 6 in-module `#[ignore = …]` reasons;
- `large`: the relocated test is gone, and the `pub(crate)` lines.
Each production remainder is byte-identical to trunk, except `large.rs`,
which gained two comment lines above `#[cfg(test)]`.
**Test lists** (`cargo test -p <crate> --all-targets`, all nine crates,
passed/failed/ignored) are equal to `target/gates/r11`:
| crate | passed/failed/ignored |
|---|---|
| `vlog_parser` | 527/0/2 |
| `vlog_semantic` | 453/0/4 |
| `vlog_refactor` | 793/0/5 |
| `vlog_formatter` | 383/0/0 |
| `vlog_linter` | 710/0/0 |
| `lucisv_core` | 129/0/0 |
| `lucisv` | 162/0/0 |
| `lucisv_server` | 2263/0/53 |
| `lucisv_mcp` | 400/0/3 |
The sorted `test … ok|ignored` lines are equal too. The only differences
are the 12 `ignored, <reason>` suffixes and the move of
`large::tests::references_on_one_giant_line…` to
`server::tests::large_file::…`.
**4. `#[ignore]`.** Trunk had 12 bare `#[ignore]`; there are 0 now
(`grep -rnE '^\s*#\[ignore\]\s*$' crates`). I read every one of them,
and each reason is true: the probe prints timings and asserts only its
premises, and it needs `corpus/`, a generated tree, `CENSUS`,
`SVA_LINES` or `LUCISV_BIND_ROOT`. Runs:
- `CENSUS=…/hw/ip/uart`: ok, 35 files.
- `SVA_LINES=<list>`: ok.
- `rename_bind` with `LUCISV_BIND_ROOT` unset: skips (the run with it
set is a known trunk failure, topo #68, not re-run).
- The two `inlay` `qa_perf` probes: ok.
- The 6 corpus probes in `lucisv_server`, and `vlog_refactor --test
corpus`: ok in a scratch copy of the tree with `corpus` →
`~/.cache/lucisv-corpus` (860 files).
*Observation, pre-existing:* in this checkout there is no `./corpus`.
`file_ops::tests::perf::…` (`file_ops/tests.rs:751`) and
`includes::tests::perf::…` (`includes.rs:980`) then panic on
`assert!(files > 500)`, where the other probes print "skipping". Their
reasons do say "over corpus/". I request no change.
**5. The one non-move** (`server/tests/large_file.rs:261`). The test
sends `textDocument/references` through `Session`, and so the real
`Server::large_scan`. It asserts `hits == width + 1`, so it cannot pass
by answering nothing. `server/large_file.rs` and the production lines of
`large.rs` are unchanged against trunk. The old copy is gone: the test
name has exactly one definition.
- *Flakiness:* 10 guarded runs passed on the first attempt, at 3.7 /
7.4 / 14.9 / 30.0 ms (8.1x, limit 24x) every time. It also passed
inside the full `lucisv_server` suite at the default thread count.
- *Mutation*, in a scratch worktree copy of the tree: `large_scan`
mapped through `positions.range(span)` instead of the walker. The test
fails in all 3 attempts at **57.6x**: 6.7 / 25.3 / 98.0 / 387 ms.
**6. Behaviour, OpenTitan** (`/Users/lucio/repo/opentitan/hw`, read-only,
`--no-cache`). Release binaries of trunk and of this tree, with stdout,
stderr and exit code compared for 10 commands:
- `format --diff` in the default style, `--style lowrisc` and
`--style auto`;
- `format --check` in the same three styles;
- `--check --output-format json`, in the default style and in `lowrisc`;
- `check`, in text and in JSON.
**All 30 outputs are byte-identical.** Every command exits 2. The
default style gives 3 967 would reformat, 72 unchanged and 7 failed
(4 046 files, 4 039 format cleanly); `check` gives 1 178 violations and 1
file that cannot be checked. SHA-256 prefixes of stdout:
| command | stdout SHA-256 prefix |
|---|---|
| `--diff` default | `6d408ffaa38a3fef` (46.1 MB) |
| `--diff` lowrisc | `beebd02e86e0a3f9` |
| `--diff` auto | `66c2d4dc749cdc29` |
| `--check` default | `92fe09236a27851a` (the same for auto) |
| `--check` lowrisc | `d6aec944645cc220` |
| `--check` JSON | `fd160c4c8362ca37` |
| `check` text | `9ac721f0bd782051` |
| `check` JSON | `28898c5a1765fd2f` |
The server was compared two ways:
- `tools/perf/rescan_diff.py`, with `aes_cipher_core.sv` and then
`uart_core.sv` open, 2 rescans each. All 94 lines are identical,
including the index store hash (`f268de99…`, 50 626 930 bytes, for
`uart`).
- My own probe over 53 sampled `hw/ip` and `vendor` files:
`semanticTokens/full`, `foldingRange`, `documentSymbol`, `formatting`,
`documentLink` and `inlayHint`. All 318 answers are identical.
The CLI has no token-dump mode, so I ran no lexer token-dump
differential; the formatting and semantic-token answers exercise the
lexer.
**7. Performance.** `format --no-cache --check` over `hw`, 7 runs, the
two binaries alternated, timed inside one guarded Python process (an
earlier run, timed around `guard.sh`, was skewed by its 1 s poll):
| | trunk | tree | tree/trunk |
|---|---|---|---|
| min | 1.015 s | 1.024 s | +0.9 % |
| median | 1.034 s | 1.037 s | +0.3 % |
`check --no-cache`, 15 runs: median 0.421 s on both, +0.1 %. No
regression over 3 %.
**8. Size.** I measured all 440 `src` files of the tree. The naive count
stops at the first `#[cfg(test)]`; the refined count skips a
`#[cfg(test)]` item and stops at the inline test module. No production
file is over 600 by either count. The top production files are
`lucisv/src/main.rs` 574, `parser/module.rs` 568, `parser/split.rs` 554,
`sva.rs` 542, `extract/flow.rs` 535, `class.rs` 518, `covergroup.rs` 517,
`dispatch.rs` 515 and `discover.rs` 515, as the new `CLAUDE.md`
paragraph says. Over 600 there are only test-only files: `perf.rs` 907
and 13 moved `tests.rs` files from 611 to 1 926 (`hierarchy/tests.rs` is
exactly 600).
`lexer.rs` at trunk: 540 by the naive count, 771 counting every line
before `mod tests`, 757 by the refined count. **The dev's finding
holds:** it was the one production file over 600. The refined counts of
`warnings.rs` 521 / 80, `rename/mod.rs` 494 and `rescan.rs` 483 agree
with the dev's.
**9. Hygiene.**
- `cargo fmt --all -- --check`: clean.
- `cargo clippy --workspace --all-targets -- -D warnings`: clean.
- `tools/gates.sh -o <scratch> --only corpus,cross,docs,stamp`: PASS
(corpus 814/6).
- All 34 new files carry exactly the two stamp lines, first and last,
and end in a newline.
- `sites.py`: `ROOT` is `/Users/lucio/repo/opentitan` here,
`/Users/guoliangchen/…` under that `HOME`, and `OPENTITAN` still wins.
- The `topo.md` edits are accurate.
- This README has all seven sections, the tables and the list of
forced visibility changes.
#### Findings
1. **Low: one size figure is wrong.** `CLAUDE.md` (new paragraph) and
this README's lexer table both give `lexer/define_params.rs` **88**.
The README's own refined rule gives **105** (118 counting every line
before the tests, 6 by the naive count). The other figures in the
paragraph match my measurement. Reproduce with `size.py` (scratch), or
count by hand: 118 non-blank, non-comment lines, minus the 13 under
`#[cfg(test)]`.
2. **Low: new rustdoc warnings, ungated.** `cargo doc -p vlog_semantic -p
vlog_parser --no-deps --document-private-items` gives 6 warnings
trunk does not:
- 5 links in moved docs that no longer resolve, as the Assumptions
predict: `resolve/member.rs:113:53`, `:114:47`, `:114:63` (for
example `this_member`, `super_member`, `unit_member`),
`resolve/types.rs:46:54` and `resolve.rs:261:41`;
- 1 in text written this round: the new `//!` doc of `lexer.rs:11:45`
links to the private `` [`RawLexer`] `` from a public module ("public
documentation for `lexer` links to private item `RawLexer`"). The
Assumptions do not cover this one.
No gate runs rustdoc lints, so nothing fails.
3. **For the lead to rule on: guidance in the measurement paragraph.**
`git diff CLAUDE.md` is one appended paragraph and nothing else. Two
sentences in it are guidance rather than measurement:
- "A `#[cfg(test)]` that is not the test module is stepped over, not
stopped at" changes the counting rule.
- "Test-only files over 600 (declared under `#[cfg(test)]`, so not
production)" states how moved `tests.rs` files are classified.
**Notes, not findings:**
- `DefineParams::scanned` is now `pub(super)` in production, although
only the lexer's tests read it from outside. That is the least the
move allows.
- Besides `crates/lucisv_mcp/tests/opentitan.rs:25`, the dev's request,
`/Users/guoliangchen` is hard-coded in archived scripts under
`docs/perf/review-052-20260909/*.py` and
`docs/perf/take5-review-20260908/*.py`, and in many docs. Reported,
not fixed.
- To rebuild rustdoc I `touch`ed `vlog_semantic/src/lib.rs` and
`vlog_parser/src/lib.rs`. Their content is unchanged.
**Not verified:** `rename_bind` and `lucisv_mcp --test opentitan` with
OpenTitan set (known trunk failures, topo #68); the `perf.rs` probes;
the full `tools/gates.sh`, which the lead runs.
## Review
**2026-11-26 — lead: accepted on the first QA pass, with three lead edits.**
- Delivered: five pure-move splits (`resolve.rs`, `parser/item.rs`,
`parser/instance.rs`, `format/stmt.rs`, `lexer.rs`), 23 inline test
modules of `lucisv_server` moved to their own files, reasons on all 12
bare `#[ignore]` (the plan said 11), `tools/perf/sites.py` default root.
No production file is over 600.
- The fifth split is accepted: `lexer.rs` was really 771, and the 540 this
file's earlier paragraph records was a counting artifact (a
`#[cfg(test)]` field ended the count early). The dev's threshold for
moving a test module (≥ 500 lines and ≥ 2× its file) is accepted as this
round's working line, not as a rule.
- Proof: QA's own item-by-item token comparison (194 items) finds only
`pub(super)`, two rustfmt signature re-breaks and one banner comment;
171 multi-line test inputs byte-identical; test counts equal to the
Round 11 gate logs in all nine crates; 30 OpenTitan outputs over 4 046
files byte-identical to `a479faf` (dev and QA independently, same
hashes); server answers and index store identical; no timing change
over 1 %.
- The one non-move, test-only: `large.rs` finding 4 — the giant-line
references test now times the real request. QA's mutation fails it at
57.6× against a 24× limit; 10 clean runs at 8.1×.
- Lead edits after QA: `define_params.rs` 88 → 105 in `CLAUDE.md` and this
README (QA finding 1); the five intra-doc links the moves broke and the
new `RawLexer` link repaired, doc text only (finding 2); the `CLAUDE.md`
sentence that read as a new counting rule reworded to describe how this
measurement was taken (finding 3) — whether to make it the rule is the
owner's call.
- Left: `crates/lucisv_mcp/tests/opentitan.rs:25` and archived perf scripts
still default to another user's home directory; two corpus probes panic
instead of skipping when `./corpus` is absent; parser tests for the new
parser files were not re-homed.
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->