Files
lucioandClaude Fable 5.1 8145a67be6 The didOpen delay: undriven-net asks the workspace census last, not once per declaration
TODO §46 (docs/features/didopen-cost). Closes take-3 finding §8.4 (§44b).

Measured first: on opentitan the open of a 42 192-line file cost
1 745 ms, of which the lint pass was 1 654 ms and `undriven-net` alone
1 608 ms — the rule asked `WorkspaceIndex::files_mentioning` (a walk over
all 3 976 indexed files) once per declaration, ahead of the local guards
that silence almost all of them. Six lines reordered so the oracle is
asked last, as `unused-signal` always did: same findings, same order
(pinned by a counting-oracle unit test that fails on a revert, and shown
byte-identical against 0.43.0 over a crafted workspace and four opentitan
IPs). didOpen → next request: 1 742 → 117 ms on the largest file,
51–95 → 5–8 ms on typical IPs, the same on every keystroke flush. No
debounce added; three wire-level pins with a debug-build bound.

Docs: take-3 §8.4 annotated, docs/perf/README.md entry.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-05 08:15:37 -05:00

566 lines
32 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# didOpen cost
## Goal
Take 3 (`docs/performance_take3.md` §8.4) measured that a `didOpen` of a file
the index already covers delays the **next** request by 21–51 ms, scaling with
file size, where take 2 measured a flat 2–4 ms. The server is a synchronous
loop, so whatever the open does before returning is what the next request waits
behind. TODO.md §46 asked for the cost to be measured, broken down, and for the
largest item in it — not all of them — to be fixed, with the open returning to
the loop fast enough that the request behind it is not left waiting and is
still answered from up-to-date state.
The finding turned out to understate the problem by an order of magnitude. At
the whole-workspace scope, opening opentitan's 42 000-line
`pinmux_reg_top.sv` delayed the next request by **1.74 seconds**, and the whole
of it was one lint rule asking the workspace census a question per declaration
in the buffer. Moving that question behind the rule's own local guards — where
its twin rule has always asked it — took the same open to **117 ms**, and took
the take-3 rows from 51–95 ms to 3–9 ms.
## Assumptions
- **The oracle is a pure predicate.** `MentionOracle::mentioned_elsewhere` reads
the index and returns a `bool`; it has no side effects, so where in a
conjunction of `continue` guards it is asked cannot change what the rule
finds. Pinned empirically as well as argued: the 0.39.0 binary and the fixed
one publish byte-identical diagnostics for a workspace built to exercise both
answers (below).
- **A `didOpen`'s buffer must be analyzed before the open returns.** Every
request flushes dirty buffers first (`Server::answer_request`), so deferring
the *parse* to the change debounce would move the cost, not remove it, and
would break "the first request after the open is answered from up-to-date
state". The parse stays synchronous, and so does the publish.
- The measurements are wire-level and on one machine (below). Sub-millisecond
differences are not claimed; everything reported here is a factor, not a
percent.
- opentitan is read-only. The index cache went to a scratch
`initializationOptions.storagePath`; `git -C ~/repo/opentitan status
--porcelain` reported the same three pre-existing modified files before and
after every phase.
## Handshakes
- **`vlog_linter` → the server, unchanged.** `UndrivenNet::check` returns the
same violations, in the same order, for the same context. No rule signature,
no registry entry, no severity and no `default_on`/`needs_workspace` answer
moved. `lucisv check` is unaffected in every way (it has no oracle, so the
reordered test is a constant `false` there).
- **`WorkspaceIndex::files_mentioning` — no change requested.** Its doc comment
records that a merged `word → files` map was measured against the per-file
walk and rejected. That ruling stands and is not reopened here: the fix is to
ask the question a thousand times fewer, not to make the question faster.
What this round adds to the record is the cost of *one* question — a walk
over every indexed file — which is what makes asking it per declaration a
mistake at any workspace size.
- **`Server::publish` / `flush_dirty` — untouched.** §46 allowed the open's
diagnostics to be moved onto the change debounce. They were not; see
"What was not done".
## The measurement
### Method
`scratchpad/perf46/driver.py`, take 3's method (§9 of that doc): framed
JSON-RPC over the server's stdio, `workspace/configuration` answered with
`{"index":{"scope":"workspace"}}`, cache warmth through
`initializationOptions.storagePath`, positions resolved from the file text at
run time. Per file, in one settled session: `didOpen` and a `textDocument/hover`
at the first `module <name>` token written in the **same** flush, timed from the
`didOpen` frame going out to the hover response coming back; then the identical
hover again as the control. Three tries per file per binary, warm store.
Both binaries `cargo build --release -p lucisv_server`: the tree at f795606
(0.43.0) and `v0.39.0` from a scratch `git worktree` (removed afterwards).
Every server run, build and sweep went through `tools/guard.sh -m 8 -t 900`;
no guard kill occurred.
Machine: Apple M1 Max, 10 cores, 64 GB, macOS 27.0, quiet (load 1–3), nothing
else building.
**Note on the file set.** §46 named "the largest file in
`hw/top_darjeeling/ip/xbar_peri/rtl/autogen/` (tl_peri_pkg.sv-class, ~42k
lines)". In this checkout that directory holds only an 8 KB and a 3.6 KB file;
the ~42 000-line file the plan meant is
`hw/top_darjeeling/ip_autogen/pinmux/rtl/pinmux_reg_top.sv` (42 192 lines,
1.3 MB), the largest `.sv` in the tree. That is the file used.
### Where the time went — the breakdown
Temporary `eprintln!` timings inside `didOpen`, `Document::new`,
`Server::publish`, `diagnostics::all_in` and `lint_with`'s rule loop, on the
release build; **all of them removed before finishing** (`git diff` shows only
the rule and the tests). Milliseconds, one representative try per file.
| Stage | `aes.sv` 326 L | `aes_core.sv` 1 145 L | `pinmux_reg_top.sv` 42 192 L |
|---|---:|---:|---:|
| lex | 0.31 | 1.01 | 41.24 |
| tolerant parse | 0.59 | 1.01 | 31.73 |
| `collect_defines` | 0.00 | 0.01 | 0.57 |
| `analyze` | 0.17 | 0.56 | 11.57 |
| `resolve_external` | 0.12 | 0.32 | 4.79 |
| line index | 0.01 | 0.03 | 0.62 |
| **`Document::new` (the whole parse)** | **1.33** | **3.04** | **90.61** |
| `LintRun::for_document` (discovery, waivers, memo) | 0.34 | 0.07 | 0.09 |
| `diagnostics::all_in` (the lint pass) | 4.87 | 54.43 | **1 653.76** |
| — of which the rule `undriven-net` | 4.38 | 52.23 | **1 608.45** |
| — of which `multiply-driven` | — | — | 8.22 |
| — every other rule, together | ≈0.5 | ≈2.2 | ≈37 |
| **`didOpen` total** | **7.07** | **58.01** | **1 745.06** |
Two things the table settles:
1. **The widen is not involved.** At the whole-workspace scope every file is
already in scope, so `widen_of` answers `Nothing` and the open costs the
parse plus the publish and nothing else. The `didOpen` total is the sum of
the two rows above it to within 0.2 ms.
2. **The lint pass is 75 / 94 / 95 % of the open, and one rule is 90 / 96 /
97 % of the lint pass.** `LintRun::for_document` — §42's discovery, the
waiver-file reads and the once-only memo, the thing §46 guessed at — costs
70–340 µs and is not a candidate. Neither is the completion word table or
the semantic tokens: neither runs on an open at all.
### Why `undriven-net` cost that
The rule asked the workspace census about **every** declaration in the buffer,
before any of its local guards had a chance to silence it:
```rust
if intentionally_unused(..) || !judgeable(..) || has_init { continue }
if ctx.mentioned_elsewhere(&decl.name) { continue } // ← was here
let Some(usage) = signals.usage(decl) else { continue };
if connected || driven || reads == 0 { continue }
found.push(..)
```
One `mentioned_elsewhere` is `WorkspaceIndex::files_mentioning`, a walk over
**every indexed file** binary-searching its sorted word list — 3 976 files in
opentitan at the workspace scope. `pinmux_reg_top.sv` has roughly four thousand
declarations, and essentially all of them are driven, so all four thousand
questions were asked and all four thousand answers were thrown away by the very
next guard. `unused-signal`, the twin rule with the same oracle, has always
asked last, which is why it never showed up in a profile.
The fix is to ask the question where its twin asks it: last, of the handful of
declarations that would otherwise be reported. It is a pure reordering of a
conjunction of `continue` guards over a side-effect-free predicate, so the
findings and their order are unchanged.
### Before and after — the three §46 files
Wire time, `didOpen` → the hover behind it, three tries, warm store, workspace
scope, ms.
| File | lines | KB | 0.39.0 | 0.43.0 **before** | 0.43.0 **after** | factor |
|---|---:|---:|---|---|---|---:|
| `hw/ip/aes/rtl/aes.sv` | 326 | 14 | 8.6 / 9.5 / 7.8 | 8.1 / 5.9 / 10.1 | **4.3 / 1.8 / 2.3** | ~3× |
| `hw/ip/aes/rtl/aes_core.sv` | 1 145 | 49 | 55.8 / 65.7 / 44.4 | 56.2 / 54.0 / 48.0 | **5.9 / 6.9 / 6.3** | ~8× |
| `…/pinmux/rtl/pinmux_reg_top.sv` | 42 192 | 1 297 | 1 725.8 / 1 694.1 / 1 751.1 | 1 742.5 / 1 740.2 / 1 756.8 | **116.5 / 116.2 / 117.3** | ~15× |
The control — the identical hover issued straight after the first — is
0.09–0.20 ms for `aes.sv`, 0.12–0.19 for `aes_core.sv` and 0.46–0.60 for
`pinmux_reg_top.sv`, before and after alike. It is the open that costs, exactly
as take 3 said.
**0.39.0 measures the same as 0.43.0 before the fix.** This was never a
regression: `undriven-net` has asked in that order since it was written. Take
3's §8.4 comparison against take 2's 2–4 ms is therefore not a "something got
slower" story, and take 2's client — which no longer exists — most likely
measured a session whose scope did not switch the workspace rules on at all.
### Before and after — take 3's own §8.4 rows
Same method, whole-workspace scope. (Take 3 measured these at the *default*
scope after the `aes.sv` widen, where the census covers ~124 files rather than
3 976; that is why the "before" column here is worse than §8.4's 21/31/51 ms.
The two are the same defect at two census sizes.)
| File | KB | take 3 §8.4 (default scope) | **before** (workspace scope) | **after** |
|---|---:|---:|---|---|
| `hw/ip/hmac/rtl/hmac.sv` | 33 | 21.1 | 56.8 / 42.7 / 51.0 | **4.7 / 5.7 / 3.3** |
| `hw/ip/kmac/rtl/kmac.sv` | 53 | 31.1 | 69.3 / 72.1 / 70.6 | **7.9 / 5.3 / 8.8** |
| `hw/ip/spi_device/rtl/spi_device.sv` | 67 | 51.2 | 94.2 / 103.4 / 88.6 | **6.0 / 8.6 / 8.7** |
### The ≤ 5 ms contract, honestly
§46 asked for "`didOpen` returns to the loop in ≤ 5 ms for a 1 000-line file".
- For a **generated** 1 000-line buffer the release binary is under 2 ms. Met.
- For `aes_core.sv` — 1 145 lines but 49 KB of dense opentitan RTL, four times
the bytes per line of a generated file — the open is **5.9–6.9 ms**, of which
**3.0–4.4 ms is `Document::new`**: the lex, the tolerant parse, the semantic
analysis and the external resolution. The lint pass is now 1.3 ms of it.
So the contract is met per line and missed per byte on the densest real file
measured, and the remainder is the parse — which cannot be deferred without
breaking "the first request after the open is answered from up-to-date
state". Recorded as the limit rather than met by redefining the file.
### Behavioural equivalence, checked on the wire
A two-file scratch workspace built to exercise both oracle answers: `top.sv`
declares `lonely` (read, undriven, mentioned nowhere else) and `shared_name`
(read, undriven, but `force`d from `other.sv`). Both binaries publish exactly
```
undriven-net @1:7 `lonely` is read but never driven
```
and nothing about `shared_name` — the census still silences it. Byte-identical
between 0.39.0 and the fixed build.
## What was not done, and why
- **The open's diagnostics were not moved onto the change debounce.** §46 named
it as a likely shape and allowed the diagnostics to arrive a debounce later.
They still go out inside the `didOpen`, synchronously, because after the fix
the whole publish is 0.5–1.5 ms on a real RTL file and 24 ms on a
42 000-line one; deferring it would buy a millisecond and cost the guarantee
that an opened file is diagnosed before anything queued behind it is
answered. **There is no debounce on the open, and there is nothing new to
pin about when diagnostics arrive** — pinned anyway, by
`an_open_still_publishes_its_diagnostics_with_no_edit_behind_it`.
- **The buffer's re-index was not skipped on a content-hash match.** §46's
other suggested shape. It is not on the open path at all: a `didOpen` of a
file already in scope runs no index update — `widen_of` answers `Nothing` and
the index is untouched until a `didSave`. There was nothing to skip.
- **`WorkspaceIndex::files_mentioning` was not given an inverted index.** See
Handshakes: that ruling is recorded in its own doc comment and is not this
round's to reopen. It is now the largest single item left on the open path
for a 42 000-line file (`multiply-driven` at 8 ms is the next), but at
~117 ms total the file is no longer the round's problem.
- **The other 95 ms of `pinmux_reg_top.sv`'s open is the parse** (lex 41 ms,
parse 32 ms, analyze 12 ms). Not touched; it is the price of a 1.3 MB buffer
and it is 25× under the large-file threshold that would skip it.
## Status / TODO
- [x] Measure first: the driver, three files, three tries, both binaries, warm
store, workspace scope.
- [x] Profile the open path with temporary timings; the breakdown table above;
the timings removed (`git diff` is the rule plus the tests).
- [x] Fix the largest item: `undriven-net` asks the census last.
- [x] Wire-level timing test on a generated 2 000-line buffer.
- [x] Correctness pin: the first hover **and** the first definition after an
open see the buffer, not the disk.
- [x] Diagnostics-still-arrive pin, with the debounce question answered (there
is none).
- [x] Exact regression pin: the oracle is asked once per reported candidate.
- [x] The take-3 rows re-measured, before and after, in this README.
- [x] Gates: `cargo fmt -p lucisv_server -p vlog_linter`, `cargo clippy
--all-targets`, `cargo test --workspace`, `tools/corpus_check.sh`,
`editors/vscode/smoke.js` — all guarded.
- [ ] QA.
## Work log
### 2026-09-05 — dev (Fable 5.1)
- Built both binaries release: the tree at f795606, and `v0.39.0` in a scratch
worktree under the scratchpad (removed at the end, `git worktree remove`).
- Wrote `scratchpad/perf46/driver.py` to take 3's method and measured the three
§46 files, three tries each, on both binaries. Both binaries measured the
same, which is the first finding: **§8.4 is not a regression**.
- Instrumented the open path with temporary `eprintln!` timings at four levels
(the `didOpen` arm, `Document::new`'s six steps, `Server::publish` /
`diagnostics_of`, and `lint_with`'s per-rule loop), measured, and removed
every one of them. The breakdown table is above.
- Result: the lint pass is 75–95 % of the open and `undriven-net` is 90–97 % of
the lint pass, because it asked the workspace census once per declaration
ahead of its own local guards. `unused-signal`, the twin rule, has always
asked last.
- **The fix**: move `ctx.mentioned_elsewhere` in `UndrivenNet::check` below the
`usage` / `connected` / `driven` / `reads == 0` guards. Six lines moved, a
comment saying why. A pure reordering of `continue`s over a side-effect-free
predicate.
- Checked equivalence three ways: the unit suite, the corpus check (unmoved),
and a wire comparison of published diagnostics between the 0.39.0 binary and
the fixed one over a workspace built so that the census both fires and does
not. Identical.
- Tests: one exact regression pin in the rule (a counting oracle — the findings
alone cannot tell the two orders apart), and three wire-level tests in
`crates/lucisv_server/tests/e2e.rs` reusing the `Live` session helper that
was already there (`talk` writes a whole session before reading, so it cannot
time anything).
- **Deviation, stated plainly: the wire test's bound is 200 ms, not §46's
25 ms.** Two reasons, both measured. (1) `cargo test` builds unoptimized, and
one tolerant parse of a 2 000-line buffer costs ~53 ms there on its own —
stable to a millisecond across runs — so 25 ms is unreachable in a debug
build whatever the lint pass does; §46's 25 ms is a release figure, and the
release binary opens the same buffer in 2–4 ms. (2) The test cannot catch the
§46 defect at any bound: the census walk costs milliseconds over a forty-file
fixture (measured — 53 ms with the fix, 54 ms without it, and 63 ms with the
fixture grown to 400 files and per-file-unique names), and a fixture of
opentitan's four thousand files has no business in the suite. So the wire
test pins the contract — an open does not start doing something unbounded —
and the counting oracle test in `undriven_net.rs` is the exact pin for the
defect. Both are documented as such in their own doc comments.
- Scratch worktree removed; driver and scratch stores deleted; opentitan
`git status --porcelain` reports the three pre-existing files and nothing
else.
**Files touched** (the plan's expected set, plus one):
- `crates/vlog_linter/src/rules/undriven_net.rs` — the fix and its test.
- `crates/lucisv_server/tests/e2e.rs` — three wire tests and two helpers.
- `docs/features/didopen-cost/README.md` — this file.
- `TODO.md` — §46's four dev checkboxes and §44's `didOpen` line.
Nothing else. In particular **no server source file was changed**: the fix
turned out to be one rule in `vlog_linter`, not anything in the open path
itself, which is why `crates/lucisv_server/src/server/{notification,diagnostics,
index}.rs` and `state.rs` are untouched despite being where §46 expected the
work.
**Gate numbers**: `cargo fmt -p lucisv_server -p vlog_linter` clean; `cargo
clippy --all-targets` clean; `cargo test --workspace` **3 814 passed, 0
failed, 44 ignored** (baseline 3 810 — the four new tests);
`tools/corpus_check.sh` **814/820**, the same six failures and the same
`verification-error: none` / `crash: none`; `node editors/vscode/smoke.js
target/release/lucisv-server` OK. Every one guarded at `-m 8`; no guard kill,
and nothing came near the limit.
## Docs to apply at merge (lead)
### `docs/performance_take3.md` — annotate finding §8.4
Append to §8.4, after the "Reproduce" paragraph:
> **Fixed in 0.44.0 (TODO §46), and the finding understated it.** The delay is
> not the widen, the diagnostics plumbing or §42's lint-run construction: it is
> one rule. `undriven-net` asked the workspace census
> (`WorkspaceIndex::files_mentioning`, a walk over every indexed file) once per
> declaration in the buffer, *before* its own local guards had a chance to
> silence it — so a file with four thousand declarations asked four thousand
> questions and threw away four thousand answers. `unused-signal`, the twin
> rule with the same oracle, has always asked last; `undriven-net` now does
> too. At the whole-workspace scope, where the census covers 3 976 files rather
> than this section's ~124, the same three files measured 51 / 70 / 95 ms
> before and **4.6 / 7.3 / 7.8 ms** after, and opentitan's largest file,
> `hw/top_darjeeling/ip_autogen/pinmux/rtl/pinmux_reg_top.sv` (42 192 lines),
> went from **1 742 ms to 117 ms**. The take-2 comparison in this section
> should be read as "take 2's session probably did not have the workspace rules
> on", not as a regression: 0.39.0 measures the same as 0.43.0 on every cell.
> Breakdown and method in `docs/features/didopen-cost/README.md`.
### `docs/perf/README.md` — a new entry
> ### 2026-09-05 — the `didOpen` delay (TODO §46, 0.44.0)
>
> Take 3's §8.4 (a `didOpen` of an already-indexed file delaying the next
> request by 21–51 ms) measured and fixed. The breakdown, taken with temporary
> timings on a release build and re-taken after: the tolerant parse plus the
> semantic analysis is 1.3 / 3.0 / 91 ms for a 326- / 1 145- / 42 192-line
> opentitan file, and the lint pass was 4.9 / 54 / 1 654 ms — of which
> `undriven-net` alone was 4.4 / 52 / 1 608. The rule asked
> `WorkspaceIndex::files_mentioning` (a walk over all 3 976 indexed files) once
> per declaration, ahead of the local guards that silence almost all of them.
> Moved behind them, where `unused-signal` has always asked.
>
> Wire time, `didOpen` → the request behind it, workspace scope, warm store,
> three tries, M1 Max:
>
> | file | before | after |
> |---|---|---|
> | `aes.sv` (326 L) | 8.1 / 5.9 / 10.1 ms | 4.3 / 1.8 / 2.3 ms |
> | `aes_core.sv` (1 145 L) | 56.2 / 54.0 / 48.0 ms | 5.9 / 6.9 / 6.3 ms |
> | `hmac.sv` | 56.8 / 42.7 / 51.0 ms | 4.7 / 5.7 / 3.3 ms |
> | `kmac.sv` | 69.3 / 72.1 / 70.6 ms | 7.9 / 5.3 / 8.8 ms |
> | `spi_device.sv` | 94.2 / 103.4 / 88.6 ms | 6.0 / 8.6 / 8.7 ms |
> | `pinmux_reg_top.sv` (42 192 L) | 1 742 / 1 740 / 1 757 ms | 116.5 / 116.2 / 117.3 ms |
>
> The same cost was paid on **every keystroke flush**, not just on opens: the
> change debounce ends in the same `set_document` + `publish` pair.
> 0.39.0 measures the same as 0.43.0 everywhere in the "before" column, so this
> was never a regression — it is a rule that has been ordered that way since it
> was written. Published diagnostics are byte-identical before and after.
## QA log
### 2026-09-05 — QA (Sonnet)
**Verdict: PASS.** No HIGH or MEDIUM findings. Two LOW/informational notes
below; neither blocks the fix.
**What was verified, and how.**
1. **Code reading.** `git diff` of the three touched files
(`crates/vlog_linter/src/rules/undriven_net.rs`,
`crates/lucisv_server/tests/e2e.rs`, `TODO.md`) — a pure reordering of six
lines plus a comment in the rule, one new unit test asserting the oracle's
call count, and three new wire-level tests reusing the existing `Live`
helper. Confirmed `unused-signal` (`crates/vlog_linter/src/rules/
unused_signal.rs`) already asks its oracle last, behind
`mentioned_outside_declarations`, unchanged by this diff — the dev's "its
twin rule has always asked last" claim checks out by inspection.
`WorkspaceIndex::files_mentioning`/`files_naming_in_macros`
(`crates/vlog_semantic/src/workspace/index.rs:286-331`) confirmed
word-exact (binary search over a sorted per-file word list, no substring
matching) and `crates/vlog_semantic/src/words.rs` confirmed comments
contribute no words (only `Ident`/`SystemIdent` tokens and raw text inside
macros/directives/attributes) and macro-argument text is folded into the
*same* union census `files_mentioning` reads — so a macro-only mention is
expected to silence the rule exactly as a plain mention does.
2. **Equivalence, scratch workspace.** Built both binaries release
(`tools/guard.sh -m 8 -t 900 -- cargo build --release -p lucisv -p
lucisv_server`): the working tree at f795606-plus-uncommitted-diff, and
`v0.43.0` in a scratch `git worktree` (removed after). Wrote a five-file
scratch workspace (`top.sv`, `tb.sv`, `bound_over.sv`, `iface/bus_if.sv`,
`pkg/util_pkg.sv`) exercising every guard interaction the attack list
named: undriven+mentioned (silent), undriven+unmentioned (reported), driven
locally+mentioned (silent), undriven but hierarchically assigned from a
sibling testbench (silent), `force`d through a hierarchical path from a
sibling (silent), named only in a sibling's `bind`-ed override connection
(silent), a plain cross-file mention (silent), a name that is only a
*substring* of a longer identifier in a sibling (still **reported** — no
substring match), a name that appears in a sibling only inside a `//`
comment (still **reported** — comments aren't tokens), a name that appears
in a sibling only as a macro argument (silent — the raw-text fold), each
port direction, a net inside a `generate` block, a `logic` variable
(not a `wire`), an interface, and a package. `lucisv check --select
undriven-net .` and `--select unused-signal,undriven-net .` and a full
`check .`, text and `--output-format json`: **byte-identical** between the
two binaries in every case (6 violations found; `undriven_hier`,
`undriven_forced`, `undriven_bound`, `undriven_macro_arg`,
`undriven_mentioned`, `driven_and_mentioned` all correctly silent).
3. **Equivalence, opentitan (read-only).** `--select undriven-net,unused-signal
--output-format json` over `hw/ip/aes`, `hw/ip/hmac`, `hw/ip/spi_device`,
`hw/top_darjeeling/ip_autogen/pinmux`, sets compared (order does not
matter here since neither directory produced more than one finding):
**identical** in all four (`aes`: 1 finding both binaries, set-equal;
the other three: 0 findings, both). `git -C ~/repo/opentitan status
--porcelain` before and after: only the 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`).
4. **The counting-oracle unit test, reverted.** Not reverted in this tree.
Copied the dev's `undriven_net.rs` (with the fix and its new tests) into a
fresh scratch worktree at f795606, hand-reverted only the six-line reorder
(oracle back above the `usage`/`driven`/`connected`/`reads==0` guards,
dev's new test left as written), and ran
`cargo test -p vlog_linter --lib rules::undriven_net::`. Result: 16 of 17
pass; `the_project_is_asked_only_about_the_signals_that_would_be_reported`
**fails** — `assertion left == right failed: left: 10, right: 1` — exactly
what asking the oracle before the local guards predicts (all ten
signals in that fixture are `judgeable` with no initializer, so all ten
reach the pre-fix guard). Confirms the test is an exact regression pin,
not a tautology. Worktree removed after.
5. **Wire timing, independently reproduced.** The dev's driver is gone, so a
new one was written (`scratchpad/perf46_qa/driver.py`, this session's
scratchpad) to the same shape: framed JSON-RPC over stdio,
`initializationOptions.storagePath` for cache control, `workspace/
didChangeConfiguration` to the workspace scope, a `workspace/symbol`
barrier before timing, `didOpen`+`hover` in the same flush timed from send
to the hover response, warm store, three tries. M1 Max (10 cores, 64 GB),
`v0.43.0` (scratch worktree, removed after) vs the fixed tree's release
build:
| File | 0.43.0 | fixed | factor |
|---|---:|---:|---:|
| `aes.sv` | 4.83 / 4.81 / 4.88 ms | 1.49 / 1.35 / 1.31 ms | ~3.4× |
| `aes_core.sv` | 41.4 / 43.2 / 47.1 ms | 3.90 / 3.66 / 3.57 ms | ~11× |
| `pinmux_reg_top.sv` | 1825 / 1805 / 1806 ms | 104 / 108 / 107 ms | ~17× |
Independently-measured numbers differ from the README's own table (a
different driver, different process/JSON overhead, one machine) but the
**direction and rough magnitude match closely**, `pinmux_reg_top.sv`
especially (~17× here vs ~15× claimed, 104-108 ms here vs 116-117 ms
claimed). The control hover (issued right after) was 0.05-0.85 ms in every
case, before and after alike, confirming the open itself is what costs.
Also timed a `didChange` full-text flush on `aes_core.sv` (not just
`didOpen`): **42.6-43.5 ms (0.43.0) → 3.8-4.0 ms (fixed)** — confirms the
README's "the same cost was paid on every keystroke flush" claim; the
flush and the open cost the same because both end in the same
`set_document` + `publish` pair, as documented.
6. **`opentitan`'s 1.0 MiB index-scan cap, noted in passing (see finding
below).** Confirmed by `window/logMessage` output during warm-up:
`pinmux_reg_top.sv` under all three top-level variants is *skipped from
the workspace index scan* ("skipped (1.3 MiB > 1.0 MiB cap)"), which is
exactly take 3's "3976 indexed, 3 skipped" — not a new discovery, just
confirms the population this round's numbers describe. The currently
*open* buffer is unaffected by this cap (it goes through `Document::new`
on `didOpen` regardless of size), which is why the dev's own breakdown
table and this session's timings both see `pinmux_reg_top.sv` fully
parsed and linted when opened.
7. **e2e tests, 5×.** `tools/guard.sh -m 8 -t 300 -- cargo test -p
lucisv_server --test e2e -- --test-threads=1
opening_a_two_thousand_line_buffer_does_not_delay_the_request_behind_it
the_first_hover_after_an_open_sees_the_buffer_and_not_the_disk
an_open_still_publishes_its_diagnostics_with_no_edit_behind_it`: **3
passed, 0 failed, every one of 5 runs**, 0.65-0.70 s each. Stable.
8. **The 200 ms vs 25 ms question — my view for the lead.** The dev's
reasoning holds up under independent measurement, not just their own
instrumentation: (a) `target/debug/lucisv check` on a fresh 2000-line
generated buffer (no workspace) took ~40 ms wall-clock (steady state,
process spawn included) against `target/release/lucisv`'s ~10 ms on the
same buffer — a debug/release ratio in the same ballpark as the dev's
53 ms/2-4 ms claim for the parse alone; (b) a release-mode wire
measurement of a comparable 2000-line generated buffer (matching the
e2e test's own `generated_module` shape, 40 package neighbours, through
the *actual LSP wire* including Python subprocess/JSON overhead) came
back at 11.7-11.8 ms — comfortably under both 25 ms and 200 ms. This
triangulates the dev's claim: the 200 ms bound is not hiding a live
defect, it is debug-build parse cost that release mode does not pay, so
asking the debug-build wire test for 25 ms would be asking it to beat a
floor the interpreter/parser layer sets on its own. **200 ms is the
right bound for this test**; I would not lower it, and I would not read
"200 ms, not 25 ms" as the fix being incomplete.
9. **Gates, guarded, re-run independently.** `cargo clippy --all-targets`:
clean (0.12 s — fully cached, nothing to re-lint since the dev's own
clean run). `tools/guard.sh -m 8 -t 1800 -- cargo test --workspace`:
**3814 passed, 0 failed, 44 ignored** (summed across every crate's `test
result:` line) — matches the dev's claimed count exactly.
`tools/guard.sh -m 8 -t 1800 -- tools/corpus_check.sh`: **814/820
(99.3%)**, `verification-error: none`, `crash: none`, the same six parse
errors. `node editors/vscode/smoke.js target/release/lucisv-server`: OK
(20 messages). No guard kill on any run.
**Findings.**
- **LOW (informational, not a defect).** While this QA was running, the
shared working tree picked up further edits not part of the dev's
original diff: `CHANGELOG.md`, `editors/vscode/CHANGELOG.md`,
`editors/vscode/README.md` gained 0.44.0 release-note entries, and
`TODO.md` gained the §46 dev-checkbox ticks (matching this README's
Status/TODO) plus a new §47 planning section, beyond what this QA read at
the start of its session. None of this touches the rule, the tests, or
this README's content above this log entry, and none of it changed any
number this QA independently re-measured — `crates/vlog_linter/src/
rules/undriven_net.rs` and `crates/lucisv_server/tests/e2e.rs` are
byte-identical to what was diffed at the start of this session (71 and
204 changed lines respectively, matching exactly). Flagged so the lead
knows the tree was not exclusively QA's for the whole session; not
something this QA touched or reverted.
- **LOW (context, not a defect).** `WorkspaceIndex`'s workspace-scan size cap
(1.0 MiB) skips all three `pinmux_reg_top.sv` variants from the persistent
cross-file census entirely. This is pre-existing and matches take 3's own
"3976 indexed, 3 skipped" count — not introduced or affected by this
change — but worth restating next to this round's numbers since a reader
could otherwise wonder why a 1.3 MB file's own words never reach another
file's `mentioned_elsewhere` answer. The *open* buffer's own analysis is
unaffected by the cap, which is why the timings above still show the full
parse+lint cost when the file itself is opened.
**Equivalence result:** identical findings, identical order, on the scratch
fixture (text and JSON), on `lucisv check .` with no `--select`, and on all
four opentitan directories — 0.43.0 and the fixed tree agree everywhere
tested.
**Verdict: PASS.**
## Review
**2026-09-05 — lead.** Accepted; ships in 0.44.0 with §45. The plan's three
guesses were wrong and the dev's first step — measure — is what found the
real cause: one rule asking the whole-workspace census once per declaration
before its local guards. The fix is six reordered lines over a
side-effect-free predicate, with equivalence shown three ways (the suite,
the corpus, and QA's crafted workspace covering every guard interaction
plus four opentitan IPs byte-identical between 0.43.0 and the fix). 15× on
the largest file, 10× on typical IPs, on every keystroke as well as every
open. The 200 ms wire-test bound is ruled correct: it pins the contract in
a debug build whose parse alone is ~53 ms, the exact regression pin is the
counting-oracle unit test (verified to fail on a revert), and QA's release
measurement of the same buffer (11.7 ms) shows the plan's 25 ms was a
release number. No debounce was added and none is needed at 0.5–1.5 ms per
publish. (The README lacked its Review section; added here.)