Files
lucisv/docs/features/perf5-p2/README.md
T
Guoliang ChenandClaude Mythos 5.2 71d13b5fbe
ci / checks (push) Successful in 1m0s
ci / corpus (push) Successful in 18s
ci / linux (push) Successful in 6m4s
release / build-and-publish (push) Successful in 5m31s
Release 0.66.2: every source file names its author
Every tracked file that can carry a comment (880 of them) now opens with
"Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with
"Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love,
luciochen.com", in the file's own comment syntax. No behaviour change: the
diff outside the version bump and changelogs is comment lines only.

- tools/stamp_author.py: writes the lines; idempotent, `--check` lists
  what is missing. Headers go under a shebang and under Markdown front
  matter.
- Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON
  and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the
  LICENSE files (already carry the copyright line).
- tools/linux_check.sh: --help reads its header from line 3, now that the
  author line sits under the shebang.
- tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-24 12:11:09 -08:00

1542 lines
94 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
# perf5-p2 — rename reuses its analysis, verification untouched
Take 5 §P2 (`docs/performance_take5.md`), TODO §60.2. Stages P2a → P2b → P2c
(2026-09-07, merged), then **handshake 33 and §P2d** (2026-09-07, second lane).
The first three stages removed the repeated work inside a rename. The second
lane closes topology handshake 33 — the file that reaches an instance through
modules it does not itself instantiate, which inline-module could not see —
and then asks §P2d's question: can the selected set be made smaller? The
answer this lane brings back is **measured and negative for the large block**,
and it is written out below with the census that says so.
## Goal
A hierarchical rename on OpenTitan costs about **780 ms** and nobody could say
which stage that is. This lane first *measures* it (P2a: an additive trace
carrying per-stage wall time and per-stage **whole-file parse counts**), then
removes the repeated work the measurement names — the same file parsed and
analysed two, three, four times inside one request — without touching a single
one of the verifier's checks. P2b makes the request-local scope parse and
analyse each file **once** and keep what later stages need; P2c builds the
after-edit index from the unchanged files' existing facts plus the edited
files' one new analysis, and re-resolves the untouched watched files against it
rather than re-analysing them.
What the user sees must not move at all: the same edits, the same warnings, the
same refusal sentences, the same fingerprints. A faster partial edit is a
failure, and so is a faster refusal that refuses something else.
**The second lane, 2026-09-07, is two more things.** First, **correctness**:
topology handshake 33 — `module_sources` has no rung for a file that reaches an
instance through modules it does not itself instantiate, so inline-module's
hierarchical-use refusal never saw a testbench two wrapper levels up and the
inline was silently accepted. It gains a fifth rung, and the rung is chosen so
that the selected set answers that refusal **exactly as the whole workspace
would**, which is asserted by test rather than argued. It adds files and adds
time, and both are reported as the correctness work they are.
Second, **§P2d's question**: after §P2c the tail rename is 420 ms of which 225
is one parse of each of 238 *selected* files, so the only lever left is the
size of that set. The lane's answer is a **census** — of each selected file,
whether it writes either name down — and the answer it brings back is that
**133 of the 238 (56 %) write neither, and every one of them is load-bearing
anyway**: they are what a multi-level hierarchical tail's path folds through.
Dropping them costs an edit, or worse, gains one. So **no selector is
narrowed**. The census, the mechanism and the narrowing that is still open are
in the work log.
**The third round, 2026-09-07, is the dedupe §P2d filed rather than fixed.**
`warnings` tokenized each spelling file twice and built up to four
`LineIndex`es, none of them shared and none of them the parse the scope had
already made. One lex and one index per file per call takes the stage from
82.2 ms to **51.4** on the tail rename and from 848.5 to **437.9** on the
`clk_i` fallback, and with it the tail rename to **387.95 ms = 2.01× the §P0
REF** — so the ≥2× target the first two rounds missed is **met**, without one
sentence of one warning changing. The other dedupe §P2d proposed is *not*
equivalent and is not taken; the counter-example is in the code and below.
## Assumptions
- **A rename is answered on one thread.** `vlog_parser::stats::parses()` is
thread-local, so a stage's parse delta is that stage's own work. This is
§P1's assumption too, and the server is single-threaded per request.
- **`FileFacts::of(path, src)` and the `Semantics` its own read-off was made
from describe the same text.** P2b keeps that `Semantics` instead of dropping
it; it does not recompute it, so the two cannot disagree. The additive
`FileFacts::analyzed` is literally `facts_of`'s body with the analysis handed
back rather than dropped.
- **`parse_source_tolerant(src).0` and `parse_and_collect(src).0` are the same
tree.** `parse_source_tolerant` is `tokenize` + `parse_tolerant`, with
`parser::error_file` on a lex failure; `parse_and_collect` is the same two
branches. So the `Semantics` a scope retains is the one
`Scope::analysis` used to compute for itself.
- **Retention is a cache, never an oracle.** A file whose analysis was not
retained is analysed on demand exactly as before, so a retention rule that
guesses wrong costs time and can never change an answer.
- **`contains_word(text, name)` implies `text.contains(name)`.** The verifier's
watched set is the whole-word one and the occurrence walk's prefilter is the
substring one, so every watched file is one the substring rule retains.
- The corpus is OpenTitan `00981352642fb65ef2b6c47143a0f6bb31fd4a97` with the
three pre-existing modified files, read-only, as in §P0/§P1.
## Handshakes
**Consumed.**
- `vlog_parser::stats::parses()` — §P1's per-thread whole-file parse counter.
This lane counts deltas around stages and asserts formulas on them.
- `vlog_semantic::workspace`: `FileFacts::of` / `IndexBuilder::{new, add_facts,
finish}` / `WorkspaceIndex::{build, absorb, fingerprint}` and the contract in
`docs/topo.md` §3 that **`absorb` must equal one build over the resulting
record set**. P2c depends on exactly that sentence and pins it by test.
- `lucisv_server::state::Workspace::rename_sources`' rung ladder — climbed
unchanged; only the sink it inserts into changed.
**Promised / requested (topo edges for the lead).**
1. `vlog_refactor ──▶ vlog_semantic`: **new additive API
`FileFacts::analyzed(path, src) -> (FileFacts, Semantics)`** — `FileFacts::of`
handing back the analysis it read the record off instead of dropping it. No
codec change; `FACTS_FORMAT` untouched (nothing new is persisted).
2. `vlog_refactor` public surface: **`rename_traced` and the `RenameTrace` /
`VerifyTrace` / `Stage` values**. Additive; `rename` is `rename_traced` with
a trace nobody reads, so there is no second rename path.
3. `lucisv_server ──▶ vlog_refactor`: `rename::rename_traced` replaces
`rename::rename` at the one call site (`server/dispatch.rs`), and
`Workspace::rename_sources_traced` replaces `rename_sources`. Both are the
old function with an out parameter; the ladder and the engine are unchanged.
4. `lucisv_server` internal: new module `rename_trace.rs` (`Rung`, `Wanted`,
`SelectionTrace`) — the path set the fan-out fills, which now remembers
which rung filled it.
5. **(second lane)** `lucisv_server` internal: new module `module_select.rs`
(`Reach`, `hierarchical_users`) and `Workspace::module_sources_reaching`;
`inline_module::execute` is its only caller. It consumes
`WorkspaceIndex::files_mentioning`, which already existed for the semantic
lints' mention guard and is used here unchanged — no new semantic surface,
no codec change.
6. **(second lane)** `rename_trace.rs` gains `indirect_census` / `census_line`
and `SelectionTrace::indirect`; `Wanted::finish` hands back
`BTreeMap<PathBuf, Rung>` rather than `BTreeSet<PathBuf>` so the census can
ask *which rung* each selected file came from. The `timing: rename trace`
line gains one `indirect{…}` group, which `tools/perf/phases_p2.py` reads
back as `trace_indirect_*` with no harness change. Additive; no selection
logic changed and the selector's own cost did not move (13.6 ms against
§P2c's 13.4 on the tail rename).
**Handshake 33 — closed 2026-09-07 (second lane).** `module_sources` gains a
**fifth rung**, opt-in, asked for by inline-module alone:
`Workspace::module_sources_reaching(file, modules, Reach { scopes })` unions in
every file whose token stream writes one of `scopes` down
(`crate::module_select`, over `WorkspaceIndex::files_mentioning`). The scope
inline names is the instance it dissolves.
- **What was wrong.** `inline/mod.rs::no_hierarchy` refuses when a handed file
spells the instance with a `.` beside it, and it sees only the files it was
handed. `tb.sv` writing `u_wrapper.u_top.u_sub.s` instantiates `wrapper` —
not `top`, not `sub` — so no rung asked for it and the inline was silently
accepted, dissolving a scope a testbench walks through.
- **Why the rung is the word census and not the transitive-instantiator walk
the topology row asks for.** `files_mentioning` is read off `FileFacts::words`,
which `vlog_semantic::words::harvest` fills from every `Ident` token **and**
from the raw text of macro invocations, directives and attributes. Every file
`no_hierarchy` could refuse over is therefore in it, and nothing else is — so
the selected set answers that refusal **exactly as `sources()` would**, which
is a stronger claim than "one more level of wrappers". The walk was written
first and its own fixture killed it: `bind tb.u_wrapper.u_top.u_sub chk
u_chk (…)` in an SVA file that instantiates nothing in the chain is a refusal
the whole workspace makes, the walk misses and the census keeps
(`a_bind_two_levels_above_the_instance_refuses_the_inline`). `$root`-anchored
and macro-built paths are the same shape. The walk also selects files that
instantiate up the chain and never spell the instance, which no refusal can
turn on.
- **Nothing else moved.** `module_sources` is `module_sources_reaching(…,
Reach::none())` and `Reach::none()` walks nothing, so the port refactorings
and extract — including the eager `textDocument/codeAction` path — select the
same files at the same cost. Pinned by
`the_four_rung_selector_answers_exactly_what_it_did_before`, which asserts the
four-rung answer as a list, not a count.
- **Residue.** A path written entirely inside a macro *invocation* is still not
refused over: the census hands the file over, but `no_hierarchy` tokenizes and
a directive line is one opaque token. That is `no_hierarchy`'s limit, not the
selection's, and the whole-workspace engine answers identically — pinned by
`a_macro_hiding_the_path_selects_the_file_and_still_does_not_refuse`.
**Not touched.** `check::verify` / `verify_splice` / `verify_move` compare
exactly what they compared before: token identity, the resolution-identity
print, the comments/attributes ledger, parse-diagnostic preservation. Every
hunk in `check/` changes an **input** to a check — where a `Semantics` or an
index came from — and none changes a comparison. `offer_sources` and
`imports::sources` are untouched. **No selector is narrowed anywhere in either
lane**: handshake 33's fifth rung only ever *adds* files, and §P2d's census is
a diagnostic. The six rungs of `rename_sources_traced` and the four of
`module_sources` decide exactly what they decided at 0.50.0.
## Status / TODO
- [x] **P2a** — `RenameTrace` in `vlog_refactor` (`trace.rs`), `SelectionTrace`
in `lucisv_server` (`rename_trace.rs`), one `timing: rename trace …` line
behind `--verbose`, the `renametrace` harness phase, eight renames
measured with peak RSS, tracker rows and experiment `P2a-2026-09-07`.
- [x] **P2b** — one parse + analysis per file inside the request-local scope
(`FileFacts::analyzed`, `Scope::build_keeping`), experiment
`P2b-2026-09-07`.
- [x] **P2c** — the after-index from unchanged facts plus the edited files'
one new analysis; untouched watched files re-resolve rather than
re-analyse (`check/after.rs`), experiment `P2c-2026-09-07`.
- [x] measured: **`K + E` whole-file parses, asserted**; the tail rename
**1.86×** faster (**target ≥2× missed by 28 ms** — the remaining stage
is named below); `aes` rename **25 % faster**, not slower; every edit,
warning and refusal fingerprint identical to the §P0 REF; the queued
definition down 24.5 %; peak RSS unchanged or lower on all eight rows.
- [x] **QA (P2a/P2b/P2c only)** — PASS, 2026-09-07; see the QA log.
### Second lane, 2026-09-07 — handshake 33 and §P2d
- [x] **handshake 33 closed with tests.** The fifth rung
(`module_select.rs`, `Workspace::module_sources_reaching`), asked for by
`inline_module::execute` alone. Twelve tests in
`crates/lucisv_server/src/server/tests/hierarchy_reach.rs` driven through
the real dispatch, plus four in `module_select.rs`: multi-level (two and
three wrappers up), the level the four rungs already saw, a `bind` from a
file that instantiates nothing, a generated path, a macro-hidden path
(pinned as *not* refused, with the reason), a package/interface/class
name, duplicate modules (the ambiguity refusal, unchanged), an unsaved
buffer, a ladder nobody reaches into (still inlines), the four-rung
answer asserted unchanged as a list, and a **six-shape whole-workspace
equivalence test** — the narrowed set against `ws.sources()`.
- [x] **§P2d census** — `indirect_census` in `rename_trace.rs`, in the trace
line's `indirect{…}` group and in the `renametrace` rows. The tail
rename: **133 of 238 selected files (56 %) write neither name down**,
all of them on the reference (113) and instantiation (19) rungs plus the
one open buffer. Experiment `H33-2026-09-07` in the tracker.
- [x] **§P2d ruling: the selected set is not narrowed.** The census's 133 are
the container rungs, and they are load-bearing — the argument and the
counter-example are in the work log below. The other §P2d idea,
exact-name postings, is gated by the plan on selection still being
material: it is **13.6 ms of 420** (3.2 %), so it is not implemented.
- [x] **§P2d's `warnings` dedupe, implemented and measured.** One lex and one
`LineIndex` per file per `warnings()` call (`FileScan` in
`rename/warnings.rs`), the five scans sharing them, sentences
concatenated in the order the five loops emitted them. The stage
**82.2 → 51.4 ms** on the tail rename, **22.9 → 8.3** on `aes`,
**848.5 → 437.9** on the `clk_i` fallback; the tail rename **387.95 ms =
2.01× the §P0 REF**, so **§P2's ≥2× target is met**. The second gate §P2d
proposed (`files_naming_in_macros`) is **not taken** — it is not
equivalent, and the counter-example is in the code. Experiment
`P2d-warnings-2026-09-07`.
- [ ] QA (handshake 33, §P2d and the `warnings` dedupe).
## Work log
### 2026-09-07 — dev, P2a: the instrument
**Files.** New `crates/vlog_refactor/src/trace.rs` (`Stage`, `VerifyTrace`,
`RenameTrace`); `rename/mod.rs` gains `rename_traced` with `rename` delegating
to it; `check/mod.rs::verify` gains a `&mut VerifyTrace` parameter and times
its five sub-stages; `lib.rs` re-exports. New
`crates/lucisv_server/src/rename_trace.rs`; `state.rs`'s five rung functions
take a `&mut Wanted` instead of a `&mut BTreeSet<PathBuf>` and say which rung
they are on (**+23 lines net in `state.rs`** — `git diff --numstat` 35/12, all of it
the traced entry point and five `wanted.on(…)` lines; no selection logic
changed);
`server/dispatch.rs` logs one line when `--verbose`; new
`tools/perf/phases_p2.py` with the `renametrace` phase and a `RSTMGR` site.
**Deviations from the brief, and why.**
- The trace is an **out parameter** (`&mut RenameTrace`,
`&mut Option<String>`) rather than half of the `Ok` value. A rename that
*refuses* after 2.1 s is one of the seven rows the plan asks for, and a
`Result<(Edit, Trace), String>` throws the trace away on exactly those rows.
- `Workspace::rename_sources` and `lucisv_server::rename::rename` were
**collapsed into their traced forms** rather than kept as one-line wrappers:
with the production path on the traced form the wrappers are dead code in a
non-test build, and `#[allow(dead_code)]` on a public method to keep a
wrapper alive is worse than the four mechanical `.0`s it saves. The call
sites updated are two benchmarks in `perf.rs` (outside the brief's file list
— flagged here) and four test helpers.
**What the 780 ms tail rename is.** Repeat medians of four requests, release
binary `bf584aa0daf6…`, `renametrace` row *tail: state_q → state_q_x*, wire
**781.7 ms**:
| Stage | ms | whole-file parses |
|---|---:|---:|
| selection (`rename_sources`, server) | 13.4 | 0 |
| `Scope::build` — the index over the input | 228.5 | **238** |
| `locate` | 0.5 | 1 |
| `collect_edits` (the occurrence walk) | 116.3 | **134** |
| `verify` — token identity | 4.3 | 0 |
| `verify` — before-prints (analyses already cached) | 14.0 | 0 |
| `verify` — `rebuilt_index` | **228.4** | **238** |
| `verify` — after analyses + compare | 71.5 | **106** |
| `warnings` | 83.6 | 0 |
| **total** | **760.5** of 781.7 | **717** |
- The **input is 238 files / 4.55 MB**, not the two the edit touches. The rungs:
request 1, declaration 95, reference 122, instantiation 19, macro 0,
speller 0, open buffer 1. So the "2 files" of the tracker's output row is
0.8 % of the input, and the fan-out is dominated by the declaration and
reference rungs of `state_q` — a name 95 files declare.
- **717 whole-file parses over 238 files.** Every file is parsed for the index,
134 again by the occurrence walk, all 238 again by `rebuilt_index`, and 106
again for the after-prints. `K + E` — one parse per input file plus one per
edited file — is **240**. The other 477 are the duplication §P2b/§P2c exist
to remove.
- **The two 228 ms stages are the same work twice**: `Scope::build` and
`rebuilt_index` are both `WorkspaceIndex::build` over 238 texts, and only two
of those texts differ between them.
- The 83.6 ms of `warnings` runs **zero** parses: it is tokenizing, not
parsing, and it is out of P2b/P2c's reach.
**The other six rows, in one paragraph each's worth of numbers.** The ordinary
`aes` rename: 13 files / 400 KB, 51 parses, 140.5 ms — index 23.4, edits 19.2,
verify 63.3 (rebuild 22.4, after 20.3), warnings 23.4. A **unique internal
name** (`cipher_alert`, 4 files): 10 parses, 22.3 ms — the shape the fan-out is
built for. A **common port name** (`clk_i` at its declaration): the fan-out's
ambiguity hatch fires, the input is the **whole workspace** — 3 976 files /
35.8 MB, **10 399 parses**, **7 142 ms**, peak RSS **1 864 MiB**; the edit is
still 2 edits in 2 files. The **conflict** row (`state_q` → `state_d`) refuses
correctly after 634 ms, having done 638 parses. A new name a great many
external uses spell (`cipher_alert` → `clk_i`) refuses after 5 291 ms and 9 229
parses. A **duplicate module name** (`rstmgr_por`, declared in four files)
takes the same hatch and refuses after 2 116 ms — of which 1 837 ms is a
whole-workspace `Scope::build` and 242 ms the selection, and **none** of it is
the refusal, which `locate` reaches in 1.8 ms. A cursor on **no symbol at all**
is the same shape through a different door (`rename.rs` hands `ws.sources()`
over when there is no name to fan out from): 2 111 ms, 3 976 parses.
**Where the answer is that the 780 ms goes.** 29 % `Scope::build`, 29 %
`rebuilt_index` (the same build again), 15 % the occurrence walk's re-parses,
9 % the after analyses, 11 % warnings, 2 % selection. **73 % of it is
whole-file parsing, and two thirds of that parsing is repeated work.**
**Reference agreement.** Every §P0 REF row was re-taken on this binary and
every fingerprint is byte-identical: tail rename `b39defb21265…` (817.5 /
789.5–782.2 ms against REF 813.4 / 778.8–782.1), `aes` rename `fa7e31c78382…`
(168.4 / 141.3–140.1 against 167.6 / 140.5–142.1), connect-missing-ports
`4b534a16bca7…` (174.9 / 164.9–162.8 against 171.4 / 165.8–167.5),
expand-wildcard `8f3a26dd147b…` (78.4 / 69.8–71.1 against 73.6 / 71.7–73.0),
organize-imports resolve `0ee027e37d07…`, the extract capture `090e92e7736e…`
(258.5 / 245.0–243.4 against 257.3 / 245.1–247.0), the definition behind the
rename 159.0 / 158.9 / 154.3 (against 163.4 / 161.6 / 161.1). The
instrumentation costs nothing measurable, which is what a stage timer and a
`Cell` increment should cost.
*(The §P2b and §P2c dev entries are at the end of this file, below Review —
where the first lane's dev put them and where QA flagged them. Left in place;
moving another agent's prose is the lead's call. The second lane's entry is
here, under Work log, where it belongs.)*
### 2026-09-07 — dev, second lane: handshake 33
**Files.** New `crates/lucisv_server/src/module_select.rs` (**24** production
lines, non-blank and non-comment) and `crates/lucisv_server/src/server/tests/hierarchy_reach.rs`;
`state.rs` gains `module_sources_reaching` and loses nothing (`module_sources`
is now one line delegating to it — **+25 lines net** (`git diff --numstat` 28/3), all of it the new entry
point and its doc comment; the four rungs are byte-identical);
`inline_module.rs` names the instance as its `Reach`; `main.rs` and
`server/tests/mod.rs` gain one `mod` line each.
**The bug, exactly.** `inline/mod.rs::no_hierarchy` walks the files the caller
handed it, tokenizes each, and refuses when an `Ident` spelling the instance
has a `.` (or a `bind`) beside it. `module_sources`' four rungs are keyed by
*module* names — `units`, `references_to`, `instantiations_of` of the
instantiated module and of the module the cursor is in — so a file that
reaches the instance through a level it does not itself instantiate is in no
rung. Reproduced first as an index probe (`tb` → `wrapper` → `top` → `sub`):
`instantiations_of("top")` is `wrapper.sv` and stops there; `tb.sv`, which
writes `u_wrapper.u_top.u_sub.s`, is nowhere.
**The rung I wrote first, and why it is not the one that shipped.** The
topology row asks for a transitive-instantiator walk, and I wrote it: climb
`instantiations_of` upward from the host module, adding each edge's file and
enqueuing its `owner.name`, bounded by a visited set. It passed the ladder
tests and **failed a fixture of its own test file**:
```systemverilog
// sva.sv — instantiates nothing in the chain
module chk (input logic a); endmodule
bind tb.u_wrapper.u_top.u_sub chk u_chk (.a(1'b0));
```
`no_hierarchy` refuses over this in the whole workspace. The walk cannot reach
`sva.sv` — there is no instantiation edge from it into the chain — and the
index posts nothing for it either (`references_to` on the `u_sub` instance def
is **empty**: a folded path posts against its *last* segment, `s`, not against
the hops). `$root.top.u_sub.…` and a macro-built path are the same shape.
**The rung that shipped.** `WorkspaceIndex::files_mentioning(instance)` — the
word census read off `FileFacts::words`, which `vlog_semantic::words::harvest`
fills from **every `Ident` token** plus the identifier-shaped words inside raw
text (macro invocations, directives, attributes). So:
> every file `no_hierarchy` can refuse over writes the instance's name as an
> `Ident`, `harvest` writes every `Ident` down, therefore every such file is in
> `files_mentioning(instance)`.
That is not "one level further than before"; it is **parity with the whole
workspace for this refusal**, and it is asserted directly rather than argued:
`the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does` runs
the engine over the narrowed set and over `ws.sources()` on six shapes — the
missed bench, the bench the four rungs already saw, the bind, a generated path,
a macro-hidden path, and a clean ladder — and requires the same answer.
An escaped identifier (`\u_sub `) is out of `words` by construction and out of
`no_hierarchy` too, since its token text carries the backslash and cannot equal
the instance's spelling. The two agree.
**Why nothing else asks for the rung.** Extract's hierarchical refusal
(`extract/flow.rs::hierarchical_escape`) is about paths *inside the selected
region* of the request's own file, so it needs no other file. The port
refactorings have no whole-workspace hierarchy check at all. And
`ports::code_actions` calls `module_sources` on **every cursor move** — putting
a census walk there would pay for a question nobody asks. `Reach::none()` walks
nothing, so those callers are unchanged in answer and in cost, which
`the_four_rung_selector_answers_exactly_what_it_did_before` pins as a list
equality rather than a count.
**What it costs, measured** (release `da2aa9433e11…`, medians of four requests,
load 4.1–4.7, corpus unchanged after every phase, zero guard kills):
| Row | §P2c | this lane | |
|---|---:|---:|---|
| `execute` — inline at `aes_wrap.sv` 66:2 (refuses) | 5.33 | **6.55** | +1.2 ms, the fifth rung |
| `execute` — extract capture at `aes.sv` 220:0–222:53 | 149.25 | **148.78** | fingerprint `090e92e7736e…` identical |
| `execute` — extract refused at `aes_wrap.sv` 66:2 | 801.23 | **794.12** | same sentence |
| `refactor` — connect missing ports resolve, `aes_wrap.sv` 78:2 | 132.72 | **130.81** | same edit |
| `refactor` — expand wildcard resolve | 54.91 | **54.37** | |
| `refactor` — organize-imports resolve | 8.51 | **9.27** | |
The rung added **8 files** at the measured site (`tlul_cmd_intg_gen`, which is
both the module and the instance name there). Bounding it honestly rather than
cheaply: the most-mentioned instance spellings in the corpus are `u_reg` (79
files), `u_chk` (72), `u_prim_buf` (32) — so the worst inline this rung can
reach selects about **2 % of the 3 975 files**, on an explicit command, never
on a keystroke. There is no spelling that selects most of the tree, because an
instance name is not a module name.
### 2026-09-07 — dev, second lane: §P2d, and why the set is not narrowed
**The census.** `rename_trace::indirect_census` asks, of each *selected* file,
whether its `FileFacts::words` holds either name; the trace line carries the
answer per rung as `indirect{…}`. Asked of the selected files (one `facts_for`
and two binary searches each) rather than through `files_mentioning` (a walk
over every record in the workspace): that is ~0.05 ms against ~1.7 ms, and a
diagnostic that costs a measurable slice of the request it measures is a bad
instrument. Selection time is unmoved — **13.6 ms** against §P2c's 13.4.
Tail rename, `state_q → state_q_x` (238 selected, 106 watched, 2 edited):
| Rung | files | write neither name |
|---|---:|---:|
| request | 1 | 0 |
| declaration | 95 | 0 |
| reference | 122 | **113** |
| instantiation | 19 | **19** |
| macro / speller | 0 | 0 |
| open buffer | 1 | 1 |
| **total** | **238** | **133 (56 %)** |
The 105 files that *do* spell a name are the 106 the verifier watches (the odd
one is a file whose only `state_q` is in a comment: `contains_word` sees it,
the token census does not, and a comment cannot move a print). Their bytes are
1.92 MB of the input's 4.55 MB, so **the 133 are 58 % of the bytes and about
130 ms of `Scope::build`'s 225** — the whole of the §2× shortfall and more.
**Why they cannot be dropped.** Every *direct* input of the four verifier
checks is a file spelling one of the names: an occurrence is a use of the old
name, `check::watched_files` is `contains_word` over the two, `Scope::warnings`
speaks only about them, and the edited files are a subset of the watched. So
the 133 are in the request to shape **how the others resolve** — and they do:
- The reference and instantiation rungs are `fan_out_of`'s *container* rungs:
for each unit declaring `state_q`, every file declaring, referring to or
instantiating **that unit**. A file that instantiates `entropy_src_main_sm`
need never write `state_q` down.
- `fold_path` is what needs them. A two-level tail `u_a.u_b.state_q` folds
`u_a::u_b` through `member_unit(A, u_b)`, which is contributed by **A's
declaring file** — a file that instantiates the container and spells nothing
else. Drop it and `follow_one` returns `&[]`, `follow_paths` runs out of
paths, and the reference is `StillUnresolved`: **the edit §49 exists to make
is silently not made.** `own_chain`'s `base_chain` hop has the same shape for
a class whose base declares the name.
- Worse than a missed edit is available on the same route. `follow_paths` tries
paths **in order and takes the first non-empty one**, so a reference with two
paths — the ordinary shape under `import a_pkg::*; import b_pkg::*;` — that
resolved into a dropped file falls through onto the *next* path, which may be
the target: an **extra edit**, in a file the whole-workspace rename does not
touch. That is the corruption route rung 1 was made `workspace_symbols` for
(README of refactor-rename, "No extra edit").
So the census's large block is exactly the set the sufficiency argument is
built on, and the honest §P2d answer for it is **no**. The census is worth
keeping anyway: it is the number that says so, per rung, on any rename.
**The narrowing that is left, and why it is not this lane's.** The remaining
idea is the one `docs/features/refactor-rename/README.md` filed itself under
"The escape hatch": resolve the cursor to **one** declaration from the buffer's
own `semantics`/`external` and fan out from that declaration rather than from
all 95 spellings of the name. On the tail rename that would cut the input to a
handful of files and the request to tens of milliseconds — by far the largest
lever left, and the reason to be careful with it. It needs an argument that
covers, one shape at a time: a reference whose path list has more than one
entry (wildcard imports of a package declaring the old name, and the
`import p::*` shapes), a package member reachable from anywhere, an
`extends`/alias chain, `bind`, `defparam`, `$root`, an `` `include``d fragment,
a generate-block shadow, a class member, and an unsaved buffer that adds either
a reference or a same-named declaration. Every one of those is a fall-through
route onto the target, and a fall-through onto the target is an **extra edit**.
It is not shippable on inspection, and the brief's own gate is a whole-scope
oracle over thirteen named renames, the adversarial fixtures above and a
seeded 200-site opentitan sweep with zero differences. That is a lane, and it
is filed as one rather than started and left half-proved: this lane changed no
selector's answer, which is the state a next lane wants to start from.
**Exact-name postings** — the plan's other §P2d idea — are gated on selection
still being material. It is **13.6 ms of 420 (3.2 %)**, so they are not
implemented, per the plan's own condition.
**The `warnings` finding, filed not fixed.** `Scope::build`'s 225 ms is still
the dominant stage (54 %); `warnings` is second at **82.9 ms (20 %)**, and the
brief's condition for touching it (that it be dominant) is not met. What it
scans, so the next lane does not have to re-derive it: for every selected file
whose text holds the name, `define_sites` builds a `LineIndex`;
`macro_argument_sites` **tokenizes** and builds another; `sva_fallback_warnings`
**tokenizes again** and builds a third; `unresolved_candidate_warnings` builds
a fourth. That is up to two whole-file tokenizations and four `LineIndex`
builds per file, of the 106 the tail rename spells the name in — none of them
shared, and none of them the parse the scope already made. Two changes look
like pure dedupes with no answer change: (a) tokenize and index each file once
per `warnings` call, collecting the four scans' sentences into four vectors and
concatenating them in today's order so the output is byte-identical; and (b)
gate `macro_argument_sites` on `WorkspaceIndex::files_naming_in_macros`, which
is `FileFacts::macro_words` — exactly the words inside the raw text
`macro_argument_sites` looks in, so the gate cannot hide a site. Together they
should remove most of the 83 ms, which would take the tail rename to roughly
375 ms and **over the ≥2× line the lane missed**. Not done here: it is an
engine change outside a diagnostic hook, and it wants its own pinning.
**Measured** (release `da2aa9433e11…`, medians of four requests, corpus
unchanged after every phase, zero guard kills; load noted per phase).
| Row | §P0 REF | §P2c | this lane | vs REF |
|---|---:|---:|---:|---:|
| tail rename (`tailrename`) | 780.45 | 419.86 | **420.90** | −46.1 % (**1.85×**) |
| tail rename (`renametrace`) | — | 419.86 | **419.95** | |
| `aes` rename (`rename`) | 141.30 | 106.31 | **106.75** | −24.5 % |
| definition behind the rename (`blockers`, mean of pipelines 2–3) | 161.33 | 121.85 | **121.2** | −24.9 % |
| connect missing ports resolve | 166.51 | 132.72 | **130.81** | −21.4 % |
| expand wildcard resolve | 71.89 | 54.91 | **54.37** | −24.4 % |
| extract command executed (`execute`) | 246.03 | 149.25 | **148.78** | −39.5 % |
| extract refused at `aes_wrap.sv` 66:2 | ~801 | 801.23 | **794.12** | −0.9 % |
| organize-imports resolve | 9.45 | 8.51 | **9.27** | −1.9 % |
| inline refused at `aes_wrap.sv` 66:2 | — | 5.33 | **6.55** | +1.2 ms (handshake 33) |
Every fingerprint on every `renametrace` row is byte-identical to the §P0 REF's
— `b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…` and the
shared refusal `96f32d4243b1…` on all three refusal rows — and so is the
extract capture's `090e92e7736e…`. Peak RSS: tail rename **606 MiB** against
§P2c's 593 and QA's 584; the `clk_i` fallback **1 802 MiB** against 1 830 (QA
1 574). Nothing rose outside the spread the first lane's two takers already
showed. `blockers` was taken three times because the first take's pipelines
2–3 read 131.7 — the second and third read 121.2 and 120.0, so the first was
the outlier and the median is quoted.
**Deviations and things the lead should rule on.**
- **The fifth rung is not the transitive-instantiator walk the topology row
names.** It is the instance's word census, which is a superset of what that
walk would find *for this refusal* and also catches the `bind` shape the walk
provably misses. The walk was written, tested and discarded; the fixture that
discarded it is in the test file. Topo row 33's wording wants amending with
the lead's strike.
- **The rung is opt-in, not folded into `module_sources` for every caller.**
The brief expected extract and ports to "see MORE files"; they see exactly
what they saw. The reason is `ports::code_actions`, which calls
`module_sources` on every cursor move — §P1's whole subject — and neither it
nor extract has a whole-workspace hierarchy refusal to feed. Their answers
are pinned unchanged.
- **`state.rs` grew by 22 lines net**, against the brief's "≤ ~10". The excess
is the new entry point's doc comment; the four rungs' code is untouched and
the census is one call.
- `crates/lucisv_server/src/main.rs` and `src/server/tests/mod.rs` (outside the
brief's list) — one `mod` line each, which is how the new modules are
reachable at all.
- **§P2d ships no narrowing.** The census is the deliverable and the ruling is
negative for the 56 % it measures; the target-scoped selector is filed with
its full shape list rather than half-built.
### 2026-09-07 — dev, third round: the `warnings` dedupe §P2d filed
**What changed.** `crates/vlog_refactor/src/rename/warnings.rs`, and nothing
else. A private `FileScan` holds one file's `tokenize(text).ok()` and one
`LineIndex::new(text)`, each built on first ask; `Scope::warnings` builds one
per file inside a single loop and lends it to the four whole-scope scans, then
hands the *edited* files' scans on to the fifth. Both fields are memos of pure
functions of the file's text, so a scan reading a shared one reads exactly what
its own call built — the change is which call runs, never what it answers.
`macro_warnings`, which had its own loop, became the per-file `define_warnings`.
`define_sites` and `macro_argument_sites` keep their `pub(crate)` signatures —
`ports::remove` calls both from a `&Scope` with no scan to lend — and are now
three-line wrappers over `_with` twins that take one.
**Why the order still holds.** The five scans used to run as five loops, so
the sentences came out grouped by scan and, inside a group, by file. The new
loop collects into four vectors and concatenates them in that same order, and
the fifth scan still runs afterwards over `edits` **in the order `edits`
arrives in**, not in file order — the edited files' scans are parked in a
`HashMap` rather than the loop being restructured around them, so no assumption
about how `collect_edits` orders its result is baked in.
**The proof.** `Scope::warnings_reference` is the old control flow kept under
`#[cfg(test)]`: five loops, each scan handed a fresh `FileScan`, which is
exactly "each scan builds its own inputs".
`the_shared_scan_says_exactly_what_the_per_scan_one_did` asks both of them for
fifteen fixtures, over **separate scopes** so a cache the first call warmed
cannot flatter the second, and compares the answers **as lists**. The fixtures
are every warning-producing shape `crates/vlog_refactor/tests/rename.rs` pins
(a macro of the same name, a macro body, a macro argument, a macro argument in
an untouched file, a file whose only relationship to the name is a macro
argument, an SVA fallback in the edited file and in an untouched one, an
unresolved candidate in both), the three controls that must stay silent (a
structured assertion, a resolved tail, the §P2b eight-file workspace), the
shapes the brief named (a `` `define`` naming the name *plus* one whose body
spells it *plus* an `` `undef``, a comment-only mention, a file that does not
lex), two stray-occurrence shapes for the fifth scan (a member tail, a
mismatched end label), and one workspace holding all of them with **two files
edited**. The table asserts all six warning sentences are reached, so it cannot
pass by producing nothing. `a_comment_and_an_unlexable_file_are_warned_about_by_neither_scan`
pins the silent case as silent on both sides.
Three sabotages, each caught and reverted: swapping two groups in the
concatenation (fails on the all-shapes fixture, with the two orders printed),
sharing **one** `FileScan` across all files (fails on the
macro-invocation-in-an-untouched-file fixture), and keying the kept scan to the
wrong file (fails on the resolved-tail control).
**The gate that was not taken, and why.** §P2d's second proposal was to gate
`macro_argument_sites` on `WorkspaceIndex::files_naming_in_macros`. That census
is `FileFacts::macro_words` = `vlog_semantic::words::harvest_raw`, and the two
are **not** the same text. `harvest_raw` walks the same invocation tokens the
scan walks, but `raw_words` **steps over every double-quoted run** inside them
(deliberately: without it every file holding a `"%d"` would claim to mention a
signal called `d`) and skips a word a `'` precedes. `macro_argument_sites` asks
`contains_word` of the raw argument text, where a `"` is not a name byte — so
`` `uvm_info("state_q", $sformatf(...), UVM_LOW) ``, the commonest shape in
which a testbench names an RTL signal, is a site the scan reports and the
census does not hold. The gate would silently drop that warning, which is the
one thing this stage exists not to do. Not taken; the non-equivalence is
written into `macro_argument_sites`' own doc comment.
**Wire parity — the warning *lists*, not their counts.** The fingerprint the
harness records is a sha over sorted edits and sorted warnings, which cannot
see a re-ordering. So a scratchpad client
(`~/.cache/lucisv-perf/take5-p2w/warnparity.py`) runs thirteen renames against
each binary — the eight `renametrace` rows and the five sites the §P2a–c QA
pass chose (a port `entropy_clearing_ack_i`, a parameter
`SecStartTriggerDelay`, a package member `aes_pkg::AES_OP_WIDTH`, the
128-instantiation module `prim_flop_2sync`, and `delay_cntr_q` inside
`tlul_delayer.sv`'s `gen_delay_logic` block) — capturing every
`window/logMessage` the request produced **verbatim, in arrival order**. The
two 189 541-byte dumps `diff` clean: 13/13 rows, statuses, refusal sentences,
edit counts and warning lists identical, including the tail rename's **217**
warnings and the `clk_i` fallback's **652**, in order.
**Measured** (candidate release `18ef6d60c548…` against a clean clone of HEAD
`e51a2c7` built to `644e11dd3cb3…`; corpus verified unchanged after every
phase; zero guard kills; load 3.3–5.9, noted per phase; no `cargo` command ran
during any timed phase).
| Row | §P0 REF | this round's reference | this round | vs REF |
|---|---:|---:|---:|---:|
| tail rename (`tailrename`, median of three takes) | 780.45 | 417.63 | **387.95** | −50.3 % (**2.01×**) |
| tail rename (`renametrace`) | — | 419.63 | **395.45** | |
| `aes` rename (`rename`) | 141.30 | 107.54 | **91.79** | −35.0 % |
| definition behind the rename (`blockers`, mean of pipelines 2–3) | 161.33 | 124.12–127.67 | **115.91** | −28.2 % |
| `clk_i` all-sources fallback (`renametrace`) | — | 3 825.66 | **3 478.44** | −9.1 % on the reference |
The stage that moved, and the only one:
| Row | `warnings` before | after | change |
|---|---:|---:|---:|
| tail rename | 82.2 | **51.4** | −37.5 % |
| `aes` rename | 22.9 | **8.3** | −63.8 % |
| unique internal | 2.7 | **0.9** | −66.7 % |
| `clk_i` fallback | 848.5 | **437.9** | −48.4 % |
Everything else is run-to-run noise (tail `index` 225.8 → 233.5, `select`
14.0 → 14.4, `verify` 73.7 → 74.6) and every work count is unchanged: 238
selected, 106 watched, 2 edited, **240 parses = K + E**. All eight
`renametrace` fingerprints are byte-identical to the reference and to the §P0
REF — `b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…`, and
the shared refusal `96f32d4243b1…` on all three refusal rows. Peak RSS: tail
rename 572 → **596 MiB**, `clk_i` fallback 1 801 → **1 795**, `aes` 583 → 585.
The tail's +24 MiB is the only row that rose and sits inside the spread the
earlier lanes' own takers showed for it (584 / 593 / 606); what is retained is
the two **edited** files' token vectors, for the length of one `warnings` call.
**So §P2's target is met.** 780.45 → **387.95 ms is 2.01×**. The stretch goal
(<200 ms) is not approached, and what stands between is unchanged: `Scope::build`
is **233 ms of the 388 (60 %)** — one parse of each of the 238 selected files —
which only the target-scoped selector §P2d filed as its own lane can reach.
**Deviations.**
- **Only one of §P2d's two dedupes shipped**, for the reason above. The
expected ~375 ms was a prediction made on the assumption both would; one of
them reaches 387.95, which is still over the line.
- **The `rss` phase was not run** as a separate phase: the brief asks for peak
RSS of the tail rename and the `clk_i` fallback, and `renametrace` samples
exactly those across the request. The idle/scan RSS rows are §P4's and
nothing here touches them.
- **`tools/perf/` is unchanged.** The warning-list parity needed a client, not
a row, so it lives in the evidence directory beside the dumps it wrote,
the way the §P2a–c QA pass's five extra renames did.
## QA log
### 2026-09-07 — QA (Sonnet), P2a/P2b/P2c verification
**Scope.** TODO §60.2's P2a/P2b/P2c only. Handshake 33 and P2d are not this
lane's and are not touched or judged here. Read CLAUDE.md, `docs/topo.md`,
`docs/performance_take5.md` §P2, `docs/perf/take5-tracking.md`'s P2 rows and
experiments, `docs/features/refactor-rename/README.md`'s verification story,
the working-tree diff, and the evidence in `~/.cache/lucisv-perf/take5-p2/`.
Note early: the dev's P2b/P2c work-log entries (§P2b at line 206, §P2c at
line 271 of this file) landed *after* this QA log/Review heading pair instead
of under Work log — a structural slip, not a content problem (nothing in
them belongs in Review). Flagged for the lead; not reordered here since
moving another agent's prose is not a "small unambiguous fix."
**1. Gates, guarded, in the main tree.** `tools/guard.sh -m 8 -t 1800 --
cargo fmt --all -- --check`: clean. `cargo clippy --all-targets`: clean,
0.12 s (cache already warm from the dev's own build); no `#[allow]` anywhere
in `git diff`. `cargo test --workspace`: **4231 passed, 0 failed**, matches
the dev's count exactly; zero guard kills. Load 3.46/4.62/5.07 before, no
spike.
Per-crate/binary counts, candidate vs. a HEAD (`dafa4f0`, the pre-P2 P1c
commit) build in a disposable clone
(`/private/tmp/.../scratchpad/qa-p2/head-clone`), both **full** `cargo test
--workspace` runs (not `-p`-restricted, so this is the true baseline):
HEAD **4215 passed, 0 failed**, matching the tracker's stated pre-lane count
exactly. Deltas, all growth, none dropped: `vlog_refactor` unittests 123→135
(+12: 4 in `scope::tests`, 3 in `check::after::tests`, 5 in
`rename::tests`); `vlog_refactor` `tests/rename.rs` 70→70 (unchanged, as
claimed — the refusal-list tests were not touched); `vlog_semantic`
unittests 36→36 (unchanged); `vlog_semantic` `tests/workspace.rs` 87→89 (+2:
`analyzed_gives_the_record_of_gives_and_the_analysis_a_caller_would_compute`,
`an_index_from_analyzed_facts_is_the_index_a_build_gives`); `lucisv_server`
unittests 1545→1547 (+2, `rename_trace`'s own tests). Every other crate
(`vlog_parser`, `vlog_linter`, `vlog_formatter`, `lucisv`, `lucisv_core`)
unchanged. 4215+16=4231 ties out exactly to every individual diff above —
no test was quietly removed and replaced.
Production line counts: `check/mod.rs` **405** (measured: everything before
`#[cfg(test)]` at line 603, non-blank non-comment), `after.rs` **39**
(before `#[cfg(test)]` at line 86) — both match the dev's claim exactly.
Nothing over 600. `state.rs` `git diff --numstat`: 35 insertions / 12
deletions = **net +23**, inside the "~20 lines" the brief allowed and
matching the dev's own count; the diff is exactly the traced entry point
(`rename_sources_traced`) plus the six `wanted.on(Rung::...)` lines — no
selection-logic line changed.
**2. The verifier, hunk by hunk.** Read `git diff crates/vlog_refactor/src/
check/mod.rs` end to end plus the new `after.rs`. Confirmed: `Print`,
`print`, `anchor_of`, `Shifts`, `Excluded`, `watched_files`, `tokens_match`,
`first_difference`, `check/ledger.rs` (not in the diff at all — zero
changes) and the parse-diagnostic comparison in `verify_move` are
byte-identical in logic; the diff only threads a `&mut VerifyTrace`/
`Stage::measure` through the same call sequence and replaces the inline
`rebuilt_index`/re-`analyze` block with calls to `after::{after_index,
after_print}`. No comparison changed; only where a `Semantics`/index comes
from did.
**Pre-existing verifier attacks, re-run.** `check::tests`' `tokens_match`
pairs (8), `check/ledger.rs`'s ~19 `_is_rejected`/`_is_refused` tests,
`removing_an_import_a_reference_needs_is_rejected`,
`crates/vlog_refactor/tests/rename.rs`'s ~15 refusal tests — all still
refuse (covered by the full-workspace green run above; spot-ran
`check::ledger::tests` and `tests/rename.rs` individually too, both clean).
**Sabotage, in a fresh clone (`sabotage-clone`, `git diff` patch applied +
untracked files copied — verified `git status --porcelain` matched the
working tree before any sabotage) — each reverted immediately after and
`vlog_refactor --lib` re-run clean (135/135) to confirm the revert:**
- **(i) stale retained analysis for an edited file.** Forced `after_print`
to always take the retained/before-edit analysis, even for edited files
(`let _ = edited; { scope.against(i, index)... }`). Result: **4 tests
failed** — `a_rename_parses_each_input_file_once_and_each_edited_file_once_more`,
`the_traced_rename_and_the_plain_one_are_the_same_call`,
`the_trace_accounts_for_every_parse_the_rename_ran`, and (for a revealing
reason) `a_rename_that_would_make_a_third_files_use_ambiguous_is_refused`
— whose "an unclaimed name still renames" half now fails because *every*
edited-file rename refuses. The dev's own named target test
(`a_rename_whose_edit_rebinds_a_name_in_the_edited_file_is_refused`)
still shows `ok`, but only because the sabotage's collateral over-refusal
masks the narrow capture case — not proof of that one check in isolation.
**Finding, not blocking:** the target attack test alone is not a clean
isolation test for this sabotage; the *real* signal is the 4-test
collateral failure, which is unambiguous. Recommend the dev split
"capture inside the edited file" from "index/print machinery" more
finely if this needs a sharper single-assertion pin later — not required
for this lane's merge.
- **(ii) after-index forgetting facts.** Two variants: (a) literal reading
of the brief — `index.absorb(records, &edited_paths_as_gone)` — is a
**no-op** (`gone` is dropped, then the same paths are immediately
reinserted from `records`); all tests still pass. This is a finding: the
brief's literal phrasing does not describe a real bug in this API's
semantics. (b) the doc comment's own named rejected alternative — drop
every *unedited* file from the cloned index before absorbing (`gone` =
every in-scope path not in `edited`) — **fails 2 tests**:
`an_absorbed_after_index_is_the_index_a_rebuild_would_give` and
`absorbing_an_edited_file_keeps_every_file_id`, both immediately and
clearly. The dev's named target,
`a_rename_that_would_make_a_third_files_use_ambiguous_is_refused`, still
passes under this sabotage too — traced why: dropping `b.sv` entirely
makes `use.sv`'s `taken_pkg::V` resolve unambiguously to the wrong
file (`a.sv`, freshly re-added) instead of ambiguously, and the
resolution-identity check's anchor comparison catches *that* difference
independently (defense in depth) — a legitimate positive finding, but it
means the "third file" test is not the one that actually detects index
forgetting; the fingerprint/rebuild-equality tests are. Recommend the
README's claim ("an after-index built from the edited files alone... —
would have forgotten the third file's declaration") cite
`an_absorbed_after_index_is_the_index_a_rebuild_would_give` as the pin,
not (only) the third-file rename test.
- **(iii) print keyed by FileId, not path.** `anchor_of`'s
`index.path(def.file)` replaced with `PathBuf::from(format!("#{}",
def.file.0))`. Fails exactly and only the named target,
`a_print_names_paths_so_shifted_file_ids_cannot_change_it`, cleanly (left
`"#0"`, right `"#1"` for the same file across two indexes with an
inserted-first file). Precise, as predicted.
**Two attack pairs of my own**, added to the sabotage clone (not merged;
disposable), both pass on the real code:
- `qa_after_print_of_an_edited_file_reflects_its_own_edited_text` — an
ordinary one-file rename's returned edits must rename *both* the
declaration and the use; passes.
- `qa_a_file_retained_only_by_the_substring_rule_never_changes_the_answer`
— a third file (`third.sv`) spelling `outsig` (contains `sig` as a
substring, never as a whole word: `contains_word(THIRD, "sig")` is
false, `THIRD.contains("sig")` is true) is retained by
`Scope::build_keeping`'s substring rule but excluded from
`watched_files`'s whole-word rule. Confirms by direct assertion (not just
reasoning) that its presence, retained or entirely removed from the
workspace, produces byte-identical edits and warnings — the superset
claim (retained ⊇ watched) holds and is harmless where it is a strict
superset. Passes.
- Adversarial after-index case of my own, in `check/after.rs`'s test
module: `qa_an_edited_file_that_declares_a_name_another_file_already_has_is_ambiguous_like_a_rebuild`
— editing `sub.sv` to add a *second* `package pkg;` (an unrelated file,
`pkg.sv`, already declares `pkg`) and asserting the absorbed after-index
reports `pkg` exactly as ambiguous as a full rebuild does (fingerprint +
file list + per-name `answers()` all equal). Passes — `absorb`'s
`merge(None)` is a full re-derivation by construction, so this holds by
the same argument `an_absorbed_after_index_is_the_index_a_rebuild_would_give`
already pins, but it is now pinned on this specific adversarial shape too.
**4. Parse-count formula, sabotaged.** Re-added a redundant
`parse_source_tolerant(text)` call inside `Scope::analysis` unconditionally
(even when `kept.remove(&i)` would hit). `a_rename_parses_each_input_file_once_and_each_edited_file_once_more`
fails immediately: `left: 14, right: 10` (the `K+E=10` formula breaks the
moment `locate`/`edits` stop being free). Reverted; test green again.
**5. Fingerprint/FileId proofs.** Read
`an_absorbed_after_index_is_the_index_a_rebuild_would_give` (9 cases) and
`absorbing_an_edited_file_keeps_every_file_id` — both sound, both already
covered above under sabotage (ii-b), which is exactly the sabotage these
two tests are built to catch. Added my own 10th adversarial case (above,
"an edited file that adds a second declaration of a package already
declared elsewhere"); passes.
**3. Wire parity, old vs. new — 8 `renametrace` rows + 5 of my own.** Built
`dafa4f0` (pre-P2, post-P1c) release server in the disposable clone; ran
`tools/perf/phases_p2.py`'s `renametrace` phase against it and against the
candidate `target/release/lucisv-server` (sha256
`1601b13a9bacda47095cb23580e475ac8f33a171f446875484439ec67d58eb31` —
**matches the tracker's P2c entry exactly; no rebuild performed**, satisfying
item 7's binary-identity check for the re-measurement below too). All 8
rows' fingerprints and refusal sentences byte-identical between the two
binaries and equal to the tracker's REF/P2a-c values: `b39defb21265…`,
`fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…`, and the shared refusal
fingerprint `96f32d4243b1…` on all three refusal rows plus the no-symbol
row's message. Candidate-side trace fields also reproduce the tracker's
numbers exactly (tail: parses 240 = 238+2, `rungs_declaration=95
rungs_reference=122 rungs_instantiation=19`; `clk_i` fallback: 3977 parses,
fallback=true, selected=3976).
Five renames of my own (`tools/perf`-style script, run from the QA
scratchpad, not committed to the dev's tree): a **port**
(`entropy_clearing_ack_i` in `aes_core.sv`, connected from `aes.sv`), a
**parameter** (`SecStartTriggerDelay`, used in `aes.sv`/`aes_control.sv`/
`aes_core.sv`), a **package member** (`aes_pkg::AES_OP_WIDTH`, used from
`aes_cov_if.sv`/`aes_core_fi_vseq.sv`), a **module with many
instantiations** (`prim_flop_2sync`, the 128-file fan-out cursor from
`sites.FANOUT_CURSORS`), and a **name inside a generate block**
(`delay_cntr_q` in `tlul_delayer.sv`'s `gen_delay_logic` block). All 5
succeeded (no refusals) on both binaries and all 5 fingerprints are
byte-identical HEAD vs. candidate.
`git -C ~/repo/opentitan status --porcelain` checked after every phase
(the 8-row runs ×2 binaries, the 5-row runs ×2 binaries, the P0-run for
per-crate test counts does not touch opentitan): unchanged, always exactly
the three pre-existing modified files.
**6. Memory, re-taken on the candidate.** `clk_i` fallback peak RSS:
**1574 MiB** (mine) vs. the dev's P2c **1830 MiB** — lower, not higher (no
"exceeds by >10%" concern; if anything the gap the other way is larger than
10%, plausibly host load variance between runs — flagged, not blocking,
since "lower" cannot itself be a corruption or perf regression). Tail
rename peak RSS: **584 MiB** (mine) vs. dev's **593 MiB** — within 2%.
Neither approaches the 8 GiB guard (fallback is 19% of it).
**7. Re-measured on the P2c binary.** Binary confirmed byte-identical to
the tracker's P2c entry by sha256 (above) — no rebuild. `renametrace`'s
ms medians on my run: tail 421.0 (dev 419.9, +0.3%), `aes` 106.8 (dev
106.3, +0.5%), `clk_i` fallback 3882.7 (dev 3860.1, +0.6%) — all within
±10%, fingerprints identical (above). Did not re-run `tailrename` /
`rename` / `blockers` / `refactor` / `execute` as separately-named `bench.py`
phases beyond `renametrace`'s own tail/`aes` rows and the fingerprint
survey in item 3, given time budget; the tracker's own P2c figures for
those rows are independently corroborated by the traceability check below
(item 8) reading the same raw evidence files the dev's prose quotes.
**8. Traceability — 15+ numbers cross-checked against
`~/.cache/lucisv-perf/take5-p2/*.jsonl` directly (not just the README's
prose):** `results-p2a.jsonl`'s tail row: `trace_parses_index=238,
trace_parses_locate=1, trace_parses_edits=134, trace_parses_rebuild=238,
trace_parses_after=106`, summing to **717**, matching `trace_parses=717`
exactly. `results-p2c.jsonl`'s tail row: `238+0+0+2+0` = **240**, matching
`trace_parses=240`. `results-probe-updatefacts.jsonl`'s
`trace_verify_rebuild`: tail 53.3, `aes` 40.2, `clk_i` 400.9 — exactly the
"two `update_facts`" numbers the README's P2c work-log quotes.
`results-p2c.jsonl`'s own `trace_verify_rebuild` for the same three rows:
37.2, 23.4, 269.7 — exactly the "one `absorb`" numbers the same paragraph
quotes. All eight `renametrace` fingerprints (item 3). The P2c sha256
(item 7/3). Stage-sum arithmetic (this item). That is 8 (fingerprints) + 6
(rebuild-cost pairs) + 1 (sha256) + the two parse sums = well over 15
independent numbers, all reproduced from the raw `.jsonl`, not taken on
faith from the README's prose.
**9. The `--verbose` trace line.** Ran the tail rename twice from a
disposable script: once with `verbose=False` (0 `timing: rename trace`
lines in `window/logMessage`), once with `verbose=True` (exactly 1 line,
419 characters, no embedded newline, fields in the documented order).
Confirms the line is verbose-gated and single-line as claimed.
**Guard / resource notes.** Every `cargo` command and every server session
above went through `tools/guard.sh -m 8 -t 1800`. **Zero guard kills**
across the whole QA pass. No `cargo` command ran concurrently with a timed
phase (checked `ps` before each; the one background `cargo build --release`
for the HEAD comparison binary completed before any timed harness run
started). Peak RSS on every row stayed far under the 8 GiB limit (worst
case ~1.6 GiB).
**Verdict: PASS**, for P2a/P2b/P2c only. Findings above are non-blocking
(one documentation-structure slip, two notes about which existing test
actually pins which sabotage class, one note that the dev's cited
literal-`gone` sabotage reading is a no-op) and are recorded for the lead
and for whoever picks up P2d/handshake 33 next, not required fixes for this
merge. Handshake 33 and P2d remain open and are not judged here.
### 2026-09-07 — QA (Sonnet, second lane: handshake 33 and §P2d)
**Scope.** TODO §60.2's second lane only: handshake 33, §P2d's census/ruling,
and the `warnings` dedupe. P2a/P2b/P2c are the prior QA pass's and not
re-judged. Read CLAUDE.md, `docs/topo.md` row 33, `docs/performance_take5.md`
§P2 ("Correctness prerequisite", "P2d: narrow only with a proof"), this
README's second-lane work log in full, `docs/features/extract-inline-module/
README.md`'s QA-3 (the case that filed handshake 33), `docs/features/
hierarchical-tail/README.md` (§49, `fold_path`/`follow_paths`/`member_unit`),
`docs/perf/take5-tracking.md`'s H33/P2d/P2d-W rows and experiment records, the
working-tree diff (`state.rs`, `inline_module.rs`, `rename_trace.rs`,
`module_select.rs`, `server/tests/hierarchy_reach.rs`,
`rename/warnings.rs`), and the evidence in `~/.cache/lucisv-perf/take5-p2/`,
`take5-p2d/` and `take5-p2w/`.
**1. Gates, guarded, main tree.** `tools/guard.sh -m 8 -t 1800 -- cargo fmt
--all -- --check`: clean. `cargo clippy --all-targets`: clean (workspace
variant also run); `git diff | grep '#\[allow'` — zero hits, no new `#[allow]`
anywhere. `cargo test --workspace`: **4250 passed, 0 failed**, matching the
dev's claim exactly; zero guard kills.
Baseline: full `cargo test --workspace` in a disposable clone at HEAD
`e51a2c7` (before this lane) — **4231 passed, 0 failed** (ties out exactly to
the prior QA pass's own recorded HEAD baseline). Per-binary deltas, all
growth, none dropped: `lucisv_server` unittests 1547→1564 (**+17**: twelve
tests in `hierarchy_reach.rs`, four in `module_select.rs`, one in
`rename_trace.rs`'s own test module — `the_census_counts_only_the_files_
that_write_neither_name`); `vlog_refactor` unittests 135→137 (**+2**:
`the_shared_scan_says_exactly_what_the_per_scan_one_did`,
`a_comment_and_an_unlexable_file_are_warned_about_by_neither_scan`); every
other binary unchanged. 4231+17+2 = 4250, ties out exactly — matches the
dev's own H33 record (4231→4248) plus the later warnings-dedupe round's +2,
which the H33 record predates. No test was quietly removed.
Note: the disposable HEAD clone (a plain `git clone --local`, no submodule
recursion) has no `corpus/` directory, so `vlog_refactor`'s `tests/corpus.rs`
silently skips its real-RTL trials there (still reports "passed", just does
no work — confirmed with `--nocapture`, "corpus/ not checked out —
skipping"). This does not affect the test-count comparison (skip vs. full
run is still one passing test each), but it means that specific baseline run
is not a timing comparison; the main tree's own `cargo test -p vlog_refactor
--test corpus -- --nocapture` was run separately and reproduces the
extract-inline-module README's established corpus numbers exactly (**5
inlined, 9 refused**; **5 regions extracted, 6 refused**), confirming
handshake 33's added rung changes nothing in the existing corpus trial's
outcome.
**Line counts** (non-blank, non-comment, before the outer `#[cfg(test)]`):
`module_select.rs` **24** — matches exactly. `rename/warnings.rs` **430** —
matches exactly. `state.rs` `git diff --numstat`: 28 insertions / 3 deletions
= **net +25**. Read every added line: two `use` lines, the one-line
`module_sources` delegation shim, the new `module_sources_reaching` function
signature plus an 11-line doc comment, the unchanged four-rung body now
seeded from `hierarchical_users(...)` instead of `BTreeSet::new()`, the
3-line `indirect_census` call plus its 3-line comment, and the `.into_keys()`
swap. No selection-logic line for the four existing rungs changed. Nothing
over 600 among the changed/new files; `state.rs`'s pre-existing total
(5570 lines) is the already-documented CLAUDE.md exception (TODO §55), not
something this lane made worse in kind.
**2. HANDSHAKE 33 — attacking "the census is a superset of every file
`no_hierarchy` can refuse from".** Read `inline/mod.rs::no_hierarchy`
(refuses when a handed file's token stream has a plain `Ident` token with
`text == site.instance`, adjacent to `.` or `bind`) against
`vlog_semantic::words::harvest` (unions every plain `Ident`/`SystemIdent`
token not starting with `\`, plus identifier-shaped words split out of raw
text — macro invocations, directives, attributes). The claim holds by
construction: every token `no_hierarchy` can match is a plain `Ident`
token, and `harvest` puts every plain `Ident` token in the census, so the
census cannot omit a file `no_hierarchy` could refuse over. It can only be
a *superset* (raw-text mentions with no matching `Ident`, e.g. the macro-body
case) — which only ever adds files, never a correctness gap.
Built a disposable clone (`scratchpad/qa-p2d/clone`, `git apply` of the
working-tree diff plus the two new untracked files — `git status --porcelain`
confirmed byte-for-byte identical to the working tree before any QA edit) and
added **seven** attack tests to `hierarchy_reach.rs`, each comparing
`ws.module_sources_reaching(...)` (the narrowed set) against `ws.sources()`
(the whole workspace) through the real `vlog_refactor::inline_module` engine,
run twice as `the_selected_set_answers_the_inline_exactly_as_the_whole_
workspace_does` already does for its six shapes:
| Case | Shape | Result |
|---|---|---|
| (a) macro defined in file B, invoked in file C | `` `define`` in `defs.sv`, `` `include``d and invoked in `tb.sv` | **parity** — both inline cleanly (no `Ident` token spells `u_sub` in either file) |
| (b) `$root`-anchored path | `$root.tb.u_wrapper.u_top.u_sub.s` | **parity** — both refuse, same sentence |
| (c) `bind` target built from a macro argument | `` `define ATTACH(path) bind path checker_m u_chk(...)``, invoked with the full XMR path as the argument | **parity** — both accept (no plain `Ident` token spells `u_sub`; the whole path is inside one macro-invocation token, the documented residue shape) |
| (d) negative control: name only in a string/comment | `// ... u_wrapper.u_top.u_sub.s` and `$display("u_wrapper.u_top.u_sub.s")` | **parity** — both accept, neither refuses |
| (e) escaped identifier `\u_sub ` | `\u_sub .s` | **parity** — both accept; independently confirmed the census does **not** select the file on this mention (`harvest` excludes tokens starting with `\`, matching `no_hierarchy`'s exact-text-match requirement) |
| (f) generate-block label path directly on the instance | `u_wrapper.u_top.gen[0].u_sub.s` | **parity** — both refuse, same sentence |
| (g) sabotage: `hierarchical_users` disabled (`Reach::none()` in place of the real reach) | the three-level `bind` fixture (`sva.sv` instantiates nothing in the chain) | **the corrupting inline is silently accepted** without the rung, and correctly refused with it — proving the rung is load-bearing for exactly the shape handshake 33 names |
All seven pass (`cargo test -p lucisv_server --bin lucisv-server hierarchy_
reach` — 19/19 including the dev's original twelve). Read
`the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does`
directly: confirmed it really does call `vlog_refactor::inline_module` twice,
once over `narrowed` and once over `ws.sources()`, and asserts the `.edits`
equal — not a cost or count comparison.
**Verdict: the superset claim holds.** No case above found a file the whole
workspace refuses over that the narrowed set misses. Case (g)'s sabotage is
the direct proof the instructions asked for: an empty reach set does let the
three-level `bind` corruption through, exactly the class of bug the rung
exists to close.
**3. The transitive-instantiator walk — independently confirmed weaker.**
Rather than reimplement the dev's discarded 15-line walker, probed the same
index API it would use directly (`WorkspaceIndex::instantiations_of`), added
as `module_select.rs::qa_transitive_walk_probe`: `instantiations_of("top")`
on the ladder-with-bind fixture returns exactly `["wrapper.sv"]` — `sva.sv`
never appears as an instantiator of `sub`, `top`, `wrapper` or `chk` anywhere
in the index, because a `bind` is not an instantiation edge. Since any walk
bounded to climbing instantiation edges can only ever reach files that
appear in some `instantiations_of(...)` list, and `sva.sv` appears in none of
them, **no instantiation-edge walk, at any depth, can reach `sva.sv`** — this
is not an implementation accident of the discarded walker, it is structural.
**Verdict for the lead's topo strike: confirmed.** Row 33's requested rung is
provably weaker than the shipped one for this refusal; the strike text below
reflects that.
**4. Cost bound.** Re-ran `execute` at `aes_wrap.sv` 66:2 on the exact
release binary already in `target/release/lucisv-server` (sha256
`18ef6d60c54897d9512c3f98653db0c3c2e7b610ffee50801eb5444f2ce9f03b` — **matches
the dev's candidate hash exactly, no rebuild performed**). Inline refusal
(`tlul_cmd_intg_gen`, the "uses a `generate` construct" sentence): median
**~5.52 ms** (tries 5.542/5.520/5.490/5.593, first excluded as warm-up)
against the dev's claimed 6.55 — a small absolute delta (~1 ms) at
millisecond scale, plausibly host-load noise; flagged as non-blocking rather
than a regression since the fingerprint/refusal-sentence identity is what
actually matters here and both are unchanged. Extract capture fingerprint
`090e92e7736e0a5a93557d75befa65a5bea0c2f44494d71dc67e3f8d70d05835` —
**byte-identical** to every prior round's. `ports::code_actions`/`extract`
pass `Reach::none()` by reading (`module_sources` is literally
`module_sources_reaching(file, modules, Reach::none())`, and the diff shows
no other call site of the four-rung path); `the_four_rung_selector_answers_
exactly_what_it_did_before` (dev's test, re-read and re-run) pins their
answer as a list equality, not a count, so no file could silently appear.
**5. §P2d CENSUS — "cannot be dropped", tested by experiment.** Rather than
trust the `fold_path`/`member_unit` argument by reading alone, reproduced the
dev's own two-level-tail fixture
(`a_nested_cross_file_hierarchical_tail_is_renamed_through_both_hops`:
`leaf.sv` declares `sig`, `mid.sv` instantiates `leaf` as `u_b`, `top.sv`
reads `u_a.u_b.sig` where `u_a` is `mid`) as a new integration test
(`qa_census_drop.rs`) and **dropped `mid.sv` entirely** from the file set
handed to `vlog_refactor::rename` — `mid.sv` writes neither `sig` nor
`signal`, exactly a §P2d "indirect" (instantiation-rung) file.
Result: **the tail edit is silently lost.** With `mid.sv` present, `top.sv`
is edited to `u_a.u_b.signal` (control, matches the existing pinned fixture
exactly). With `mid.sv` dropped, `top.sv` comes back **completely
unedited** — the rename still succeeds (no refusal) but the multi-level tail
reference is left with the old name, a silent missed edit precisely of the
shape the README's `StillUnresolved` argument predicts (`member_unit(mid,
u_b)` has nowhere to come from once `mid.sv`'s declaration is out of the
scope entirely). This is a minimal, direct reproduction of the mechanism
argued in the work log rather than the full opentitan-scale sabotage-and-
rerun (which would need a sabotaged `rename_sources_traced` wired through a
live server session against the tail-rename site — out of this pass's time
budget); the mechanism-level proof is unambiguous and matches the argument
exactly.
**Verdict: the "no narrowing shipped" ruling is correct and now doubly
supported** — by the dev's `fold_path`/`follow_paths`-tracing argument and by
this independent experimental reproduction of its predicted failure mode.
**Census numbers, cross-checked against the live re-measurement (below):**
the `renametrace` trace line's own `indirect_reference=113`,
`indirect_instantiation=19`, `indirect_open=1` sum to **133**, and
`rungs_reference=122`/`rungs_instantiation=19` match the README's per-rung
counts exactly — read directly off my own re-run's raw JSON, not taken from
the README's prose.
**6. WARNINGS DEDUPE — re-attacked.** Ran `the_shared_scan_says_exactly_
what_the_per_scan_one_did` and `a_comment_and_an_unlexable_file_are_warned_
about_by_neither_scan` (both pass). Read `Scope::warnings_reference`
(`#[cfg(test)]`, five separate loops, each scan building its own `FileScan`)
against `git show e51a2c7:crates/vlog_refactor/src/rename/warnings.rs` — the
old `warnings()` before this round is exactly five loops with no `FileScan`
at all (`macro_warnings`, `macro_use_warnings`, `sva_fallback_warnings`,
`unresolved_candidate_warnings`, `unaccounted_warnings`, each tokenizing
independently); `warnings_reference` is that same control flow with a
freshly-defaulted `FileScan` handed to each call, which is the honest
"as it was" oracle it claims to be.
Added two of my own fixtures to the equality table:
1. **Two scan groups firing from one file** — a `` `define`` naming the old
name *and* an SVA fallback spelling it, both in the same file. Both scans
read the same file's shared `FileScan` inside one loop iteration without
one borrow clobbering the other; `shared == reference` holds and both
expected sentences appear.
2. **An edited file that also carries an unresolved candidate** of the old
name — exercises the edited-file scan (`unaccounted_warnings`, run after
the four-scan loop, reading the *kept* `FileScan` from the `HashMap`)
alongside `unresolved_candidate_warnings` (run inside the loop) on the
same file. `shared == reference` holds.
**Sabotage.** Reordered the concatenation (`fallbacks, defines, macro_uses,
unfinished` instead of the real `defines, macro_uses, fallbacks,
unfinished`) on the "every shape, two files edited" fixture, which fires
several scan kinds at once: the sabotaged output **differs** from the real
`warnings()` output, confirming the order assertion is load-bearing and the
existing tests would have caught a real reordering bug.
**The macro-words gate, constructed directly rather than only read.** Built
`` `uvm_info("state_q", $sformatf("state_q=%0d", val), UVM_LOW) `` with
`state_q` appearing **only** inside quoted runs of the macro invocation (a
separate plain declaration/use of `state_q` elsewhere, outside any macro,
for the rename target) and confirmed: `macro_argument_sites` still reports
the site and the resulting `warnings()` call still emits the "arguments of
the macro invocation" sentence — **and** `vlog_semantic::words::harvest_raw`
on the same text does **not** contain `"state_q"` at all (it walks the same
raw tokens but skips every double-quoted run). This is the exact
non-equivalence the doc comment on `macro_argument_sites` claims: gating on
`files_naming_in_macros` (`harvest_raw`) would have silently dropped this
warning. Confirmed by direct construction, not only by reading the
reasoning.
**7. Wire parity re-run.** `~/.cache/lucisv-perf/take5-p2w/warnparity.py`'s
two dumps (`warnings-head.jsonl`, `warnings-p2w.jsonl`) — `diff` clean,
identical sha256 (`4ec83625df46185bfe19fe19a55bb7e25185bb944f91cb431def63
edd6618f85`) on both, 189541 bytes each. Parsed independently: **13/13 rows**,
tail rename **217** warnings and `clk_i` fallback **652** warnings, both
exactly matching the README's quoted counts, in arrival order. This already
covers all 13 renames (the 8 `renametrace` rows plus the 5 QA-chosen sites),
which is more than the requested 6-of-13 spot check.
**8. Re-measurement on the candidate binary.** `target/release/lucisv-server`
sha256 `18ef6d60c54897d9512c3f98653db0c3c2e7b610ffee50801eb5444f2ce9f03b` —
**matches the dev's stated candidate hash exactly; no rebuild performed.**
`git -C ~/repo/opentitan status --porcelain` checked clean (exactly the
three baseline files) before and after every phase below.
| Row | dev's figure | my re-measurement | within ±10%? |
|---|---:|---:|---:|
| `tailrename` (median of 3 takes, this run) | 387.95 | 368.5 / 387.0 / 367.3 | yes |
| `renametrace` tail (5 tries, first excluded) | 395.45 | median 369.1 | yes |
| `rename` (`aes`, 4 tries, first excluded) | 91.79 | median 90.4 | yes |
| `blockers` (`rename on aes`, mean of tries 2–3) | 115.91 | mean 113.97 | yes |
| `renametrace` `clk_i` fallback | 3478.44 | median 3286.5 | yes (5.5% under) |
| `execute` inline refusal (`tlul_cmd_intg_gen`) | 6.55 | median 5.52 | borderline (~16% under; ~1 ms absolute, flagged non-blocking) |
| `execute` extract capture | 148.78 (fingerprint check) | fingerprint identical | n/a (fingerprint, not timing, is the pin) |
Fingerprints on every `renametrace` row: `b39defb21265…`, `fa7e31c78382…`,
`5f53e977da59…`, `31aadc134628…`, and the shared refusal `96f32d4243b1…` on
all three refusal rows — **all byte-identical**, read directly from my own
run's raw JSON. `tailrename`'s trace fields on my run: `parses=240`
(238+2, `K+E`), `indirect_reference=113`, `indirect_instantiation=19`,
`indirect_open=1` (sum 133/238 = 56%) — matching the census exactly.
`warnings` stage: tail 48.5 ms (dev 51.4), `aes` 8.1 ms (dev 8.3) — both
close, confirming the dedupe's effect reproduces on an independent run.
**9. Traceability — 15+ numbers, cross-checked against raw evidence (not
README prose):** the `warnparity.py` dumps' sha256 and byte count (2); tail/
`clk_i` warning counts 217/652 (2); all 5 distinct `renametrace` fingerprints
+ the shared refusal fingerprint (6, item 8 table); the H33 measured-site
fingerprint `090e92e7736e…` (1); the candidate binary sha256
`18ef6d60c548…` (1, confirmed via `shasum` on the actual file, not asserted);
`module_select.rs` (24) and `warnings.rs` (430) production-line counts (2);
`state.rs`'s `git diff --numstat` 28/3 (1); the census's `indirect_
reference`/`indirect_instantiation`/`indirect_open` = 113/19/1 (3, from my
own live re-run's raw JSON) summing to 133. That is 18 independent numbers,
all reproduced from raw evidence or freshly measured, not taken on faith
from the README's prose.
**Guard / resource notes.** Every `cargo` command and every server session
above went through `tools/guard.sh -m 8 -t 1800` (shorter local timeouts used
for quick unit-test iterations, still guarded). **Zero guard kills.** No
`cargo` command ran during any timed phase. `git -C ~/repo/opentitan
status --porcelain` showed the same three baseline files after every single
phase in this pass, including the census-drop and attack-test compilations.
**Findings, all non-blocking:**
1. The `execute` inline-refusal row's re-measurement (~5.52 ms) is about
16% under the dev's 6.55 ms — a ~1 ms absolute gap at a very small
timescale, most plausibly host-load noise given every other row lands
comfortably within ±10%. Not treated as a regression; the fingerprint and
refusal sentence (the actual correctness/cost-bound claim) are unchanged.
2. A disposable `git clone --local` (no `--recurse-submodules`) silently
drops the `corpus/` directory, so `vlog_refactor`'s corpus integration
tests report "passed" there while doing no real work. Does not affect any
test-count comparison in this pass (confirmed with `--nocapture`), but
worth the next QA lane knowing before trusting a bare local clone's
corpus-trial *timing*.
**Topo strike text recommended for the lead (row 33):** the row's wording
("Wanted: a transitive-instantiators rung ... in `module_sources`") should be
struck and replaced with a note that the *shipped* rung is
`WorkspaceIndex::files_mentioning` (the instance's word census), which is
independently confirmed **strictly stronger** than the requested
transitive-instantiator walk for this refusal — the walk cannot, by
construction, reach a file that names the instance via `bind`/`$root`/a
macro-built path while instantiating nothing in the chain (§3 above), a case
the census both selects and does not need to selectively refuse (`no_
hierarchy`'s own lexical scan handles the refusal decision). Closed, no
follow-up rung needed for handshake 33 itself.
**Verdict: PASS.** Handshake 33's superset claim held under seven attack
cases including a load-bearing sabotage; the topo row's requested rung is
confirmed structurally weaker than the shipped one; §P2d's "cannot be
dropped" argument was reproduced experimentally, not just read, and the
"no narrowing shipped" ruling stands; the `warnings` dedupe survived two new
equality fixtures and a concatenation-order sabotage, and the macro-words
gate's non-equivalence was constructed directly, confirming it was correctly
not taken; wire parity holds over all 13 renames; every fingerprint on every
re-measured row is byte-identical to the reference; every timing is within
±10% except one small-absolute-value row flagged as noise. Two non-blocking
findings recorded above for the lead.
## Review
**2026-09-07 (lead, P2a–P2c).** Accepted. Read `scope.rs`'s assemble /
`build_keeping` / `against`, `check/after.rs` and every hunk of
`check/mod.rs`, `trace.rs`, `rename_trace.rs`, the tracker's three
experiment entries and both logs; QA's independent HEAD baseline (4215 →
4231, no test dropped) and its wire parity over thirteen renames are the
acceptance.
- P2a is the finding that shaped the rest: "2 files" was 238 input files,
4.55 MB and 717 whole-file parses, two thirds of them repeated — one
`WorkspaceIndex::build` over 238 files twice, and every watched file
twice more. The trace makes that visible on the `--verbose` channel and
nowhere else, which is the right place.
- P2b/P2c are the boring version of the fix: the index build hands back
the analysis it already made (`FileFacts::analyzed`, `of` = `.0` so no
drift), the request's own file is analysed first so the cursor's name is
known before the rest are parsed, retention is a cache and never an
oracle, and the after-index is the before-index plus the edited files'
absorbed records. Every hunk in `check/` moves an input; no comparison
changed, and the three new attack pairs plus QA's two say so. K + E
parses, asserted from the trace, is the invariant the next round inherits.
- Target: tail rename 780 → 420 ms (1.86× against the 2× goal, short by
30 ms); the remaining 225 ms is one parse of each of the 238 *selected*
files, so the lever left is the selection — P2d, behind handshake 33, in
its own lane. `aes` rename −25%, both resolves −20%, the extract
capture −39%; the `aes_wrap.sv` extract refusal unchanged because it is
selection (a package name's `module_sources`), the same lever.
- QA's non-blocking findings noted: attack (i) is caught by collateral
refusals rather than by its named test alone, and attack (ii)'s literal
form is a no-op while its stronger form fails the pinning tests — both
are defence in depth working, and the named tests stay as the pins.
- Memory: peak RSS moved by less than 20 MiB everywhere and fell on the
two heaviest renames; the fallback stays at 1.8 GiB, the number P2d
should also bring down.
- Deviations accepted: the trace as an out parameter (refusals traced
too), the collapse of the untraced wrappers, the two touched files
outside the list (`perf.rs` call sites, one `mod` line).
Docs applied at merge: topo edges (1)–(4) from Handshakes.
**2026-09-07 (lead, second lane: handshake 33, P2d, the warnings
dedupe).** Accepted. Read `module_select.rs`, the `state.rs` hunks, the
inline caller, the census in `rename_trace.rs`, the `warnings.rs` diff
with its `FileScan` and the retained reference control flow, the three
experiment entries and QA's second log.
- Handshake 33 closed with a rung that is *stronger* than the one the row
asked for, and the argument is the kind I want: the refusal keys on a
file's tokens writing the instance name beside a `.` or a `bind`, the
word census is exactly the set of files that can, and the proposed
transitive walk was implemented, shown to miss a `bind` from a file
that instantiates nothing in the chain, and dropped. Opt-in, so the
cursor-move paths pay nothing. Topo row 33 struck with that text.
- P2d's answer is "no, and here is why", which is the plan's own rule
("narrow only with a proof") working in the negative direction: 133 of
the 238 selected files write neither name but are the container files
a multi-level tail folds through; drop one and a resolved tail goes
`StillUnresolved` (a missed edit) or a two-path reference falls onto
the target (an extra edit). QA reproduced the missed edit on the
fixture. The target-scoped selector (fan out from the one declaration
the cursor resolves to) is the remaining lever and is filed for loop 3
with its shape list; it needs the whole-scope oracle this lane
described and did not build.
- The `warnings` dedupe is a pure memo of two functions of the file text,
pinned against the old control flow as a list oracle over 15 fixtures
and by the raw `logMessage` dumps of thirteen renames (217 and 652
warnings, byte-identical). The macro-words gate was correctly refused:
a name inside a quoted macro argument is a warning the census cannot
see. **The tail rename is 388 ms against 780 — 2.01×, the plan's
target met**; `Scope::build`'s one parse per selected file is 60 % of
what is left.
- Deviations accepted: the rung's opt-in shape; `state.rs` +25 lines of
doc comment; the warning-list parity script living in the evidence
directory rather than `tools/perf/`.
Docs applied at merge: topo row 33 struck; `files_mentioning` edge; the
target-scoped selector added to the loop-3 list.
### 2026-09-07 — dev, P2b: one parse per file inside the scope
**The additive semantic API.** `FileFacts::analyzed(path, src) -> (FileFacts,
Semantics)` (`vlog_semantic/src/workspace/record.rs`). `facts_of`'s body is now
this function, and `facts_of` is `analyzed_facts(path, src).0` — so the record
cannot depend on which was called, and there is no second read-off to drift.
No codec change: nothing new is persisted and `FACTS_FORMAT` is untouched. The
approach the brief named first — rebuilding a record with
`FileFacts::from_analysis` — was rejected because that constructor needs the
token slice the parser consumes, so a caller would have to clone every file's
tokens to feed it; handing back the analysis the read-off already used costs
nothing and cannot disagree.
**The scope.** `Scope::assemble` replaces `WorkspaceIndex::build` with an
`IndexBuilder` loop over `FileFacts::analyzed`, so each file is parsed and
analysed exactly once and the analysis is *kept* rather than dropped.
`Scope::build(files)` keeps none — every existing caller (`ports`, `imports`,
`extract`, `inline`, `references`) behaves and costs exactly as before.
`Scope::build_keeping(files, lead, keep)` is the rename's: it analyses `lead`
(the request's own file) **first**, hands that analysis to `keep`, and retains
every file whose text `contains` one of the words `keep` names.
`Scope::analysis(i)` takes the retained `Semantics` when there is one and
parses otherwise, so **retention is a cache and never an oracle**.
**Why the lead-first ordering.** The words worth keeping are the new name and
the name under the cursor, and the cursor's name is only knowable from the
cursor file's analysis. Analysing it first makes that analysis the file's own
one-and-only parse instead of an extra one, which is what keeps the budget at
`K` rather than `K + 1`. The name is read with `rename_name_at` — the same
function the server's fan-out is built from, whose agreement with the target
the rename acts on is already pinned by
`the_name_a_fan_out_is_built_from_is_the_name_the_engine_acts_on`.
**Why a substring test and not `contains_word`.** `collect_occurrences`'
prefilter is `text.contains(&target.name)` and the verifier's watched set is
`contains_word`, which is a subset of it. Retaining on the substring rule
therefore covers every file either of them will ask for, and nothing else.
**Memory, which is why retention is not unconditional.** §P2a measured the
all-sources fallback (`clk_i`, 3 976 files / 35.8 MB) at **1 864 MiB** peak
while holding ~1 250 analyses. Retaining all 3 976 would have been roughly
0.8 MiB × 3 976 ≈ 3.9 GiB on top of the index — inside the 8 GiB guard but a
2× regression on a row that is already the worst. The `keep` rule holds the
retained set to exactly the files the request was going to analyse anyway, and
the measurement says so: the fallback's peak went **1 864 → 1 840 → 1 830 MiB**
across §P2a/§P2b/§P2c, and the `cipher_alert → clk_i` row **1 809 → 1 695 →
1 590**. No row's peak rose by more than 20 MiB.
**Measured** (release `e555e6c79d8d…`, repeat medians of four requests, load
5.1 → 3.8, corpus unchanged after every phase, zero guard kills). Tail rename
**781.7 → 676.6 ms**, parses **717 → 582** — `locate` 1 → 0 and the occurrence
walk 134 → 0. `aes` rename **140.5 → 122.6**, parses 51 → 38. Every fingerprint
unchanged.
**Tests.** `analyzed_gives_the_record_of_gives_and_the_analysis_a_caller_would_compute`
(`vlog_semantic/tests/workspace.rs`) — the record and its encoded form against
`FileFacts::of`, and the analysis against
`analyze(&parse_source_tolerant(src).0, src)`, over the crafted set the
existing `from_analysis` equality test uses (which is now a shared
`crafted_sources()`); `an_index_from_analyzed_facts_is_the_index_a_build_gives`
— fingerprint and file list. In `vlog_refactor`, four `scope::tests`:
the same index however it is assembled, a retained analysis equal to the
on-demand one file by file, the lead's analysis available to the retention
rule, and a lead outside the scope retaining nothing without failing.
### 2026-09-07 — dev, P2c: the after-index from unchanged facts
**New module `crates/vlog_refactor/src/check/after.rs`** (39 production
lines), holding the two functions that build the state after the edits, out of
`check/mod.rs` (**427 → 405** production lines) so each file keeps one
sentence.
- `after_index(scope, edited)` — the before-index **cloned and absorbed**, plus
the edited files' one new analysis each, handed back for their after-prints.
It replaces `rebuilt_index`, which was `WorkspaceIndex::build` over every
in-scope text.
- `after_print(scope, i, path, index, edited, excluded)` — the edited file's
own new analysis when the edits touched it, and otherwise the analysis the
before-pass already computed, re-resolved against the after-index
(`Scope::against`). It replaces the `analyze(&parse_source_tolerant(text).0,
text)` both `verify` and `verify_move` ran for **every** watched file.
**Every hunk changes an input, never a check.** `verify` still compares token
identity over each edited file, the before-print against the after-print for
every watched file, and (in `verify_move`) the comments/attributes ledger and
the parse-diagnostic count. `Print`, `print`, `Shifts`, `Excluded`,
`watched_files`, `tokens_match` and `first_difference` are untouched. The
refusal sentences are the same strings.
**`absorb` against `update_facts`, measured.** The plan warned that an
incremental-looking API may still rebuild global tables, and `absorb` does:
`merge(None)` clears every table and re-pushes from all records.
`update_facts` per record uses the restricted merge instead. It is **slower**:
the tail rename's rebuild stage was **37.2 ms with one `absorb`** and
**53.3 ms with two `update_facts`**, the `aes` rename's 23.4 against 40.2, the
`clk_i` fallback's 269.7 against 400.9 — the restricted merge walks the same
records and pays a name-set lookup at every declaration, which costs more than
the push it skips. `absorb` kept; the probe's rows are in
`~/.cache/lucisv-perf/take5-p2/results-probe-updatefacts.jsonl`. Either way the
parse saving stands: the after-index costs **E** parses, not **K**.
**Measured** (release `1601b13a9bac…`, repeat medians of four requests, load
5.2 → 2.8, corpus unchanged after every phase, zero guard kills).
| Row | §P0 REF | §P2a | §P2b | §P2c | vs REF |
|---|---:|---:|---:|---:|---:|
| tail rename (`tailrename`) | 780.45 | 784.19 | 674.68 | **419.86** | **−46.2 %** |
| `aes` rename (`rename`) | 141.30 | 140.15 | 123.08 | **106.31** | **−24.8 %** |
| definition behind the rename (`blockers`, mean of pipelines 2–3) | 161.33 | 156.48 | 141.64 | **121.85** | **−24.5 %** |
| connect missing ports resolve | 166.51 | 164.91 | 165.29 | **132.72** | **−20.3 %** |
| expand wildcard resolve | 71.89 | 70.31 | 70.29 | **54.91** | **−23.6 %** |
| extract command executed (`execute`) | 246.03 | 244.53 | 244.78 | **149.25** | **−39.3 %** |
| extract refused at `aes_wrap.sv` 66:2 | ~801 | 802.03 | 802.07 | **801.23** | **0 %** |
| organize-imports resolve | 9.45 | 11.99 | 11.18 | **8.51** | −10 % |
Whole-file parses on the tail rename: **717 → 240**, which is `K + E` =
238 + 2, asserted as a formula by
`a_rename_parses_each_input_file_once_and_each_edited_file_once_more`. On the
all-sources fallback: **10 399 → 3 977**. Every fingerprint on every row is
byte-identical to the §P0 REF's (`b39defb21265…`, `fa7e31c78382…`,
`4b534a16bca7…`, `8f3a26dd147b…`, `0ee027e37d07…`, `090e92e7736e…`), and the
three refusal rows carry the same sentences and the same empty-edit
fingerprint `96f32d4243b1…`.
**The target that was missed, and the stage that is left.** ≥2× on the tail
rename needed **390.2 ms**; the measurement is **419.9**, i.e. **1.86×**, short
by 29.7 ms. The trace says exactly where the remaining 418 ms is:
| Stage | ms | share | parses |
|---|---:|---:|---:|
| `Scope::build` — one parse of each of the 238 selected files | **225.1** | 54 % | 238 |
| `warnings` — a **token** scan of every file spelling the name | **83.3** | 20 % | 0 |
| `verify` | 73.0 | 17 % | 2 |
| … of which the after-index (clone + absorb) | 37.2 | 9 % | 2 |
| … before-prints | 14.0 | 3 % | 0 |
| … token identity | 4.5 | 1 % | 0 |
| … after-prints | 7.9 | 2 % | 0 |
| selection (server fan-out) | 13.4 | 3 % | 0 |
| `collect_edits` | 12.1 | 3 % | 0 |
| server + transport + position conversion | ~11 | 3 % | — |
**There is no duplicated parsing left to remove.** The 225 ms is the *first*
and only parse of each selected file, and the only way past it is to select
fewer files (§P2d, which is not this lane) or to hand the engine records the
server's own index already holds (a step §P2b's plan deliberately defers,
because file ids and the subset's resolution universe differ). The 83 ms of
`warnings` is `tokenize` + `LineIndex` per file that spells the name — not a
parse, already guarded by the same prefilter, and untouched by this lane.
**Tests.** `check::after::tests` — `an_absorbed_after_index_is_the_index_a_rebuild_would_give`
compares fingerprint, file list **and** a query-level print (`units`,
`references_to`, `instantiations_of`, `hierarchical_declarations`,
`workspace_symbols`) against a full rebuild on nine cases: an ordinary
one-file and two-file rename edit, a file that gains a declaration, one that
loses it and leaves a dangling use, an edit that changes what *another* file
resolves to, an edited package under a re-export chain, an `export`ed chain
losing its export, a module that stops being instantiated, and an edit that
makes a file stop lexing. `absorbing_an_edited_file_keeps_every_file_id` pins
id stability.
**The three new attack pairs**, aimed at the reuse itself:
1. `a_rename_whose_edit_rebinds_a_name_in_the_edited_file_is_refused` — an
edited file whose after-print came from the *before* analysis would describe
text that no longer exists. The rename gives `sig` the name of an existing
`taken` in the same file, which only a print of the **edited** text can
catch; it is refused.
2. `a_rename_that_would_make_a_third_files_use_ambiguous_is_refused` — an
after-index built from the edited files alone (or absorbed with a wrong
`gone`) would have forgotten the untouched `b.sv`. The rename renames
`a_pkg` to a package `b.sv` already declares, and the refusal is *about*
`use.sv`, which is neither edited nor mentioned by the edits. The same test
asserts an unclaimed new name still renames, so the refusal is not blanket.
3. `a_print_names_paths_so_shifted_file_ids_cannot_change_it` — the same file's
print against two indexes whose `FileId`s differ by one everywhere must be
the same print, so the comparison cannot start depending on the id stability
`absorb` happens to give.
Every existing verifier attack is untouched and still refuses:
`check::tests`' eight `tokens_match` pairs, the ledger attacks in
`check/ledger.rs`, `removing_an_import_a_reference_needs_is_rejected`, and the
rename refusals in `rename/tests.rs` and `tests/rename.rs`.
**Test counts.** 4 215 before this lane → 4 225 after §P2b → **4 231** after
§P2c; no test was removed or weakened. `cargo fmt --all -- --check` clean,
guarded `cargo clippy --all-targets` clean with **no new `#[allow]`**, guarded
`cargo test --workspace` green before each of the three release builds. No
`cargo` command ran during any timed phase; **zero guard kills**;
`git -C ~/repo/opentitan status --porcelain` showed the same three files after
every one of the nineteen timed phases.
**Deviations and things the lead should rule on.**
- `Scope::sources()` was deleted: `rebuilt_index` was its only caller.
- `crates/lucisv_server/src/perf.rs` (outside the brief's list) — two benchmark
call sites moved to `rename_traced` / `rename_sources_traced`, mechanical.
- `crates/lucisv_server/src/main.rs` (outside the brief's list) — one line,
`mod rename_trace;`, which is how the new module is reachable at all.
- **Not done, deliberately:** the extract refusal at `aes_wrap.sv` 66:2 is
still ~801 ms. It refuses immediately after `Scope::build`, so there is no
repeated analysis to remove; its cost is `module_sources` selecting hundreds
of files for a *package* name, which is the §P1 finding filed for §P2d and
handshake 33.
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->