perf5r-preflight — engine-owned refusal preflights
Take 5 review round (docs/performance_take5_review.md §3 items 5–6),
TODO §61.1, tracker rows R3a and the refused-extraction half of R3c.
Baseline is 0.51.0.
Goal
Two refactorings refuse a request only after materializing and analyzing a
workspace they never needed. A textDocument/rename on a cursor that sits on
no symbol reads all 3 976 in-scope files, performs 3 975 whole-file
parses and spends 1.9 s building a scope, so that locate can refuse in
0.1 ms from the request buffer's own analysis — 2 192 ms on the wire for a
sentence the buffer could have said immediately. An extraction at the review's
aes_wrap.sv inline site spends 805 ms building a scope before the checks
that refuse it.
For the rename this lane adds one additive function to vlog_refactor,
rename_preflight, which takes — from the request file alone and in the slow
road's own order — the refusals the slow road is certain to reach in the same
words. The server calls it before it selects or analyzes anything, and
materializes nothing when it refuses. Result: 2 012 → 0.3 ms, 3 975 → 0
parses.
For the extraction the answer is a measured negative, and no code shipped. An extract preflight was written, wired and measured, and then removed: every refusal it could take is already taken before a scope is built, by two mechanisms that were both already there. The 805 ms refusal is none of them. The evidence is below; this is the review's "instrument first, then decide" answered honestly rather than with code that changes nothing.
The refusals stay the engine's. That is the review's own condition ("put any
cheap preflight in the refactor engine so the server does not become a second
authority on what is safe") and it is also the only way the sentences can be
guaranteed identical: each one is a single function in rename/mod.rs that
both roads call.
What must not move: the sentences, their order, the successful edits and their fingerprints, and the warnings. A faster refusal that refuses something else is a failure, and so is a refusal invented for a rename the workspace would have performed.
Assumptions
- A buffer's
Semanticsis a pure function of its text.analyze(&tree, text)consults no index and no other file, and both roads reach it the same way: the server'sDocument::newcallsanalyzedirectly, and the scope'sFileFacts::analyzedcalls it throughanalyzed_facts. So the request file's analysis inside aScopeand the open buffer's analysis are the same value, and every refusal read off one is the refusal that would be read off the other. Not enforced by a type — asserted at every byte of seven fixtures by the oracle below. - The request file is always among the files the caller hands the engine.
Scope::locaterefuses a file it was not given before it looks at the cursor, so a preflight that jumped that check would reorder the refusals. Both rename selectors put every open buffer in the set. Stated as a precondition in the preflight's doc comment and pinned bythe_preflights_refusal_is_the_whole_workspaces_refusal. - A large-file buffer never reaches the rename preflight. On the fast path
every field but the text is the analysis of the empty file, so a preflight
over it would refuse every cursor as symbolless.
server/large_file.rsanswerstextDocument/renamewithTOO_LARGEbefore this module is reached;a_large_buffer_is_refused_before_the_preflight_could_see_itpins both halves of that — the gate, and the fact that the preflight would otherwise be wrong, so the test fails loudly if the gate is ever moved. - The workspace index is not current with respect to unsaved edits. See the duplicate-declaration decision below; this is the load-bearing assumption of the whole lane, and it is the reason two refusals stayed on the slow road.
Handshakes
Consumed.
vlog_semantic::Semantics—reference_id_at,reference,symbol_at,symbol,file_scope, andResolution's four variants. The preflight reads exactly the fieldsScope::locatereads, and nothing else.crate::state::Document'ssemantics— read, never written.
Promised.
vlog_refactor::rename_preflight(semantics, offset, new_name) -> Result<(), String>. Additive: no existing signature changed, no existing behaviour changed, andOk(())means "proceed exactly as before" — never "this rename will succeed". It is the only new public item in the crate; the extraction gained none.- Every refusal the preflight makes is byte-identical to the one
renamemakes for the same request. This is the contract; the oracle is its proof. - The
--verbosetiming: rename traceline is still written for a rename the preflight refuses, withselected=0,parses=0and a newpreflight=truefield.tools/perf/phases_p2.pyreads that line by regex and flattens everykey=valueinto a row field, so the new field arrives aspreflightwith no harness change.
Requested of others: none. No file outside this lane's list was touched.
Amended for docs/topo.md (lead to apply). §1.2's request-selector parity
gains a third participant. Today it reads that prepare_rename_here must
produce the same answer or refusal text as whole-scope prepare_rename. It
should now also record that rename_preflight must produce the same refusal
text as whole-scope rename — a one-directional obligation, since the
preflight may always stand aside — and that the two cheap paths are
deliberately not the same set: prepare_rename_here reads the index and
rename_preflight does not. The reason is in "the duplicate-declaration
decision" below.
The duplicate-declaration decision — evidence, and the answer
TODO §61.1 asks whether the ambiguous-declaration refusal (rstmgr_por,
2 200 ms) may move ahead of materialization "ONLY with the evidence the review
asks for: the index is current and authoritative for that name".
It is not, and the refusal stays on the slow road. The evidence:
state/mod.rs::set_document(line 695) — the handler for everydidOpenanddidChange— readsself.indexto build the newDocument's external overlay and never writes it. The index is written only byabsorb, at scan publication and on thedidSaverebuild. So an unsaved buffer that adds or removes a file-scope declaration of a name is a buffer whoseindex.units(name).len()is stale, in both directions.docs/features/refactor-rename/README.mdalready states this exact divergence ("The one divergence, stated exactly") forprepare_rename_here, and resolves it by naming the authority: "renamere-derives the count from the current texts and is the authority."- So the two callers are not symmetric, and the asymmetry is the whole point.
An optimistic
prepareRenamethat is wrong is LSP-legal and self-correcting — the rename that follows delivers the real answer. Arenamethat is wrong is terminal: the user is told a name is declared twice, and there is no later road to say otherwise. Moving this refusal forward would trade a correct 2 200 ms answer for a possibly-wrong 15 ms one. - The ports offer's
declared_twice(ports.rs:338) does trust the index, and that is consistent rather than contradictory: a wrong offer costs a lightbulb that should or should not have appeared, and the command behind it still asks the engine. A wrong refusal costs the work itself.
The same argument disposes of the two cross-file cursor refusals — a use whose
declaration the index answers ambiguously, and one it cannot answer at all
(ExternalTarget::Ambiguous / StillUnresolved). Both are the index's word,
so rename_preflight stands aside for every Resolution::ExternalCandidate
and for every declaration at file scope.
a_name_declared_in_two_files_stays_on_the_slow_road asserts the deferral
rather than merely permitting it, so a later round cannot quietly take it.
The cost of the decision is stated plainly: rstmgr_por keeps its 2 200 ms,
and so does cipher_alert → clk_i at 2 884 ms, whose "meaning would change"
refusal is check::verify's and needs the edit computed over the real scope.
What the preflight takes, and what it leaves
rename_preflight — crates/vlog_refactor/src/rename/preflight.rs
In renaming's order. Rule numbers are
docs/features/refactor-rename/README.md's refusal list.
| Rule | Refusal | Taken? | Why |
|---|---|---|---|
| 1 | new name empty / not an identifier / a keyword | taken | check_new_name is a pure function of the new name, and is renaming's own first statement |
| 3 | "… is not one of the files lucisv indexes …" | n/a | unreachable: both selectors contain the request buffer (precondition above) |
| 4 | "there is no symbol to rename at this position." | taken | reference_id_at and symbol_at on the buffer — the 2 192 ms row |
| 5 | "… is not resolved to any declaration …" | taken | Resolution::NotFound is single-file resolution |
| 6 | "… could only come from the base class B …" |
taken | Resolution::InheritedCandidate, same |
| 7 | "… is declared outside the files lucisv indexes …" | deferred | the index's word |
| 8 | "… is declared in more than one indexed file …" (from a use) | deferred | the index's word |
| 9 | the same sentence, from a file-scope declaration | deferred | the index's word — the decision above |
| 11a | "lucisv cannot find where x is spelled …", declaration in this buffer |
taken | empty name_span, read here |
| 11b | the same, declaration elsewhere | deferred | needs that file's text |
| 2 | "x is the name it already has." |
taken, narrowly | only for a declaration in this buffer that is not at file scope, where nothing stands between the cursor and this check. At file scope rule 9 comes first, so it is deferred |
| 10, 12, 13 | ambiguous use onto this declaration, capture, token drift | deferred | all need the edit computed over the scope |
Note rule 2's narrowing: taking it unconditionally would let a same-name
refusal jump ahead of rule 9's ambiguity check and change which sentence the
user sees.
renaming_a_symbol_to_the_name_it_already_has_is_refused_from_the_buffer
pins both halves — taken for a net, deferred for a module.
The extraction — a preflight was written, measured, and removed
The same preflight was built for extract_module: plain_identifier, the
occupied-target check, the request file's parse-diagnostic refusal, and every
refusal Region::read knows, stopping before declared_once. It was wired
into extract::execute ahead of Scope::build, measured, and then deleted,
because every one of those refusals is already reached before a scope exists:
site_atisextract_site_in.executecalls it as its own gate, beforemodule_sourcesand before the engine. Its first two statements areif !diagnostics.is_empty() { return None }andRegion::read(tree, text, …).ok()?. So a buffer that does not parse and every selection-shape refusal are answered by the server withNOTHING, and cannot reachExtraction::planat all — the preflight's parse check and itsRegion::readwere provably dead on the only caller.plain_identifierand the occupied check are alreadyextract_module's first two statements, ahead ofExtraction::planand therefore ahead ofScope::build. Moving them earlier moves nothing.
Measured, at the 805 ms site itself (extractrefuse, both cases below):
| Row | 0.51.0 | with preflight | Where it is refused |
|---|---|---|---|
| new name is not an identifier | 9.3 ms | 9.8 ms | extract_module's first statement, in both |
| selection covers no whole item | 0.22 ms | 0.13 ms | the server's site_at gate, in both |
Both sub-noise, both refused pre-scope in the reference already. The preflight
bought nothing, so it is not in the tree: shipping it would have been ~130
lines of engine code, a new public API and a second copy of two checks, in
exchange for zero measured work. crates/lucisv_server/src/extract.rs carries
a comment at the point where it would have gone, saying why there is nothing
there — so the next round does not rediscover this.
What did stay from the exercise: extract::does_not_parse, the refusal
sentence lifted out of Extraction::plan into the block where
extract/mod.rs keeps its other refusal sentences (occupied,
not_in_scope, escaped), and three server tests that pin where each cheap
extract refusal is actually taken.
What the aes_wrap.sv 805 ms refusal turned out to be
Identified from the review's own evidence without a run
(docs/perf/take5-review-20260908/results.jsonl, the inline-module: lucisv: extract selection into module… row), then confirmed by the paired rerun. Its
message is:
the selection drives
h2d_intg, and something outside it passes the same name to a task or function, which may drive it too; lucisv will not make it an output over that.
That sentence is extract/boundary.rs:196, inside Crossing::read — the
last stage of plan before rendering. Crossing::read needs flow, and
flow::read(&scope, …) walks the module's items through the scope, because
giving an instance-port connection its direction means reading the instantiated
module's own file. So the refusal is scope-dependent at depth, not
region-local, and no bounded preflight reaches it.
Measured unchanged, as predicted: 761.1 → 767.8 ms (+0.9%, within the session's noise), identical sentence.
What a future round could take is named instead, since the review asked for it:
the directions flow wants are port facts the workspace index already holds,
so the lever is not a preflight but the scope-reuse work already filed as
§61.5 (R3b/R3c). Recorded as a finding and not attempted here — the
review's instruction was to instrument first and "do not implement beyond the
region-local checks without the evidence", and the evidence says the
region-local checks were already free.
Status / TODO
rename_preflight, additive, engine-owned, inrenaming's order- the server calls it before selecting sources; nothing materializes on a refusal; the sentence goes back unchanged
- the duplicate-declaration question answered with evidence — deferred, argument recorded above
- extract: the region-local checks confirmed to run before
Scope::buildalready, bysite_atand byextract_module's own prefix; a preflight was written, measured and removed as redundant - the equality oracle: every byte of seven fixtures × six new names
- the parse-count proof: a no-symbol rename performs zero whole-file parses, asserted in a test and read off the wire trace
- the
aes_wrap.svrefusal identified, its stage named, measured unchanged - measured against 0.51.0; R3a and R3c cells filled
Measurements — 0.51.0 vs candidate
Paired, ~/.cache/lucisv-perf/take5r-1/. Repeat medians (ms[1:]), three
repeats after a first. Reference and candidate order alternated between
phases; load 1.7–4.8 throughout, inside the review's own 2.82–6.00 band.
| Phase / row | 0.51.0 | candidate | Δ | parses | peak RSS |
|---|---|---|---|---|---|
| renametrace no symbol | 2 012.3 ms | 0.3 ms | −100.0% | 3 975 → 0 | 909 → 429 MiB |
renametrace duplicate module rstmgr_por |
2 012.6 | 2 032.0 | +1.0% | 3 975 → 3 975 | 910 → 914 MiB |
renametrace common port clk_i |
3 242.4 | 3 252.7 | +0.3% | 3 977 → 3 977 | 1 827 → 1 826 MiB |
renametrace cipher_alert → clk_i |
2 626.4 | 2 730.1 | +3.9% | unchanged | 1 609 → 1 610 MiB |
renametrace conflict state_q → state_d |
305.9 | 319.3 | +4.4% | unchanged | 530 → 539 MiB |
renametrace tail state_q |
367.3 | 365.0 | −0.6% | unchanged | 611 → 659 MiB |
renametrace ordinary aes |
84.9 | 85.2 | +0.4% | unchanged | 454 → 455 MiB |
renametrace unique internal cipher_alert |
15.5 | 17.2 | +11.0% | unchanged | 434 → 433 MiB |
| tailrename | 376.3 | 377.4 | +0.3% | — | — |
rename aes → aes_renamed |
87.6 | 88.1 | +0.6% | — | — |
| rename prepareRename | 0.11 | 0.17 | sub-ms, not read | — | — |
execute extract capture (aes.sv) |
143.5 | 143.3 | −0.1% | — | — |
execute extract refusal (aes_wrap.sv) |
761.1 | 767.8 | +0.9% | — | — |
| execute inline refusal | 5.79 | 5.85 | +1.0% | — | — |
| refactor extract offer | 0.81 | 0.80 | −1.2% | — | — |
| extractrefuse bad name | 9.3 | 9.8 | already pre-scope | — | — |
| extractrefuse partial selection | 0.22 | 0.13 | refused by site_at in both |
— | — |
Gates. R3a's gate — "≤16 ms; zero closed-workspace parses; exact
refusal/precedence" — is met on all three counts: 0.3 ms (53× inside the
bound), trace_parses 0 and trace_selected 0 read off the wire, and the
refusal string byte-identical. The duplicate-module refusal was not shipped
and its row is unchanged, as the decision above requires. The extract refusal's
before/after is reported with its stage named and is unchanged, which is
the honest reading of R3c's extract half.
Parity. Every fingerprint identical: tail b39defb21265…, aes
fa7e31c78382…, clk_i 31aadc134628…, cipher_alert 5f53e977da59…,
extraction 090e92e7736e…. Every refusal message identical (checked
programmatically, not by eye). Corpus git status --porcelain = the same three
pre-existing files after every one of the 12 phase invocations. No guard
kill.
Variability. The +3.9% and +4.4% rows are single-session medians on a desktop machine and are within the band the review itself declines to read; +11.0% is on a 15.5 ms row (1.7 ms). None is a claimed movement, and none is adjusted.
Work log
2026-09-08 — dev (Opus).
- Read the code before designing. Three findings changed the plan the brief
proposed:
- The brief's premise that
set_documentupdates the index is wrong — it reads the index and does not touch it (state/mod.rs:695). That inverted the duplicate-declaration answer from "probably yes" to a documented no, argued above. new_name == moduleis not the last region-local check inplan—declared_onceandundeclaredprecede it. It could not go in a preflight without reordering two refusals.- The
aes_wrap.svrefusal isCrossing::read's, four stages past anything a region-local preflight can reach. Identified from the review's preservedresults.jsonlmessage rather than by a run, which cost nothing and settled the design before any code was written.
- The brief's premise that
- Signature deviation, rename. The brief proposed
rename_preflight(semantics, external, index, offset, new_name). Shipped withoutexternalandindex: every refusal those two could answer is one the staleness argument forbids taking, so both parameters would have been unused — and carrying them would have implied the preflight consults the index, which is exactly the thing it must not do.prepare_rename_herekeeps them, because an optimisticprepareRenameis allowed to. - The extract preflight was built, then removed. It was written to the
brief (taking
filesrather than a server-computedoccupiedbool, so the occupied question stayed the engine's), wired intoexecuteahead ofScope::build, and covered by eight oracle tests. Measuring it is what killed it:tools/perf/phases_r3.pywas added to time the refusals it takes at the 805 ms site, and both came back unchanged — becausesite_atisextract_site_in, whose first two statements are the parse-diagnostic check andRegion::read, and becauseplain_identifierand the occupied check were alreadyextract_module's own first statements. Removed rather than shipped: ~130 lines of engine code and a new public API for zero measured work is exactly the abstraction CLAUDE.md says to stop building. The reason is now a comment at the call site so it is not rediscovered. - A refusal now traces too.
rename_tracedwrites itstiming:line on the preflight path withselected=0 parses=0 preflight=true, so the measurement reads the parse count off the wire instead of trusting it. No change torename_trace.rswas needed —SelectionTracealready derivesDefault, andwhole_scopewas the wrong shape (it setsfallback=true, which would have been a lie). - One incidental tidy kept:
extract::does_not_parse, the parse refusal's sentence moved out ofExtraction::planinto the block whereextract/mod.rsalready keepsoccupied,not_in_scopeandescaped. Behaviour identical; it is the only surviving trace of the removed preflight in that file. - Tests:
crates/vlog_refactor/tests/preflight_oracle.rs(10), 4 added inlucisv_server/src/rename.rs, 3 inlucisv_server/src/extract.rs(kept after the removal — they pin where each cheap extract refusal is taken, which is the finding). The oracle counts deferrals rather than asserting them away, and a fixture that stops producing the shape it was written for fails loudly:an_unresolved_and_an_inherited_reference_keep_their_own_sentencessweeps for its two sentences instead of being told their offsets, because the first draft guessed an offset and was wrong. - Harness:
tools/perf/phases_r3.py(new, phaseextractrefuse) and one import line intools/perf/bench.py. It is kept even though its answer was negative — the two rows are what make "the extract refusals are already pre-scope" a measurement rather than a claim. - File sizes after the change:
rename/mod.rs549,rename/preflight.rs84,extract/mod.rs535 — all under 600. The rename preflight went in a module of its own becauserename/mod.rswas already within 60 lines of the mark. - Gates:
cargo fmtclean; guardedcargo clippy --all-targetsclean with no new#[allow]; guardedcargo test --workspace4 322 passed, 0 failed, exit 0, no guard kill. Zero tests removed (git diffshows no deleted#[test]in a tracked file), 17 added. (Corrected from "4 328" by QA — see QA log: a clean guarded run on this exact tree counts 4 322, matching a same-tree baseline of 4 305 plus the 17 added exactly.)
QA log
2026-09-08 — QA (Sonnet). Verdict: PASS. Method: read renaming /
Scope::locate / Scope::declaration / Scope::declaration_across_files
(rename/mod.rs) side by side with rename_preflight / declared_here
(rename/preflight.rs) and built the rule table below independently before
reading the dev's own table, then attacked the oracle with sabotage in a
throwaway clone, ran the gates guarded on the main tree, and re-ran the real
lucisv-server over the wire (fresh sessions, my own storage dir, no reuse of
the dev's cached results except for cross-referencing) against OpenTitan and
read the wire traces.
1. Gates, guarded, main tree.
cargo fmt --all -- --check: clean. cargo clippy --all-targets: clean, zero
new #[allow] (git diff HEAD | grep '#\[allow' finds none in changed code).
cargo test --workspace (guarded, tools/guard.sh -m 8 -t 1800): 4 322
passed, 0 failed, no guard kill. Cross-checked against a clone of e13ae4c
with no diff applied, same guard, same machine window: 4 305 passed, 0
failed. 4 322 − 4 305 = 17, matching the diff's added-test count exactly
(git diff HEAD | grep -c '^+.*#\[test\]' → 7 in tracked files, plus the 10 in
the new preflight_oracle.rs = 17; git diff HEAD | grep -c '^-.*#\[test\]' →
0). Nothing lost, nothing invented. Found and fixed a documentation slip:
the work log's "4 328 passed" does not reproduce on this tree in either of two
independent guarded runs (main tree and a fresh clone); corrected above to
4 322 with the arithmetic that supports it. Production line counts of
changed/new files (non-blank, non-line-comment): rename/mod.rs 400 (551
total), rename/preflight.rs 31 (84 total), extract/mod.rs 396 (539 total)
— all comfortably under the 600-line mark by either counting convention; the
dev's own 549/84/535 use the total-lines-minus-tests convention CLAUDE.md's
own history entries use, and agree.
2. The precedence contract — rule table, built independently.
Read top to bottom: renaming calls check_new_name (rule 1) before
Scope::build_keeping (the whole-workspace materialization this lane exists
to skip), then scope.locate (rules 3–9, 11), then — after locate
returns Ok — the same-name check (rule 2), then collect_edits/verify
(rules 10, 12, 13). Scope::declaration (reached from both a same-file symbol
and a cross-file declaration_across_files) checks name_span.is_empty()
(rule 11) before at_file_scope && index.units(name).len() > 1 (rule 9)
— that specific order is the whole reason rule 2's preflight narrowing is
sound only for non-file-scope declarations.
| Rule | Refusal | Preflight takes it? | Can preflight's answer differ from renaming's for the same request? |
|---|---|---|---|
| 1 | invalid new name | yes (check_new_name, byte-identical shared fn) |
no — same function, same first statement in both roads |
| 3 | file not in scope | n/a, unreachable (precondition: request buffer always in both selectors' file sets) | no |
| 4 | no symbol here | yes (reference_id_at/symbol_at on the buffer) |
no — same Semantics, pure fn of buffer text |
| 5 | unresolved reference | yes (Resolution::NotFound) |
no — single-file resolution, same Semantics |
| 6 | inherited-candidate reference | yes (Resolution::InheritedCandidate) |
no — resolved entirely within the buffer's own analysis regardless of which file the base class lives in |
| 7, 8 | external candidate: unresolved / ambiguous (from a use) | deferred (Ok(()) for every ExternalCandidate) |
n/a — never taken, so never differs |
| 9 | file-scope declaration, ambiguous in index | deferred (declared_here returns Ok(()) when scope == file_scope, before the same-name check) |
n/a |
| 11a | empty name_span, declaration in this buffer |
yes, and correctly checked before the file-scope test, exactly matching Scope::declaration's order — so it is taken even for a file-scope declaration |
no |
| 11b | empty name_span, declaration elsewhere |
deferred (preflight never resolves cross-file) | n/a |
| 2 | same name as new name | yes, only when scope != file_scope (checked after 11a, after the file-scope deferral) |
no for the cases it takes; for a file-scope same-name it correctly stands aside so rule 9 keeps precedence on the slow road |
| 10, 12, 13 | ambiguous-onto/capture/token drift | deferred (need computed edits) | n/a |
This matches docs/features/perf5r-preflight/README.md's own table exactly,
built before I read it. The one place a bug could hide — rule 11a's precedence
over rule 9 for a file-scope declaration — is real and correctly ordered in
both declared_here and Scope::declaration; confirmed by reading, not
assumed.
3. Wire matrix, a–j. Both a hostile-fixture sweep (the oracle, byte-by-byte)
and real OpenTitan sessions over the wire (fresh lucisv-server process, my
own --storage, none of the dev's cached results reused for this half):
| Case | Verified how | Old vs new |
|---|---|---|
(a) invalid name (1abc,wire,a b,empty) at no-symbol cursor |
an_invalid_new_name_outranks_every_cursor_refusal (oracle) + the_preflight_does_not_disturb_the_refusal_order (server) |
identical — name's sentence wins, rule 1 before rule 4 |
(b) comment/string/whitespace/macro-arg/ `define/keyword cursor |
oracle's PROSE/GEN fixtures swept at every byte; the_preflights_refusal_is_the_whole_workspaces_refusal pins the module keyword explicitly |
identical, NOTHING_HERE in both roads |
| (c) unresolved reference | an_unresolved_and_an_inherited_reference_keep_their_own_sentences, swept for the sentence rather than told an offset |
identical |
(d) inherited-candidate via extends (base in another file) |
same test/fixture (STRAY); confirmed by reading that Resolution::InheritedCandidate is settled entirely inside the request buffer's own analysis regardless of which file the base lives in — the resolution type itself already encodes "unresolved candidate", not "resolved to a symbol in file X" |
identical |
| (e) same-name at non-file-scope (local net) vs file-scope (module) | renaming_a_symbol_to_the_name_it_already_has_is_refused_from_the_buffer — pins both halves directly |
net: taken, identical sentence. module: deferred, confirmed rename_preflight(...).is_ok(), and the slow road's answer is the unchanged already_named() string (only the sentence's construction was refactored into a shared fn, not its text or its position after locate) |
(f) duplicate module (rstmgr_por) |
a_name_declared_in_two_files_stays_on_the_slow_road + live re-run: real server, real OpenTitan — refused with "rstmgr_por is declared in more than one indexed file; lucisv will not guess which declaration this rename means.", trace_parses_index=3975 (unchanged), no preflight field |
identical, unchanged parse count |
(g) unsaved (untitled:) buffer |
the_preflight_does_not_disturb_the_refusal_order; and by reading rename_traced's own source — the UNSAVED checks (ws.document, then doc.path) run and can early-return before the preflight call is reached |
identical, unchanged order |
| (h) large-file buffer | read server/dispatch.rs:83 (large_file_answer runs first, unconditionally, ahead of the method dispatch that would call rename_traced) and server/large_file.rs:80 (Rename::METHOD => Err(... TOO_LARGE ...)) — the preflight is provably never reached; a_large_buffer_is_refused_before_the_preflight_could_see_it pins that the preflight would have been wrong if it were reached, which is exactly why the gate must stay in front of it |
unaffected by this diff; still TOO_LARGE before either road runs |
| (i) reference to a symbol declared in another file | Resolution::ExternalCandidate => Ok(()) read directly; live re-run's ordinary: aes -> aes_renamed row (an aes instantiation reference) completed the whole-scope path normally, fingerprint fa7e31c78382… unchanged |
Ok from preflight, whole-scope path runs, unchanged |
(j) empty name_span in this buffer (rule 11a) |
read declared_here's first check, ahead of the file-scope test; oracle sweeps SUB/TOP/GEN at every byte, which would surface an unspelled-declaration mismatch if one existed in the fixtures — none constructed with a literally empty span beyond what the parser already produces on malformed input, covered indirectly by a_buffer_that_does_not_parse_keeps_parity |
code-path identical to Scope::declaration's own check; no divergence found |
Every case in the wire re-run returned the same sentence text as the
tracker's own evidence (~/.cache/lucisv-perf/take5r-1/results.jsonl), which
I cross-checked field by field (see §5).
4. Oracle sabotage. In a throwaway clone
(.../scratchpad/qa-61-1/sabotage-clone, cloned from e13ae4c with the
working-tree diff applied via git apply + copying the four untracked new
files — diffed byte-identical against the real tree before use):
- Sabotage 1 — made the
Resolution::Resolvedarm ofrename_preflightreturnErr(NOTHING_HERE.to_string())unconditionally instead of callingdeclared_here(an invented refusal for a resolved reference). Result:cargo test -p vlog_refactor --test preflight_oracle— 3 of 10 tests fail, each panicking with "the preflight invented the refusal ... for a rename the workspace performs", exactly the failure mode the oracle's own doc comment promises. - Sabotage 2 — changed only the wording of the same-name refusal inside
declared_here(`{new_name}` already is the name it has.instead of the sharedalready_named()'s`{new_name}` is the name it already has.), leaving the slow road's sentence untouched. Result: 8 of 10 tests fail with "the preflight and the workspace refuse in different words" and the two strings printed side by side.
Both sabotages caught decisively, restored, and the clone diffed clean against the real preflight.rs afterward. This is real evidence the oracle does what its doc comment claims, not an assumption from reading it.
5. Parse count and traceability. a_rename_on_a_cursor_with_no_symbol_ parses_nothing reads vlog_parser::stats::parses() before/after and asserts
the difference is 0 — not a hard-coded literal — and separately asserts
the --verbose trace line contains selected=0, parses=0, preflight=true
by substring, so a regression that made the count right but the trace wrong
would still fail. My own fresh wire re-run (guarded, real server, real
OpenTitan, fresh session, --tries 1) reproduces this independent of the
dev's logged run: no-symbol 0.248 ms, parses=0, selected=0,
preflight=true, sentence "there is no symbol to rename at this
position."; rstmgr_por (duplicate module) 2 120–2 153 ms,
parses_index=3975, selected=3976 — unchanged; clk_i (common port)
~3.4 s, parses_index=3975, fallback=true — unchanged. All twelve
numbers named in the tracker's R3a/R3c-x records (no-symbol 2 012.3→0.34,
duplicate-module 2 012.6→2 032.0, common-port 3 242.4→3 252.7, tail
367.3→365.0, plus the five fingerprints) were located verbatim in
~/.cache/lucisv-perf/take5r-1/results.jsonl/results2.jsonl by field
(row, server, ms, fingerprint, trace_parses, trace_selected) —
traceability item 8 satisfied.
6. The extract decision. Read lucisv_server/src/extract.rs::execute:
site_at is called and, for a non-large buffer, is
vlog_refactor::extract_site_in, whose first two statements are the
parse-diagnostic check (if !diagnostics.is_empty() { return None }) and
Region::read(...).ok()? — confirmed at
crates/vlog_refactor/src/extract/mod.rs:99-103, called before
ws.module_sources (workspace materialization). Read extract_module
(same file, line 131): plain_identifier(new_name)? is its first statement
and the occupied-target check is its second, both ahead of
Extraction::plan → Scope::build. Live re-run of the extractrefuse phase:
bad-name refusal 12.7 ms, partial-selection refusal 0.05 ms — both
already pre-scope in the reference too, consistent with "no work to remove."
Live re-run of execute's aes_wrap.sv inline-site row: refused at
757.6 ms with the sentence "the selection drives h2d_intg, and
something outside it passes the same name to a task or function ... lucisv
will not make it an output over that." — matches boundary.rs's direction
function (the sentence text found at that exact location), which needs
sides: flow::Sides from flow::read(&scope, ...), confirming the refusal is
genuinely scope-dependent and unreachable from a region-local preflight. aes.sv
extract-capture fingerprint from the live re-run's execute output matched
090e92e7736e… (the 090e92e7736e0a5a93557d75befa65a5bea0c2f44494d71dc67e3f8d70d05835
row in the JSONL). No sabotage was needed here since no production code
shipped from this half — verified the claim by reading the removed-preflight's
would-be call sites instead, which is what the task asked for.
7. Trace-line / RequestFailed check. Read server/dispatch.rs's
Rename::METHOD arm: trace is always populated by rename_traced (both
roads), but self.timing(...) — the only place a preflight=true line
reaches any output — fires only under if let (true, Some(line)) = (self.verbose, trace). Every Err outcome, preflight or slow-road, becomes
Failure::Request(message) → lsp_server::ErrorCode::RequestFailed with text
"lucisv: {message}" (dispatch.rs:598-599) — never a result value. Matches
the task's item 6 exactly.
8. Re-measured cells. Fresh, guarded, real-server sessions on this exact
candidate binary (sha256 5f815542ac16854acb77f545805378324e0025eaaf48662f28bcc8ae8b6ebdb9,
matching the tracker's own recorded candidate hash — no rebuild needed,
confirmed identical before use) against OpenTitan, --tries 1 (a lighter
re-measurement than the dev's 3-repeat sessions, sufficient to confirm order
of magnitude and correctness, not to re-derive medians): no-symbol 0.248 ms,
duplicate-module 2 120–2 153 ms, common-port ~3.4 s, tail-adjacent rows in the
same session all within normal single-session variance of the tracker's
values (a few percent, same direction the tracker itself notes as
session-to-session noise). extractrefuse bad-name 12.7 ms / partial-selection
0.05 ms, execute inline-refusal 757.6 ms, aes.sv capture 138.2/167.9 ms —
all within the same variance band and all sentences/fingerprints identical.
No cell moved outside what the tracker itself already characterizes as
session noise (±10%), and none of the safety-relevant numbers (parse counts,
sentences, fingerprints) showed any deviation.
9. OpenTitan / guard / lingering processes. git -C /Users/guoliangchen/repo/opentitan status --porcelain showed exactly the
three pre-existing modified files (hw/ip/aes/dv/tb/tb.sv,
hw/top_darjeeling/.../ast.sv, hw/top_earlgrey/.../ast.sv) before and after
every phase invocation in this QA pass. Every cargo/test/bench invocation ran
through tools/guard.sh -m 8 -t <bound>; zero guard kills. No sleep over
60 s was used; all waits were Monitor-backed PID polls that exited on their
own; no lingering background processes or monitors remain at the end of this
pass (ps checked clean after each phase).
10. Fixed directly (small, unambiguous). The feature README's own work
log said cargo test --workspace 4 328 passed; two independent guarded
runs on this exact tree (main tree, and the untouched sha256-matched binary's
own source) show 4 322, which is also exactly what the QA brief itself
expected ("dev says 4322"). Corrected in the Work log entry above with the
supporting arithmetic; not a functional finding, a transcription slip.
Topo handshake for the lead to apply (repeating the README's own
Handshakes request, verified sound): docs/topo.md §1.2's
lucisv_server ◀──▶ vlog_refactor entry should gain a one-directional
parity obligation — rename_preflight must produce the same refusal text as
whole-scope rename for the same request, but may always stand aside — and a
note that rename_preflight deliberately does not read the workspace
index, unlike prepare_rename_here, which does. Confirmed by code: no index
or external parameter reaches rename_preflight anywhere in this diff, and
declared_here's file-scope branch is the one place that would have needed
it, and defers instead.
Verdict: PASS. Every refusal's sentence and precedence is unchanged between 0.51.0 and the candidate on every case checked, including two successful sabotage attacks on the oracle that would have caught a real regression. TODO §61.1's QA line is ticked below.
Review
2026-09-08 (lead). Accepted. Read preflight.rs, the server call
site, the oracle test, both logs; QA's independently rebuilt rule table
and its sabotage of the oracle are the acceptance.
- The result is the review's gate met by two orders of magnitude (2.0 s and 3 975 parses → 0.34 ms and none) with the sentence and its precedence byte-identical, proven at every byte of the fixtures and on the wire.
- The two things the dev refused to do are as good as the thing it did.
The duplicate-declaration refusal stays on the slow road because the
index is written on save and on a watcher event, never on a keystroke,
and a wrong rename refusal is terminal where a wrong prepareRename is
not — the right reading of "only with evidence the index is current".
The extract preflight was built, measured at zero work, and removed:
the offer gate already runs the region-local checks before the engine
is reached, and the
aes_wrap.svrefusal isCrossing::read, the last stage of the plan, which only §61.5's scope reuse can move. - The signature deviation (no
external/indexparameters) is the contract itself: a preflight that could read the index would invite exactly the refusal the argument forbids. - QA fixed one arithmetic slip in this README's test count; nothing else.
Docs applied at merge: topo §1.2 — rename_preflight owes whole-scope
rename the same refusal text, one-directionally, and reads no index.
(empty — for the lead)