Files

perf5r-lint-snapshot — the code-action path on a large file

Take 5 review round (docs/performance_take5_review.md §1), TODO §61.2, tracker rows R1b (the stage trace) and R1a (the lint-result snapshot). Baseline is 0.51.0; the paired reference for this lane is trunk at 51cbfd2, which is 0.51.0 plus §61.1's rename preflight — a change on the rename path that this lane does not touch.

Goal

A textDocument/codeAction on a comment in pinmux_reg_top.sv (42 192 lines, 1.3 MB, generated) costs 25 ms, of which 23 ms is the quickfix family, and the first request after a one-character edit costs 136 ms. The review's own reading is that lint.rs::fixable calls lint_with on every request and nothing memoizes the result; take 5 §P1's lane deferred that memo because "its key is a different shape from anything else in this lane" and its failure mode is a stale fix offer.

This lane does the two halves the review asks for, in its order:

  • R1b, first: measure. One timing: codeaction … line per request behind --verbose, splitting the request into config discovery, LintRun build, lint pass, fence filter and action serialization — and, separately, the flush: the debounced Document rebuild that answer_request performs before any handler runs, with the diagnostics pass that publishes inside it split the same five ways. No behaviour change.
  • R1a, then: reuse. One lint-result snapshot per open Document, keyed by every input the result depends on, read by the diagnostics pass and by quick-fix discovery alike, recomputed whenever the key does not match. The fence authority and execute-time validation are untouched.

What must not move: which diagnostics are published, which fixes are offered, and their bytes. A menu that is fast because it is stale is a failure, and so is a fix offered for a finding the current buffer no longer has.

What the measurement said (R1b)

tools/perf/phases_r1.py::actionprofile, three cursors, four request shapes, --verbose, one warm session each. Milliseconds, --tries 3, repeat median of the wire time and the trace of the last request.

pinmux comment wire flush wall flush parses flush lint action config action build action lint fence serialize
first request of the session 25.10 0.00 0 0.00 0.20 0.06 22.43 0.00 0.05
repeated, unchanged buffer 21.97 0.00 0 0.00 0.04 0.01 20.87 0.00 0.03
definition queued behind it 22.33 0.00 0 0.00 0.04 0.02 20.96 0.00 0.03
first request after a didChange 127.54 99.72 1 21.08 0.03 0.01 20.22 0.00 0.03

Read off those numbers:

  • The 23 ms is the rules. Config discovery — the lucisv.toml walk, ProjectLint::read and the waiver reads — is 0.04 ms on a repeat (0.20 ms on the first request of a session, which is the OS cache warming). The LintRun build is 0.01–0.06 ms. The fence filter costs nothing: this buffer has zero violations, so §P1a's "no fix, no fence parse" gate answers before the memo is asked. Serialization is 0.03 ms. 99% of the quickfix menu is lint_with.

  • Which rules. tools/perf/phases_r1.py::ruleablation pushes lucisv.lint.select one rule at a time through didChangeConfiguration and times the same quickfix-only menu under each. The floor — one cheap rule, so context construction and transport alone — is 1.3–1.4 ms. Three rules stand out, and they are the three semantic ones that read the buffer's Semantics and the workspace census:

    rule repeat median over the floor
    unused-signal 9.52 +8.2
    undriven-net 8.69 +7.4
    multiply-driven 8.88 +7.5
    every other default rule (55 of them) 1.24–3.51 ≤ +2.2
    control, all 57 default rules 20.19 +18.9

    The three semantic rules are effectively the whole of it; the remaining 55 rules together account for about 2 ms. (Single-rule rows each pay the shared context setup once, so the three do not add up to 18.9 exactly — the ranking is what this row set establishes, not an exact partition.)

  • The 136 ms first-after-edit is mostly not the lint pass. Of 127.5 ms: 99.7 ms is the flush (one whole-file parse and the analysis of 1.3 MB, plus the diagnostics publish it triggers) and 20.2 ms is the handler's own lint pass. Inside the flush, the diagnostics pass is 21.1 ms of the 99.7 — so the Document rebuild itself is about 78.6 ms, and the request runs lint_with twice on the same revision: once to publish diagnostics, once to discover quick fixes.

    That is the review's item 4 answered with a number: a lint cache alone cannot fix the 136 ms, because 79 ms of it is Document::new. What a snapshot can take out of it is one of the two 21 ms passes.

The small-file controls behave as expected and are recorded in full: tb.sv 0.52 ms unchanged / 0.98 ms after a change (flush 0.49 ms), the aes.sv aes_reg_top cursor 3.2 ms / 4.19 ms (flush 1.10 ms).

The dependency / invalidation table

Written before any cache, as the review requires. One row per input that can change a lint result or a fix. "How the key observes it" is the mechanism, not a hope; "test" is the test that flips that row and asserts a fresh result.

lint_with(ctx, rules, external) is a pure function of its three arguments, and ctx = LintContext::from_parse(text, tokens, tree, line_index, path) .with_semantics(&doc.semantics).with_options(options).with_line_length(w) .with_tab_width(t) plus the oracle. So the table below is complete by construction: every argument of that expression is a row.

# input how it can change how the key observes it test
1 document text, tokens, tree, semantics, line index, path didOpen, didChange, a text-carrying didSave, willRenameFiles identity. The snapshot is a field on the Document, and Workspace::set_document builds a new Document for every flushed change and drops the old one. There is no revision number to compare because there is no way to hold the wrong one — the same argument crate::fences already rests on an_edited_buffer_is_relinted
2 doc.large a buffer crossing lucisv.largeFile.threshold in either direction identity (row 1: the mode is re-taken in set_document, which builds a new Document). A large buffer never reaches the pass at all: codeAction is answered [] by large_file.rs before any handler, and diagnostics::all_in returns empty a_large_buffer_lints_nothing_and_stores_nothing
3 the enabled rule set lucisv.lint.select / ignore / severity.<class> / rules.<name> pushed by didChangeConfiguration; [lint] select / ignore in the buffer's lucisv.toml Key.rules: the &'static str names the ladder produced, in registry order, compared exactly (not hashed) a_pushed_rule_selection_is_relinted, a_rewritten_toml_is_relinted
4 merged rule options [lint.<rule>] tables in lucisv.toml; lucisv.lint.options from the editor Key.options: the merged RuleOptions, compared exactly (PartialEq) a_rewritten_toml_is_relinted
5 line width line-length in lucisv.toml; lucisv.lineLength Key.line_length a_rewritten_toml_is_relinted
6 tab width (fix text only) indent in lucisv.toml; lucisv.indent Key.tab_width. Since this lane the width lives on the LintRun — read there through format::indent_width, which used to be called by the dispatcher — so the diagnostics pass and the quick-fix pass build the same context and share one snapshot. Only no-tabs' fix string reads it, and the diagnostics path never reads a fix, so no published diagnostic moves a_tab_width_change_rewrites_the_fix
7 external waiver file contents any edit of a file named by [lint] waivers or by lucisv.lint.waivers Key.waivers: (path, text) per file, in the order they are read — the exact text ExternalWaivers::parse was handed, not a hash and not an mtime. One read, not two: lint.rs now reads the bytes itself and parses them, reproducing ExternalWaivers::read's error sentence byte for byte a_rewritten_waiver_file_is_relinted
8 the lucisv.toml itself any edit of the discovered config file; a new config file appearing in a parent directory through rows 3–7. Nothing in a lucisv.toml reaches a lint result except the selection, the options, the width, the indent and the waiver paths, and all five are in the key. LintRun::for_document re-runs Discovery::for_file on every request (0.04 ms, measured above), so a rewritten file is in the key at the next request a_rewritten_toml_is_relinted
9 the workspace index the census oracle reads publish_scan, both finish_scan paths, update_one — i.e. a scan step, a scan finishing, a didSave or a watcher event in another file not a key field: an explicit drop. All four of those call sites end with for doc in self.docs.values_mut() { doc.refresh_overlay(&self.index) }, and refresh_overlay — the one place a Document is told the index moved — clears the snapshot. Verified by exhaustion: self.index.{absorb,remove_file,update_facts,update_file} occurs nowhere else in state/ a_change_in_another_file_relints_this_one
10 whether there is an oracle at all the first scan of a session that began with an empty index Key.has_oracle, and row 9's drop a_workspace_appearing_turns_the_semantic_rules_on
11 client settings generation workspace/didChangeConfiguration, or the reply to workspace/configuration through rows 3–7; apply_settings also republishes every open buffer, which recomputes under the new key immediately a_pushed_rule_selection_is_relinted
12 file-watcher events on the lucisv.toml / the waiver files there are none. watch::SOURCE_GLOB is **/*.{v,vh,sv,svh} and the only other watcher is the configured filelist's own path rows 7 and 8 are what make this safe: both files are re-read per request, so no watcher is needed and none is added a_rewritten_toml_is_relinted (no watcher event is sent)
13 close and reopen didClose then didOpen identity: close_document removes the Document, and with it the snapshot a_closed_and_reopened_buffer_is_relinted
14 UTF-16 ranges — not an input. Positions is built from doc.text per request in code_action.rs and lint::diagnostics_in; nothing positional is stored in the snapshot, which holds byte spans exactly as lint_with returned them a_snapshot_fix_keeps_its_utf16_range

Two things are deliberately not in the key:

  • A hash of anything. Every field is compared by value. A 64-bit digest would have been smaller and would have made "no stale fix" an argument about collision probability instead of a fact.
  • A time or a generation number for the config files. An mtime is a weaker statement than the contents and is wrong across a same-second rewrite; the contents are already in hand because the pass reads them.

What R1a bought (paired)

Reference 51cbfd2 (5d2a7aa2a4fd…) against the same tree plus this lane's diff (827c7ac222c8…), both --release --locked, the same schema-2 harness, phase order alternating which binary went first, no build during any timed run, --tries 3, repeat medians. Load 2.5–5.9 one-minute, inside the review's own 2.8–6.0 band; zero guard kills; opentitan git status --porcelain = the same three pre-existing files after every phase.

workload 51cbfd2 this lane change
pinmux comment, all action families, unchanged 22.61 0.98 −95.6%
pinmux comment, quickfix only, unchanged 24.51 0.11 −99.5%
pinmux comment, empty family filter 0.05 0.05 unchanged
pinmux menu, repeated on the unchanged buffer (offeredit) 23.44 0.18 −99.2%
definition queued behind the pinmux menu (leader / follower, pipeline 3) 22.39 / 22.38 0.78 / 0.76 −96.5%
pinmux comment, first offer after a didChange 125.65 106.89 −14.9%
tb.sv comment, unchanged / after a change 0.19 / 1.26 0.23 / 1.45 +0.04 / +0.19 ms
aes.sv aes_reg_top, unchanged / after a change 2.86 / 3.83 2.58 / 3.62 −9.7% / −5.5%
diagnostics publish after didChange (≈150 ms of it is the debounce) 162.29 162.75 +0.3%
didOpen pinmux_reg_top.sv → definition 120.45 110.42 −8.3%
didOpen aes.sv / aes_core.sv / spi_device.sv → definition 4.53 / 5.72 / 8.68 3.49 / 5.56 / 8.15 −23% / −3% / −6%
take-3 codeaction cells (eager, fan-out 1 / 6 / comment) 21.37 / 88.44 / 1.67 21.60 / 89.74 / 1.56 +1.1% / +1.5% / −6.7%
idle RSS, 100 open buffers each asked for quick fixes (MiB) 574.0 574.6 +0.1%
idle RSS, 10 / 1 buffers (MiB) 429.4 / 420.9 428.4 / 422.2 ±0.3%

Gates.

  • unchanged pinmux menu ≤ 16 ms — met, 0.98 ms (quickfix-only 0.11 ms).
  • queued definition ≤ 16 ms — met, 0.76 ms.
  • first-after-edit improved, reported separately with its stage split — 125.65 → 106.89 ms, −14.9%, and the split says exactly why that is the whole of what a lint cache can do here: of the candidate's 109 ms, 106 ms is the flush, of which 21.9 ms is the diagnostics pass and the remaining ~84 ms is Document::new on 1.3 MB. The handler's own lint pass is 0.00 ms — it does not run. The remaining stage is named and is not this lane's: the parse and analysis of a 1.3 MB buffer.
  • diagnostics publish unchanged — met, +0.3% (inside the run-to-run spread of a 150 ms debounce).
  • no higher retained memory — met, +0.1% at 100 open buffers, all of them holding a snapshot.
  • no stale diagnostic or fix under any invalidation row — 11 server tests and 10 unit tests, one per row plus the attack; see below.

The candidate's own trace, at the same three cursors:

pinmux comment wire flush wall flush lint flush snapshot action lint action snapshot
first request of the session 2.07 0.00 0.00 — 0.01 hit
repeated, unchanged 0.72 0.00 0.00 — 0.00 hit
definition queued behind it 0.23 0.00 0.00 — 0.00 hit
first after a didChange 109.39 106.09 21.87 miss 0.00 hit

The first request of a session already hits: the didOpen published diagnostics, and that pass is the one the menu reads. A queued definition logs no trace line of its own at all — it lints nothing — which is what the result_count of those rows says.

The config-discovery decision: leave it. The review allows memoizing the FileConfig read "if the trace says that I/O is material". It does not: 0.04–0.16 ms on a repeat, against a 21 ms pass. Memoizing it would have added a second key (path, mtime, length) whose failure mode is a stale rule selection — and the lucisv.toml and the waiver files are not watched (table row 12), so that per-request read is the only thing that ever notices one of them changing. It stays.

The one thing that did move is where the indent width is read. It used to be format::indent_width, called by the dispatcher; it is now the same function, called by LintRun::for_document, because the two doors must build the same context to share one snapshot. A code-action request therefore does the same two Discovery walks it always did (one in configured, one in indent_width); the diagnostics publish now does two where it did one. Measured, that moved the config stage from about 0.04 to 0.15 ms on a repeat and left the publish row at +0.3%, inside the spread of a 150 ms debounce. It is stated rather than hidden, and the fix is a handshake request below, not a second spelling of the indent ladder here.

Assumptions

  • lint_with is deterministic and side-effect-free given (ctx, rules, external). Not enforced by a type; it is what makes a snapshot legitimate at all. Pinned by a_recomputed_snapshot_equals_a_fresh_pass, which lints the same document twice through the two doors and compares every violation.
  • A Document's derived fields are a pure function of its text. The same assumption crate::fences (§P1b) already ships on, and the reason identity can stand in for a revision number in row 1.
  • refresh_overlay is called for every open buffer at every index mutation. Established by exhaustion over state/mod.rs (row 9) rather than by a type. A new index mutation that skipped it would be a stale oracle for external resolution too, which is a pre-existing contract this lane now also depends on — stated in Handshakes.
  • format::indent_width stays the one authority on the indent ladder. LintRun::for_document calls it rather than re-deriving the width from the FileConfig it already read, which costs a second Discovery walk — worth hundredths of a millisecond against a 21 ms pass, and worth not having two spellings of a rule that decides a fix's bytes. Pinned rung by rung by the_runs_tab_width_is_the_formatters_own_ladder. The dispatcher's own call to it is gone, so the request as a whole does not walk more often than before.

Handshakes

Consumed

  • vlog_linter::{lint_with, ExternalWaivers::parse, RuleOptions} — unchanged. ExternalWaivers::parse (already public) is now called directly instead of ExternalWaivers::read, so the file's text is in hand for the key; the error sentence for an unreadable file is reproduced verbatim (format!("{}: {e}", path.display())).
  • vlog_formatter::fence::protected_regions through crate::fences — the shared-fence-filter contract (docs/features/shared-fence-filter/) is not amended. fences.rs gains one read-only predicate, held, which the trace uses to say whether a request paid the parse; it decides nothing.
  • crate::state::Document::refresh_overlay — the existing "the index moved" hook. This lane makes it also drop the lint snapshot.
  • vlog_parser::stats::parses — the flush's parse count in the trace.

Promised

  • crate::lint::violations_in and crate::lint::fixable now return Arc<[Violation]> instead of Vec<Violation>, and fixable no longer takes a tab_width — the width comes from the LintRun. In-crate callers only (lucisv_server is a binary crate): diagnostics.rs, code_action.rs and their tests.
  • crate::lint_trace is new and is written to from lint.rs, code_action.rs and server/dispatch.rs. It is a thread-local accumulator, armed per request; nothing outside --verbose observes it.

Requested of another module

  • crate::format (not this lane's file): indent_width(path, client) runs its own Discovery walk, and LintRun::for_document has already discovered the same FileConfig a line earlier. A form taking that FileConfig — indent_width_of(&FileConfig, &ClientSettings), with today's function as a one-line wrapper — would let the lint pass pay one walk instead of two. The cost of not having it is measured above (about +0.11 ms on the config stage, publish row +0.3%), which is why this lane did not spell the ladder a second time to avoid it: one authority on a fix's bytes is worth more than 0.11 ms. Nothing else is needed in vlog_linter, vlog_formatter, fence.rs or state/scan.rs.

docs/topo.md — this lane adds one edge (lint.rs ──▶ lint_snapshot.rs, lint.rs ──▶ lint_trace.rs, state/mod.rs ──▶ lint_snapshot.rs for the field) and amends the server-lint ◀──▶ diagnostics edge to say the two now share one computed result. topo.md is not this lane's file: the amendment is requested here for the lead to apply at merge.

Status / TODO

  • R1b — the timing: codeaction … stage trace (lint_trace.rs), with the flush group and its parse count; fences::held for the memo hit
  • R1b — the harness: tools/perf/phases_r1.py, phases actionprofile (three cursors × four request shapes) and ruleablation (one row per default-on rule)
  • R1b — measured, and the 23 ms / 136 ms attributed (above)
  • the dependency/invalidation table, written before the cache
  • R1a — lint_snapshot.rs, the Document field, both consumers
  • R1a — one invalidation test per table row, plus the stale-fix attack
  • R1a — measured paired against 51cbfd2; the 100-buffer RSS cell
  • tracker cells R1a/R1b and both experiment records; TODO §61.2

Work log

2026-09-08 — dev (Opus), R1b.

  • crates/lucisv_server/src/lint_trace.rs (new): a thread-local stage accumulator in vlog_parser::stats' shape — per thread because a request is answered on one thread, and armed only by the request wrapper when --verbose asked. Off costs one Cell<bool> read per traced site: no clock, no allocation, no line. Two groups per request, flush and action, divided by close_flush, so the diagnostics pass that publishes during the debounced flush is readable beside the handler's own pass.
  • lint.rs: LintRun::for_document's body split into Discovered::read (everything read from disk) and Discovered::into_run (the oracle and the rule ladder), so the I/O has a stage of its own. The calls, their order and the order the config problems are collected in are unchanged. One place now calls lint_with (found), which is what makes one trace site enough.
  • dispatch.rs: flush_dirty_traced wraps the flush with a clock and a vlog_parser::stats::parses() delta, but only when a trace is armed; Server::request arms one and logs timing: codeaction method=… total=… + the two groups, for any request that linted anything — which is the code actions and any request whose flush published diagnostics, so the queued definition gets its own line.
  • Deviation, stated: the flush is traced as one stage plus its parse count, not split into parse / analysis / overlay-refresh. Those three live inside Document::new and Workspace::set_document in state/mod.rs, which this lane owns only for the snapshot field and its initializers; splitting them means threading a trace through set_document's signature. The number the review asks for — dirty-buffer stage versus lint pass — is fully answered without it: flush 99.7 ms of which the diagnostics lint is 21.1, so the rebuild is ~78.6 ms.
  • Measured (§R1b cells above). Zero guard kills; opentitan git status --porcelain = the three known files after every phase; load 1.9–3.6 one-minute, inside the review's own 2.8–6.0 band.

2026-09-08 — dev (Opus), R1a.

  • crates/lucisv_server/src/lint_snapshot.rs (new): Key — the inputs, by value — and Slot, a Mutex<Option<Held>> on the Document. read_or answers from the slot when the key matches and otherwise computes with the lock released and replaces what is held. No hash anywhere: the waiver files' text is compared, not a digest, so "can this offer a stale fix?" is a PartialEq question. Mutex rather than RefCell so a Document stays Sync exactly as its OnceLock fence memo leaves it; a poisoned lock (which a single message loop with no panicking library code cannot produce) degrades to computing every time.
  • state/mod.rs: one field (Document::lint), its two initializers, and one line in refresh_overlay — the hook that already exists for "the index moved" — which clears it. That line is the whole of the index invalidation and is why there is no generation counter to keep in step. Four lines of production code in that file; it is over the size threshold already (1 063 → 1 067 by the CLAUDE.md measure) and TODO §55 owns that.
  • lint.rs: one found(doc, run) reads the slot and both doors call it, so the diagnostics publish and quick-fix discovery are one pass. Both now return Arc<[Violation]>; fixable copies only when the fence filter actually drops something, which on a buffer with no // lucisv: off region is never. The tab width moved onto the LintRun (read through format::indent_width, whose call the dispatcher no longer makes) — without that the two doors would build different contexts and thrash one slot. Waiver files are read with read_to_string + ExternalWaivers::parse instead of ExternalWaivers::read, one read still, so the text is in hand for the key; the unreadable-file sentence is reproduced verbatim.
  • Found by an existing test, and worth recording: the first version let a test helper set external without the matching text, so two runs with different waivers shared a key. with_external became with_waivers(path, text), which writes both — the invariant is now structural, and the field's doc comment says so.
  • Tests: 21 added, none removed (4 322 → 4 343 in the guarded workspace run). 11 in server/tests/lint_snapshot.rs, one per table row through the real doors plus the stale-fix attack (a buffer edited so the span a previously offered fix named no longer exists — nothing is offered, and the wire answer is empty); 4 in lint_snapshot.rs (every field of the key forces a recompute; a waiver rewritten in place is a different key); 4 in lint_trace.rs; 2 in lint.rs (the tab-width ladder rung by rung, and a reused snapshot compared violation for violation and fix for fix against a fresh lint_with).
  • Reuse is asserted by pointer (Arc::ptr_eq), never by a stopwatch: a timing assertion on a lint pass is a flake.
  • Harness fix during the run: actionprofile's queued rows attributed trace lines by position, and a definition that lints nothing logs no line, so two leaders were recorded as a leader and a follower. Lines are now attributed by their own method field and result_count says how many the follower logged. The r1a-cand actionprofile rows in the evidence file predate that fix and are superseded by r1a-cand-2; no number quoted anywhere came from the mis-attributed field (the R1b table's queued row is the leader's split, which is what it always was).
  • Measured (above). Zero guard kills; opentitan clean after every phase.

QA log

2026-09-08 — QA (Sonnet).

Read CLAUDE.md, TODO §61.2, docs/performance_take5_review.md §1, this README in full, perf5-p1's deferral memo, semantic-lints-on's oracle handshake, and docs/perf/take5-tracking.md's R1a/R1b records plus both experiment records, before touching anything.

Gates, guarded, main tree. cargo fmt --all -- --check clean. cargo clippy --all-targets --workspace clean after touching every changed file to defeat the incremental cache — no new #[allow] anywhere in the diff. cargo test --workspace (guarded, tools/guard.sh -m 8 -t 1800): 4 343 passed, 0 failed, matching the dev's own count exactly. Cross-checked independently: cloned trunk 51cbfd27dfd22720856c501c9c17277460cc6a68 fresh into scratch (no diff), built and tested the same way — 4 322 passed, 0 failed. cargo test --workspace -- --list, name-sorted and comm-diffed between the two trees: zero names removed, exactly 21 added, and the 21 match the dev's own breakdown byte for byte (11 in server::tests::lint_snapshot, 4 in lint_snapshot::tests, 4 in lint_trace::tests, 2 in lint::tests). Production line counts (non-blank, non-comment, up to mod tests): lint.rs 334, dispatch.rs 464, lint_snapshot.rs 54, lint_trace.rs 207 — all four numbers match what the dev's own measure would produce; note for whoever wrote my brief: the file names for the last two are transposed there (the smaller file is lint_snapshot.rs, holding Key/Slot, and the larger is lint_trace.rs, holding Stage/Group/Trace) — a wording slip, not a code finding. state/mod.rs: read the diff directly rather than counting — exactly one field (pub lint: crate::lint_snapshot::Slot), two initializers (Document::new and the large-file constructor), and one line in refresh_overlay (self.lint.clear();). All files well inside the 300–600 target; no file pushed over a threshold.

The invalidation table, derived independently first. Read found's call to lint_with and LintRun::context/LintRun::key and listed every input that reaches lint_with(ctx, rules, external): buffer text/tokens/tree/ line_index/path (context(doc)), options, line_length, tab_width (fix text only), the oracle (has_oracle plus the index's own answers), rules, external (waiver contents), and doc.large (gates the whole path before any of this runs) — nine independent inputs, matching the table's 14 rows exactly once the table's own splits (rows 3/11 both being "the rule selection", 4/5/8/12 all being "the toml", 9/10 both being "the index") are collapsed back to the inputs of the call. Nothing reaches lint_with that the table's rows do not name. Read state/mod.rs's four index-mutating call sites (publish_scan, finish_whole_scan, finish_widen, update_one) in full: all four end in for doc in self.docs.values_mut() { doc.refresh_overlay(&self.index); }, confirming row 9's "verified by exhaustion" claim directly rather than trusting it. Document has no custom Drop; lint: Slot is dropped by the default field-wise drop whenever a Document is dropped (didClose, or replaced by set_document), confirming item 8's memory-bound claim.

The wire matrix (a)–(l), attacked twice, independently of the dev's own tests. Wrote two standalone Python scripts (wire_probe.py, wire_probe2.py, in the QA scratchpad) speaking real JSON-RPC over stdio (Content-Length framing) to the actual --release --locked candidate binary, against a fixture workspace this QA built from scratch (not the dev's fixtures, not the Rust in-process Session): a lucisv.toml, a waiver file, a tabbed module, and a dut.sv/tb.sv pair for the oracle row. Every row, all passing on the first clean run (after two script bugs of my own — a premature take_notifications() and a stale waiver directive shadowing a later section — found and fixed, noted so the evidence is legible):

row attack result
(a) edit the buffer covered by (g)/(k)'s edits and the dev's own an_edited_buffer_is_relinted
(b) didChangeConfiguration toggling lucisv.lint.ignore twice fresh both times
(c) lucisv.toml [lint] select rewritten on disk with no watcher event, twice fresh at the very next request both times
(d) waiver file rewritten to the same length, different content (--line=1 vs --line=2) fresh, not stale
(e) waiver file deleted entirely fresh (finding un-silenced)
(f) tb.sv — never opened — rewritten on disk, reaching dut.sv only through a bare workspace/didChangeWatchedFiles (no didChange anywhere) dut.sv's republished diagnostics flip unused-signal on, then back off when tb.sv mentions the signal again
(g) close, then reopen with different text fresh
(h) a buffer over lucisv.largeFile.threshold offers nothing (fast path answers before any handler)
(i) a UTF-16 fix range (é + a non-BMP 🎉 before the tab) on a snapshot asked for twice the reused answer is byte-identical to the computed one; range is character: 9 (UTF-16 units), not the byte offset
(j) indent in lucisv.toml changed between two quick-fix requests on the same open buffer the no-tabs fix text changes from " " to " " at the very next request
(k) offer a fix, edit the buffer so both fixes' spans (one of them 40+ lines deep) are gone, ask again over a range that would be out-of-bounds for a stale answer nothing offered, and the server's own view of the buffer is the post-edit text
(l) source.fixAll.lucisv after the buffer is edited back down to one violation offers exactly the one-tab fresh edit, not the earlier two-tab one

Sabotage, in a fresh clone with the working diff applied (scratchpad/qa-61-2/cand), one at a time, each reverted before the next and confirmed clean (git diff --stat back to the original 341/16 insertion counts, grep -rn SABOTAGE empty):

  1. Stripped the waiver text out of LintRun::key() (kept the path, blanked the string) → server::tests::lint_snapshot::a_rewritten_waiver_file_is_relinted FAILED (14 passed, 1 failed), exactly the row-7 test and nothing else.
  2. Removed self.lint.clear() from Document::refresh_overlay (early return right after the external line) → a_change_in_another_file_relints_this_one FAILED (14 passed, 1 failed), exactly the row-9 test.
  3. Hard-coded tab_width: 0 in LintRun::key() (context still builds with the real width, so the fix would be correct but the key blind to a change) → a_tab_width_change_rewrites_the_fix FAILED (1 passed, 1 failed alongside the unrelated the_runs_tab_width_is_the_formatters_own_ladder, which stayed green because it never reuses a snapshot across a config change — consistent, not a miss).

All three cuts were caught by exactly the test the row predicts and no other test in the same run flipped. Nothing else was sabotaged (hashing the key, an index-generation counter, etc. — the README's own rejected-alternatives list — since none of those are what shipped).

Trace. Confirmed lint_trace::arm() is reachable only through Server::request's let Some(started) = self.timer() else { return … } branch, and timer() is self.verbose.then(Instant::now) — so a non---verbose session allocates nothing and logs nothing, by construction, not by convention. Re-ran tools/perf/phases_r1.py::actionprofile and ::ruleablation against my own fresh --release --locked build of the candidate (sha256 827c7ac222c8…, byte-identical to the dev's own candidate binary hash — confirms the evidence file and my build are the same code) over the read-only OpenTitan corpus:

  • unchanged pinmux menu 0.57–0.88 ms, queued definition 0.24–0.26 ms, first after a didChange 103.5–118.0 ms (repeat median ≈106 ms) — all inside or close to the dev's own range, on the same machine, at a different time of day.
  • the trace fields on the first-after-edit row: trace_flush_lint=21.85ms (dev: 21.1–21.9 across the two records), trace_flush_snapshot=miss, trace_action_lint=0.00ms, trace_action_snapshot=hit on every row including the first-after-edit one — the handler's own pass really is 0.00 ms, reproduced independently.
  • ruleablation on the candidate: every row is cheap (≤~1.5 ms), which is the expected consequence of R1a and not a re-derivation of the R1b per-rule costs — didChangeConfiguration republishes every open buffer before the timed codeAction requests run, so the expensive single-rule pass happens during the republish and the timed request always hits. I did not rebuild a snapshot-free (51cbfd2 + lint_trace.rs only, no lint_snapshot.rs) variant to re-derive the three-semantic-rules-cost attribution itself; that number is R1b's, marked "attribution, no behaviour change" in the tracker, and the flush-lint figure above (21.85 ms) is consistent with it. Flagged as a scope limitation, not a finding.

Re-measured cells. snapshotrss re-run on both my own ref and candidate builds (100 open buffers, quickfix-only on each, 3 tries): candidate median 574.2 MiB (dev: 574.6), reference median 575.2 MiB (dev: 574.0) — both inside noise of the dev's own numbers and confirming the "+0.1%, no higher retained memory" gate independently. codeAction-family latency reproduced via actionprofile above; did not separately re-run offerkinds/offerqueue/ offeredit/diagnostics/didopen as their own named phases (time budget) — actionprofile's four request shapes at the same three cursors cover the same underlying behaviour (unchanged menu, quickfix-only, queued definition, first-after-edit) those phases measure. Also a scope limitation, not a finding.

Traceability. Pulled ~/.cache/lucisv-perf/take5r-2/results.jsonl and checked all 12 numbers named in the tracker's R1a/R1b rows and experiment records: 22.61, 24.51, 22.39/22.38, 0.98, 0.11, 0.78/0.76, 574.0, 574.6, 162.29, 162.75 match raw sample values in the file to within 0.005; 125.65 and 106.89 are not raw samples but are exactly the median of the last two of the three ms samples for the reference and candidate "first offer after didChange" rows respectively (128.96 was the first, so 125.65 = median of 127.76/123.54; 106.07 was the first, so 106.89 = median of 108.64/105.14) — consistent with the tracker's own "first / repeat median" convention, not a fabricated number. Same check for 574.0/574.6: exact medians of the three 100-buffer rss_kib samples in the file.

Guard / opentitan / cleanup. Every cargo invocation (fmt, clippy, test ×3 trees, -- --list ×2 trees) and every perf phase (actionprofile, ruleablation, snapshotrss ×2 binaries) ran through tools/guard.sh -m 8 -t 1800; zero guard kills. git -C /Users/guoliangchen/repo/opentitan status --porcelain checked before, during and after every phase: the same three pre-existing files (hw/ip/aes/dv/tb/tb.sv, hw/top_darjeeling/ip/ast/rtl/ast.sv, hw/top_earlgrey/ip/ast/rtl/ast.sv), nothing else, every time. All sabotage was done in scratchpad/qa-61-2/cand, a fresh clone with the working diff applied; the main tree was never git checkout/reset/stash/cleaned and nothing outside this README's QA log and the TODO line below was edited. No background loop or server process left running at the end of this session (checked ps aux — only a pre-existing, unrelated VS Code extension server survives).

Verdict: PASS. No stale diagnostic or fix found or produced under any of the 14 table rows, over the real wire, on a fixture this QA built independently, with three targeted sabotage cuts each caught by exactly one predicted test. Gates green and cross-checked against a from-scratch clone of 51cbfd2 with matching binary hashes; test count +21/-0 confirmed by name, not just by count. Two scope limitations disclosed above (no snapshot-free rebuild for the R1b per-rule ablation; five perf-phase names not re-run under their own headings) are attribution/measurement gaps, not correctness gaps, and do not change the verdict.

Topo edges for the lead to apply at merge (from this README's own Handshakes section, confirmed absent from docs/topo.md today): lint.rs ──▶ lint_snapshot.rs, lint.rs ──▶ lint_trace.rs, state/mod.rs ──▶ lint_snapshot.rs (the field), and the server-lint ◀──▶ diagnostics edge amended to say the two doors now share one computed result. The format::indent_width_of(&FileConfig, …) request to crate::format's owner is still open and unclaimed by this round; it is a 0.11 ms/request cost, not a correctness issue.

Review

2026-09-08 (lead). Accepted. Read lint_snapshot.rs, the state/ hunks (one field, two initializers, one clear in refresh_overlay), the lint.rs door, the invalidation table and both logs; QA's independent derivation of the input list and its wire matrix through a real client are the acceptance.

  • R1b answered the review's question before anything was built: the 23 ms is three semantic rules over a 42k-line file, and the 136 ms first-after-edit is the flush (one parse of 1.3 MB plus the diagnostics pass) with the handler's second pass on top. That is why the snapshot is shaped as one pass per revision shared by both doors.
  • The key is the design: every input of lint_with by value — waiver contents, not an mtime, because nothing watches them — and identity for what identity settles (the Document, and the index through the overlay refresh every mutation ends in, checked by exhaustion by dev, QA and me). No hash, no generation counter, no map: a stale fix is a question about PartialEq.
  • Gates met by an order of magnitude (menu 22.6 → 1.0 ms, queued definition 22.4 → 0.8) with the publish and memory unchanged. The first-after-edit residue is the parse of the buffer, named, not this lane's.
  • The config-discovery memo was correctly refused: 0.04 ms of I/O that is the only thing noticing an unwatched lucisv.toml change.
  • Deviations accepted: the flush traced as one stage; the indent-width read moved into the run (+0.1 ms on publish) with the format::indent_width(FileConfig) request filed.

Docs applied at merge: topo (the snapshot and trace modules, the diagnostics/quick-fix shared result, the parsed timing: codeaction line); the format::indent_width request to the loop-3 list.