Perf take 5 P2d (§60.2): handshake 33 closed by an opt-in word-census rung (module_select::hierarchical_users — stronger than the transitive walk, which cannot reach a bind from a file that instantiates nothing); the P2d census proves the 133 indirect files are container files a tail folds through, so no narrowing ships; the rename warnings stage lexes and indexes each file once (list-identical over 13 renames); tail rename 780 → 388 ms, 2.01×
ci / checks (push) Successful in 1m9s
ci / corpus (push) Successful in 34s

This commit is contained in:
lucio committed 2026-09-07 21:53:19 -05:00
1 parent e51a2c7f21
commit 5c9fdb2c62
12 files changed
+2525 -106

No files matched your search

+84 -7
View File
@@ -4691,6 +4691,16 @@ in 0.49.0. Take 4's findings are in the loop-3 list above.
revision + tab width + rule set + merged options + waiver contents +
index generation (each attacked); worth 24 ms per cursor move on
opentitan's largest file, 1–3 ms on ordinary RTL.
- **perf take 5 P2d (§60.2) deferred:** the target-scoped rename
selector — fan out from the one declaration the open buffer resolves
the cursor to, instead of every declaration of the name; the lever
left on the tail rename (233 of 388 ms is one parse per selected
file, 133 of 238 files being container files a multi-level tail folds
through). Needs the whole-scope oracle over the shape list in
`docs/features/perf5-p2/README.md` (multi-path references, wildcard
imports, package members, `extends`/alias chains, `bind`, `defparam`,
`$root`, `` `include``, generate shadows, class members, unsaved
buffers) before any file is dropped.
Sections after §46 are planned when reached.
## 45. Small items, round 4 (planned 2026-09-05) — topo §2.9-29, 30, 17, 22
@@ -5865,14 +5875,38 @@ real paths first and names them in the README.
candidate), parse-formula sabotage, RSS re-take, traceability; see
the QA log in `docs/features/perf5-p2/README.md` (2026-09-07).
Handshake 33 and P2d are **not** covered by this QA pass.
- [ ] handshake 33 closed with tests (multi-level hierarchy, generated
- [x] handshake 33 closed with tests (multi-level hierarchy, generated
scopes, interface/package/class names, macros, duplicate modules,
unsaved references) before P2d
- [ ] P2d (only with proof): exact-name postings; the selected set
unsaved references) before P2d — an opt-in **fifth rung** on
`module_sources`, asked for by inline-module alone: every file whose
token census (`files_mentioning`, i.e. `FileFacts::words`) writes
the dissolved instance's name. That census is exactly what
`no_hierarchy` can refuse from, so the selected set now answers that
refusal **as `sources()` does**, asserted by a six-shape
whole-workspace equivalence test. Sixteen tests, twelve through the
real dispatch; +1.2 ms at the measured site (8 files added); extract
and the port actions unchanged in answer and in cost. The
transitive-instantiator walk the topology row names was written and
**discarded**: it cannot reach a `bind` from a file that
instantiates nothing in the chain. Experiment `H33-2026-09-07`
- [x] P2d (only with proof): exact-name postings; the selected set
unchanged; every edit, warning, ambiguous-use refusal,
unresolved new-name capture and unsaved-buffer contribution
compared against the whole-scope engine on adversarial cases
- [~] measured: tail rename ≥ 2× faster (stretch < 200 ms), `aes`
compared against the whole-scope engine on adversarial cases —
**measured; no narrowing shipped, and the proof is why.** The new
by-rung census says **133 of the tail rename's 238 selected files
(56 %, 58 % of the bytes, ~130 ms) write neither name down**, all of
them on the container rungs — and those are what `fold_path` hops
through for a multi-level hierarchical tail and what `base_chain`
climbs, so dropping them makes a resolved tail `StillUnresolved` (a
**missed edit**, §49's own feature) and, where a reference has two
paths, lets it fall through onto the target (an **extra edit**).
Exact-name postings not implemented: selection is 13.6 ms of 420
(3.2 %), below the plan's own materiality gate. The target-scoped
selector — fan out from the one declaration the cursor resolves to
— is filed with its full shape list and the oracle it needs, as a
lane of its own. Experiment `P2d-2026-09-07`
- [x] measured: tail rename ≥ 2× faster (stretch < 200 ms), `aes`
rename not slower, edit/warning parity exact; queued definition
follows; tracker + experiment entries — **1.86×** (780.45 →
419.86 ms), so the 2× target is **missed by 29.7 ms**; the
@@ -5881,9 +5915,52 @@ real paths first and names them in the README.
reach. `aes` rename −24.8 % (not slower), every edit / warning /
refusal fingerprint byte-identical, queued definition −24.5 %,
whole-file parses 717 → **240 = K + E**. Experiments
`P2a-2026-09-07`, `P2b-2026-09-07`, `P2c-2026-09-07`
- [ ] QA: whole-scope parity suite, the verifier invariant (a faster
`P2a-2026-09-07`, `P2b-2026-09-07`, `P2c-2026-09-07`.
**Second lane, 2026-09-07:** still **1.85×** (420.90 ms), because
§P2d ships no narrowing; `aes` 106.75 (not slower), queued
definition 121.2, every fingerprint still byte-identical, peak RSS
not higher (tail 606 MiB, fallback 1 802). The two stages left are
`Scope::build` **226 ms (54 %)** and `warnings` **83 ms (20 %)**.
`warnings` is **not** dominant, so it was reported rather than
fixed: it tokenizes each spelling file up to twice and builds up to
four `LineIndex`es, none shared and none of them the parse the scope
already made. Two pure dedupes (one tokenize + one index per call;
gate `macro_argument_sites` on `files_naming_in_macros`, which is
`FileFacts::macro_words`) should take the tail rename to ~375 ms and
**over the 2× line**. Filed for the lead.
**Third round, 2026-09-07 — the dedupe, and the target met.** One
lex and one `LineIndex` per file per `warnings()` call, the five
scans sharing them and their sentences concatenated in the order
the five loops emitted them: `warnings` **82.2 → 51.4 ms** on the
tail rename, 22.9 → 8.3 on `aes`, 848.5 → 437.9 on the `clk_i`
fallback. Tail rename **387.95 ms = 2.01× the REF (780.45)**, so
the **≥2× target is MET**; `aes` 91.79 (−35.0 %, not slower),
queued definition 115.91, every fingerprint byte-identical and the
warning **lists** compared as lists across 13 renames against a
pre-change binary — identical, order included. Peak RSS tail 596
MiB / fallback 1 795. The second gate the finding proposed
(`files_naming_in_macros`) is **not shipped**: `macro_words` skips
double-quoted runs, so `` `uvm_info("state_q", …) `` is a site the
scan reports and the census cannot see. What is left is
`Scope::build`, **233 ms of 388 (60 %)**. Experiment
`P2d-warnings-2026-09-07`
- [x] QA: whole-scope parity suite, the verifier invariant (a faster
partial edit is a failure), handshake-33 attacks, numbers re-taken
— PASS, 2026-09-07 (Sonnet). Seven handshake-33 attack cases
(macro-defined-elsewhere, `$root`, macro-built `bind` target,
string/comment negative control, escaped identifier, generate-label
path, and a sabotage disabling the rung that proved it load-bearing
on the three-level `bind` fixture); the topology row's transitive-
instantiator walk independently confirmed structurally unable to
reach a `bind` from a non-instantiating file; §P2d's "cannot be
dropped" census argument reproduced by experiment (dropping the
indirect container file from the dev's own two-level-tail fixture
silently loses the tail edit); the `warnings` dedupe re-attacked
with two new equality fixtures, a concatenation-order sabotage, and
a direct construction of the macro-words-gate non-equivalence; wire
parity confirmed over all 13 renames; every fingerprint
byte-identical on re-measurement. See the QA log in
`docs/features/perf5-p2/README.md`.
### 60.3 P3 — one parse for the CLI package census
+11 -3
View File
@@ -23,6 +23,7 @@ use lsp_types::{
};
use serde_json::Value;
use crate::module_select::Reach;
use crate::state::{Document, Workspace};
/// Inline the module instantiated at a position: `[uri, position]`.
@@ -98,9 +99,16 @@ pub fn execute(
};
// The engine reads the instantiated module's declaration and refuses over
// any hierarchical path into the instance, so the file set is the two
// units' own fan-out: the declaring file, and every file the index says
// mentions either name.
let files = ws.module_sources(&path, &site.units);
// units' own fan-out — the declaring file, and every file the index says
// mentions either name — **plus the fifth rung**: every file whose tokens
// write the instance's own name down. A file naming
// `u_wrapper.u_top.u_sub.s` reaches this instance through modules it does
// not itself instantiate, and the first four rungs have nothing that asks
// for it (topology handshake 33). The rung is the exact census
// `no_hierarchy` can refuse from, so this set answers that refusal the way
// the whole workspace would.
let scopes = [site.instance.clone()];
let files = ws.module_sources_reaching(&path, &site.units, Reach { scopes: &scopes });
let refactoring = vlog_refactor::inline_module(&files, &path, offset)?;
Ok((crate::ports::workspace_edit(ws, &refactoring)?, refactoring.warnings))
}
+1
View File
@@ -32,6 +32,7 @@ mod lens;
mod linked;
mod lint;
mod locate;
mod module_select;
mod nav;
mod on_type;
mod pairs;
+146
View File
@@ -0,0 +1,146 @@
//! Which files can name a scope *inside* the module a refactoring rewrites.
//!
//! [`Workspace::module_sources`](crate::state::Workspace::module_sources)'s
//! four rungs answer "who declares, instantiates or refers to these **names**".
//! That is enough for the port refactorings and for extract, whose refusals
//! are about the names themselves. It is not enough for inline-module, whose
//! `no_hierarchy` refusal is about a *path through the design hierarchy*:
//! `tb.sv` writing `u_wrapper.u_top.u_sub.s` names the instance `u_sub` that
//! inlining dissolves, and `tb.sv` instantiates `wrapper` — not `top`, not
//! `sub`. No rung asks for it, `no_hierarchy` only sees what it is handed, and
//! the inline was **silently accepted**, dissolving a scope a testbench walks
//! through. §53.2's QA reproduced exactly that; it is topology handshake 33.
//!
//! **The rung is the instance's own word census.** `no_hierarchy` refuses when
//! some handed file's token stream holds an `Ident` spelling the instance with
//! a `.` (or a `bind`) beside it. [`WorkspaceIndex::files_mentioning`] is the
//! census of every file whose token stream writes a word down at all — 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. So a file that could raise that refusal is
//! always in this answer, and [`hierarchical_users`] hands inline exactly the
//! files that could change its mind.
//!
//! That is a stronger claim than the transitive-instantiator walk the topology
//! row asks for, and it is why this module does not do that walk. Climbing the
//! instantiation edges upward from the host module finds the wrapper levels,
//! but it misses `bind tb.u_wrapper.u_top.u_sub …` written in an SVA file that
//! instantiates nothing in the chain, and `$root`-anchored and macro-built
//! paths with it — all shapes `no_hierarchy` refuses over and all shapes the
//! word census holds. It also selects files that instantiate up the chain and
//! never spell the instance, which no refusal can turn on. The census is both
//! the tighter and the more complete answer. Written out in the feature
//! README's handshake note, with the failing `bind` fixture that settled it.
//!
//! The rung can only **add** files, so an edit stays the edit it was and a
//! refusal it makes possible is one the whole-workspace engine also makes.
//! Nothing here reads a file or parses anything: it is a walk over the records
//! the index already holds, binary-searching each file's sorted word list.
use std::collections::BTreeSet;
use std::path::{Path, PathBuf};
use vlog_semantic::WorkspaceIndex;
/// The extra reach one refactoring asks for.
///
/// A caller that needs none passes [`Reach::none`] — which is what
/// `module_sources` itself does, so the port and extract paths are unchanged
/// by this module in answer and in cost.
#[derive(Debug, Clone, Copy, Default)]
pub struct Reach<'a> {
/// The scope names whose *inside* the refactoring dissolves: for
/// inline-module, the instance it removes. Every file whose tokens write
/// one of these words is wanted, because every file that could refuse
/// over a hierarchical path through it does.
pub scopes: &'a [String],
}
impl Reach<'_> {
/// No extra reach — the four rungs alone.
pub fn none() -> Reach<'static> {
Reach { scopes: &[] }
}
}
/// Every file whose token stream writes one of `reach`'s scope names.
///
/// The caller unions this into the set its own rungs filled, so a path this
/// rung is the first to ask for is still just a path.
pub fn hierarchical_users(index: &WorkspaceIndex, reach: Reach<'_>) -> BTreeSet<PathBuf> {
let mut out = BTreeSet::new();
for scope in reach.scopes {
out.extend(
index
.files_mentioning(scope)
.filter_map(|file| index.path(file))
.map(Path::to_path_buf),
);
}
out
}
#[cfg(test)]
mod tests {
use super::*;
/// `tb` → `wrapper` → `top` → `sub`, the shape §53.2's QA reported: `tb`
/// names `u_sub` through two levels it does not itself instantiate, and
/// `sva.sv` names it through a `bind` while instantiating nothing at all.
fn ladder() -> WorkspaceIndex {
WorkspaceIndex::build(vec![
(PathBuf::from("/w/sub.sv"), "module sub; logic s; endmodule\n"),
(PathBuf::from("/w/top.sv"), "module top; sub u_sub (); endmodule\n"),
(PathBuf::from("/w/wrapper.sv"), "module wrapper; top u_top (); endmodule\n"),
(
PathBuf::from("/w/tb.sv"),
"module tb; wrapper u_wrapper (); assign x = u_wrapper.u_top.u_sub.s; endmodule\n",
),
(
PathBuf::from("/w/sva.sv"),
"module chk (input logic a); endmodule\nbind tb.u_wrapper.u_top.u_sub chk u_chk (.a(1'b0));\n",
),
(PathBuf::from("/w/stranger.sv"), "module stranger; logic q; endmodule\n"),
])
}
fn names(paths: &BTreeSet<PathBuf>) -> Vec<String> {
paths
.iter()
.filter_map(|p| p.file_name().map(|n| n.to_string_lossy().into_owned()))
.collect()
}
#[test]
fn every_file_that_writes_the_instance_down_is_wanted() {
let index = ladder();
let scopes = ["u_sub".to_string()];
let found = hierarchical_users(&index, Reach { scopes: &scopes });
assert_eq!(
names(&found),
vec!["sva.sv".to_string(), "tb.sv".to_string(), "top.sv".to_string()],
"the declaring file, the bench two levels up, and the bind that instantiates nothing"
);
}
#[test]
fn a_file_that_never_writes_it_is_not() {
let index = ladder();
let scopes = ["u_sub".to_string()];
assert!(!names(&hierarchical_users(&index, Reach { scopes: &scopes }))
.contains(&"stranger.sv".to_string()));
}
#[test]
fn a_name_nothing_writes_wants_nothing() {
let index = ladder();
let scopes = ["u_no_such_instance".to_string()];
assert!(hierarchical_users(&index, Reach { scopes: &scopes }).is_empty());
}
#[test]
fn no_reach_asked_for_is_no_work_done() {
let index = ladder();
assert!(hierarchical_users(&index, Reach::none()).is_empty());
}
}
+119 -15
View File
@@ -7,17 +7,25 @@
//! for them. This module is the answer — a set of paths that also remembers
//! **why** each one was added.
//!
//! [`Wanted`] is a `BTreeSet<PathBuf>` with a current [`Rung`]: the selector
//! sets the rung it is on and inserts exactly as it did before, so the
//! selection logic is not changed by being watched. The first rung to ask for
//! a path is the one recorded, which is what makes the counts add up to the
//! selected set rather than over-counting a file three rungs want.
//! [`Wanted`] is a `BTreeMap<PathBuf, Rung>` with a current [`Rung`]: the
//! selector sets the rung it is on and inserts exactly as it did before, so
//! the selection logic is not changed by being watched. The first rung to ask
//! for a path is the one recorded, which is what makes the counts add up to
//! the selected set rather than over-counting a file three rungs want.
//!
//! Take 5 §P2d added the second question on top of the first: of the files a
//! rung asked for, how many **write neither name down** and are therefore in
//! the request only to shape how the others resolve ([`indirect_census`]).
//! That census is what says which rung a narrower selector would have to
//! argue about, and the argument it needs.
//!
//! Nothing here decides anything. A [`SelectionTrace`] is written, logged once
//! behind `--verbose`, and dropped.
use std::collections::BTreeSet;
use std::path::PathBuf;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use vlog_semantic::WorkspaceIndex;
/// Why one file is in a rename's input.
///
@@ -82,6 +90,9 @@ pub struct SelectionTrace {
pub selected: usize,
/// Milliseconds the selection itself took, reading and all.
pub ms: f64,
/// Per rung, how many of its files write **neither** name down —
/// [`indirect_census`]. Empty on the fallback path, which climbs no rung.
pub indirect: Vec<(Rung, usize)>,
}
impl SelectionTrace {
@@ -89,7 +100,7 @@ impl SelectionTrace {
/// — the ambiguity escape hatch, and a cursor with no name to fan out
/// from. No rung ran, so none is counted.
pub fn whole_scope(selected: usize, ms: f64) -> SelectionTrace {
SelectionTrace { counts: Vec::new(), fallback: true, selected, ms }
SelectionTrace { counts: Vec::new(), fallback: true, selected, ms, indirect: Vec::new() }
}
/// One file added by `rung`, if no earlier rung had it.
@@ -112,11 +123,12 @@ impl SelectionTrace {
.map(|rung| format!("{}={}", rung.label(), self.count(*rung)))
.collect();
format!(
"select={:.1}ms selected={} fallback={} rungs{{{}}}",
"select={:.1}ms selected={} fallback={} rungs{{{}}} {}",
self.ms,
self.selected,
self.fallback,
rungs.join(" ")
rungs.join(" "),
census_line(&self.indirect)
)
}
}
@@ -129,7 +141,7 @@ impl SelectionTrace {
/// selected set.
#[derive(Debug, Default)]
pub struct Wanted {
paths: BTreeSet<PathBuf>,
paths: BTreeMap<PathBuf, Rung>,
trace: SelectionTrace,
rung: Rung,
}
@@ -147,9 +159,16 @@ impl Wanted {
}
/// Add one path, attributed to the current rung if it is new.
///
/// `entry(…).or_insert(…)`, not `insert(…)`: the map keeps the **first**
/// rung to ask for a path, which is what makes the counts partition the
/// selected set. A plain `insert` would overwrite with the last.
pub fn insert(&mut self, path: PathBuf) {
if self.paths.insert(path) {
self.trace.add(self.rung);
let rung = self.rung;
let before = self.paths.len();
self.paths.entry(path).or_insert(rung);
if self.paths.len() != before {
self.trace.add(rung);
}
}
@@ -161,14 +180,76 @@ impl Wanted {
}
}
/// The paths, in path order, and the trace of how they got there.
pub fn finish(self) -> (BTreeSet<PathBuf>, SelectionTrace) {
/// The paths, in path order and each with the rung that asked for it, and
/// the trace of how they got there.
pub fn finish(self) -> (BTreeMap<PathBuf, Rung>, SelectionTrace) {
let Wanted { paths, mut trace, .. } = self;
trace.selected = paths.len();
(paths, trace)
}
}
/// How many files each rung asked for that **write neither name down**.
///
/// The census §P2d turns on. Every direct input of the four verifier checks is
/// a file that spells one of the two names: an occurrence is a use of the old
/// name, `check::watched_files` watches exactly the files whose text holds
/// either as a whole word, `Scope::warnings` speaks only about the two names,
/// and an edited file is a subset of the watched ones. A selected file that
/// writes neither is therefore in the request for one reason only — **it
/// shapes how the others resolve**, by declaring a unit some path hops
/// through or a base class a member lookup climbs to.
///
/// So this is not "files that could be dropped". It is the exact set whose
/// contribution is *indirect*, which is the set a narrower selector has to
/// argue about one shape at a time. Counting it by rung says which rung the
/// argument would have to be made for.
///
/// The word census is `FileFacts::words`, so this reads no file and parses
/// nothing. It is asked of the **selected** files only — one `facts_for` and
/// two binary searches each — rather than through
/// [`WorkspaceIndex::files_mentioning`], which would walk every record in the
/// workspace to answer about a couple of hundred of them. On the tail rename
/// that is the difference between ~1.7 ms and ~0.05 ms, and a diagnostic that
/// costs a measurable slice of the request it is measuring is a bad
/// instrument.
///
/// A path the index has no record for — an open buffer the scan has not
/// reached — counts as spelling the name: the census may not claim a file is
/// idle when it does not know.
pub fn indirect_census(
index: &WorkspaceIndex,
paths: &BTreeMap<PathBuf, Rung>,
names: [&str; 2],
) -> Vec<(Rung, usize)> {
let idle = |path: &Path| match index.facts_for(path) {
Some(facts) => !names
.iter()
.any(|name| facts.words().binary_search_by(|w| w.as_str().cmp(name)).is_ok()),
None => false,
};
Rung::ALL
.iter()
.map(|rung| {
let count = paths.iter().filter(|(path, held)| *held == rung && idle(path)).count();
(*rung, count)
})
.collect()
}
/// [`indirect_census`] as one `timing:`-style fragment — every rung named,
/// whether or not it contributed, so the line's shape never moves.
pub fn census_line(census: &[(Rung, usize)]) -> String {
let fields: Vec<String> = Rung::ALL
.iter()
.map(|rung| {
let count = census.iter().find(|(held, _)| held == rung).map_or(0, |(_, n)| *n);
format!("{}={}", rung.label(), count)
})
.collect();
format!("indirect{{{}}}", fields.join(" "))
}
#[cfg(test)]
mod tests {
use super::*;
@@ -185,6 +266,29 @@ mod tests {
assert_eq!(trace.count(Rung::Request), 1);
assert_eq!(trace.count(Rung::Reference), 1);
assert_eq!(trace.selected, 2);
// And the map agrees with the counts: a re-insertion does not
// re-attribute, which is what makes the census partition the set.
assert_eq!(paths[&PathBuf::from("/rtl/a.sv")], Rung::Request);
assert_eq!(paths[&PathBuf::from("/rtl/b.sv")], Rung::Reference);
}
#[test]
fn the_census_counts_only_the_files_that_write_neither_name() {
let index = WorkspaceIndex::build(vec![
(PathBuf::from("/w/decl.sv"), "module decl; logic state_q; endmodule\n"),
(PathBuf::from("/w/user.sv"), "module user; decl u_d (); endmodule\n"),
(PathBuf::from("/w/reads.sv"), "module reads; assign x = u_d.state_q; endmodule\n"),
]);
let mut paths = BTreeMap::new();
paths.insert(PathBuf::from("/w/decl.sv"), Rung::Declaration);
paths.insert(PathBuf::from("/w/reads.sv"), Rung::Reference);
paths.insert(PathBuf::from("/w/user.sv"), Rung::Instantiation);
let census = indirect_census(&index, &paths, ["state_q", "state_q_x"]);
let count = |rung: Rung| census.iter().find(|(r, _)| *r == rung).map_or(0, |(_, n)| *n);
assert_eq!(count(Rung::Declaration), 0, "it declares the name");
assert_eq!(count(Rung::Reference), 0, "it spells the name");
assert_eq!(count(Rung::Instantiation), 1, "it only instantiates the container");
assert!(census_line(&census).contains("instantiation=1"), "{}", census_line(&census));
}
#[test]
@@ -0,0 +1,344 @@
//! Topology handshake 33: the file that reaches an instance through modules
//! it does not itself instantiate.
//!
//! `tb.sv` writes `u_wrapper.u_top.u_sub.s`. It instantiates `wrapper`;
//! `wrapper` instantiates `top`; `top` is where `sub u_sub (…)` is written and
//! where the inline happens. None of `module_sources`' four rungs asks for
//! `tb.sv` — it declares neither `sub` nor `top`, refers to neither, and
//! instantiates neither — so `inline/mod.rs::no_hierarchy` never saw the path
//! and the inline was **silently accepted**, dissolving a scope a testbench
//! walks through. §53.2's QA reproduced exactly this.
//!
//! `module_select`'s fifth rung is the fix and this file is its pin: the
//! ladder, the deeper ladder, the shapes the rung must **not** walk, and the
//! callers whose answers must not move.
use super::*;
use crate::module_select::Reach;
use crate::state::Workspace;
const SUB: &str = "\
module sub (
input logic a,
output logic q
);
logic s;
assign s = a;
assign q = s;
endmodule
";
const TOP: &str = "\
module top (
input logic x,
output logic z
);
sub u_sub (
.a(x),
.q(z)
);
endmodule
";
const WRAPPER: &str = "\
module wrapper (
input logic x,
output logic z
);
top u_top (
.x(x),
.z(z)
);
endmodule
";
/// The instantiation of `sub` in `top.sv`: line 4, on the module name.
fn inline_cursor() -> Value {
serde_json::json!({ "line": 4, "character": 2 })
}
/// A tree holding the three-level ladder, with `tb.sv` written by the caller
/// so each test can say what the bench does.
fn ladder(name: &str) -> Tree {
let tree = Tree::new(name);
tree.write("sub.sv", SUB);
tree.write("top.sv", TOP);
tree.write("wrapper.sv", WRAPPER);
tree
}
/// A wide session with `top.sv` open, ready to be asked to inline.
fn opened(tree: &Tree) -> (Session, Uri) {
let mut session = Session::wide(vec![tree.path.clone()], false);
let uri = session.open(&tree.path.join("top.sv"), TOP);
session.drain();
(session, uri)
}
/// Run `lucisv.inlineModule` at the `sub` instantiation; `Err` is the
/// engine's own sentence.
fn inline(session: &mut Session, uri: &Uri) -> Result<Value, String> {
let response = session.request(
ExecuteCommand::METHOD,
serde_json::json!({
"command": crate::inline_module::INLINE_MODULE,
"arguments": [uri, inline_cursor()],
}),
);
response.response_result.map_err(|error| error.message)
}
#[test]
fn a_bench_two_levels_above_the_instance_refuses_the_inline() {
let tree = ladder("h33ladder");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n\
\n initial $display(\"%b\", u_wrapper.u_top.u_sub.s);\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("the bench names the instance");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
assert!(refusal.contains("tb.sv"), "{refusal}");
}
#[test]
fn a_bench_three_levels_above_the_instance_refuses_the_inline() {
let tree = ladder("h33deep");
tree.write(
"outer.sv",
"module outer (\n input logic x,\n output logic z\n);\n\
\n wrapper u_wrapper (.x(x), .z(z));\nendmodule\n",
);
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n outer u_outer (.x(x), .z(z));\n\
\n initial $display(\"%b\", u_outer.u_wrapper.u_top.u_sub.s);\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("three levels up is still the same scope");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
assert!(refusal.contains("tb.sv"), "{refusal}");
}
#[test]
fn the_level_the_four_rungs_already_saw_still_refuses() {
// `wrapper.sv` instantiates `top` directly, so it was always in the set.
// The fifth rung must not change what the fourth already answered.
let tree = ladder("h33direct");
tree.write(
"wrapper.sv",
"module wrapper (\n input logic x,\n output logic z\n);\n\
\n top u_top (.x(x), .z(z));\n logic peek;\n assign peek = u_top.u_sub.s;\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("the direct parent names the instance");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
assert!(refusal.contains("wrapper.sv"), "{refusal}");
}
#[test]
fn a_ladder_nobody_reaches_into_still_inlines() {
// The rung selects more files; selecting them must not invent a refusal.
let tree = ladder("h33clean");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let edit = inline(&mut session, &uri).expect("nothing names the instance");
assert!(edit.is_object() || edit.is_null(), "{edit:#?}");
}
#[test]
fn a_generated_scope_two_levels_above_is_refused_and_stays_refused() {
let tree = ladder("h33generate");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n\
\n initial $display(\"%b\", u_wrapper.gen[0].u_top.u_sub.s);\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("a generated path walks the same scope");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
}
#[test]
fn a_bind_two_levels_above_the_instance_refuses_the_inline() {
let tree = ladder("h33bind");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\nendmodule\n",
);
tree.write(
"sva.sv",
"module checker_m (input logic a);\nendmodule\n\
\nbind tb.u_wrapper.u_top.u_sub checker_m u_chk (.a(1'b0));\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("a bind names the instance as a scope");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
assert!(refusal.contains("sva.sv"), "{refusal}");
}
#[test]
fn an_unsaved_bench_that_adds_the_path_refuses_the_inline() {
// The bench on disk names nothing; the buffer does. Open buffers are a
// rung of their own, and this pins that the fifth rung did not displace
// it.
let tree = ladder("h33unsaved");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
session.open(
&tree.path.join("tb.sv"),
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n\
\n initial $display(\"%b\", u_wrapper.u_top.u_sub.s);\nendmodule\n",
);
session.drain();
let refusal = inline(&mut session, &uri).expect_err("the unsaved text names the instance");
assert!(refusal.contains("`u_sub` is named as a scope of the design hierarchy"), "{refusal}");
}
#[test]
fn a_second_declaration_of_the_inlined_module_still_refuses_for_being_ambiguous() {
let tree = ladder("h33duplicate");
tree.write("sub_again.sv", SUB);
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\nendmodule\n",
);
let (mut session, uri) = opened(&tree);
let refusal = inline(&mut session, &uri).expect_err("two `sub`s is ambiguous");
assert!(refusal.contains("sub"), "{refusal}");
assert!(
!refusal.contains("named as a scope of the design hierarchy"),
"the ambiguity refusal, not the hierarchy one: {refusal}"
);
}
#[test]
fn a_macro_hiding_the_path_selects_the_file_and_still_does_not_refuse() {
// Today's behaviour, pinned rather than asserted to be right. The fifth
// rung *does* hand `tb.sv` over — `words::harvest` splits raw text, so
// `u_sub` written inside a `` `define`` body is in the file's census. But
// `no_hierarchy` tokenizes, and a directive line is one opaque token, so
// there is no `Ident` spelling `u_sub` for it to find. The selection is
// not the limit here; the lexical refusal is. The whole-workspace engine
// answers exactly the same way, which is the parity that matters.
let tree = ladder("h33macro");
tree.write(
"tb.sv",
"`define PEEK u_wrapper.u_top.u_sub.s\n\
module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n\
\n initial $display(\"%b\", `PEEK);\nendmodule\n",
);
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
let scopes = ["u_sub".to_string()];
let selected = crate::module_select::hierarchical_users(ws.index(), Reach { scopes: &scopes });
assert!(selected.contains(&tree.path.join("tb.sv")), "the census sees raw text: {selected:?}");
let (mut session, uri) = opened(&tree);
inline(&mut session, &uri).expect("a macro-hidden path is not a token `no_hierarchy` can see");
}
#[test]
fn the_rung_is_the_instances_word_census_and_nothing_wider() {
// A package, an interface and a class are not scopes an inline dissolves,
// and the rung is keyed by the instance's spelling alone — so a caller
// that names one of them by mistake selects only the files that really
// do write that word.
let tree = Tree::new("h33units");
tree.write("p.sv", "package p;\n localparam K = 1;\nendpackage\n");
tree.write("user.sv", "module user;\n import p::*;\n logic a;\nendmodule\n");
tree.write("stranger.sv", "module stranger;\n logic b;\nendmodule\n");
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
let scopes = ["p".to_string()];
let found = crate::module_select::hierarchical_users(ws.index(), Reach { scopes: &scopes });
assert_eq!(
found,
[tree.path.join("p.sv"), tree.path.join("user.sv")].into_iter().collect(),
"{found:?}"
);
}
#[test]
fn the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does() {
// The claim the fifth rung is worth having: `no_hierarchy` refuses from a
// token census, and the rung *is* that census, so the narrowed set and
// `sources()` cannot disagree. Six shapes, each run through the engine
// twice — the one the four rungs missed, the one they saw, the bind, the
// generated path, the macro-hidden path, and the clean ladder.
let benches = [
("h33p1", " initial $display(\"%b\", u_wrapper.u_top.u_sub.s);\n", ""),
("h33p2", "", ""),
("h33p3", "", "module chk (input logic a);\nendmodule\nbind tb.u_wrapper.u_top.u_sub chk u_chk (.a(1'b0));\n"),
("h33p4", " initial $display(\"%b\", u_wrapper.gen[0].u_top.u_sub.s);\n", ""),
("h33p5", " initial $display(\"%b\", `PEEK);\n", ""),
("h33p6", " initial $display(\"%b\", u_wrapper.u_top.z);\n", ""),
];
for (name, extra, sva) in benches {
let tree = ladder(name);
tree.write(
"tb.sv",
&format!(
"`define PEEK u_wrapper.u_top.u_sub.s\n\
module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n{extra}endmodule\n"
),
);
if !sva.is_empty() {
tree.write("sva.sv", sva);
}
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
let path = tree.path.join("top.sv");
let offset = TOP.find("sub u_sub").expect("the instantiation") as u32;
let units = ["sub".to_string(), "top".to_string()];
let scopes = ["u_sub".to_string()];
let narrowed = ws.module_sources_reaching(&path, &units, Reach { scopes: &scopes });
let whole = ws.sources();
assert_eq!(
vlog_refactor::inline_module(&narrowed, &path, offset).map(|edit| edit.edits),
vlog_refactor::inline_module(&whole, &path, offset).map(|edit| edit.edits),
"{name}: the narrowed set and the whole workspace disagree"
);
}
}
#[test]
fn the_four_rung_selector_answers_exactly_what_it_did_before() {
// Every other caller of `module_sources` — the port actions, extract —
// asks with no reach, and the fifth rung must therefore be invisible to
// them. Asserted as an equality against the rungs' own answer rather
// than as a count, so a file appearing is a failure whatever its name.
let tree = ladder("h33unchanged");
tree.write(
"tb.sv",
"module tb;\n logic x, z;\n wrapper u_wrapper (.x(x), .z(z));\n\
\n initial $display(\"%b\", u_wrapper.u_top.u_sub.s);\nendmodule\n",
);
let mut ws = Workspace::default();
ws.open_whole_workspace(vec![tree.path.clone()]);
let units = ["sub".to_string(), "top".to_string()];
let path = tree.path.join("top.sv");
let four: Vec<PathBuf> =
ws.module_sources(&path, &units).into_iter().map(|(path, _)| path).collect();
assert_eq!(
four,
vec![tree.path.join("sub.sv"), tree.path.join("top.sv"), tree.path.join("wrapper.sv")],
"the four rungs, unchanged — and `tb.sv` is exactly what they miss"
);
let scopes = ["u_sub".to_string()];
let five: Vec<PathBuf> = ws
.module_sources_reaching(&path, &units, Reach { scopes: &scopes })
.into_iter()
.map(|(path, _)| path)
.collect();
assert!(five.contains(&tree.path.join("tb.sv")), "{five:?}");
for path in &four {
assert!(five.contains(path), "the fifth rung only ever adds: {path:?} went missing");
}
}
@@ -49,6 +49,7 @@ mod code_action;
mod file_ops;
mod folders;
mod formatting;
mod hierarchy_reach;
mod index;
mod large_file;
mod progress;
+28 -3
View File
@@ -27,7 +27,8 @@ use crate::candidates::Candidates;
use crate::convert::Positions;
use crate::includes::IncludeGraph;
use crate::index_cache::IndexCache;
use crate::rename_trace::{Rung, SelectionTrace, Wanted};
use crate::module_select::{self, Reach};
use crate::rename_trace::{self, Rung, SelectionTrace, Wanted};
use crate::settings::{ClientSettings, IndexScope};
use crate::uri::uri_to_path;
@@ -1486,7 +1487,26 @@ impl Workspace {
/// the open buffer when there is one, disk otherwise, and neither for a
/// buffer on the large-file fast path or a file over the size cap.
pub fn module_sources(&self, file: &Path, modules: &[String]) -> Vec<(PathBuf, String)> {
let mut wanted: BTreeSet<PathBuf> = BTreeSet::new();
self.module_sources_reaching(file, modules, Reach::none())
}
/// [`Workspace::module_sources`] plus the **fifth rung**: every file whose
/// tokens write one of `reach`'s scope names down
/// ([`crate::module_select`], topology handshake 33).
///
/// Only inline-module asks for it, and only because its `no_hierarchy`
/// refusal is about a path *through* the instance it dissolves rather
/// than about either module's name: a testbench two wrapper levels above
/// is in none of the four rungs. The rung can only add files, so every
/// other caller's answer is untouched — and so is its cost, since
/// [`Reach::none`] walks nothing.
pub fn module_sources_reaching(
&self,
file: &Path,
modules: &[String],
reach: Reach<'_>,
) -> Vec<(PathBuf, String)> {
let mut wanted: BTreeSet<PathBuf> = module_select::hierarchical_users(&self.index, reach);
wanted.insert(file.to_path_buf());
for name in modules {
for def in self.index.units(name) {
@@ -1601,8 +1621,13 @@ impl Workspace {
wanted.on(Rung::OpenBuffer);
wanted.extend(self.docs.values().filter_map(|doc| doc.path.clone()));
let (paths, mut trace) = wanted.finish();
// §P2d's census: which rungs asked for files that write neither name
// down, and therefore contribute to this request only by shaping how
// the others resolve. One record lookup per selected file, no read.
trace.indirect =
rename_trace::indirect_census(&self.index, &paths, [name, new_name.unwrap_or(name)]);
let texts: Vec<(PathBuf, String)> = paths
.into_iter()
.into_keys()
.filter_map(|path| {
let text = self.current_text(&path)?;
Some((path, text))
+535 -58
View File
@@ -1,16 +1,26 @@
//! What a rename could not account for, said out loud: the name inside a
//! `` `define`` or a macro invocation's opaque token, inside an assertion the
//! SVA grammar could not structure, a reference the workspace could not
//! finish, and identifier occurrences no reference was recorded for — each
//! found by its own scan of the file, and each a sentence naming where to
//! look. The `` `define`` and macro-argument scans are shared with the port
//! refactorings, which word their news differently.
//! finish, and identifier occurrences no reference was recorded for — each its
//! own scan, and each a sentence naming where to look. The `` `define`` and
//! macro-argument scans are shared with the port refactorings, which word
//! their news differently.
//!
//! **One lex and one line index per file** (take 5 §P2d's `warnings` finding).
//! The five scans used to build their own, so a file spelling the name was
//! tokenized twice and indexed four times inside one `warnings` call — none of
//! it shared, and none of it the parse the scope had already made. [`FileScan`]
//! is that memo. It is a cache of two pure functions of the file's text and
//! nothing else, so a scan handed a shared one reads exactly what its own call
//! would have built; what each scan *says* is untouched, and the sentences come
//! out in the order they always did.
use std::collections::HashMap;
use std::path::Path;
use vlog_parser::defines::DefineKind;
use vlog_parser::span::TextRange;
use vlog_parser::token::TokenKind;
use vlog_parser::token::{Token, TokenKind};
use vlog_parser::{tokenize, LineIndex};
use vlog_semantic::{ExternalTarget, ReferenceId, Resolution};
@@ -19,37 +29,116 @@ use crate::TextEdit;
use super::Target;
use crate::scope::{display, Scope};
/// One file's token stream and its line index, built at most once per
/// [`Scope::warnings`] call and lent to every scan that asks.
///
/// Both fields are memos of pure functions of the file's text, so sharing one
/// cannot change an answer: `tokens` is `tokenize(text).ok()` and `lines` is
/// `LineIndex::new(text)`, computed on first use and then handed out.
#[derive(Default)]
struct FileScan {
/// `None` until asked; `Some(None)` for a file that does not lex — which
/// every scan reads as "nothing to say", exactly as `tokenize`'s `Err` did.
tokens: Option<Option<Vec<Token>>>,
lines: Option<LineIndex>,
}
impl FileScan {
/// The file's tokens, or `None` when it does not lex.
fn tokens(&mut self, text: &str) -> Option<&[Token]> {
self.tokens.get_or_insert_with(|| tokenize(text).ok()).as_deref()
}
/// The file's line index.
fn lines(&mut self, text: &str) -> &LineIndex {
self.lines.get_or_insert_with(|| LineIndex::new(text))
}
/// Both at once, for a scan that walks the tokens and asks the index for
/// each hit's line — two borrows it cannot take one after the other.
fn tokens_and_lines(&mut self, text: &str) -> (Option<&[Token]>, &LineIndex) {
let tokens = self.tokens.get_or_insert_with(|| tokenize(text).ok());
let lines = self.lines.get_or_insert_with(|| LineIndex::new(text));
(tokens.as_deref(), lines)
}
}
impl<'a> Scope<'a> {
/// What the rename could not account for: the name inside `` `define``
/// text, inside a macro invocation's opaque token, inside an assertion
/// the SVA grammar could not structure, and identifier occurrences no
/// reference was recorded for.
///
/// Every scan but the last runs over **every** file that spells the name,
/// not only the edited ones: `` `BUMP(a) `` in a file the rename never
/// touches still expands to the old name, an assertion the SVA grammar
/// could not read is source text wherever it sits, and a reference the
/// workspace could not finish is spelled with the old name either way.
/// Their sentences are collected per scan and concatenated in that order,
/// which is the order they were emitted in when each scan had its own loop.
pub(super) fn warnings(
&mut self,
target: &Target,
edits: &[(usize, Vec<TextEdit>)],
) -> Vec<String> {
let mut warnings = self.macro_warnings(&target.name);
// Macro *invocations* are scanned in every file that spells the name,
// not only the edited ones: `` `BUMP(a) `` in a file the rename never
// touches still expands to the old name.
let name = &target.name;
let (mut defines, mut macro_uses) = (Vec::new(), Vec::new());
let (mut fallbacks, mut unfinished) = (Vec::new(), Vec::new());
// The edited files' scans outlive the loop: the unaccounted scan runs
// after all four of these and must not lex them a second time.
let mut kept: HashMap<usize, FileScan> = HashMap::new();
for i in 0..self.len() {
warnings.extend(self.macro_use_warnings(i, &target.name));
let mut scan = FileScan::default();
defines.extend(self.define_warnings(i, name, &mut scan));
macro_uses.extend(self.macro_use_warnings(i, name, &mut scan));
fallbacks.extend(self.sva_fallback_warnings(i, name, &mut scan));
unfinished.extend(self.unresolved_candidate_warnings(i, name, &mut scan));
if edits.iter().any(|(file, _)| *file == i) {
kept.insert(i, scan);
}
}
// Same reason again: an assertion whose spec the SVA grammar could not
// read is kept as source text, and the old name inside it is invisible
// to the semantic layer wherever the file sits.
for i in 0..self.len() {
warnings.extend(self.sva_fallback_warnings(i, &target.name));
let mut warnings = defines;
warnings.extend(macro_uses);
warnings.extend(fallbacks);
warnings.extend(unfinished);
for (i, edits) in edits {
let mut scan = kept.remove(i).unwrap_or_default();
warnings.extend(self.unaccounted_warnings(*i, name, edits, &mut scan));
}
// Same reason: a reference the workspace could not finish is spelled
// with the old name in a file the rename never edits, and silence
// there is the same kind of wrong as silence about a macro argument.
warnings.dedup();
warnings
}
/// [`Scope::warnings`] as it was written before take 5 §P2d shared the
/// per-file lex and line index: five loops, and every scan building its
/// own inputs from the file's text.
///
/// The oracle `the_shared_scan_says_exactly_what_the_per_scan_one_did`
/// compares against, so the dedupe is pinned against the control flow it
/// replaced — both the sharing and the order the sentences come out in —
/// rather than against itself.
#[cfg(test)]
fn warnings_reference(
&mut self,
target: &Target,
edits: &[(usize, Vec<TextEdit>)],
) -> Vec<String> {
let name = &target.name;
let mut warnings = Vec::new();
for i in 0..self.len() {
warnings.extend(self.unresolved_candidate_warnings(i, &target.name));
warnings.extend(self.define_warnings(i, name, &mut FileScan::default()));
}
for i in 0..self.len() {
warnings.extend(self.macro_use_warnings(i, name, &mut FileScan::default()));
}
for i in 0..self.len() {
warnings.extend(self.sva_fallback_warnings(i, name, &mut FileScan::default()));
}
for i in 0..self.len() {
warnings.extend(self.unresolved_candidate_warnings(i, name, &mut FileScan::default()));
}
for (i, edits) in edits {
warnings.extend(self.unaccounted_warnings(*i, &target.name, edits));
warnings.extend(self.unaccounted_warnings(*i, name, edits, &mut FileScan::default()));
}
warnings.dedup();
warnings
@@ -57,24 +146,22 @@ impl<'a> Scope<'a> {
/// lucisv does not preprocess, so a name that is also a macro name, or that
/// appears in a macro body, is left exactly as written — and said so.
fn macro_warnings(&self, name: &str) -> Vec<String> {
fn define_warnings(&self, file: usize, name: &str, scan: &mut FileScan) -> Vec<String> {
let where_ = display(self.path(file).unwrap_or(Path::new("?")));
let mut out = Vec::new();
for i in 0..self.len() {
let where_ = display(self.path(i).unwrap_or(Path::new("?")));
for site in self.define_sites(i, name) {
let line = site.line;
match site.defines_the_name {
Some(DefineKind::Define) => out.push(format!(
"`{name}` is also a macro defined at {where_}:{line}; macro names and macro uses are never renamed."
)),
Some(DefineKind::Undef) => out.push(format!(
"`{name}` is also a macro undefined at {where_}:{line}; macro names and macro uses are never renamed."
)),
None => out.push(format!(
"`{name}` appears in the body of macro `{}` at {where_}:{line} and was left unchanged; lucisv does not preprocess.",
site.macro_name
)),
}
for site in self.define_sites_with(file, name, scan) {
let line = site.line;
match site.defines_the_name {
Some(DefineKind::Define) => out.push(format!(
"`{name}` is also a macro defined at {where_}:{line}; macro names and macro uses are never renamed."
)),
Some(DefineKind::Undef) => out.push(format!(
"`{name}` is also a macro undefined at {where_}:{line}; macro names and macro uses are never renamed."
)),
None => out.push(format!(
"`{name}` appears in the body of macro `{}` at {where_}:{line} and was left unchanged; lucisv does not preprocess.",
site.macro_name
)),
}
}
out
@@ -84,9 +171,9 @@ impl<'a> Scope<'a> {
/// so the name inside `` `BUMP(a) `` is invisible to the semantic layer and
/// cannot be edited. It can be seen, though — and silence would be worse
/// than a warning, because the expansion still spells the old name.
fn macro_use_warnings(&self, file: usize, name: &str) -> Vec<String> {
fn macro_use_warnings(&self, file: usize, name: &str, scan: &mut FileScan) -> Vec<String> {
let where_ = display(self.path(file).unwrap_or(Path::new("?")));
self.macro_argument_sites(file, name)
self.macro_argument_sites_with(file, name, scan)
.into_iter()
.map(|site| {
format!(
@@ -110,15 +197,19 @@ impl<'a> Scope<'a> {
/// region is therefore already covered and already edited. So the scan may
/// be generous — `expect(word[7:0]);`, an ordinary task call, is claimed as
/// a region and contributes nothing.
fn sva_fallback_warnings(&mut self, file: usize, name: &str) -> Vec<String> {
fn sva_fallback_warnings(
&mut self,
file: usize,
name: &str,
scan: &mut FileScan,
) -> Vec<String> {
let (Some(text), Some(path)) = (self.text(file), self.path(file)) else {
return Vec::new();
};
if !contains_word(text, name) {
return Vec::new();
}
let Ok(tokens) = tokenize(text) else { return Vec::new() };
let regions = sva_regions(&tokens);
let Some(regions) = scan.tokens(text).map(sva_regions) else { return Vec::new() };
if regions.is_empty() {
return Vec::new();
}
@@ -126,9 +217,9 @@ impl<'a> Scope<'a> {
let mut covered: Vec<TextRange> =
analysis.semantics.symbols().iter().map(|s| s.name_span).collect();
covered.extend(analysis.semantics.references().iter().map(|r| r.name_span));
let lines = LineIndex::new(text);
let (Some(tokens), lines) = scan.tokens_and_lines(text) else { return Vec::new() };
let mut at: Vec<u32> = Vec::new();
for token in &tokens {
for token in tokens {
if token.kind != TokenKind::Ident || token.text != name {
continue;
}
@@ -158,6 +249,11 @@ impl<'a> Scope<'a> {
/// because "was left unchanged" and "no longer exists after the removal"
/// are different pieces of news.
pub(crate) fn define_sites(&self, file: usize, name: &str) -> Vec<DefineSite> {
self.define_sites_with(file, name, &mut FileScan::default())
}
/// [`Scope::define_sites`], reading the caller's shared line index.
fn define_sites_with(&self, file: usize, name: &str, scan: &mut FileScan) -> Vec<DefineSite> {
let (Some(text), Some(id)) = (self.text(file), self.file_id(file)) else {
return Vec::new();
};
@@ -165,7 +261,7 @@ impl<'a> Scope<'a> {
return Vec::new();
}
let Some(defines) = self.index.defines(id) else { return Vec::new() };
let lines = LineIndex::new(text);
let lines = scan.lines(text);
let mut out = Vec::new();
for define in defines.entries() {
let line = lines.line_col(define.span.start).0;
@@ -187,13 +283,32 @@ impl<'a> Scope<'a> {
}
/// Every macro invocation in one file whose *arguments* spell `name`.
///
/// The prefilter is `text.contains(name)` and **not**
/// `WorkspaceIndex::files_naming_in_macros` (take 5 §P2d proposed that
/// gate; it is not equivalent, so it is not taken). That census is
/// `FileFacts::macro_words` = `words::harvest_raw`, which reads the same
/// invocation tokens this scan reads but **skips every double-quoted run**
/// inside them, and skips a word a `'` precedes. So
/// `` `uvm_info("state_q", …) `` — the commonest shape a testbench names an
/// RTL signal in — is a site this scan reports and the census does not
/// know about, and gating on it would silently drop that warning.
pub(crate) fn macro_argument_sites(&self, file: usize, name: &str) -> Vec<ArgumentSite> {
self.macro_argument_sites_with(file, name, &mut FileScan::default())
}
/// [`Scope::macro_argument_sites`], reading the caller's shared tokens.
fn macro_argument_sites_with(
&self,
file: usize,
name: &str,
scan: &mut FileScan,
) -> Vec<ArgumentSite> {
let Some(text) = self.text(file) else { return Vec::new() };
if !text.contains(name) {
return Vec::new();
}
let Ok(tokens) = tokenize(text) else { return Vec::new() };
let lines = LineIndex::new(text);
let (Some(tokens), lines) = scan.tokens_and_lines(text) else { return Vec::new() };
let mut out = Vec::new();
for token in tokens.iter().filter(|t| t.is_macro()) {
// The macro's own name is reported by the `` `define`` scan when
@@ -215,7 +330,13 @@ impl<'a> Scope<'a> {
/// Identifier tokens spelling the name that no declaration and no
/// reference covers — grouped by *why* lucisv could not attribute them, so
/// the user is told where to look rather than guessing.
fn unaccounted_warnings(&mut self, file: usize, name: &str, edits: &[TextEdit]) -> Vec<String> {
fn unaccounted_warnings(
&mut self,
file: usize,
name: &str,
edits: &[TextEdit],
scan: &mut FileScan,
) -> Vec<String> {
let (Some(text), Some(path)) = (self.text(file), self.path(file)) else {
return Vec::new();
};
@@ -225,8 +346,7 @@ impl<'a> Scope<'a> {
covered.extend(analysis.semantics.references().iter().map(|r| r.name_span));
covered.extend(edits.iter().map(|e| e.range));
let Ok(tokens) = tokenize(text) else { return Vec::new() };
let lines = LineIndex::new(text);
let (Some(tokens), lines) = scan.tokens_and_lines(text) else { return Vec::new() };
// Reason → the lines it happened on, in source order.
let mut groups: Vec<(&'static str, Vec<u32>)> = Vec::new();
for (i, token) in tokens.iter().enumerate() {
@@ -236,7 +356,7 @@ impl<'a> Scope<'a> {
if covered.contains(&token.span) {
continue;
}
let reason = stray_reason(&tokens, i);
let reason = stray_reason(tokens, i);
let line = lines.line_col(token.span.start).0;
match groups.iter_mut().find(|(r, _)| *r == reason) {
Some((_, at)) => at.push(line),
@@ -269,7 +389,12 @@ impl<'a> Scope<'a> {
///
/// Grouped one line per (file, unit), because a name used against an
/// un-indexed module is used against it many times.
fn unresolved_candidate_warnings(&mut self, file: usize, name: &str) -> Vec<String> {
fn unresolved_candidate_warnings(
&mut self,
file: usize,
name: &str,
scan: &mut FileScan,
) -> Vec<String> {
let (Some(text), Some(path)) = (self.text(file), self.path(file)) else {
return Vec::new();
};
@@ -279,7 +404,7 @@ impl<'a> Scope<'a> {
return Vec::new();
}
let where_ = display(path).to_string();
let lines = LineIndex::new(text);
let lines = scan.lines(text);
let Some(analysis) = self.analysis(file) else { return Vec::new() };
// Unit that could not be found → the lines it was named on.
let mut groups: Vec<(String, Vec<u32>)> = Vec::new();
@@ -355,7 +480,7 @@ pub(crate) struct ArgumentSite {
/// read off its neighbours in the token stream. Naming the actual construct
/// is the difference between a warning the user can act on and one they have
/// to decode.
fn stray_reason(tokens: &[vlog_parser::token::Token], i: usize) -> &'static str {
fn stray_reason(tokens: &[Token], i: usize) -> &'static str {
let before = i.checked_sub(1).and_then(|n| tokens.get(n));
if before.is_some_and(|t| t.is_sym(".")) {
return "a hierarchical or member tail, which lucisv does not resolve";
@@ -383,7 +508,7 @@ fn stray_reason(tokens: &[vlog_parser::token::Token], i: usize) -> &'static str
/// structure. Deliberately generous: whether a region actually *is* a
/// fallback is decided by its caller from the analysis, and a region that
/// structured contributes nothing.
fn sva_regions(tokens: &[vlog_parser::token::Token]) -> Vec<TextRange> {
fn sva_regions(tokens: &[Token]) -> Vec<TextRange> {
let mut out = Vec::new();
let mut i = 0usize;
while i < tokens.len() {
@@ -418,7 +543,7 @@ fn sva_regions(tokens: &[vlog_parser::token::Token]) -> Vec<TextRange> {
/// The index of the `(` that opens the spec of the concurrent assertion or
/// `expect` statement starting at `i`, if one starts there.
fn assertion_paren(tokens: &[vlog_parser::token::Token], i: usize) -> Option<usize> {
fn assertion_paren(tokens: &[Token], i: usize) -> Option<usize> {
let mut k = i;
if tokens[i].kind == TokenKind::Ident && tokens.get(i + 1).is_some_and(|t| t.is_sym(":")) {
k = i + 2;
@@ -441,7 +566,7 @@ fn assertion_paren(tokens: &[vlog_parser::token::Token], i: usize) -> Option<usi
}
/// The index of the `)` matching the `(` at `open`, or the last token.
fn closing_paren(tokens: &[vlog_parser::token::Token], open: usize) -> usize {
fn closing_paren(tokens: &[Token], open: usize) -> usize {
let mut depth = 0usize;
for (j, t) in tokens.iter().enumerate().skip(open) {
if t.is_sym("(") {
@@ -500,7 +625,9 @@ fn is_name_byte(byte: u8) -> bool {
#[cfg(test)]
mod tests {
use super::contains_word;
use std::path::PathBuf;
use super::{contains_word, Scope};
#[test]
fn whole_word_search_ignores_substrings() {
@@ -510,4 +637,354 @@ mod tests {
assert!(contains_word("`WIDTH", "WIDTH"), "a macro use of the name still counts");
assert!(!contains_word("x", ""));
}
// ------------------------------------------------------------------
// take 5 §P2d: the shared lex and line index say what the old
// per-scan ones did
// ------------------------------------------------------------------
/// One rename fixture: the workspace, where the cursor is, and what the
/// warnings must say about it.
struct Case {
/// What this fixture is built to exercise, quoted on failure.
what: &'static str,
files: &'static [(&'static str, &'static str)],
/// The file the cursor sits in, and the text it sits at the start of.
file: &'static str,
at: &'static str,
new_name: &'static str,
/// A sentence fragment the warnings must contain, so a case cannot
/// pass by producing nothing at all. Empty for the controls, which
/// exist to prove the *absence* of a warning is shared too.
says: &'static str,
}
/// The six sentences `warnings` can produce, so the table can assert it
/// exercises every one of them rather than five.
const KINDS: [&str; 6] = [
"is also a macro",
"appears in the body of macro",
"appears in the arguments of the macro invocation",
"is spelled inside an assertion lucisv could not structure",
"could not be resolved — nothing in the indexed workspace answers",
"lucisv records no reference there",
];
/// A file that does not lex — an unterminated block comment — which every
/// scan must treat as "nothing to say" whether it lexes the file itself or
/// reads a shared answer.
const UNLEXABLE: &str = "module unlexable;\n /* sig is in here and the comment never closes\n";
/// A file whose only spelling of the name is in a comment: `contains_word`
/// sees it, the token stream does not.
const COMMENT_ONLY: &str =
"module note;\n // sig is only mentioned here\n logic other;\nendmodule\n";
const CASES: &[Case] = &[
Case {
what: "a macro of the same name, and one whose body spells it, and an undef",
files: &[(
"m.sv",
"`define sig 1\n`define USE_SIG assign z = sig;\n`undef sig\nmodule m;\n wire sig;\n assign q = sig;\nendmodule\n",
)],
file: "m.sv",
at: "sig;\n assign q",
new_name: "signal",
says: "is also a macro defined at",
},
Case {
what: "the name inside a macro body",
files: &[(
"m.sv",
"`define SET_A assign a = 1;\nmodule m;\n wire a;\n assign a = 0;\nendmodule\n",
)],
file: "m.sv",
at: "a;",
new_name: "sig",
says: "body of macro `SET_A`",
},
Case {
what: "the name inside a macro invocation's arguments",
files: &[(
"m.sv",
"`define BUMP(x) x = x + 1\nmodule m;\n int a;\n initial `BUMP(a);\nendmodule\n",
)],
file: "m.sv",
at: "a;",
new_name: "b",
says: "arguments of the macro invocation `BUMP`",
},
Case {
what: "a macro invocation in a file the rename does not edit",
files: &[
("p.sv", "package p;\n localparam int WIDTH = 8;\nendpackage\n"),
(
"u.sv",
"`define DECL(w) logic [w-1:0] bus\nmodule u;\n import p::*;\n `DECL(WIDTH);\nendmodule\n",
),
],
file: "p.sv",
at: "WIDTH",
new_name: "BUS_W",
says: "macro invocation `DECL`",
},
Case {
what: "a file whose only relationship to the name is a macro argument",
files: &[
(
"lib.sv",
"`define CHECK(sig) assert property (sig)\npackage p;\n localparam int WIDTH = 8;\nendpackage\n",
),
("user.sv", "module u;\n `CHECK(WIDTH)\nendmodule\n"),
],
file: "lib.sv",
at: "WIDTH = 8",
new_name: "BUS_W",
says: "macro invocation `CHECK`",
},
Case {
what: "an SVA spec the grammar could not structure, in the edited file",
files: &[(
"m.sv",
"module m;\n logic sig;\n assign x = sig;\n assert property (sig |-> $blah $blah);\nendmodule\n",
)],
file: "m.sv",
at: "sig;",
new_name: "signal",
says: "could not structure",
},
Case {
what: "an SVA fallback in a file the rename does not edit",
files: &[
("p.sv", "package p;\n localparam int WIDTH = 8;\nendpackage\n"),
(
"u.sv",
"module u;\n import p::*;\n assert property (WIDTH |-> $blah $blah);\nendmodule\n",
),
],
file: "p.sv",
at: "WIDTH",
new_name: "BUS_W",
says: "could not structure",
},
Case {
what: "an assertion the grammar did structure — the control",
files: &[(
"m.sv",
"module m;\n logic sig;\n assert property (sig |-> sig);\nendmodule\n",
)],
file: "m.sv",
at: "sig;",
new_name: "signal",
says: "",
},
Case {
what: "an unresolved candidate spelling the name",
files: &[(
"m.sv",
"module top;\n wire sig;\n unknown_mod u_x ();\n wire w;\n assign w = u_x.sig;\nendmodule\n",
)],
file: "m.sv",
at: "sig;",
new_name: "signal",
says: "could not be resolved",
},
Case {
what: "an unresolved candidate in a file the rename never edits",
files: &[
("holder.sv", "module holder;\n wire sig;\nendmodule\n"),
(
"other.sv",
"module other;\n unknown_mod u_y ();\n wire w;\n assign w = u_y.sig;\nendmodule\n",
),
],
file: "holder.sv",
at: "sig;",
new_name: "signal",
says: "other.sv",
},
Case {
what: "a tail the workspace can finish — the control",
files: &[
("sub.sv", "module sub;\n wire sig;\n assign sig = 1'b0;\nendmodule\n"),
(
"top.sv",
"module top;\n sub u_sub ();\n wire w;\n assign w = u_sub.sig;\nendmodule\n",
),
],
file: "sub.sv",
at: "sig;",
new_name: "signal",
says: "",
},
Case {
what: "a stray occurrence no reference covers — a member tail",
files: &[(
"m.sv",
"module m;\n wire sig;\n logic s;\n assign x = s.sig;\nendmodule\n",
)],
file: "m.sv",
at: "sig;",
new_name: "signal",
says: "as a hierarchical or member tail",
},
Case {
what: "a stray occurrence no reference covers — a mismatched end label",
files: &[(
"m.sv",
"module m;\n wire sig;\n initial begin : blk\n end : sig\nendmodule\n",
)],
file: "m.sv",
at: "sig;",
new_name: "signal",
says: "as an end label lucisv could not attach",
},
Case {
what: "a file that mentions the name only in a comment",
files: &[
("sub.sv", "module sub;\n wire sig;\n assign sig = 1'b0;\nendmodule\n"),
("note.sv", COMMENT_ONLY),
],
file: "sub.sv",
at: "sig;",
new_name: "signal",
says: "",
},
Case {
what: "a file that does not lex",
files: &[
("sub.sv", "module sub;\n wire sig;\n assign sig = 1'b0;\nendmodule\n"),
("unlexable.sv", UNLEXABLE),
],
file: "sub.sv",
at: "sig;",
new_name: "signal",
says: "",
},
Case {
what: "the §P2b eight-file workspace, whose rename edits two files",
files: &[
(
"/w/sub.sv",
"module sub (input logic clk, output logic q);\n wire sig;\n assign q = sig;\nendmodule\n",
),
(
"/w/top.sv",
"module top;\n logic w;\n sub u_sub (.clk(1'b0), .q(w));\n assign w = u_sub.sig;\nendmodule\n",
),
("/w/pkg.sv", "package pkg;\n localparam int SIG = 1;\nendpackage\n"),
(
"/w/user.sv",
"import pkg::*;\nmodule user;\n localparam int X = SIG;\nendmodule\n",
),
("/w/note.sv", COMMENT_ONLY),
("/w/far.sv", "module far;\n logic sig;\n assign sig = 1'b0;\nendmodule\n"),
("/w/quiet_a.sv", "module quiet_a;\n logic a;\nendmodule\n"),
("/w/quiet_b.sv", "module quiet_b;\n logic b;\nendmodule\n"),
],
file: "/w/sub.sv",
at: "sig;",
new_name: "renamed_sig",
says: "",
},
// The order test: every kind of warning at once, from several files,
// with two files edited — so a concatenation that grouped by file
// instead of by scan, or that ran the unaccounted scan too early,
// would come out in a different order and be caught.
Case {
what: "every shape in one workspace, two files edited",
files: &[
(
"sub.sv",
"`define sig 1\n`define USE_SIG assign z = sig;\nmodule sub;\n wire sig;\n assign sig = 1'b0;\n logic s;\n assign y = s.sig;\n assert property (sig |-> $blah $blah);\nendmodule\n",
),
(
"top.sv",
"`define BUMP(x) x + 1\nmodule top;\n sub u_sub ();\n wire w;\n assign w = u_sub.sig;\n assign w = `BUMP(sig);\n assign w = elsewhere.sig;\nendmodule\n",
),
(
"stray.sv",
"module stray;\n unknown_mod u_y ();\n wire w;\n assign w = u_y.sig;\nendmodule\n",
),
("note.sv", COMMENT_ONLY),
("unlexable.sv", UNLEXABLE),
],
file: "sub.sv",
at: "sig;\n assign sig",
new_name: "signal",
says: "could not be resolved",
},
];
/// One case's warnings, computed both ways over **separate** scopes, so a
/// cache the first call warmed cannot flatter the second.
fn both_ways(case: &Case) -> (Vec<String>, Vec<String>) {
let sources: Vec<(PathBuf, String)> =
case.files.iter().map(|(p, t)| (PathBuf::from(*p), (*t).to_string())).collect();
let path = PathBuf::from(case.file);
let text = case.files.iter().find(|(p, _)| *p == case.file).expect("the cursor's file").1;
let at = text.find(case.at).expect("the cursor text is in the file") as u32;
let mut shared = Scope::build(&sources);
let target = shared.locate(&path, at).expect("the cursor names something renameable");
let edits = shared.collect_edits(&target, case.new_name).expect("the rename has edits");
let said = shared.warnings(&target, &edits);
let mut apart = Scope::build(&sources);
let target = apart.locate(&path, at).expect("the cursor names something renameable");
let edits = apart.collect_edits(&target, case.new_name).expect("the rename has edits");
(said, apart.warnings_reference(&target, &edits))
}
/// **The §P2d proof.** Sharing one lex and one line index per file per call
/// changes no sentence and no order: fifteen fixtures — every warning-
/// producing shape `crates/vlog_refactor/tests/rename.rs` pins, the three
/// controls that must stay silent, a file that only mentions the name in a
/// comment, a file that does not lex, and one workspace holding all of them
/// with two files edited — asked both ways and compared as lists.
#[test]
fn the_shared_scan_says_exactly_what_the_per_scan_one_did() {
let mut seen = [false; KINDS.len()];
for case in CASES {
let (shared, reference) = both_ways(case);
assert_eq!(shared, reference, "{}: the shared scan disagrees", case.what);
if case.says.is_empty() {
continue;
}
assert!(
shared.iter().any(|warning| warning.contains(case.says)),
"{}: no warning says `{}`: {shared:?}",
case.what,
case.says
);
for (kind, seen) in KINDS.iter().zip(seen.iter_mut()) {
*seen |= shared.iter().any(|warning| warning.contains(kind));
}
}
let missed: Vec<&str> =
KINDS.iter().zip(seen).filter_map(|(kind, seen)| (!seen).then_some(*kind)).collect();
assert!(missed.is_empty(), "these warnings are never exercised: {missed:?}");
}
/// The controls are silent *and* silent in the same way: a workspace where
/// the only other spellings of the name are a comment and a file that does
/// not lex warns about nothing at all.
#[test]
fn a_comment_and_an_unlexable_file_are_warned_about_by_neither_scan() {
let case = Case {
what: "a comment and an unlexable file, together",
files: &[
("sub.sv", "module sub;\n wire sig;\n assign sig = 1'b0;\nendmodule\n"),
("note.sv", COMMENT_ONLY),
("unlexable.sv", UNLEXABLE),
],
file: "sub.sv",
at: "sig;",
new_name: "signal",
says: "",
};
let (shared, reference) = both_ways(&case);
assert!(shared.is_empty(), "nothing there can be warned about: {shared:?}");
assert_eq!(shared, reference);
}
}
+851 -7
View File
@@ -1,8 +1,14 @@
# perf5-p2 — rename reuses its analysis, verification untouched
Take 5 §P2 (`docs/performance_take5.md`), TODO §60.2. Stages P2a → P2b → P2c.
**P2d (source-set narrowing) and topology handshake 33 are not this lane's**;
no source set is narrowed or shared here.
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
@@ -21,6 +27,35 @@ 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
@@ -74,14 +109,68 @@ failure, and so is a faster refusal that refuses something else.
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. `module_sources`,
`offer_sources` and `imports::sources` are untouched; no selector is narrowed
or shared, so handshake 33 stays P2d's prerequisite and is not reached here.
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
@@ -100,7 +189,43 @@ or shared, so handshake 33 stays P2d's prerequisite and is not reached here.
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.
- [ ] QA.
- [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
@@ -199,6 +324,378 @@ 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
@@ -447,6 +944,315 @@ 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 /
@@ -488,6 +1294,44 @@ acceptance.
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,
+403 -11
View File
@@ -1,6 +1,6 @@
# Performance implementation tracker — take 5
**Status: baseline measured; P0 done; P1a, P1b and P1c implemented and measured (2026-09-07; P1c QA pending).** The implementation agent owns the blank candidate columns and experiment entries below. Read [the causes and detailed plan](../performance_take5.md) before selecting work. Baseline provenance and raw rows are in [take5-baseline](take5-baseline/README.md).
**Status: baseline measured; P0 done; P1a–P1c and P2a–P2c implemented, measured and merged; topology handshake 33 closed and P2d measured; P2d's `warnings` dedupe implemented and measured (2026-09-07; the second §P2 lane's QA pending). P2d ships no narrowing — the census below says why — and the ≥×2 rename target is **met at 2.01×** by the dedupe instead.** The implementation agent owns the blank candidate columns and experiment entries below. Read [the causes and detailed plan](../performance_take5.md) before selecting work. Baseline provenance and raw rows are in [take5-baseline](take5-baseline/README.md).
Do not overwrite the baseline, silently replace a workload, omit refusals, or report a proposed target as an achieved result. Use `not measured`, `blocked`, or `not applicable` rather than zero. Update this file after each measured stage, including rejected changes.
@@ -38,7 +38,9 @@ The order follows the plan. Later stages are conditional on the preceding measur
| P2a | Rename per-stage timings and selected/watched/input counts | P0 | dev (Opus); release `bf584aa0daf6…` → QA PASS → lead; committed 2026-09-07 | Done | `docs/features/perf5-p2/README.md`; experiment `P2a-2026-09-07` below. The tail rename's 780 ms is **238 input files / 4.55 MB and 717 whole-file parses**: `Scope::build` 228.5 ms, the occurrence walk 116.3, `rebuilt_index` 228.4 (the same build again), the after analyses 71.5, warnings 83.6, selection 13.4. 73 % of the request is whole-file parsing and two thirds of that parsing is repeated |
| P2b | Reuse per-file input analysis in request-local scope | P2a | dev (Opus); release `e555e6c79d8d…` → QA PASS → lead; committed 2026-09-07 | Done | Same README; experiment `P2b-2026-09-07`. Additive `FileFacts::analyzed`; `Scope::build_keeping` analyses the request's file first, reads the cursor's name off it and retains the analyses the rest of the request will ask for. Tail rename 781.7 → **676.6 ms**, parses 717 → **582**; peak RSS unchanged or lower on all eight rows |
| P2c | Reuse unchanged after-facts/semantics; re-resolve external references | P2b | dev (Opus); release `1601b13a9bac…` → QA PASS → lead; committed 2026-09-07 | Done | Same README; experiment `P2c-2026-09-07`. New `vlog_refactor/src/check/after.rs`: the after-index is the before-index cloned and **absorbed**, and an untouched watched file's after-print is its existing analysis re-resolved. Tail rename **419.9 ms (−46.2 % on REF, 1.86×)**, parses **240 = K + E**; every fingerprint identical. **Target ≥2× missed by 29.7 ms**; the remaining stage is `Scope::build`'s one parse of each of the 238 *selected* files (225 ms), which only §P2d can reach |
| P2d | Exact-name postings; source-set narrowing only with whole-scope proof | Reprofile P2c; topology 33 for shared module selector | — | Not started | Reprofiled: after §P2c the tail rename is 419.9 ms of which **225 ms is one parse of each selected file** and 83 ms a token scan. There is no duplicated parsing left; the next lever is the size of the selected set |
| H33 | Topology handshake 33 — the transitive hierarchical user `module_sources` could not see | P2c | dev (Opus); release `da2aa9433e11…`; committed 2026-09-07 | Done | `docs/features/perf5-p2/README.md`; experiment `H33-2026-09-07` below. A **fifth rung**, opt-in and asked for by inline-module alone: every file whose token census (`files_mentioning`, i.e. `FileFacts::words`) writes the dissolved instance's name. That census is exactly what `no_hierarchy` can refuse from, so the selected set now answers that refusal **as `sources()` would** — pinned by a six-shape whole-workspace equivalence test. Costs **+1.2 ms** at the measured site (8 files added); the four rungs, and therefore extract and every port action, are unchanged in answer and in cost |
| P2d | Exact-name postings; source-set narrowing only with whole-scope proof | Reprofile P2c; topology 33 for shared module selector | dev (Opus); same release; committed 2026-09-07 → QA PASS → lead; committed 2026-09-07 | Done — no narrowing (proof negative); handshake 33 closed; warnings dedupe; tail rename 2.01× | Same README; experiment `P2d-2026-09-07` below. The census says **133 of the tail rename's 238 selected files (56 %, 58 % of the bytes, ~130 ms) write neither name down** — all of them on the container rungs. They are not droppable: they are what `fold_path` hops through for a multi-level hierarchical tail and what `base_chain` climbs, so dropping them turns a resolved tail `StillUnresolved` (a **missed edit**, §49's own feature) and, where a reference has two paths, lets it fall through onto the target (an **extra edit**). Exact-name postings not implemented: selection is **13.6 ms of 420 (3.2 %)**, below the plan's own materiality gate. The target-scoped selector — fan out from the one declaration the cursor resolves to — is filed with its full shape list as a lane of its own |
| P2d-W | The `warnings` stage stops repeating itself: one lex and one `LineIndex` per file per call | P2d's finding | dev (Opus); release `18ef6d60c548…`; 2026-09-07 | Done | Same README; experiment `P2d-warnings-2026-09-07` below. The pure dedupe §P2d filed: `FileScan` memoizes `tokenize` and `LineIndex::new` per file, the five scans share it, and their sentences are concatenated in the order the five loops emitted them. The `warnings` 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. Tail rename **387.9 ms = 2.01× the §P0 REF — the ≥2× target is met.** The second dedupe P2d proposed (gate `macro_argument_sites` on `files_naming_in_macros`) is **not taken and the reason is in the code**: `macro_words` skips double-quoted runs, so `` `uvm_info("state_q", …) `` is a site the scan reports and the census cannot see. Warning **lists** compared as lists across 13 renames, old binary vs new: identical, order included |
| P3 | Reuse CLI census parse for package exports/interfaces | P0; coordinate semantic ownership | — | Not started | — |
| P4a | Attribute scan/prelude/table-build/cache/RSS cost | P0 | — | Not started | — |
| P4b | Implement the dominant measured startup/memory fix | P4a; serialize with state/index changes | — | Not started | — |
@@ -82,13 +84,13 @@ REF and part of each delta is §P1b's.
| `aes` lazy offer (`codeaction`) | 12.39 / 8.15–9.11 ms; 1 action | Repeated <5 ms | **REF** 13.87 / 7.33–9.66 ms; 1 action — REF median **8.17**. **P1a** 14.30 / 7.21–9.60, median 7.92. **P1b** 11.41 / 7.11–9.70, median **7.76**; 1 action in every try. **P1c** 2.72 / 1.60–2.03, median **1.74**; 1 action in every try | REF vs baseline −8.0%. **P1a −3.1%, P1b −5.0%, P1c −77.6% on P1b** | **Target <5 ms met at P1c.** The other three fan-out cursors fall with it: 42 → **0.77**, 67 → **1.78**, 128 → **1.38** ms lazy |
| `aes_reg_top` lazy offer (`codeaction`) | 32.81 / 22.45–25.09 ms; 2 actions | Repeated <10 ms | **REF** 30.64 / 22.72–24.42 ms; 2 actions — REF median **23.31**. **P1a** 32.24 / 22.08–24.17, median 23.60. **P1b** 31.50 / 20.93–24.42, median **21.83**; 2 actions in every try. **P1c** 6.92 / 4.80–5.62, median **5.46**; 2 actions in every try | REF vs baseline +1.0%. **P1a +1.3% (no change), P1b −6.3%, P1c −75.0% on P1b (−76.6% on REF)** | **Target <10 ms met at P1c.** P1b's residue was the discarded ports plan; §P1c replaced it with a predicate. The 5.46 ms left is dominated by the one parse of `aes_reg_top.sv` (52 461 B, 2.16–2.43 ms standalone) |
| `aes_reg_top` ports-only offer (`offer-breakdown`) | 21.72 / 21.55–21.78 ms; 0 port actions | Remove throwaway edit computation | **REF (`offerkinds`)** 22.27 / 22.46–22.56 ms; 0 port actions — REF median **22.47**. **P1a** 21.68 / 21.28–21.89, median 21.84. **P1b** 20.86 / 21.14–21.48, median **21.15**; 0 port actions. **P1c** 3.51 / 3.08–3.45, median **3.27**; 0 port actions | REF vs baseline +3.3%. **P1a −2.8%, P1b −5.8%, P1c −84.6% on P1b (−85.5% on REF)** | The row P1c existed for. All four planners refuse at *plan* time here, and the offer used to pay four `WorkspaceIndex::build`s (3.89 ms each, measured) to be told so. The all-family cell at the same cursor is 21.79 → **4.70** |
| `state_q` tail rename (`tailrename`) | 821.59 / 789.50–809.83 ms; 2 files | At least 2× faster; stretch <200 ms | **REF** 813.44 / 778.77–782.13 ms; **5 edits / 2 files / 0 created**, fingerprint `b39defb21265…` — REF repeat median **780.45**. **P2a** 817.45 / 789.49–782.21, median 784.19. **P2b** 706.50 / 676.19–673.57, median **674.68**. **P2c** 451.54 / 421.27–419.86, median **419.86**; 5 edits / 2 files / 0 created, **fingerprint identical** | REF vs baseline −1.4%. **P2a +0.5% (no change), P2b −13.6%, P2c −46.2% on REF** | **Target ≥2× missed**, at **1.86×**; stretch <200 ms not approached. The measured remaining stage is `Scope::build` — one parse of each of the **238 selected files**, 225 ms of the 420 — plus 83 ms of `warnings`, a token scan. Whole-file parses fell **717 → 240 = K + E** |
| Ordinary `aes` rename (`rename`) | 168.67 / 139.34–140.35 ms; 9 files | No regression; exact edit/warning parity | **REF** 167.60 / 140.46–142.13 ms; **14 edits / 9 files / 0 created**, fingerprint `fa7e31c78382…` — REF repeat median **141.30**. **P2a** 168.44 / 141.31–140.15, median 140.15. **P2b** 142.71 / 123.11–123.08, median **123.08**. **P2c** 126.13 / 107.15–105.95, median **106.31**; 14 edits / 9 files, **fingerprint identical** | REF vs baseline +1.2%. **P2a −0.8%, P2b −12.9%, P2c −24.8% on REF** | Goal was *no regression*; it is **25 % faster**, with byte-identical edits and warnings. Parses 51 → **22 = K + E** |
| Common port name `clk_i` at its declaration (`renametrace`, **new**) | not measured | Measure the fan-out's escape hatch | **P2a** 7 249.73 / 7 158.16–7 142.58, median **7 158.16**; the ambiguity hatch fires, so the input is the **whole workspace** — 3 976 files / 35.8 MB, 10 399 parses, peak RSS 1 864 MiB; 2 edits / 2 files, fingerprint `31aadc134628…`. **P2b** median 6 286.13, 9 150 parses, 1 840 MiB. **P2c** 3 985.94 / 3 888.95–3 860.05, median **3 860.05**, **3 977 parses**, 1 830 MiB, **fingerprint identical** | **P2c −46.1% on P2a** | New row, new phase. The worst rename on this corpus, and the one the fallback's cost is really made of. Still 3.9 s: 1 826 ms of it is one parse of each of the 3 976 files, 848 ms `warnings`, 245 ms selection |
| `state_q` tail rename (`tailrename`) | 821.59 / 789.50–809.83 ms; 2 files | At least 2× faster; stretch <200 ms | **REF** 813.44 / 778.77–782.13 ms; **5 edits / 2 files / 0 created**, fingerprint `b39defb21265…` — REF repeat median **780.45**. **P2a** 817.45 / 789.49–782.21, median 784.19. **P2b** 706.50 / 676.19–673.57, median **674.68**. **P2c** 451.54 / 421.27–419.86, median **419.86**; 5 edits / 2 files / 0 created, **fingerprint identical**. **H33/P2d** 448.80 / 420.90–424.44, median **420.90**; `renametrace`'s own tail row **419.95**; fingerprint identical. **P2d-W** three takes of `tailrename`, medians **389.82 / 387.95 / 385.29** → median of the three **387.95**; `renametrace`'s own tail row **395.45**; 5 edits / 2 files / 0 created, fingerprint identical | REF vs baseline −1.4%. **P2a +0.5% (no change), P2b −13.6%, P2c −46.2%, P2d-W −50.3% on REF** | **Target ≥2× MET at P2d-W: 2.01×** (780.45 → 387.95). Stretch <200 ms not approached. Against the same day's pre-change binary the paired fall is −7.1% (417.63 → 387.95), all of it the `warnings` stage (**82.2 → 51.4 ms**). What is left is `Scope::build` — one parse of each of the **238 selected files**, 233 ms of the 388 — which only a narrower selector can reach. Whole-file parses still **240 = K + E** |
| Ordinary `aes` rename (`rename`) | 168.67 / 139.34–140.35 ms; 9 files | No regression; exact edit/warning parity | **REF** 167.60 / 140.46–142.13 ms; **14 edits / 9 files / 0 created**, fingerprint `fa7e31c78382…` — REF repeat median **141.30**. **P2a** 168.44 / 141.31–140.15, median 140.15. **P2b** 142.71 / 123.11–123.08, median **123.08**. **H33/P2d** 131.03 / 106.75–106.99, median **106.75**, fingerprint identical. **P2c** 126.13 / 107.15–105.95, median **106.31**; 14 edits / 9 files, **fingerprint identical**. **P2d-W** 112.28 / 93.56–90.35, median **91.79**; 14 edits / 9 files, **fingerprint identical** | REF vs baseline +1.2%. **P2a −0.8%, P2b −12.9%, P2c −24.8%, P2d-W −35.0% on REF** | Goal was *no regression*; it is **35 % faster**, with byte-identical edits and warnings. Parses 51 → **22 = K + E**. P2d-W's share is the `warnings` stage, 22.9 → **8.3 ms** |
| Common port name `clk_i` at its declaration (`renametrace`, **new**) | not measured | Measure the fan-out's escape hatch | **P2a** 7 249.73 / 7 158.16–7 142.58, median **7 158.16**; the ambiguity hatch fires, so the input is the **whole workspace** — 3 976 files / 35.8 MB, 10 399 parses, peak RSS 1 864 MiB; 2 edits / 2 files, fingerprint `31aadc134628…`. **P2b** median 6 286.13, 9 150 parses, 1 840 MiB. **P2c** 3 985.94 / 3 888.95–3 860.05, median **3 860.05**, **3 977 parses**, 1 830 MiB, **fingerprint identical**. **P2d-W** 3 654.95 / 3 569.67–3 478.44, median **3 478.44**, 3 977 parses, 1 795 MiB, **fingerprint identical**; the same day's pre-change binary reads 3 825.66 | **P2c −46.1% on P2a; P2d-W −9.1% on that day's pre-change binary** | New row, new phase. The worst rename on this corpus, and the one the fallback's cost is really made of. Still 3.5 s: 1 888 ms of it is one parse of each of the 3 976 files, **438 ms `warnings` (was 848)**, 248 ms selection |
| Unique internal name (`renametrace`, **new**) | not measured | The shape the fan-out is built for | **P2a** median **23.05 ms**; 4 files / 68 KB, 10 parses, fingerprint `5f53e977da59…`. **P2b** 21.84, 9 parses. **P2c** median **19.84**, **5 parses**, **fingerprint identical** | −13.9% | New row. `cipher_alert` in `aes_core.sv` — the case the six rungs exist to make cheap, and they do |
| Conflicting new name, refused (`renametrace`, **new**) | not measured | A refusal is timed as a refusal | **P2a** median **640.81 ms**, 638 parses, `status: refused`. **P2b** 530.26, 498 parses. **P2c** median **331.18**, **244 parses**; same sentence, same empty-edit fingerprint `96f32d4243b1…` | **−48.3%** | New row. `state_q → state_d` in `entropy_src_main_sm.sv`; the verifier still refuses, in the same words, in half the time |
| All-sources fallback, ambiguous references (`renametrace`, **new**) | not measured | Do not lose the refusal it exists for | `rstmgr_por` (declared in four files): **P2a** median 2 146.63 ms, **P2c** **2 137.42**; 3 975 parses at both, peak 922 → 927 MiB, same refusal sentence. A cursor on **no symbol** takes the same road through `rename.rs`: 2 136.20 → **2 160.63** | ~0 % | New rows, both unmoved — and correctly so. Both refuse inside `locate`, having paid one whole-workspace `Scope::build` (1 840 ms) and nothing else; there is no repeated work in either for §P2b/§P2c to remove |
| Definition behind ordinary rename (`blockers`) | 145.99–168.79 ms, 3 pipelines | Falls with rename work | **REF** 163.43 / 161.55 / 161.11 ms, 3 pipelines (now `follower_ms.definition`) — REF mean of pipelines 2–3 **161.33**. **P2a** 158.88 / 158.80 / 154.17 (mean 2–3 = 156.48). **P2b** 148.86 / 138.02 / 145.25 (141.64). **P2c** 130.87 / 123.37 / 120.32 (**121.85**) | REF inside the baseline range; **P2c −24.5% on REF** | The queued definition follows its blocker exactly as the plan predicted |
| Definition behind ordinary rename (`blockers`) | 145.99–168.79 ms, 3 pipelines | Falls with rename work | **REF** 163.43 / 161.55 / 161.11 ms, 3 pipelines (now `follower_ms.definition`) — REF mean of pipelines 2–3 **161.33**. **P2a** 158.88 / 158.80 / 154.17 (mean 2–3 = 156.48). **P2b** 148.86 / 138.02 / 145.25 (141.64). **P2c** 130.87 / 123.37 / 120.32 (**121.85**). **H33/P2d**, three takes: (131.83, 130.51, 111.93) → 121.2, (135.47, 129.87, 110.00) → 120.0, and one outlier take (134.46, 130.83, 132.47) → 131.65; **median of the three means 121.2**. **P2d-W**, three takes: 116.97, 114.32, 115.91 → **median 115.91**, against the same day's pre-change binary at 127.67 and 124.12 | REF inside the baseline range; **P2c −24.5%, P2d-W −28.2% on REF** | The queued definition follows its blocker exactly as the plan predicted |
| Connect missing ports resolve (`refactor`) | 170.77 / 164.79–165.82 ms; 1 file | Measure collateral benefit; exact edit parity | **REF** 171.37 / 165.77–167.45 ms; 1 file, REF median **166.51**, fingerprint `4b534a16bca7…`. **P1c** 168.01 / 165.15–209.85, median **169.13**; 1 file, 2 edits, **fingerprint identical**. **P2a** median 164.91, **P2b** 165.29, **P2c** 142.25 / 131.21–132.72, median **132.72**; 1 file, 2 edits, **fingerprint identical** | REF vs baseline +0.4%; P1c +1.6%; **P2c −20.3% on REF** | The collateral the plan asked to be measured: `verify_splice` reaches the same after-index and the same re-resolution §P2c gave the rename, and the edit is byte-identical |
| Expand wildcard resolve (`refactor`) | 73.02 / 70.35–70.73 ms; 1 file, 32 connections | No lost connections/refusals | **REF** 73.61 / 71.67–73.01 ms; 1 file, 32 connections, REF median **71.89**, fingerprint `8f3a26dd147b…`. **P1c** 76.61 / 69.34–71.40, median **70.22**; 1 file, 32 connections, **fingerprint identical**. **P2a** median 70.31, **P2b** 70.29, **P2c** 66.31 / 54.91–55.85, median **54.91**; 1 file, 32 connections, **fingerprint identical** | REF vs baseline +2.2%; P1c −2.3%; **P2c −23.6% on REF** | Agrees; no connection and no refusal moved, and the same §P2c collateral |
| Eager 128-fan-out offer (`codeaction`) | 518.32 / 495.60–499.69 ms | Compatibility/perf guardrail; not first priority | **REF** 523.16 / 495.13–496.77 ms; 2 actions — REF median **496.24**. **P1b** 519.49 / 492.71–494.57, median **493.92**; 2 actions. **P1c** 516.78 / 492.51–496.34, median **492.54**; 2 actions | REF vs baseline +0.1%. **P1b −0.5%, P1c −0.3%** | Unchanged, which is the guardrail: the eager path's cost is the module's fan-out, and neither P1b nor P1c touched it — `code_actions` still computes and verifies every plan |
@@ -97,8 +99,8 @@ REF and part of each delta is §P1b's.
| Organize-imports **resolve** (`refactor`, **new**) | not measured | No lost removal, sort or refusal | **REF (P0)** 9.87 / 9.45–10.15 ms; 1 file, 1 edit, fingerprint `0ee027e37d07…`, REF median **9.45**. **P1c** 14.62 / 9.96–11.97, median **11.03**; 1 file, 1 edit, **fingerprint identical** | +16.7% on REF, inside this document's ±20% band for a 1–20 ms row | New row. The resolve path is unchanged by §P1c — `organize`'s middle was lifted into `planned` and it still verifies the splice |
| First offer after a `didChange`, same cursor (`offeredit`, **new**) | not measured — the gap the P0 entry named | Track separately from the repeated offer | **P1a** pinmux 383.61 / 366.93–369.71 (median 368.32); `aes_reg_top` instance 35.82 / 23.38–26.30 (24.84); `tb.sv` comment 4.80 / 3.28–3.42 (3.35). **P1b** pinmux 152.88 / 132.68–135.04 (median **133.86**); `aes_reg_top` 28.82 / 22.58–22.75 (**22.66**); `tb.sv` 2.29 / 1.90–2.00 (**1.95**) | P1a → P1b: pinmux **−63.7%**, `aes_reg_top` −8.8%, `tb.sv` −41.8% | New row, new phase `offeredit`. Each try is the *first* `codeAction` after its own `didChange`, so the document rebuild is inside the number; the paired "repeated offer on the unchanged buffer" rows sit beside them in the same session (P1b: pinmux **24.18**, `aes_reg_top` **21.65**, `tb.sv` **0.54**). No REF exists — P0 could not measure it |
| Extract command actually executed (`execute`, **new**) | not measured — take 4's `extract-module resolve` rows are invalid | Measure the command, not a refusal | **REF** `lucisv.extractModule` at `aes.sv` 220:0–222:53: **257.33 / 245.05–247.00 ms** executeCommand→applyEdit; 2 edits / 2 files / **1 created**; `deliver_ms` 0.015–0.033; status `capture`; fingerprint `090e92e7736e…` — REF median **246.03**. **P2a** median 244.53, **P2b** 244.78, **P2c** 161.41 / 149.25–149.86, median **149.25**; 2 edits / 2 files / 1 created, **fingerprint identical** | new row; **P2c −39.3% on REF** | The gap the tracker's work-count table named is closed — and §P2c's `verify_move` reuse is worth 39 % of the one refactoring command that really runs |
| Inline command actually executed (`execute`, **new**) | not measured | Measure the command, not a refusal | `lucisv.inlineModule` at `aes_wrap.sv` 66:2 is **refused** (`generate` construct); 6.58 / 5.87–6.20 ms. Not a timing of an inline | new row | Refusal recorded as `refused`; **not quotable** as an inline cost |
| Extract offered at the inline cursor, refused (`execute`, **new**) | not measured | — | `lucisv.extractModule` at `aes_wrap.sv` 66:2 refused after **817.37 / 793.77–809.07 ms** — REF median ~801. **P2a** 802.03, **P2b** 802.07, **P2c** median **801.23** | new row; **0 % at P2c** | Unchanged, and correctly so: it refuses *immediately after* `Scope::build`, so there is no repeated analysis for §P2b/§P2c to remove. Its cost is `module_sources` selecting hundreds of files for a **package** name — §P2d and handshake 33 territory |
| Inline command actually executed (`execute`, **new**) | not measured | Measure the command, not a refusal | `lucisv.inlineModule` at `aes_wrap.sv` 66:2 is **refused** (`generate` construct); 6.58 / 5.87–6.20 ms. Not a timing of an inline. **P2c** 5.62 / 5.49–5.05, median **5.33**. **H33** 6.95 / 6.74–6.17, median **6.55**, same refusal sentence | new row; **H33 +1.2 ms on P2c** | Refusal recorded as `refused`; **not quotable** as an inline cost. The H33 delta is the fifth rung's own census walk plus the 8 files it adds — the price of the refusal handshake 33 was missing |
| Extract offered at the inline cursor, refused (`execute`, **new**) | not measured | — | `lucisv.extractModule` at `aes_wrap.sv` 66:2 refused after **817.37 / 793.77–809.07 ms** — REF median ~801. **P2a** 802.03, **P2b** 802.07, **P2c** median **801.23**, **H33/P2d** 819.36 / 797.00–790.80, median **794.12**, same sentence | new row; **0 % at P2c, −0.9 % in the second lane** | Unchanged, and correctly so: it refuses *immediately after* `Scope::build`, so there is no repeated analysis for §P2b/§P2c to remove. Its cost is `module_sources` selecting hundreds of files for a **package** name — §P2d and handshake 33 territory |
| Cold workspace scan (`scan`, 3 fresh sessions) | 2830.30–2853.06 ms; mean 2843.00 | Investigation goal <2300 ms | **REF** 2860.12–2868.45 ms; mean 2863.85 | +0.7% on means | Agrees |
| Warm workspace scan (`scan`, 3 fresh sessions) | 1322.24–1344.03 ms; mean 1332.41 | Investigation goal <1000 ms | **REF** 1346.02–1352.80 ms; mean 1348.94 | +1.2% on means | Agrees |
| First useful answer during the scan (`scan`, **new**, 3 fresh sessions) | not measured | Stay responsive during a scan (P4) | **REF** cold **84.42–85.87 ms**, warm **206.12–218.72 ms**; 1 location in every session | new row | Warm is 2.5× *slower* than cold to first answer — carried to P4a |
@@ -148,15 +150,15 @@ this stage; each says so rather than being left ambiguous.
| Action parity | Titles/kinds/counts/commands/data or edits/refusals; empty/prefix filters; cursor and selection | **P0: recorded, not yet a comparison.** Every offer row now carries `titles`, the shape of each offer (`edit`/`command`/`data`), `result_count` and the `only` filter it asked with; `offerkinds` walks 7 filters at 5 cursors. This is the reference P1 must match — **P1a/P1b: matched.** Every one of the 60 rows in each stage carries the REF's own `result_count`, and the `codeaction` rows the REF's own `titles`; all 7 filters at all 5 cursors agree. In tests, `vlog_refactor/tests/parsed_selectors.rs` compares old against new at **every byte offset** of five fixtures, and `server/tests/code_action.rs` pins order, prefix filters, the empty filter, a cursor-width extraction and a fix spanning the cursor. **P1c: matched again** — every row of `offerkinds`, `codeaction` and `offerqueue` compared field-by-field against P1b's own record (`result_count`, `titles`, `shapes`, `status`, `fingerprint`, `edits`, `files`, `created`): **50 rows, 0 differences**; against the P0 REF, **65 rows, 0 differences**. In tests, `vlog_refactor/tests/port_offers.rs` compares the offered *menu* against `port_actions`' menu — titles included, in order — at every byte offset of eight fixtures, and `import_offers.rs` compares `organize_offer` against `organize_counts` — counts and refusal sentence — at every byte offset of seven |
| Reuse freshness | didChange, unsaved overlays, config/options/tab width/waiver changes, index generation, closed files changed on disk | Not applicable at P0. **P1b: one memo exists, the fence answer, and it is bound to the `Document` that owns the text** — `Workspace::set_document` builds a whole new `Document` on every `didOpen`/`didChange`/text-carrying `didSave`, and `answer_request` flushes pending changes before any handler runs, so there is no revision to compare and no way to hold the wrong one. Pinned by `a_fence_typed_into_the_buffer_is_seen_by_the_next_request` (fix → fence typed in → fix withheld → fence removed → fix back). Configuration is **not** memoized: `an_external_waiver_still_keeps_its_fix_out_of_the_offer` writes a `lucisv.toml` between two requests and the second obeys it. An index rebuild between two requests changes nothing at the cursor (`an_index_refresh_does_not_change_what_the_cursor_offers`). **Lint results are not cached** — see the `P1b-2026-09-07` entry for why and for the number |
| Fence parity | All aliases, class/statement fences, malformed source, raw scan backstop, insertions and multi-edit fixes | Not applicable at P0. **P1: `vlog_formatter/src/fence.rs` is untouched and the shared-fence-filter contract is not amended** — the question asked is still `protected_regions(&doc.text)`, byte for byte, so every alias, class/statement fence, malformed-source case and scan backstop is answered by the same code as before. What changed is *when* it is asked (only when a violation carries a fix) and *how often* (once per document revision). `vlog_formatter`'s own suite is green |
| Refactor whole-scope parity | Exact edits, warnings, refusal sentences; old/new common names, unresolved and ambiguous uses | **P0 supplies the instrument**: `fingerprint` (sha256 over sorted edits + created paths + warnings) and `edits`/`files`/`created` on every edit-bearing row, plus refusal sentences captured verbatim in `message`. First reference values recorded (tail rename, `aes` rename, extraction). **P2: matched on every row of every stage.** All thirteen edit-bearing rows of `renametrace`, `tailrename`, `rename`, `refactor` and `execute` carry byte-identical fingerprints at §P2a, §P2b and §P2c and equal to the §P0 REF's — `b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…`, `4b534a16bca7…`, `8f3a26dd147b…`, `0ee027e37d07…`, `090e92e7736e…` — and the three refusal rows carry the same sentences and the same empty-edit fingerprint `96f32d4243b1…`. The common-name, unresolved-new-name and ambiguous-use cases the gate names are the `renametrace` phase's own rows |
| Topology handshake 33 | Transitive `wrap.u_S.x` refusal coverage before sharing/narrowing module sources | **Still not applicable at P2a–P2c**: `module_sources`, `offer_sources`, `imports::sources` and `rename_sources`' six rungs are untouched, and **no source set was narrowed or shared** — the ladder's only change is that the set it fills now records which rung filled it. Handshake 33 remains §P2d's prerequisite. Not applicable at P0 — no selector shared or narrowed. **Still not applicable at P1**: the four `*_in` selectors take the same decisions over the same tree, and **no source set was narrowed or shared** — `module_sources` / `offer_sources` / `imports::sources` are untouched. Handshake 33 stays P2's prerequisite |
| Refactor whole-scope parity | Exact edits, warnings, refusal sentences; old/new common names, unresolved and ambiguous uses | **P0 supplies the instrument**: `fingerprint` (sha256 over sorted edits + created paths + warnings) and `edits`/`files`/`created` on every edit-bearing row, plus refusal sentences captured verbatim in `message`. First reference values recorded (tail rename, `aes` rename, extraction). **P2: matched on every row of every stage.** All thirteen edit-bearing rows of `renametrace`, `tailrename`, `rename`, `refactor` and `execute` carry byte-identical fingerprints at §P2a, §P2b and §P2c and equal to the §P0 REF's — `b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…`, `4b534a16bca7…`, `8f3a26dd147b…`, `0ee027e37d07…`, `090e92e7736e…` — and the three refusal rows carry the same sentences and the same empty-edit fingerprint `96f32d4243b1…`. The common-name, unresolved-new-name and ambiguous-use cases the gate names are the `renametrace` phase's own rows. **Second lane (H33/P2d): matched again on every row** — the four `renametrace` edit fingerprints, the shared refusal `96f32d4243b1…` on all three refusal rows, the extract capture `090e92e7736e…` and the three `refactor` resolves, all byte-identical; and inline-module gains a **whole-workspace equivalence test in the suite** (`the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does`), which is this gate asserted in code rather than only on the corpus |
| Topology handshake 33 | Transitive `wrap.u_S.x` refusal coverage before sharing/narrowing module sources | **CLOSED 2026-09-07 (second lane).** `module_sources` gains an opt-in **fifth rung** (`module_select::hierarchical_users`, `Workspace::module_sources_reaching`), asked for by `inline_module::execute` alone: every file whose token census (`WorkspaceIndex::files_mentioning`, i.e. `FileFacts::words`) writes the dissolved instance's name down. `words::harvest` records every `Ident` token **and** the words inside macro/directive/attribute raw text, so every file `no_hierarchy` can refuse over is in it — the selected set now answers that refusal exactly as `sources()` does, asserted by `the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does` on six shapes. Sixteen tests (twelve through the real dispatch): two and three wrapper levels, the level the four rungs already saw, a `bind` from a file that instantiates nothing (**the fixture that discarded the transitive-instantiator walk the topology row names — the walk cannot reach it**), a generated path, a macro-hidden path (pinned *not* refused, with the reason), a package/interface/class name, duplicate modules, an unsaved buffer, a clean ladder, and the four-rung answer asserted unchanged as a list. Cost **+1.2 ms** at `aes_wrap.sv` 66:2 (8 files added); worst instance spelling in the corpus selects 79 of 3 975 files (2 %), on a command, never on a keystroke. Extract and the port actions ask for `Reach::none()` and are unchanged in answer and cost. Historical: **not applicable at P2a–P2c**: `module_sources`, `offer_sources`, `imports::sources` and `rename_sources`' six rungs are untouched, and **no source set was narrowed or shared** — the ladder's only change is that the set it fills now records which rung filled it. Handshake 33 remains §P2d's prerequisite. Not applicable at P0 — no selector shared or narrowed. **Still not applicable at P1**: the four `*_in` selectors take the same decisions over the same tree, and **no source set was narrowed or shared** — `module_sources` / `offer_sources` / `imports::sources` are untouched. Handshake 33 stays P2's prerequisite |
| Refactor verification | Token identity, semantic identity, parse-diagnostic preservation, comments/attributes, span remapping | **P2: the checks are untouched; their inputs changed.** `Print`, `print`, `Shifts`, `Excluded`, `watched_files`, `tokens_match`, `first_difference`, the `ledger` and the parse-diagnostic comparison are the same code and the same comparisons; what moved is where a `Semantics` and an after-index come from (`check/after.rs`, new). Every existing attack still refuses — `check::tests`' eight `tokens_match` pairs, `check/ledger.rs`'s, `removing_an_import_a_reference_needs_is_rejected`, the `rename/tests.rs` refusals — and **three new attack pairs aimed at the reuse** were added and pass: a stale retained analysis (`a_rename_whose_edit_rebinds_a_name_in_the_edited_file_is_refused`), an after-index that forgot an unedited file (`a_rename_that_would_make_a_third_files_use_ambiguous_is_refused`), and shifted file ids (`a_print_names_paths_so_shifted_file_ids_cannot_change_it`). Not applicable at P0 — the engine's verifiers are untouched. **Unchanged at P1**: nothing below the four gates moved; `extract_module`, `inline_module`, `organize_imports`, `port_actions` and `check::verify` are the same code, and `vlog_refactor`'s own suites are green. **P1c: still unchanged where it matters.** `check::verify_splice`, `check::verify` and `ports::confirm` are untouched, and every resolve/execute path still runs them — the three resolve rows measured above carry fingerprints byte-identical to the REF's. The *offer* predicates deliberately do not run them; that is the only widening, it is confined to a menu, it was already the lazy offer's stated contract, and the every-offset parity suites find **zero** cursors on their fixtures where it changes the answer |
| CLI output | Compare full findings/fixes/waivers/exit codes, not just counts; disabled-rule run stays attribution-only | **Passed.** stdout sha256 of all five configurations byte-identical to the baseline's; exit codes 1 (lint findings) / 2 (four pre-existing format failures) as before; the `--ignore unused-import` run is recorded as attribution only |
| Index parity | Fresh/incremental/absorbed fingerprints, unsaved wins, coherent partial publication, scope/filelist/rootless behavior | **P2c pins the absorbed-against-fresh equality where the verifier now stands on it**: `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`) on nine cases including a file gaining and losing a declaration, an edit that changes what another file resolves to, a re-export chain, an edited package and a file that stops lexing; `absorbing_an_edited_file_keeps_every_file_id` pins id stability; `an_index_from_analyzed_facts_is_the_index_a_build_gives` pins the §P2b assembly. Not applicable at P0. Store size unchanged at 44.34 MiB and the scan's own `$/progress` end messages recorded per cell (`124 → 3976 files indexed, 3975 from cache, 3 skipped` warm) |
| Persistence | Corrupt/truncated/old-format stores rebuild safely; interrupted writes; content hash retained | Not applicable at P0 |
| Resources | Guard outcomes, idle and peak memory, allocated/actual store size, stack-size requirement | **P2: zero guard kills** across nineteen timed phases and every `cargo` gate; largest resident set **1 864 MiB** (23 % of the 8 GiB limit), on the §P2a all-sources fallback — and §P2b/§P2c *lowered* it. Peak RSS re-measured per rename at all three stages (the row above); no row rose by more than 20 MiB. The one new retention is a request-local `HashMap<usize, Semantics>` bounded to the files whose text spells one of the two names, which are the files the request analyses anyway. No new parsing thread, so the 16 MiB stack contract is untouched. **Passed.** Every run under `tools/guard.sh -m 8 -t 1800`; **zero kills**; largest resident set 575.6 MiB (7% of the limit). Idle *and* peak RSS now recorded in their own KiB fields; store 44.34 MiB. **P1: zero guard kills** across ten timed runs and every `cargo` gate. Memory not re-measured (P4a's phase); the only new retention is one `Vec<Region>` per open buffer that ever needed a fence answer. No new parsing thread, so the 16 MiB stack contract is untouched |
| Formatting | `cargo fmt --all -- --check`, appropriate formatter snapshot/idempotency and corpus gates | **P2: `cargo fmt --all -- --check` clean** at every stage; the formatter is not on this change's path (`vlog_formatter` is untouched) and its suite ran green inside each workspace run. `python3 -m py_compile tools/perf/*.py` clean for the new `phases_p2.py`. Not applicable at P0 — no Rust changed, and no `cargo` command may run during a timed round. `python3 -m py_compile tools/perf/*.py` and `bash -n tools/perf/*.sh` clean. **P1: `cargo fmt --all -- --check` clean; `cargo test -p vlog_formatter` green inside the workspace run** (the formatter is not on this change's path — `fence.rs` is untouched — but it was run anyway). `python3 -m py_compile tools/perf/*.py` clean for the new phase |
| Lint/tests | Guarded affected tests then clippy/workspace tests at integration, no benchmark overlap | **P2: guarded `cargo test --workspace` green before every release build — 4 215 (before the lane) → 4 225 (§P2b) → 4 231 (§P2c), 0 failed, no test removed or weakened**; guarded `cargo clippy --all-targets` clean at each stage with **no new `#[allow]`**; `cargo fmt --all -- --check` clean. **No `cargo` command ran during any timed phase**: each stage built once, to completion, then measured. Not applicable at P0 (no Rust). No benchmark overlapped a build. **P1: `cargo clippy --all-targets` clean at both stages** (one `needless_borrow` introduced by the P1b diff was fixed; **no new `#[allow]`**), `cargo test --workspace` green before each stage's build, all guarded. **No cargo command ran during any timed phase**: each stage built once, to completion, then measured. **P1c: `cargo fmt --all -- --check` clean, guarded `cargo clippy --all-targets` clean, guarded `cargo test --workspace` **4215 passed / 0 failed** (4194 at P1b, +21), then one guarded release build, then four timed phases with no cargo running; zero guard kills; corpus unchanged after every phase. One new `#[allow(clippy::too_many_arguments)]`, on `imports::planned`, with the reason on the line |
| Lint/tests | Guarded affected tests then clippy/workspace tests at integration, no benchmark overlap | **P2: guarded `cargo test --workspace` green before every release build — 4 215 (before the lane) → 4 225 (§P2b) → 4 231 (§P2c), 0 failed, no test removed or weakened**; guarded `cargo clippy --all-targets` clean at each stage with **no new `#[allow]`**; `cargo fmt --all -- --check` clean. **No `cargo` command ran during any timed phase**: each stage built once, to completion, then measured. Not applicable at P0 (no Rust). No benchmark overlapped a build. **P1: `cargo clippy --all-targets` clean at both stages** (one `needless_borrow` introduced by the P1b diff was fixed; **no new `#[allow]`**), `cargo test --workspace` green before each stage's build, all guarded. **No cargo command ran during any timed phase**: each stage built once, to completion, then measured. **Second lane (H33/P2d): guarded `cargo test --workspace` 4 231 → **4 248 passed / 0 failed** (+17, none removed or weakened); guarded `cargo clippy --all-targets` clean with **no new `#[allow]`**; `cargo fmt --all -- --check` clean; one release build, then eight timed phases with no `cargo` running; zero guard kills; corpus unchanged after every phase.** **P1c: `cargo fmt --all -- --check` clean, guarded `cargo clippy --all-targets` clean, guarded `cargo test --workspace` **4215 passed / 0 failed** (4194 at P1b, +21), then one guarded release build, then four timed phases with no cargo running; zero guard kills; corpus unchanged after every phase. One new `#[allow(clippy::too_many_arguments)]`, on `imports::planned`, with the reason on the line |
| Documentation | Feature README, handshake updates in topo, accepted numbers in perf README; reserved lead Review untouched by dev | **P2: `docs/features/perf5-p2/README.md` created** with all seven sections, QA and Review left empty, the work log kept as the work went. **`topo.md` is not edited by this lane** — four additive edges (`FileFacts::analyzed`; `vlog_refactor::rename_traced` and its trace values; the server's `rename_trace` module; `rename::rename_traced` / `Workspace::rename_sources_traced` replacing their untraced forms at the one production call site) are written as requests in that README's Handshakes for the lead to apply. `docs/perf/README.md` untouched until the lead accepts these numbers. **Done.** `docs/features/perf5-p0/README.md` created with the required sections (QA and Review left empty); no `topo.md` edge changed because no interface changed; `docs/perf/README.md` carries a note that two take-4 row *meanings* are superseded. **P1: `docs/features/perf5-p1/README.md` created** with all seven sections, QA and Review left empty, the work log kept as the work went. `topo.md` is **not** edited by this lane — the two additive edges (`vlog_parser::stats`, the four `vlog_refactor` `*_in` selectors, the server's `fences` module) are written as requests in that README's Handshakes for the lead to apply. `docs/perf/README.md` untouched until the lead accepts these numbers. **P1c: the same README gains a P1c section in Goal, Handshakes, Status and Work log**, a dated empty QA heading, and two further handshake requests for the lead — the `port_offers` / `organize_offer` topo edges, and a `vlog_semantic` request to expose a `FileFacts` built from an existing analysis (worth ~0.8 ms of the organize-imports offer). Review still untouched by the dev |
## Experiment record — P0-2026-09-07 (stage P0)
@@ -898,6 +900,396 @@ this stage; each says so rather than being left ambiguous.
selected set is the only thing left — and is a separate lane.
- **QA result and lead review link:** pending.
## Experiment record — H33-2026-09-07 (topology handshake 33)
- **Experiment ID / stage / date / owner:** `H33-2026-09-07` / handshake 33,
TODO §60.2's first unticked line / 2026-09-07, America/Chicago / dev agent
(Opus), second §P2 lane.
- **Hypothesis and exact expected work reduction:** none — this is correctness
work and it **adds** files. Hypothesis: a file that reaches an inlined
instance through modules it does not itself instantiate is in no rung of
`module_sources`, so `inline/mod.rs::no_hierarchy` cannot refuse over it and
the inline is silently accepted. Expected cost: the files the new rung adds,
read and parsed by `Scope::build`, on the inline command only.
- **Reference commit, candidate commit or diff hash, binary hashes:** reference
`e51a2c7` (§P2a–c merged), server sha256
`1ee55becdec9799ed9bfb1d329bc4a13d16300ddfed87276b0c3bce9d47e601f` for the
handshake-only build; final candidate (handshake 33 + the §P2d census) server
sha256 `da2aa9433e1156731846a1f6c70a2ee44cd88e21af8be9375e7e6909b84ff1ea`.
Release, `--locked`, workspace LTO.
- **Files changed / API contracts amended / topology references:** new
`crates/lucisv_server/src/module_select.rs` (**24** production lines,
`Reach`, `hierarchical_users`); `state.rs` gains `module_sources_reaching` (**+25 lines net**, `git diff --numstat` 28/3, `module_sources` delegates to it, the four rungs byte-identical);
`inline_module.rs` names the dissolved instance as its `Reach`; `main.rs` and
`server/tests/mod.rs` one `mod` line each; new
`crates/lucisv_server/src/server/tests/hierarchy_reach.rs`. Consumes
`WorkspaceIndex::files_mentioning`, unchanged and already public. **Topology
row 33 wants the lead's strike and an amendment**: the delivered rung is the
instance's word census, not the transitive-instantiator walk the row asks
for — see the feature README for the `bind` fixture that discarded the walk.
- **Workload, corpus/input hashes, open files, cursor/range, rules, client
capabilities:** opentitan `00981352642fb65ef2b6c47143a0f6bb31fd4a97` with the
same three pre-existing modified files. Phases `execute` and `refactor`, both
`tools/perf/bench.py`, workspace scope, `resolve_support` + `applyEdit` +
`create_files` as §P0 set them. Cursors: `aes_wrap.sv` 66:2 (the
inline-module offer site) and 78:2 (port actions); the extract selection
`aes.sv` 220:0–222:53.
- **Machine, compiler/profile, threads, load before/after, competing activity:**
M1 Max, macOS 27.0 `26A5425a`; release profile; single-threaded server. Load
before/after 4.72/4.13 (`execute`) and 4.13/3.9 (`refactor`). No `cargo`
command ran during any timed phase.
- **Commands, cache reset/prime steps, trial ordering and fresh-session count:**
`tools/guard.sh -m 8 -t 1800 -- python3 tools/perf/bench.py <phase> --server
target/release/lucisv-server --label H33 --opentitan "$OT" --storage
/tmp/perf-h33/caches/h33 --out ~/.cache/lucisv-perf/take5-p2d/results-h33.jsonl --tries 3`. One
fresh session per row; the storage cache is primed by the first session and
warm thereafter, as §P0 set it.
- **Raw evidence path, explicit units, full sample arrays:**
`~/.cache/lucisv-perf/take5-p2d/results-h33.jsonl`; `ms` is wire latency in milliseconds.
`execute` inline row `[6.95, 6.74, 6.36, 6.17]`; extract capture
`[169.49, 151.35, 147.65, 148.78]`; extract refusal
`[819.36, 797.00, 794.12, 790.80]`; `refactor` port-actions resolve
`[135.43, 131.51, 130.81, 130.73]`, expand-wildcard
`[60.69, 54.37, 54.57, 54.20]`, organize-imports
`[12.17, 10.51, 9.27, 8.47]`.
- **Reference first / repeat median / range; candidate first / repeat median /
range:** inline command §P2c 5.62 / **5.33** / 5.05–5.49 against H33 6.95 /
**6.55** / 6.17–6.74. Extract capture §P2c 161.41 / **149.25** / 148.65–149.86
against 169.49 / **148.78** / 147.65–151.35. Extract refusal §P2c 831.57 /
**801.23** / 791.88–801.48 against 819.36 / **794.12** / 790.80–797.00. Port
resolve §P2c **132.72** against **130.81**.
- **Work counts: reads, parses, analyzed/selected/watched/edited files and
bytes:** the rung added **8 files** at `aes_wrap.sv` 66:2 — the instance
there is spelled `tlul_cmd_intg_gen`, and 8 corpus files write that word.
Bound on the rung, derived from the corpus rather than assumed: the
most-mentioned instance spellings are `u_reg` 79 files, `u_chk` 72,
`u_prim_buf` 32, `u_bus_intg` 12, of 3 975 — so the worst inline this rung
can reach selects about **2 %** of the tree, on an explicit command. No
keystroke path is affected: `ports::code_actions` asks for `Reach::none()`.
- **Result/status/count/fingerprint comparisons, warnings and refusal checks:**
extract capture fingerprint `090e92e7736e…` **identical**; both refusal
sentences identical word for word (the inline's `generate`-construct refusal,
the extract's `h2d_intg` refusal); port resolve title `lucisv: connect 2
missing ports` and expand-wildcard `lucisv: expand .* (32 connections)`
unchanged.
- **Idle RSS / peak RSS / cache size / guard outcomes:** not sampled by
`execute`/`refactor` (they carry no sampler); the rename rows' peaks are in
the `P2d-2026-09-07` entry. **Zero guard kills.**
- **Target achieved or missed:** not a performance target. The correctness
target — a hierarchical use the whole workspace refuses over is refused over
here too — is **achieved and asserted**, not argued:
`the_selected_set_answers_the_inline_exactly_as_the_whole_workspace_does`
runs `vlog_refactor::inline_module` over the narrowed set and over
`ws.sources()` on six shapes and requires the same answer.
- **Correctness tests and logs:** sixteen new tests — twelve in
`server/tests/hierarchy_reach.rs` driven through the real dispatch, four in
`module_select.rs`. Two and three wrapper levels; the level the four rungs
already saw; a `bind` written in a file that instantiates nothing in the
chain; a generated path; a macro-hidden path (pinned **not** refused, with
the reason — `no_hierarchy` tokenizes and a directive is one opaque token,
and the whole workspace answers identically); a package/interface/class name;
duplicate modules (the ambiguity refusal, unchanged); an unsaved buffer that
adds the path; a ladder nobody reaches into (still inlines); the four-rung
answer asserted as a **list**, so a file appearing is a failure whatever its
name; and the six-shape equivalence test. Guarded `cargo test --workspace`
**4 248 passed / 0 failed**.
- **Interpretation, remaining bottleneck, tradeoffs, rejected alternatives:**
the postings for a hierarchical path are keyed to the path's **last**
segment, not its hops — `references_to` on the `u_sub` instance def is empty
even when another file writes `u_wrapper.u_top.u_sub.s` — so §49's surface
could not answer this by itself; that was measured with an index probe before
anything was written. **Rejected alternative: the transitive-instantiator
walk** the topology row names. It was implemented and tested, 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 and the walk cannot reach, and `$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. **Rejected
alternative: folding the rung into `module_sources` for every caller**, which
the brief expected — `ports::code_actions` calls `module_sources` on every
cursor move (§P1's whole subject) and neither it nor extract has a
whole-workspace hierarchy refusal to feed, so they ask for `Reach::none()`
and pay nothing.
- **Decision:** retain. Handshake 33 is closed, and the closure is the
prerequisite §P2d was gated behind.
## Experiment record — P2d-2026-09-07 (stage P2d)
- **Experiment ID / stage / date / owner:** `P2d-2026-09-07` / P2d /
2026-09-07, America/Chicago / dev agent (Opus), second §P2 lane.
- **Hypothesis and exact expected work reduction:** after §P2c the tail rename
is 420 ms of which 225 is one parse of each of 238 *selected* files. If a
large share of those files contributes nothing to the four verifier checks,
a narrower selector removes that share of the 225 ms and the missed ≥2×
target is met. Expected reduction if the share is ~55 %: ~130 ms, taking the
tail rename to ~290 ms (2.7×).
- **Reference commit, candidate commit or diff hash, binary hashes:** reference
§P2c server sha256 `1601b13a9bacda47095cb23580e475ac8f33a171f446875484439ec67d58eb31`;
candidate `da2aa9433e1156731846a1f6c70a2ee44cd88e21af8be9375e7e6909b84ff1ea`.
- **Files changed / API contracts amended / topology references:**
`rename_trace.rs` gains `indirect_census` / `census_line` /
`SelectionTrace::indirect`, and `Wanted` holds `BTreeMap<PathBuf, Rung>`
instead of `BTreeSet<PathBuf>` so the census can ask which rung a file came
from; `state.rs` calls the census in one line. **No selector's answer
changed.** The `timing: rename trace` line gains one `indirect{…}` group,
which `tools/perf/phases_p2.py` reads back as `trace_indirect_*` with no
harness change.
- **Workload, corpus/input hashes, open files, cursor/range, rules, client
capabilities:** the eight `renametrace` renames plus `tailrename`, `rename`
and `blockers`, all as §P2a defined them, on the same opentitan commit and
the same three pre-existing modified files.
- **Machine, compiler/profile, threads, load before/after, competing activity:**
M1 Max, macOS 27.0 `26A5425a`, release. Load 8.83 → 4.05 across the
`renametrace` take (high at the start and noted), 4.80 → 3.91 for
`tailrename`/`rename`/`blockers`. No `cargo` command ran during any timed
phase.
- **Commands, cache reset/prime steps, trial ordering and fresh-session count:**
`tools/guard.sh -m 8 -t 1800 -- python3 tools/perf/bench.py <phase> … --label
FINAL --storage /tmp/perf-h33/caches/final --out ~/.cache/lucisv-perf/take5-p2d/results-p2d.jsonl
--tries 3`; one fresh session per row; `blockers` run three times because its
first take was an outlier.
- **Raw evidence path, explicit units, full sample arrays:**
`~/.cache/lucisv-perf/take5-p2d/results-p2d.jsonl` and `results-blockers-retakes.jsonl`; ms.
Tail rename `renametrace` `[429.63, 419.95, 420.38, 420.57]`, `tailrename`
`[448.80, 420.90, 420.25, 424.44]`; `aes` `[124.77, 106.90, 106.08, 106.69]`
and `rename` `[131.03, 107.00, 105.61, 106.75]`; `clk_i` fallback
`[3927.21, 3958.95, 3796.36, 3802.35]`.
- **Reference first / repeat median / range; candidate first / repeat median /
range:** tail rename §P2c **419.86** against **420.90** (`tailrename`) and
**419.95** (`renametrace`); `aes` §P2c **106.31** against **106.75**;
fallback §P2c **3 860.06** against **3 802.35**. **Nothing moved**, which is
the point: the census is a diagnostic and had to be free. Selection time
**13.6 ms** against §P2c's 13.4.
- **Work counts — the census itself, which is this experiment's result.** Tail
rename, 238 selected / 106 watched / 2 edited: **request 1 (0 indirect),
declaration 95 (0), reference 122 (113), instantiation 19 (19), macro 0,
speller 0, open buffer 1 (1)** — **133 of 238 (56 %)** write neither
`state_q` nor `state_q_x` down. Their bytes are 2.63 MB of the input's 4.55,
so about **130 ms of `Scope::build`'s 225**. The conflict row is the same
shape (242 selected, 132 indirect); the `aes` rename has 1 of 13; the unique
internal name 3 of 4 (a 4-file request, so the ratio says nothing). The
fallback rows climb no rung and have no census by construction.
- **Result/status/count/fingerprint comparisons, warnings and refusal checks:**
every `renametrace` fingerprint byte-identical to the §P0 REF's —
`b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`, `31aadc134628…` — and the
three refusal rows carry the same sentences and the same `96f32d4243b1…`.
- **Idle RSS / peak RSS / cache size / guard outcomes:** peak RSS, tail rename
**606 MiB** (§P2c 593, QA 584); `clk_i` fallback **1 802 MiB** (§P2c 1 830,
QA 1 574); conflict 638 (653 at §P2c's take). Nothing rose outside the spread
the first lane's two takers already showed. **Zero guard kills.**
- **Target achieved or missed:** the ≥2× tail-rename target stays **missed at
1.85×**, because §P2d ships no narrowing. The measured remaining stages are
`Scope::build` **226 ms (54 %)** and `warnings` **83 ms (20 %)**.
- **Correctness tests and logs:** one new test,
`the_census_counts_only_the_files_that_write_neither_name`, and a
strengthened `the_first_rung_to_ask_for_a_path_is_the_one_counted` which now
asserts the **map** as well as the counts — the first version of the census
used `BTreeMap::insert`, which overwrites, so the map recorded the *last*
rung and the corpus run reported `indirect_instantiation=122` against
`rungs_instantiation=19`. Caught by that arithmetic being impossible, fixed
with `entry(…).or_insert(…)`, and pinned.
- **Interpretation, remaining bottleneck, tradeoffs, rejected alternatives:**
**the 133 cannot be dropped, and the census is what says why.** Every direct
input of the four verifier checks is a file spelling one of the two 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, the
edited files are a subset of the watched — so the 133 are in the request to
shape how the others resolve. They are `fan_out_of`'s **container** rungs,
and they are load-bearing: a two-level tail `u_a.u_b.state_q` folds `u_a::u_b`
through `member_unit(A, u_b)`, contributed by A's declaring file, which
instantiates the container and need never write `state_q`; drop it and
`follow_one` returns `&[]`, `follow_paths` runs out of paths and the
reference is `StillUnresolved` — the edit §49 exists to make, silently not
made. Worse is available on the same route: `follow_paths` takes the **first
non-empty** path, so a reference with two paths (the ordinary
`import a_pkg::*; import b_pkg::*;` shape) that resolved into a dropped file
falls through onto the *next*, 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. **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. **The narrowing that is
left** is the one `docs/features/refactor-rename/README.md` filed itself —
fan out from the *one* declaration the cursor resolves to, using the buffer's
own `semantics`/`external` — which on the tail rename would cut the input to
a handful of files. It needs a fall-through argument covering multi-path
references, wildcard imports of a package declaring the old name, package
members, `extends`/alias chains, `bind`, `defparam`, `$root`,
`` `include``d fragments, generate-block shadows, class members and unsaved
buffers that add either a reference or a same-named declaration, and the
brief's own gate for it is a whole-scope oracle over thirteen named renames,
those adversarial fixtures and a seeded 200-site corpus sweep with zero
differences. **`warnings`, filed not fixed:** it is second at 83 ms, not
dominant, so the brief's condition for touching it is not met. What it scans,
so the next lane need not re-derive it — per selected file spelling 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; none shared, and none
of them the parse the scope already made. Two changes look like pure dedupes:
tokenize and index each file once per call (collecting the four scans into
four vectors and concatenating them in today's order, so the output is
byte-identical), and gate `macro_argument_sites` on
`WorkspaceIndex::files_naming_in_macros` — which is `FileFacts::macro_words`,
exactly the words inside the raw text that scan looks in, so the gate cannot
hide a site. Together they should take the tail rename to roughly 375 ms and
**over the ≥2× line this stage missed**.
- **Decision:** retain the census, **reject the narrowing** for the 56 % it
measures, **defer** the target-scoped selector to its own lane with the shape
list above, and **file** the `warnings` dedupe for the lead.
## Experiment record — P2d-warnings-2026-09-07 (stage P2d, the `warnings` dedupe)
- **Experiment ID / stage / date / owner:** `P2d-warnings-2026-09-07` / P2d's
filed `warnings` finding / 2026-09-07, America/Chicago / dev agent (Opus),
§P2d follow-up lane.
- **Hypothesis and exact expected work reduction:** §P2d measured `warnings` at
82.9 ms of the tail rename's 420 and named the cause — per file spelling the
name the stage tokenizes up to twice and builds up to four `LineIndex`es,
none shared. Sharing one lex and one index per file per call is a pure
dedupe; it should remove most of that 83 ms and take the tail rename over the
≥2× line (≤ 390 ms).
- **Reference commit, candidate commit or diff hash, binary hashes:** reference
= a clean clone at HEAD `e51a2c7` (the §P2a–c commit), release server sha256
`644e11dd3cb3ecf63cad3cf8e6cae0be88af3bb26bdb9556d4c39a8158d9db86`; candidate
= the working tree (that commit plus the second lane's uncommitted handshake
33 + §P2d census, plus this change), release server sha256
`18ef6d60c54897d9512c3f98653db0c3c2e7b610ffee50801eb5444f2ce9f03b`. Handshake
33 and the census touch neither rename warnings nor their timing, so the
reference is a valid before for this stage; the tracker's §H33/§P2d numbers
agree with it (`warnings` 82.9 there, **82.2** re-measured here).
- **Files changed / API contracts amended / topology references:**
`crates/vlog_refactor/src/rename/warnings.rs` only. New private `FileScan`
(`tokens` / `lines` / `tokens_and_lines`, memos of `tokenize(text).ok()` and
`LineIndex::new(text)`); `Scope::warnings` runs the four whole-scope scans in
one per-file loop and concatenates their sentences in the order the four
loops emitted them; the edited files' scans are kept for the fifth scan.
`macro_warnings` became the per-file `define_warnings`; `define_sites` and
`macro_argument_sites` keep their `pub(crate)` signatures for
`ports::remove`, each a three-line wrapper over a `_with` twin. **No public
API, no handshake, no topology edge changed.**
- **Workload, corpus/input hashes, open files, cursor/range, rules, client
capabilities:** the eight `renametrace` renames, `tailrename`, `rename` and
`blockers` as §P2a defined them, plus a 13-rename **warning-list** parity run
(those eight 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` generate block). Same opentitan commit, same three
pre-existing modified files, verified `git status --porcelain` after every
phase.
- **Machine, compiler/profile, threads, load before/after, competing activity:**
M1 Max, macOS 27.0, release. Load 4.91 → 3.93 (`renametrace`), 3.35 → 4.49
(`tailrename`/`rename`/`blockers`), 4.05 → 5.35 (the reference binary's
phases), 3.92–5.90 across the retakes. **No `cargo` command ran during any
timed phase** (both binaries were built before the first phase started).
- **Commands, cache reset/prime steps, trial ordering and fresh-session count:**
`tools/guard.sh -m 8 -t 1800 -- python3 tools/perf/bench.py <phase> --server
<binary> --label <P2W|HEAD> --opentitan ~/repo/opentitan --storage
<scratch>/caches/<binary> --out <scratch>/results-<binary>.jsonl --tries 3`;
one fresh session per row, scratch index stores per binary. `tailrename` and
`blockers` were taken three and two times respectively per binary, alternating
binaries, and the median of the takes' medians is quoted.
- **Raw evidence path, explicit units, full sample arrays:**
`~/.cache/lucisv-perf/take5-p2w/` — `results-p2w.jsonl`, `results-head.jsonl`,
`results-p2w-retakes.jsonl`, `results-blockers.jsonl`, and the two warning
dumps `warnings-{head,p2w}.jsonl` with the scratchpad client
`warnparity.py` that wrote them. Units ms except `peak_rss_kib`.
`tailrename` candidate `[429.14, 390.97, 387.62, 389.82]`,
`[423.18, 390.68, 387.89, 387.95]`, `[414.50, 393.28, 385.29, 383.91]`;
reference `[450.88, 423.52, 422.46, 421.67]`, `[440.53, 424.44, 415.62,
415.59]`, `[440.66, 424.40, 415.28, 417.63]`. `rename` candidate
`[112.28, 93.56, 91.79, 90.35]`, reference `[131.90, 107.54, 106.49,
107.89]`. `renametrace` tail candidate `[404.91, 395.45, 393.61, 398.34]`,
reference `[449.37, 419.11, 422.97, 419.63]`; `clk_i` fallback candidate
`[3654.95, 3569.67, 3445.99, 3478.44]`, reference `[3975.36, 3895.00,
3820.79, 3825.66]`.
- **Reference first / repeat median / range; candidate first / repeat median /
range:** tail rename (`tailrename`) reference medians 422.46 / 415.62 /
417.63 → **417.63**; candidate 389.82 / 387.95 / 385.29 → **387.95**.
`aes` rename reference **107.54**, candidate **91.79**. Definition behind the
rename (`blockers`, mean of pipelines 2–3) reference 127.67 and 124.12,
candidate 116.97 / 114.32 / 115.91 → **115.91**.
- **Work counts: reads, parses, analyzed/selected/watched/edited files and
bytes:** unchanged in every field, which is the point — the dedupe removes
*repeated token scans*, not files. Tail rename: 238 selected / 4 554 326 B /
106 watched / 2 edited / **240 parses = K + E** on both binaries; `clk_i`
fallback 3 976 selected / 3 977 parses on both; `aes` 13 / 22 on both. The
per-stage split moved in exactly one place:
| Row | `warnings` reference | `warnings` candidate | 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 % |
Every other stage is inside run-to-run noise (tail `index` 225.8 → 233.5,
`select` 14.0 → 14.4, `verify` 73.7 → 74.6).
- **Result/status/count/fingerprint comparisons, warnings and refusal checks:**
all eight `renametrace` fingerprints byte-identical to the reference and to
the §P0 REF — `b39defb21265…`, `fa7e31c78382…`, `5f53e977da59…`,
`31aadc134628…` and the shared refusal `96f32d4243b1…` on all three refusal
rows — with the same refusal sentences. **The warning lists themselves were
compared as lists**, not as counts: 13 renames × 2 binaries, every
`window/logMessage` the request produced captured verbatim in arrival order;
the two 189 541-byte dumps `diff` clean. That includes the tail rename's
**217** warnings and the `clk_i` fallback's **652**, in order.
- **Idle RSS / peak RSS / cache size / guard outcomes:** peak RSS across the
request, reference → candidate: tail rename 572 → **596 MiB**, `clk_i`
fallback 1 801 → **1 795 MiB**, `aes` 583 → 585, duplicate module 911 → 914.
The tail's +24 MiB is inside the spread the earlier lanes' own takers showed
for that row (584 / 593 / 606 MiB) and is the only row that rose; what the
change retains is the two *edited* files' token vectors, for the length of
one `warnings` call. **Zero guard kills**; every `cargo` command and every
server session ran under `tools/guard.sh -m 8 -t 1800`.
- **Target achieved or missed; paired improvement and variability:** **the ≥2×
target is MET.** Tail rename **387.95 ms** against the §P0 REF's **780.45** =
**2.01×**, −50.3 %; the stretch goal (<200 ms) is not approached. Paired
against the same day's pre-change binary the fall is **−7.1 %**, and the
whole of it is the `warnings` stage's 30.8 ms. `aes` rename is not slower —
it is **−35.0 % on REF** (−14.7 % on the day's reference). Take-to-take
spread on `tailrename` was 385.29–389.82 (candidate) against 415.62–422.46
(reference): the two ranges do not overlap.
- **Correctness tests and logs:** `cargo fmt --all -- --check` clean;
`cargo clippy --all-targets` clean, no new `#[allow]`;
`cargo test --workspace` **4 250 passed, 0 failed** (4 248 before, +2 new).
The new pin is
`rename::warnings::tests::the_shared_scan_says_exactly_what_the_per_scan_one_did`:
a `#[cfg(test)]` `Scope::warnings_reference` reproducing the five-loop,
scan-builds-its-own-inputs control flow, asserted **equal as a list** to the
shared implementation over fifteen fixtures — every warning-producing shape
`crates/vlog_refactor/tests/rename.rs` pins, three silent controls, a macro
argument in a file the rename does not edit, an SVA fallback, an unresolved
candidate, a `` `define`` naming the name plus one whose body spells it plus
an `` `undef``, two stray-occurrence shapes, a comment-only mention, a file
that does not lex, and one workspace holding all of them with two files
edited. The table asserts all six warning sentences are exercised, so it
cannot pass vacuously. Three sabotages, each caught and reverted: swapping
two groups in the concatenation (fails on the all-shapes fixture), sharing
one `FileScan` across files (fails on the macro-invocation fixture), and
keying the kept scan to the wrong file (fails on the resolved-tail control).
- **Interpretation, remaining bottleneck, tradeoffs, rejected alternatives:**
`warnings` is now what it always claimed to be — five scans of one token
stream. The remaining stage is `Scope::build`, **233 ms of the tail rename's
388 (60 %)**: one parse of each of the 238 selected files, which only a
narrower selector reaches, and §P2d's census says that narrowing needs the
target-scoped lane rather than the container rungs. **Rejected: the second
dedupe §P2d proposed** — gating `macro_argument_sites` on
`WorkspaceIndex::files_naming_in_macros`. That census is
`FileFacts::macro_words` = `words::harvest_raw`, which reads the same
invocation tokens but **skips every double-quoted run** inside them (and any
word a `'` precedes), while the scan asks `contains_word` of the raw argument
text. So `` `uvm_info("state_q", …) `` — the commonest shape in which a
testbench names an RTL signal — is a site the scan reports and the census
does not hold, and the gate would silently drop that warning. The
non-equivalence is written into `macro_argument_sites`' doc comment so the
next reader does not re-propose it.
- **Decision:** **retain.** The dedupe is pure, pinned against the code it
replaced, and it is what carries §P2's ≥2× target over the line. Next stage
justified by evidence: `Scope::build`'s 233 ms, i.e. the target-scoped
selector §P2d filed as a lane of its own.
- **QA result and lead review link:** QA pending (the second §P2 lane's QA
covers handshake 33, §P2d and this follow-up).
## Experiment record — copy for every stage or rejected attempt
- Experiment ID / stage / date / owner:
+2 -2
View File
@@ -138,7 +138,7 @@ what a change on the pointed-to side must not silently break.
| `lucisv ──▶ rayon` | depends | The worker pool. Pinned exactly; pool must keep `stack_size(vlog_parser::PARSE_STACK_SIZE)` (currently 16 MiB; recursion-limit handshake) or the parser's depth guarantee regresses to a stack overflow. |
| `lucisv_server ──▶ lucisv_core` | depends | Same config discovery and walk as the CLI (that sameness is the point — format-on-save must agree with `lucisv --check`), `filelist::read` (index scope rung 1, `+incdir+` for the include graph), `cache::content_hash` (re-used by the persistent index cache — one FNV-1a, not two). |
| `lucisv_server ──▶ vlog_parser` | depends | `tokenize`, `parse_source_tolerant`/`parse_tolerant`, `ParseDiagnostic`, `LineIndex`, `TextRange`, tokens + trivia, `defines`, `KEYWORDS` (completion keyword tier; also the source the hand-maintained VS Code grammar is test-locked to), `PARSE_STACK_SIZE` for the named `lucisv-main` thread, and `stats::parses()` (perf5-p1: a per-thread whole-file parse count, asserted by the code-action tests — a repeated offer on an unchanged buffer parses nothing). |
| `lucisv_server ──▶ vlog_semantic` | depends | `analyze`/`Semantics` (every navigation answer), `WorkspaceIndex` (build/incremental update, units/members/defines, `instantiations_of`/`subclasses_of` edge tables, `FileFacts` codec for the persistent cache), `resolve_external` overlay, `index_order`/`IndexBuilder` (watched builds). |
| `lucisv_server ──▶ vlog_semantic` | depends | `analyze`/`Semantics` (every navigation answer), `WorkspaceIndex` (build/incremental update, units/members/defines, `instantiations_of`/`subclasses_of` edge tables, `FileFacts` codec for the persistent cache), `resolve_external` overlay, `index_order`/`IndexBuilder` (watched builds), and `files_mentioning` as a refactoring selector rung (perf5-p2, handshake 33: `module_select::hierarchical_users` — previously the semantic lints' oracle only). |
| `lucisv_server ◀──▶ vlog_semantic` | handshake | Two negotiated additions, both 2026-08-28 and both additive: **`Symbol::detail_span` / `Def::detail_span`** (where a non-ANSI port's body declaration completes the header that names it — the server's hover card and `nav::definition` both read it, and they show/jump to it in the same order), and **`Semantics::symbols_named`** (name → declarations, built in `analyze`, in declaration order — the server replaced two scan-every-symbol loops with it and the *first-match tie-break must stay declaration order* or hover's choice between two live declarations of one name changes). `docs/features/port-detail-spans/README.md`. |
| `lucisv_server ◀──▶ vlog_semantic` | handshake | Three later additive performance surfaces: **`DeclLines` / `Def::lines`** record declaration and detail lines at index time (`FACTS_FORMAT` 3 → 4); **`WorkspaceIndex::absorb`** folds a scan batch with one merge rather than one merge per file; and **`WorkspaceIndex::files_spelling`** finds external uses by spelling, resolved or not, for rename's dangling-use refusal. The first feeds hover-line-index, the second scan-interleave, and the third refactor-rename's six-rung fan-out. Changing the facts codec, reference-fact census or merge semantics breaks those consumers. |
| `lucisv_server ──▶ vlog_refactor` | depends | `prepare_rename`/`rename`, `find_references`, the port refactorings, `organize_imports`, `extract_module`, `inline_module`, `RefactorEdit::{edits,warnings,created}`, `rename_traced` + `RenameTrace`/`VerifyTrace`/`Stage` (perf5-p2: the rename with its stage timings and parse counts as an out parameter; `rename` is the same call with a trace nobody reads; the server logs one `timing: rename trace …` line under `--verbose` only), the parsed-input selectors `port_action_modules_in`/`imported_packages_in`/`extract_site_in`/`inline_site_in` (perf5-p1: the offer paths hand the document's own tolerant parse and diagnostics; the text forms are thin wrappers kept for standalone consumers and the every-offset parity test; a large-file buffer still takes the text form), `instantiation_plan`/`render_with`/`module_definition` (the inline instantiation ghost, signature help, inlay hints — the completion popup stopped consuming them 2026-08-30, names-only tier). Promise consumed: never a partial edit — `Ok` verified whole, `Err` is a sentence. |
@@ -689,7 +689,7 @@ update the filing README(s) and this file.
| ~~30~~ | ~~**An unreadable directory aborts the whole walk.** `Walk::dir` propagates `read_dir`'s error with `?`, so one permission-denied directory anywhere under the start — reachable now that a symlink to an outside directory is followed once (§2.9-8's ruling) — drops every file already found and fails the run. Found by walk-cycles' QA on a link to `/`. Wanted: skip the directory and say so through a warning channel the walk does not have today (the filelist-missing-file precedent), which is also where a dangling source link's warning belongs.~~ — **delivered 2026-09-05 by small-items-4 (TODO §45.2):** `walk::collect_files` takes a `&mut dyn FnMut(Warning)` sink; an unreadable directory, an unreadable `.gitignore` and a dangling source link are warned about (`warning: <path>: <message>` on the CLI's stderr before the report, exit code unchanged; logged once per scan by the server through `report_scope`) and the walk continues. | walk-cycles (QA) | lucisv_core / lucisv / lucisv_server |
| 31 | **DPI-export name binding remains open.** Package re-export resolution closed §2.9-16, but the name in a DPI export is still not a semantic reference. Keep this separate from the delivered package-member traversal. | dpi-export request (b); package-reexports | vlog_semantic |
| 32 | **The refactoring verifier does not catch a same-file relocation of a never-dropped piece written as two well-formed edits** (delete here, insert there): `verify_move` computes `after` by applying the edits, so `positions_match`'s reconstruction cannot diverge from it and equation 3 of the ledger is unreachable through any real caller. No planner produces the shape today. Wanted: an independent `after` (the client's applied text, or a second reconstruction) and a test that isolates equation 3. Found by extract-module's QA re-attack. | extract-inline-module (QA) | vlog_refactor |
| 33 | **`module_sources`' fan-out has no rung for a file that reaches an instance through an intermediate module it does not itself instantiate** (a bench naming `wrap.u_S.x` where `wrap` instantiates `S`): inline-module's hierarchical-reference refusal sees only the handed files, so such a reference is missed. Wanted: a transitive-instantiators rung (§49's hierarchical surface knows the path) in `module_sources` for the refactorings that must see every hierarchical use. Found by §53.2's QA. | extract-inline-module (QA) | lucisv_server / vlog_refactor |
| ~~33~~ | ~~**`module_sources`' fan-out has no rung for a file that reaches an instance through an intermediate module it does not itself instantiate** (a bench naming `wrap.u_S.x` where `wrap` instantiates `S`): inline-module's hierarchical-reference refusal sees only the handed files, so such a reference is missed. Wanted: a transitive-instantiators rung (§49's hierarchical surface knows the path) in `module_sources` for the refactorings that must see every hierarchical use. Found by §53.2's QA.~~ — **closed 2026-09-07 by perf5-p2 (TODO §60.2): a fifth, opt-in rung** `Workspace::module_sources_reaching(file, modules, Reach { scopes })` in `lucisv_server/src/module_select.rs` — every file whose *token census* (`WorkspaceIndex::files_mentioning`, i.e. `FileFacts::words`) writes the dissolved instance's name down. That is exactly the set `no_hierarchy` can refuse from, so the selected set answers the refusal as the whole workspace does (asserted engine-run-twice on six shapes; QA attacked seven more incl. `$root`, a macro-built `bind` path, an escaped identifier, a generate label). **The transitive-instantiator walk this row asked for was implemented and rejected:** a `bind tb.u_wrapper.u_top.u_sub …` in an SVA file that instantiates nothing in the chain has no instantiation edge for any walk to follow — structurally weaker, confirmed by QA. Only inline-module asks for the rung (extract and ports pass `Reach::none()`, unchanged in answer and cost); worst corpus cost 2 % of files on a command, +1.2 ms at the measured site. | extract-inline-module (QA) | lucisv_server / vlog_refactor |
| ~~34~~ | ~~**The format cache omits `Config::uvm_utils_indent`.** CLI `args.rs::config_with` applies the key, but `main.rs::entry_for` and core `cache::Entry` serialize/compare only content, line length and indent (plus the store version). On one UVM class: cache a clean verdict with the option false, change only the option to true, then cached `--check` exits 0 while `--no-cache --check` exits 1. Wanted: key/equality/codec coverage for the option and a regression for both toggle directions. Until fixed, use `--no-cache` or delete the format cache after toggling. See repository-analysis.md for the bounded reproduction.~~ — **fixed 2026-09-07 (TODO §59, 0.50.0):** `Entry` carries `uvm_utils_indent`, `entry_for` fills it, the store line has it as a fourth field; a well-formed five-field (0.49.0) line is dropped individually like another version's entry; the audit's probe is `changing_uvm_utils_indent_invalidates_the_entry` in `lucisv/tests/cli.rs`, both directions. | repository audit, 2026-09-07 | lucisv_core / lucisv |
---