0.52.0 review fixes (§62): F1 — one directory-identity tracker shared by the split scan's two walks, a pre-check that takes the single canonical walk when an alias sorts before the open folder, a conflict found by the remaining walk turned into one ordinary rescan, the open-buffer alias gate on both walks and only on same-named files (stats 0 on opentitan again), nine alias fixtures agreeing across startup, rescan and restart; F2/F3 — the load probe primes a warm store untimed and stamps scan completion from the scan's own end event
ci / checks (push) Successful in 1m19s
ci / corpus (push) Successful in 46s

This commit is contained in:
lucio committed 2026-09-09 17:39:23 -05:00
1 parent faf890d9f0
commit 41945912a3
17 files changed
+1964 -83

No files matched your search

+784
View File
@@ -102,6 +102,54 @@ below-walk, by `a_walk_that_starts_below_a_root_still_obeys_that_roots_gitignore
and `a_negation_below_the_root_still_wins_over_the_root_rule`, both of which
assert equality with the whole-root walk restricted to that subtree.
#### Amended 2026-09-09 (F1) — a third entry, and the identity the split owes
The two entries above promised the same *filters* across the split and said
nothing about **directory identity**, which is the other half of what a walk
of the root decides: it enters each identity once and reports its files under
the first spelling that reaches it (`docs/features/walk-cycles/README.md`).
Two walks with two visited sets do not have that between them, so a symlinked
directory reached by both was indexed twice — the review's finding F1
(`docs/performance_052_review.md`). The identity is now a value the caller
owns and hands to both walks:
```rust
/// Every directory identity a walk has entered, and the path it entered
/// each one by. Shared between two walks, they behave as one.
pub struct DirectoryTracker { /* … */ }
impl DirectoryTracker {
pub fn new() -> Self;
/// Record `dir`, and say whether it is new, already seen, or already
/// seen under a path this one sorts *before* — which is the root walk's
/// own choice, and so a disagreement about spelling.
pub fn enter(&mut self, dir: &Path) -> DirStatus;
/// Whether any `enter` reported `PrecedenceConflict`.
pub fn has_conflict(&self) -> bool;
}
pub enum DirStatus { EnteredFirstTime, AlreadyVisited, PrecedenceConflict { recorded: PathBuf } }
pub type DirId = /* (dev, ino) on unix, the canonical path elsewhere */;
pub fn dir_id(path: &Path) -> Option<DirId>;
pub fn collect_files_tracked(input, exclude, gitignore, tracker, found, warn) -> Result<(), String>;
pub fn collect_files_below_tracked(root, input, exclude, gitignore, tracker, found, warn)
-> Result<(), String>;
```
Still additive: `collect_files_with` and `collect_files_below` keep their
signatures and are two-line wrappers that make a tracker of their own, so a
single walk behaves exactly as it always did — `enter` is the same
insert-if-absent test, with a second answer for the caller that asked for one.
**What this promises the server:** one tracker across the neighbourhood walk
and the remaining walk means one directory identity entered once between them,
so no file is discovered under two spellings and the union of the two walks is
the set a single root walk yields. Where the remaining walk *does* reach an
identity by a path the root walk would have preferred, `has_conflict` says so
and the server rescans (below); nothing is duplicated either way.
### `lucisv_server` internals
- **`crate::state::discover`** is a new child module of `crate::state`: `Found`,
@@ -143,6 +191,19 @@ assert equality with the whole-root walk restricted to that subtree.
### Requests for the lead (`docs/topo.md` is not edited by this lane)
0. **2026-09-09, F1.** The `lucisv_server ──▶ lucisv_core` walk row already
carries the tracker (another agent amended it before this lane started; the
row is not this lane's file and was left alone). Two sentences are still
owed there, and the lead owns them: **(a)** what the tracker promises is
that the two walks of one scan enter each directory identity once *between*
them, so a `lucisv_core` change that gave `enter` a different answer for a
second spelling would silently un-fix F1; **(b)** the tracker's
`has_conflict` is a **server-visible** outcome now — `state/mod.rs` reads it,
`Scan::wants_rescan` reports it and `server/index.rs` turns it into one
ordinary rescan — so it is a handshake and not an internal detail. Nothing
outside `lucisv_server` calls the tracked entries; the CLI still calls
`collect_files`.
1. `lucisv_server ──▶ lucisv_core` (walk): **`collect_files_with` and
`collect_files_below`**, both additive, `collect_files` unchanged and now a
wrapper. The server's cap reads the walk's own `metadata`; its
@@ -596,6 +657,133 @@ guarded `cargo test --workspace` green.
`state/mod.rs` **1 069 → 978**: it did not grow, and the new logic went into a
new module as the brief required.
### 2026-09-09 — dev (Opus), F1 finished
**F1 is closed.** The split discovery keeps the walk's directory identity
across both halves, the one case it cannot lead with falls back to the single
canonical walk before the head is walked, and the one case nothing can see
ahead of time converges on an ordinary rescan. Nothing about the ordering or
the first-answer numbers moved.
**What the fix is, in four parts.**
1. **One tracker, two walks.** `DirectoryTracker` (above, Handshakes) is made
in `first_scope`, filled by `neighbourhood_files`, carried on
`PendingDiscovery`, and handed to the remaining walk by `rest_of_scope`. A
directory identity is entered once between them, so the two halves cannot
report one directory's files under two spellings and the path-only `seen`
set no longer has to recognise something a path cannot.
2. **A pre-check, and a fallback that discards.** `has_preceding_alias` asks,
*before* the head is walked, whether any directory between the open
buffer's folder and its root holds a symlink to that folder or one of its
ancestors under a name a root walk reaches first (`a_alias -> z_real`).
If it does, the head would spell those files a way no other scan ever
does, so the scan resolves its whole scope in one walk instead. The
`HEAD_WALK_MAX` fallback now **discards** the head and does the same: it
used to union the head with an independently-discovered rest, which was
the bug wearing a second hat.
3. **A conflict is acted on.** An alias outside that ancestor chain —
`other/link -> z_real`, `other` sorting first — is invisible to any
pre-check: the head leads with `z_real` and only the remaining walk finds
out. The tracker refuses to enter the directory a second time (so nothing
is duplicated and every answer the startup gives is right), reports
`has_conflict`, and `scan_once` sets `rescan_wanted` on the way out. That
is the flag a save or a settings change sets, so the canonical walk runs
when this scan ends, under `must_wait`, and the spelling converges there.
Exactly one rescan can come of it: only a session's *first* scan splits.
The `--verbose` count line says `conflict=1 rescan_requested=1`.
4. **An open buffer's aliases.** A buffer opened as `z_real/tb.sv` whose walk
spelling is `a_alias/tb.sv` used to put both in the index — one module
twice, and a `tb` that could not be renamed. `overlay_buffers` now drops a
walked file whose `(dev, ino)` is an open buffer's, in **one** place
rather than two.
**And it costs nothing.** The alias test is gated on the file's *name*: a
directory alias cannot rename a file, so a walked file whose name no open
buffer shares is never stat'd. Measured on opentitan (`counts` line,
`stats=`): **0** on every workspace cell with 0 or 1 open buffers, cold and
warm — the 3 976-`metadata` regression the first draft of this fix had is
gone — and **58** in the 2-buffer cell whose head holds 58 files named
`tb.sv`/`aes.sv`, which is the bound the gate promises and about 0.06 ms. A
file-level symlink under a *different* name is out of scope and stays two
files, as it is everywhere else in this server.
**The pre-check's own cost, measured.** It reads the four directories between
`hw/ip/aes/dv` and the root and stats only the entries `read_dir` already
called symlinks, so an ordinary tree costs no `metadata` at all. On opentitan
it is the unattributed remainder of `discovery` (`discovery` minus
`config+walk+filelist+sort+cap+buffers`): **0.10 → 0.27 ms**, i.e. ~0.17 ms,
once per session.
**Paired against 0.52.0** (both release servers built here; opentitan
`0098135`, three known modified files unchanged; guard 8 GiB/1 800 s
throughout; load 4.1–6.8):
| Cell | 0.52.0 | F1 | |
|---|---:|---:|---|
| Workspace scan, cold | 2 878.9 | 2 886.0 | +0.2 % |
| Workspace scan, warm | 1 044.2 | 1 039.6 | −0.4 % |
| First useful definition, cold | 82.0 | 81.9 | −0.1 % |
| First useful definition, warm | 115.6 | 117.5 | +1.6 % |
| `discovery`, workspace warm, 1 buffer | 179.2 | 162.2 | −9 % |
| `stats`, same cell | 0 | **0** | |
| Settle, 1 / 10 / 100 open buffers | 1 100 / 1 098 / 1 251 | 1 134 / 1 074 / 1 218 | |
| Warm idle RSS, KiB | 427 856 | 426 048 | |
Every row is within noise of 0.52.0 and of the round's own targets (~80/115 ms
first answer, ~1.0 s warm settle, ~155 ms discovery, ~1 170 ms at 100
buffers). Rows in `~/.cache/lucisv-perf/f1/results.jsonl`.
**Tests.** The seven fixtures the first draft added are refactored behind one
helper — `startup_rescan_and_restart_agree`, which indexes the tree, asks the
same four questions (index paths, definition targets, prepareRename, and the
open buffer's pulled diagnostics by sentence and range) of the startup scan,
of a whole rescan a watched-file burst triggers, and of a fresh session, and
asserts the three agree — so each fixture is its shape and its
own claims and nothing else. Nine of them, all `#[cfg(unix)]`: alias sorting
before its target, alias sorting after, several aliases of one directory, an
alias of an *ancestor* of the open folder, an ancestor cycle
(`sub/up -> ..`) with a file at the root the head would otherwise spell
`sub/up/top.sv`, an ignored alias, an open unsaved buffer, a genuine
duplicate declaration (still refused, same sentence, at startup and after the
rescan), and the sibling alias — which asserts the trace's
`conflict=1 rescan_requested=1`, that exactly two scans ran and the second
asked for nothing, that the per-file log names one `child.sv` per scan under
the head's spelling then the root walk's, and that the index after the rescan
is what a rescan and a restart also give. Every fixture needs
`index.scopeDepth: 0` to reach the split at all — the default raise of 2 puts
the folder *at* the root, where the split is refused: that is the review's own
reproduction setting, and `the_whole_workspace_flat()` is it.
**Gates.** `cargo fmt` clean; guarded `cargo clippy --workspace --all-targets
--locked -- -D warnings` clean, no new `#[allow]`; guarded
`cargo test --workspace --locked` **4 385 passed, 0 failed, 45 ignored**
(4 374 at 0.52.0, + 2 `DirectoryTracker` unit tests in `lucisv_core`, + 9
alias fixtures in place of the first draft's 7).
**File sizes** (non-blank, non-comment, before `mod tests`):
`state/discover.rs` **406** (329 at 0.52.0), `state/scan.rs` 135,
`scan_trace.rs` 326, `server/index.rs` 226, `lucisv_core/src/walk.rs` 332 —
all under 600. `state/mod.rs` **980 → 980**: it did not grow. The conflict
rides out on `Scan::land_discovery`, which the one caller already called, and
lives on the scan's own trace counter beside `publishes` rather than as a
second copy of the same fact.
**Deviation from the plan.** Step 1.1 names `DirectoryTracker::is_visited` /
`record_or_check` and a `WalkIdentity` struct; the shipped shape is `enter` →
`DirStatus` and `has_conflict`, because the caller needs to tell "already
seen" from "already seen under a path this one would have beaten", and a
borrow of the recorded path is not something a walk can hold while walking.
The plan's fallback is unchanged; the conflict follow-through (part 3 above)
is beyond the plan, and is what makes startup and rescan agree in the case no
pre-check can see.
**Assumption recorded.** A buffer opened *mid-scan*, after the scope was
resolved, is not put through the alias test — its disk copy is already in the
work list under whatever spelling the walk gave it. That is 0.52.0's
behaviour and 0.51.0's, it is a `Scan::reorder`/`open_next` question rather
than a discovery one, and no fixture here changes it.
## QA log
### 2026-09-08 — QA (Sonnet), §61.3
@@ -793,6 +981,561 @@ store open). Recommend also applying the `HEAD_WALK_MAX` test I built (this
QA log, above) as a topo-neutral addition to `state/mod.rs`'s existing test
module when the lane next touches that file.
### 2026-09-09 — independent 0.52.0 review: directory-alias regression
**Finding F1 (P2), open.** The split discovery does not preserve the ordinary
walk's directory-identity deduplication across its independent head/root
walks. A scratch workspace with `a_alias -> z_real`, a `child` module and a
testbench in `z_real`, workspace scope and depth 0, produces two definition
targets at startup in 0.52.0 versus one in 0.51.0. `prepareRename` then falsely
refuses an ambiguous `child`. A whole rescan with unchanged source restores
one target and accepts prepareRename. Initial lookup comparison: 3/3 sessions
per version; full startup/rescan lifecycle: another 3/3 per version.
The issue is the path-only `seen` set in `state/discover.rs::first_scope`
combined with independent `Walk.visited` sets, not ignore-rule inheritance.
The `HEAD_WALK_MAX` fallback also unions the independently discovered head.
No implementation was changed. [Full review, reproduction and repair gates](../../performance_052_review.md#f1--p2--split-startup-discovery-duplicates-modules-behind-directory-aliases),
[raw evidence](../../perf/review-052-20260909/README.md).
### 2026-09-09 — QA (Sonnet), TODO §62.1: REWORK — the rest-of-scope walk is not gated
**Verdict: REWORK.** F1's own fix is real and reproduces cleanly for every
shape the dev's nine fixtures name, but the open-buffer alias gate
(`Aliased`/`overlay_buffers`, Handshakes part 4) is wired into only *one*
of the two places a split scan's files come from, and a crafted attack
beyond the nine fixtures gets a false ambiguous-rename refusal through the
gap. Findings below; nothing else broke.
**Gates, guarded, main tree.** `cargo fmt --all -- --check` clean.
`cargo clippy --all-targets --locked -- -D warnings` clean, no new
`#[allow]`. `cargo test --workspace --locked`: **4 385 passed, 0 failed, 45
ignored** — exactly the dev's claimed 4 374 (0.52.0) + 2 tracker unit tests
+ 9 alias fixtures; I did not re-run the suite against a fresh 3ceba21
clone myself, but the independent review (`docs/performance_052_review.md`,
"Independent validation") already recorded 4 374/0/45 at that commit, so
the arithmetic is corroborated rather than assumed. Production line counts
(non-blank/non-comment, before `mod tests`): `discover.rs` **405** (claimed
406), `walk.rs` **332** (claimed 332, exact), `state/mod.rs` **980 → 980**
(exact, net zero as claimed), `scan.rs` **134** (claimed 135) — all within
one line of the dev's count and all comfortably under the 600 mark; no
finding.
**The review's own reproduction, on both binaries.** Built candidate
(`cargo build --release -p lucisv_server`, main tree) and 0.52.0 (fresh
`git archive v0.52.0` into my scratchpad, built there — not the review's
leftover `/tmp` binary). Ran an adapted `symlink_lifecycle.py` (the
review's own fixture, `a_alias -> z_real`, workspace/depth-0, `z_real/
tb.sv` open) against both, 3 trials each:
| | 0.52.0 | candidate |
|---|---|---|
| Definition after startup | 2 targets (`a_alias` + `z_real`), 3/3 | 1 target (`a_alias`), 3/3 |
| prepareRename after startup | refused, "declared in more than one indexed file", 3/3 | accepted, 3/3 |
| After the watched-file rescan | 1 target, accepted, 3/3 | 1 target, accepted, 3/3 |
Matches the review's table exactly — the finding was real, and the
candidate fixes the reproduction as claimed.
**The matrix (a)–(i), attacked in a fresh clone (`git archive HEAD` +
`git apply` of the working-tree diff) under my scratchpad, never the dev's
tree.** Nine new fixtures appended to a scratch copy of `server/tests/
startup.rs` (not shipped; QA-only):
- (a) alias to a directory **outside** the workspace root: today's
behaviour is to follow it (the external `child.sv` is indexed and
becomes the definition target) — pinned stable across startup/rescan/
restart, not asserted as correct either way, since the spec is silent on
it.
- (b) alias to the workspace root itself from inside (`sub/root_link ->
..`): one copy of every file, same shape as the shipped ancestor-cycle
fixture — ok.
- (c) two buffers, one in an aliased folder, one not: both resolve/rename
correctly — ok.
- (d) alias created **after** startup, converged by a watched-file rescan:
one copy, one target, renamable — ok.
- (e) a broken symlink beside the open folder: no crash, contributes no
file — ok. (My first attempt at this fixture named its own tree
`qadangling`, so a bare substring check on `"dangling"` matched the tree's
own temp-dir name and produced a false failure; renamed the fixture and
confirmed — a QA harness bug, not a product one, fixed in my own scratch
copy only.)
- (f) **FAILS.** A *file*-level symlink sharing an open buffer's basename,
placed outside the buffer's own head-walked folder
(`alias_dir/tb.sv -> ../z_real/tb.sv`, buffer open at `z_real/tb.sv`,
workspace/depth-0 so the scan splits): the index ends up with **two**
`tb.sv` entries (`alias_dir/tb.sv` and `z_real/tb.sv`) and
`textDocument/prepareRename` on `tb` is refused: `"lucisv: \`tb\` is
declared in more than one indexed file"`. This is a false positive of
exactly the shape F1 exists to close, and it sits inside F1's own stated
scope — the README's Handshakes text says the open-buffer alias check
"drops a walked file whose `(dev, ino)` is an open buffer's, in **one
place** rather than two" and stats only same-named files. Root cause: the
`Aliased` gate lives only in `Workspace::overlay_buffers`
(`crates/lucisv_server/src/state/discover.rs:194`), and `overlay_buffers`
is called from exactly two places — `collect_sources` (the non-split,
whole-workspace path) and `first_scope`'s **head**-only branch (line
~555). `Workspace::rest_of_scope`
(`crates/lucisv_server/src/state/discover.rs`, the function added by this
round for the split's second walk) filters its output only against the
cap and the head's own `seen` path set — never against `Aliased` — so a
same-named file-level alias discovered by the *remaining* walk (i.e.
anywhere outside the buffer's own immediate folder, which on a real
workspace is nearly everything) is not deduplicated at all.
`Scan::land_discovery`/`PendingDiscovery` carry no such check either. The
dev's own measured "58" (`stats`, the 2-buffer opentitan cell) is
consistent with this: I reproduced `stats=58` on that exact cell
(`scanprofile`, "workspace warm, 1 open buffer" — 2 buffers total once
the harness's always-open default is counted) and it is generated
entirely inside the head-only `overlay_buffers` call, so it is not
evidence the gate covers the rest of the workspace — it demonstrates the
opposite once the code path is traced. Impact: not merely a spurious
refusal — since the "walked" copy is read fresh from disk while the
buffer's overlay text can differ (unsaved edits), a workspace with such
an alias can silently carry two *different* bodies for what the editor
believes is one open file, which is a masked-duplication risk squarely
inside CLAUDE.md's "never corrupt code" invariant's neighbourhood, not
just a UX refusal.
- (g) file-level symlink under a **different** name: stays two files,
consistent across startup/rescan/restart — matches the documented
out-of-scope behaviour — ok.
- (h) genuine duplicates behind an alias of a *different* real directory
(`a/child.sv`, `b/child.sv`, `link_a -> a`): still refused, ambiguous,
identically before and after a rescan — the tracker does not collapse
two genuinely different directory identities just because one of them is
reached through an alias — ok.
- (i) the sibling-alias rescan's follow-through: confirmed by code reading
(`server/index.rs::scan_once`, `self.rescan_wanted |= scan.wants_rescan()`
runs *after* the scan-stepping loop, so `must_wait()` — which reads
`rescan_wanted` — is already true for anything arriving between this
scan's end and the rescan's end) and by a wire test that drains the
startup scan and its self-triggered rescan fully, then asserts
`!rescan_wanted && !must_wait()` and that the settled answer is the
*rescanned* (canonical) spelling, never the head's — ok. I did not build
a harness that injects a request mid-rescan (the staged test harness has
no hook to pause between the two scans), so this is the outcome
`must_wait` protects, confirmed, rather than an interleaved-request
reproduction.
**Stats and the gate sabotage.** `scanprofile` on opentitan, candidate,
`--tries 1`: `stats=0` at 0 extra buffers (workspace cold/warm, default
scope, depth0) and at 10/100 extra buffers; `stats=58` at "1 open buffer"
(2 buffers total, matching the dev's reported cell and number exactly);
`discovery` 150–197 ms depending on cell, within the dev's ~162 ms claim.
Sabotage: commented out the name-check in `Aliased::speaks_for`
(`state/discover.rs:149-152`) in my scratch clone, rebuilt release, reran
the same cells: `stats` jumped to **123** (0/10-extra-buffer default-scope
cells), **3974/3970** (1/10-buffer workspace cells) — confirming the name
gate is exactly what keeps the head-scope cost near zero when it is
wired in. (This sabotage does not contradict finding (f) above — it shows
the gate works *where it is called*, which is the head only.)
**The conflict follow-through and its sabotage.** Confirmed by reading
`server/index.rs::scan_once` (line ~311): `self.rescan_wanted |=
scan.wants_rescan()` sits after the scan-stepping `loop { … }`, so the
held first answer is not delayed by it. Sabotage: commented out that one
line in my scratch clone, rebuilt, reran the shipped
`an_alias_beside_the_open_folder_indexes_once_and_asks_for_one_rescan`
fixture: it fails as expected — `left: 1, right: 2` ("the startup scan and
the one rescan it asked for"), i.e. no follow-up rescan ever runs even
though `conflict=1 rescan_requested=1` is recorded on the trace. Restored
both sabotaged files immediately after each experiment; diffed clean
against the working tree afterwards.
**Controls (§61/P4), candidate vs a freshly-built 0.52.0, both from
scratch clones, `scanwait`, 3 tries each on opentitan:** first useful
definition cold 80.4 / 81.2 ms median (candidate/0.52.0, essentially
equal); warm 115.9 / 115.3 ms; the answering session's own scan cold
2732.7 / 2697.6 ms (+1.3%); warm 1036.8 / 996.7 ms (+4.0%). All within the
±10% band; no regression.
**Traceability.** Checked 12 numbers from the dev's table and prose
against `~/.cache/lucisv-perf/f1/results.jsonl`: workspace scan cold/warm
2878.9/2886.0 and 1044.2/1039.6, first useful answer cold/warm samples
around 81.9–82.3 and 115.6–117.6, `discovery` 179.2/162.2 (`stages.
discovery`/`stages.walk`), the 1/10/100-buffer settle triple 1100/1098/1251
(0.52.0) and 1134/1074/1218 (f1), and warm idle RSS 427856/426048 — every
one is present verbatim in that file, against the row its label says.
**Topo.** The two sentences the dev's Handshakes section said were owed to
the lead (the tracker's cross-walk promise, and `has_conflict` being
server-visible) are **already in `docs/topo.md`**'s `lucisv_server ──▶
lucisv_core` row as of this diff — nothing outstanding there. What *is*
now owed, given finding (f): a sentence (or a Handshakes amendment) saying
the open-buffer alias gate's actual scope is the split's head only, not
the whole scan, until `rest_of_scope`/`land_discovery` are given the same
check — otherwise the topo row's promise ("no file is discovered under two
spellings") overstates what the shipped code does for file-level aliases
outside the head.
**opentitan**: `git -C .../opentitan status --porcelain` checked before,
during and after every phase — always exactly the three pre-existing
modified files. **Guard**: every cargo/test/build/bench invocation (main
tree and both scratch clones) ran through `tools/guard.sh -m 8 -t …`; no
kills. No lingering background processes or poll loops left running at
session end. Fixed directly (no code changes needed): none — finding (f)
is a design gap, not a small unambiguous fix, and is left for the dev.
**TODO §62.1's QA line is left unchecked.** Recommend: extend the
`Aliased` check (or an equivalent identity filter) to `rest_of_scope`'s
output before it lands in the scan, add fixture (f) above to the shipped
suite, and re-run this QA pass.
### 2026-09-09 — QA (Sonnet), TODO §62.1 re-verification: REWORK — a newly-opened buffer's own file can vanish from the index
**Verdict: REWORK.** The lead's fix for finding (f) is itself correct — the
sibling-alias/file-symlink matrix is green, sabotage confirms the gate is
load-bearing, and the specific reproduction QA's last pass filed is closed.
But the fix as shipped introduces a **new, more severe** regression: the
same `Aliased` check that now runs in `Workspace::rest_of_scope` can drop a
just-opened buffer's own real file from the scan entirely — not duplicate
it, not misspell it, **omit it** — so that module is silently absent from
the index for the rest of that scan. This is closer to CLAUDE.md's "never
corrupt code" neighbourhood than finding (f) was: (f) produced a spurious
*second* copy; this produces *zero* copies.
**How it was found.** Guarded `cargo test --workspace --locked` in a fresh
clone (`git archive HEAD` at `3ceba21` + `git apply` of the working-tree
diff, under my scratchpad, never the dev's tree) is **not green**:
```
failures:
state::tests::a_file_opened_mid_scan_lengthens_the_neighbourhood_it_jumps_into
test result: FAILED. 1663 passed; 1 failed; 36 ignored; 0 measured
```
This is a **pre-existing, dev-authored** fixture (`state/mod.rs:4062`,
untouched by this diff — it has nothing to do with aliases) that opens a
second buffer mid-scan and checks the neighbourhood segment length. I
confirmed it is not flaky: 5/5 deterministic failures in the diffed clone,
5/5 deterministic passes in an undiffed clone built from the same `3ceba21`
snapshot with no diff applied. It is a genuine regression of this round's
change, not noise.
**Root cause, isolated by instrumentation** (temporary `eprintln!`s in my
scratch clone only, reverted immediately after — diffed clean against the
shipped patch both times, confirmed byte-identical). The failing fixture
opens `ip/aes/dv/tb/tb.sv`, steps one file, then opens
`ip/uart/rtl/uart.sv` and calls `Workspace::open_next`
(`state/mod.rs:1544`), which unconditionally calls `discover_the_rest`
(`state/mod.rs:900`) before reordering — this part is unchanged by the
current diff and is correct. `discover_the_rest` calls the new
`rest_of_scope(&mut pending, …)` (`state/discover.rs:652`). Printing
`scan.remaining()` right after `open_next` returns: **`uart.sv` is not in
the work list at all** — 10 files instead of the 11 the tree holds beyond
the one already stepped. A second probe confirmed the consequence directly:
after `finish_scan`, `ws.index().units("uart_pkg").len()` is **0** — the
buffer's own module was never indexed by this scan.
The mechanism: `rest_of_scope`'s new gate (`state/discover.rs:682`,
`if seen.contains(&found.path) || aliased.speaks_for(&found.path, &mut
stats)`) builds `aliased` from **every currently-open buffer's path**
(`spoken_for`, line ~672) at the moment the remaining walk runs — which is
*after* `uart.sv` was opened. When the walk discovers `uart.sv` for the
first time, `Aliased::speaks_for` matches it by name ("uart.sv") and then
by identity (`dir_id` — trivially equal, since it's checking the file
against *itself*) and reports it "spoken for", so it is dropped from
`files` and never reaches `scan.work`. `rest_of_scope` has **no equivalent**
of `overlay_buffers`'s own re-add step (`state/discover.rs:246`,
`files.retain(|p| p != &path); … files.push(path)`), which is what makes
the identical-looking check safe in `overlay_buffers` (line 216) but unsafe
here: `overlay_buffers` drops a spoken-for path and then unconditionally
puts every open buffer's path back at the end; `rest_of_scope` only ever
drops. Before this round's fix, `rest_of_scope` had no `Aliased` check at
all, so `uart.sv` passed through untouched, landed in `scan.work`, and was
read fresh off disk when stepped (correct, if by luck rather than by the
buffer's own text) — matching 0.52.0. This round's extension of the gate to
`rest_of_scope` is what turned that "correct by luck" path into a silent
drop, precisely because `Aliased::speaks_for` cannot distinguish "a second
spelling of a file already accounted for" (the case it exists to catch)
from "the first and only discovery of a buffer that was opened after the
head walk ran" (a case its own docstring assumes cannot happen —
`rest_of_scope`'s comment says "a buffer's path is in `pending.seen`", true
only when nothing opened between `first_scope` and `discover_the_rest`,
which is exactly what `Workspace::open_next` exists to falsify).
**Not an isolated fixture problem.** None of the round's own 9+2 alias
fixtures (nor my (j)/(k) below) exercise a `didOpen` arriving *during* a
still-pending split discovery, so none of them could have caught this. The
two existing mid-scan-`didOpen` fixtures
(`a_did_open_that_beats_the_answer_is_folded_into_the_one_scan_and_indexed_
first`, `a_did_open_answered_mid_scan_pulls_its_folder_in_front_of_the_
request_behind_it`) check that a request is answered and that reordering
happens; neither asserts the newly-opened file's own module actually lands
in the finished index, which is why the workspace suite's *only* red light
is the one unrelated fixture that happens to count work-list length.
**Left for the dev, not redesigned by QA.** Two directions, either owed a
decision: (a) minimal — in `rest_of_scope`, an exact path match against
`spoken_for` (the buffer's own real path, first discovery) must not be
treated as "already handled" the way a *different*-path same-identity match
is; it needs to still land in `scan.work` (`overlay_buffers` already draws
this distinction at line 216 before ever consulting `Aliased`, `rest_of_
scope` does not). (b) more complete — a buffer opened after the head walk
has no entry in `scan.buffered`, so even a naive fix that re-includes such a
path indexes it by re-reading disk rather than the buffer's own text
(harmless in this fixture, which has no unsaved edit, but a live regression
of `docs/features/index-scope/README.md`'s "the buffer's text overrides
disk" rule the moment there is one) — `discover_the_rest`/`land_discovery`
have no path today to feed a newly-discovered buffer's text into
`scan.buffered`.
**Sabotage of the fix under review — still holds.** Removed the
`aliased.speaks_for(&found.path, &mut stats)` half of `state/
discover.rs:682` (leaving only `seen.contains`), rebuilt, reran the shipped
fixture `a_same_named_file_symlink_outside_the_head_is_not_a_second_copy_
of_the_buffer`: **fails** as required — `left` (startup) shows three files
including `alias_dir/tb.sv`, `right` (rescan) shows two — the startup/
rescan disagreement finding (f) named exactly. Restored; diffed byte-
identical against the shipped patch afterwards.
**The matrix (a)–(k), fresh clone, same method as last time.** All of (a)
through (i) reconfirmed passing (33 `startup::` tests green as a block,
`--test-threads=4`). Two new fixtures added to a scratch copy of `server/
tests/startup.rs` (QA-only, not shipped):
- **(j)** a same-named file symlink *inside* the head folder
(`z_real/sub/tb.sv -> ../tb.sv`, buffer open at `z_real/tb.sv`) —
exercises the **head's own** gate (`overlay_buffers`, `state/
discover.rs:223`) rather than `rest_of_scope`'s: passes, one `tb.sv`, one
target, renamable.
- **(k)** a same-named but genuinely *different* file outside the head
(`other/tb.sv`, declaring `othertb`, a different inode) — passes: two
distinct `tb.sv` paths indexed, `other/tb.sv` present, one `child`
target. Confirms `speaks_for`'s identity check (not just the name check)
is what keeps a real second file from being dropped — the finding above
is specifically about a *self*-match (buffer vs. its own first-time
discovery), not a false positive on an unrelated same-named file.
Both new fixtures pass; the alias-specific behaviour this round targets is
correct. The regression is orthogonal to the alias matrix and sits in the
interaction with mid-scan `didOpen`.
**Stats — measured, and the "still 0" expectation does not hold.**
`scanprofile` on opentitan, candidate build (`cargo build --release
--locked -p lucisv_server`), `--tries 1`, guarded:
| cell (harness label) | total open buffers | `stats` | `walk_dirs` | `discovery` ms |
|---|---:|---:|---:|---:|
| workspace, cold | 1 (`tb.sv` only) | **58** | 2 | 208.5 |
| workspace, warm | 1 | **58** | 2 | 169.1 |
| workspace warm, "1 open buffer" | 2 | **58** | 3 | 200.4 |
| workspace warm, "10 open buffers" | 11 | **58** | 3 | 199.0 |
| workspace warm, "100 open buffers" | 101 | **58** | 3 | 197.7 |
| default / depth0, cold+warm | 1 | 0 | 0–1 | ≤2.6 |
**With only `tb.sv` open, `stats` is 58, not 0.** The dev's original F1
work-log number (0 at "0 or 1 open buffers") was measured *before* finding
(f)'s patch, when `Aliased` ran only inside the head's ~124-file
neighbourhood and `tb.sv` had no other same-named file there to match. Now
that `rest_of_scope` runs the same check across the **~3 850-file rest of
the workspace**, opentitan's convention of naming testbenches `tb.sv`
pervasively across many IP verification trees means 58 genuinely different
`tb.sv` files are found tree-wide, each costing one name-match + one
`dir_id` stat (correctly not filtered, since none is actually this buffer's
identity — consistent with fixture (k) above). This is the *correct*,
intended cost of extending the gate to the whole workspace, and at ~0.06 ms
total (the dev's own per-stat estimate) it is not a performance concern —
but it is **not** "still 0" as I'd been asked to confirm, and the number
being flat at 58 across 1/2/11/101 total buffers (rather than growing with
buffer count) is because the extra opened files are additional RTL modules
whose names ("aes.sv", "aes_alert_sender.sv", …) do not happen to collide
with anything elsewhere in the tree — an artifact of which files
`rtl_files()` happens to pick, not a bound the code enforces. Reporting the
actual measurement rather than confirming the assumption.
**Controls, candidate vs. the round's own targets (§61/F1), same opentitan
tree, guarded, `--tries 3`:** first useful definition cold 79.3/79.6/81.1 ms
(median 79.6, vs. the F1 table's 81.9 — within noise); warm 115.4/116.2/
116.4 ms (median 116.2, vs. 117.5 — within noise); warm settled 1001.3 ms
(vs. ~1 039–1 134 across the F1 table's buffer cells — at or below, no
regression); cold settled 2 764.8 ms (vs. 2 886.0 — below). All within the
±10% band asked for. **The regression above does not show up in these
numbers** because none of these phases opens a second buffer mid-scan
during a still-pending discovery — it is a correctness gap, not a
performance one, and the perf harness does not exercise the code path that
has it.
**Gates.** `cargo fmt --all -- --check`: clean. Guarded `cargo clippy
--workspace --all-targets --locked -- -D warnings`: clean, no new
`#[allow]`. Guarded `cargo test --workspace --locked`: **1 failed** (above);
every other crate green (`lucisv` 36+113, `lucisv_core` 111,
`vlog_formatter`+tests 315, `vlog_linter`+tests 667, `vlog_parser`+tests
508, `vlog_refactor`+tests 550, `vlog_semantic`+tests 328 — all 0 failed);
`lucisv_server`: **1 663 passed, 1 failed, 36 ignored** of 1 700. Production
line count, `state/discover.rs` (no local test module): **409** non-blank/
non-comment (raw 787 lines — the finding-(f) patch added the `Aliased`
struct and its use in `rest_of_scope`; still comfortably under 600).
**opentitan.** `git -C .../opentitan status --porcelain` checked before and
after every phase: always exactly the three known pre-existing modified
files (`hw/ip/aes/dv/tb/tb.sv`, both `ast.sv`s), never anything else.
**Guard:** every cargo/build/test/perf invocation, main clone and the
undiffed control clone, ran through `tools/guard.sh -m 8 -t …`; zero kills.
No lingering background processes at session end beyond the user's own
pre-existing VS Code `lucisv-server --stdio` (0.51.0, not something this
session started). All experiments — the workspace-test isolation, the two
instrumented probes (reverted, diffed clean), the sabotage, fixtures (j)/
(k), the release build and perf phases — ran in `/private/tmp/…/scratchpad/
qa-62b/repo` (the diffed clone) or `/private/tmp/…/scratchpad/qa-62b-base/
repo` (an undiffed control), never the main tree.
**Not repeated, per the task's own instruction: the previous QA's
reproduction-on-both-binaries check and the conflict-follow-through
sabotage** — the diff does not touch `has_preceding_alias`, `precedes_a_
target`, or `Scan::wants_rescan`'s call site, and both were already
verified in the prior pass.
**TODO §62.1's QA line stays unchecked.** Recommend: fix the self-match gap
in `rest_of_scope` (two candidate directions above, a decision for the
dev), add a fixture that opens a second buffer mid-split-discovery and
asserts the new module is indexed (not just that a request is answered or
that reordering happened), and re-run this QA pass including the matrix
above (already green and reusable) plus the new fixture.
### 2026-09-09 — QA (Sonnet), TODO §62.1 third pass: PASS
**Verdict: PASS.** The lead's fix for the self-match gap is exactly the
minimal direction (a) the previous pass left open: `rest_of_scope`
(`crates/lucisv_server/src/state/discover.rs:686-690`) now computes
`another_spelling = !spoken_for.contains(found.path.as_path())` and asks
`aliased.speaks_for` only when `another_spelling` is true — the gate is never
asked about a path that is an open buffer's *own* spelling, so a buffer
opened mid-scan for the first time still lands in `scan.work`, while a
second, different path reaching the same identity is still dropped. Read
against the two prior findings ((f) and the self-match regression): both
scenarios are now handled by one condition, not two competing ones.
**Gates, guarded, fresh clone** (`git archive 3ceba21` + `git apply` of the
working-tree diff, under my scratchpad, never the main tree — the lead was
running the full gate chain there concurrently, so no timing was taken).
`cargo fmt --all -- --check`: clean. `cargo clippy --all-targets --locked --
-D warnings`: clean, no new `#[allow]` in the diff (checked by grep, not
just by eye). `cargo test -p lucisv_server --bin lucisv-server --locked`:
**1 664 passed, 0 failed, 36 ignored** — the whole server binary green,
including `state::tests::a_file_opened_mid_scan_lengthens_the_neighbourhood_
it_jumps_into` (the second pass's regression, now `ok`) and all 39
startup-adjacent tests (31 of them in `server::tests::startup::` itself, all
`ok`), matching the task's expected 1 664/0/36 exactly.
**Sabotage 1 (the fix under review).** Reverted `rest_of_scope`'s gate to
the second pass's own bug — `if seen.contains(&found.path) ||
aliased.speaks_for(&found.path, &mut stats)`, dropping the `another_spelling
&&` guard — rebuilt, reran: `a_file_opened_mid_scan_lengthens_the_
neighbourhood_it_jumps_into` **fails** (`left: true, right: false` at
segment index 4) and a new fixture of mine (below) fails the same way
(`uart_pkg` unit count `0` instead of `1`). Restored; diffed byte-identical
against the shipped patch afterwards.
**Sabotage 2 (the gate itself, reconfirming the second pass's own
sabotage).** Removed the whole `aliased.speaks_for(...)` disjunct from
`rest_of_scope`, leaving only `seen.contains`, rebuilt, reran the shipped
`a_same_named_file_symlink_outside_the_head_is_not_a_second_copy_of_the_
buffer`: **fails** exactly as before — startup indexes three files
(`alias_dir/tb.sv` sneaks back in), rescan indexes two, `"the startup scan
and a whole rescan must agree"` fails. Restored; byte-identical.
**Two new attacks, both added to `state/mod.rs`'s test module in the clone
(QA-only, not shipped — a `Tree::link` helper had to be added there too,
also QA-only):**
- `a_buffer_opened_mid_scan_with_its_own_alias_elsewhere_is_indexed_once_
not_dropped`: `neighbourhood_tree` plus `other/uart.sv -> ../ip/uart/rtl/
uart.sv` (same basename as the buffer's own file, reachable only by the
remaining walk once `uart.sv` becomes a buffer). After the scan:
`units("uart_pkg").len() == 1`, exactly one `uart.sv` in the index (the
buffer's own spelling `ip/uart/rtl/uart.sv`), and `other/uart.sv` is the
one dropped. This is the case Sabotage 1 breaks (see above) — the own
path and the genuine alias are told apart correctly by the fix.
- `a_buffer_opened_mid_scan_whose_path_was_already_seen_is_unchanged`: opens
a second buffer at `ip/aes/rtl/aes.sv`, already inside the head's own
neighbourhood and therefore already in `pending.seen` by the time it
becomes a buffer. `seen.contains` short-circuits before `Aliased` is ever
consulted; `units("aes_pkg")` and `units("tb_pkg")` both stay at 1, one
`aes.sv` in the index — unaffected by this round's gate, as expected.
Both pass against the shipped fix; both were run under Sabotage 1 too (the
first fails as noted above; the second is unaffected by Sabotage 1, since
`seen.contains` alone already protects it — consistent with the mechanism).
**The matrix (a)-(k), fresh clone, same method as the prior two passes.**
All of (a)-(i) reconfirmed via the shipped suite (`an_alias_sorting_before/
after_its_target`, `several_aliases_of_one_directory`, `an_alias_of_an_
ancestor`, `an_ancestor_cycle` — covers (b) — `an_ignored_alias`, `an_open_
unsaved_buffer`, `a_genuine_duplicate_declaration`, `an_alias_beside_the_
open_folder` — covers (i) — and `a_same_named_file_symlink_outside_the_
head` — (f), attacked above). Six more QA-only fixtures appended to a
scratch copy of `server/tests/startup.rs` to cover what nothing shipped
names directly:
- (a) `qa_an_alias_to_a_directory_outside_the_workspace_root_is_followed_
and_pinned` — followed, one target, renamable; pinned, not asserted
correct.
- (e) `qa_a_broken_symlink_beside_the_open_folder_does_not_crash_and_
contributes_nothing` — no panic, contributes no file.
- (g) `qa_a_file_level_symlink_under_a_different_name_stays_two_files` — a
different name is out of the gate's scope by design; stays two paths.
- (h) `qa_genuine_duplicates_behind_an_alias_of_a_different_directory_stay_
ambiguous` — `link_a -> a` beside a genuinely different `b`; still
refused ambiguous.
- (j) `qa_a_same_named_file_symlink_inside_the_head_folder_is_the_heads_
own_gate` — exercises `overlay_buffers`'s gate; one `tb.sv`, renamable.
- (k) `qa_a_same_named_but_genuinely_different_file_outside_the_head_is_
kept` — a different inode under the same basename; kept as two files, one
`child` target — confirms identity, not just name, is what the gate
relies on.
All eleven matrix letters pass. `cargo test -p lucisv_server --bin
lucisv-server --locked -- qa_` (my prefix, which also matched 62 pre-existing
`qa_`-named tests elsewhere in the tree): **68 passed, 0 failed, 11
ignored** — nothing else disturbed.
**opentitan, real tree, counts only (no timing taken per the task's
instruction).** Built the candidate release binary in the clone. `scanprofile
--tries 1`: `workspace warm, "1 open buffer"` cell — `stats=58, walk_dirs=3,
buffers=2, conflict=0, rescan_requested=0`; `workspace, cold`/`warm` (0
extra buffers) — `stats=58, walk_dirs=2`; `10`/`100`-buffer cells — `stats=58`
again; `default scope` and `depth0` cells — `stats=0`. Matches the second
pass's disclosed number exactly (58, not 0, because the gate now runs
tree-wide over same-named files across opentitan's pervasive `tb.sv`
naming) — not re-litigated as a regression, per the task's framing.
**The mid-scan `didOpen` on the real tree.** A standalone script (`lspclient.
Session`, `workspace: {scope: "workspace", scopeDepth: 0}`, cold store) opened
`hw/ip/aes/dv/tb/tb.sv`, then — 50 ms later — `hw/ip/uart/rtl/uart.sv`,
waited for quiet, and asked `textDocument/documentSymbol` on `uart.sv`:
`['uart']` — the module resolves. The server's own `--verbose` log shows
exactly one `indexing: .../hw/ip/uart/rtl/uart.sv` line, not two. Re-run
against a build with Sabotage 1 applied: **identical result, no
difference observed** — the 50 ms window did not land inside the vulnerable
call (`open_next`'s `discover_the_rest` is one synchronous walk-and-filter
call per `didOpen`, fast enough on this tree that wall-clock racing is not a
reliable way to hit it; the deterministic `state/mod.rs` unit tests above,
which control `scan_step` by hand rather than by clock, are the ones that
actually exercise and break under Sabotage 1). Reporting this honestly
rather than claiming the wire-level script proves what only the unit-level
sabotage actually proved — the opentitan requirement asked for was "the
module resolves after settle," which it does; it was not a reliable
vehicle for the sabotage itself.
**opentitan status.** `git -C .../opentitan status --porcelain` checked
before and after every phase (`scanprofile`, both mid-scan script runs):
always exactly the three known pre-existing modified files
(`hw/ip/aes/dv/tb/tb.sv`, both `ast.sv`s), never anything else.
**Guard.** Every cargo/build/test/perf/script invocation — main-tree reads
aside, no main-tree writes — ran through `tools/guard.sh -m 8 -t …`; zero
kills. No lingering background processes or poll loops at session end
(`ps aux` shows only the user's own pre-existing 0.51.0 VS Code
`lucisv-server --stdio`, not anything this session started). All
experiments — both sabotages (each restored and diffed byte-identical
against the shipped patch immediately after), the new `state/mod.rs`
fixtures (with a QA-only `Tree::link` added there), the six new `startup.rs`
matrix fixtures, the release build, `scanprofile`, and the mid-scan `didOpen`
script — ran in `/private/tmp/…/scratchpad/qa-62c/repo`, never the main
tree, which was never modified (`git diff --stat` on the three touched files
matches the session-start snapshot exactly, confirmed before finishing).
**TODO §62.1's QA line is now checked.** Nothing further recommended for
this fix; N1-N3 and closing remain as filed in TODO.md.
## Review
**2026-09-08 (lead).** Accepted. Read `state/discover.rs`, the two walk
@@ -831,3 +1574,44 @@ Docs applied at merge: topo (`lucisv_server ──▶ lucisv_core` walk
entries; the `state::discover` module; the two-phase startup and
`OPENING_FILE_WAIT`); folders-and-config's Assumptions amended; the
local-record load and the double subtree walk to the loop-3 list.
**2026-09-09 (lead, F1 — the 0.52.0 review's finding).** Accepted after
two passes and a lead fix.
- The finding was real and the reviewer's fixture reproduces it on
0.52.0 exactly as written: two spellings of one directory, two
definition targets, a valid rename refused until a rescan. The cause
was the two walks of the split discovery keeping separate visited
sets — the `(dev, ino)` identity contract held inside each walk and
not between them.
- The other agent's implementation had the right shape (one tracker
shared across both walks; a pre-check that falls back to the single
canonical walk when an alias sorts before the open folder; the
`HEAD_WALK_MAX` fallback no longer unioning the head) and two
shortfalls the finishing lane closed: it stat'd every discovered file
once per open buffer (the second stat §61.3 had removed, times the
buffer count), now gated on the file name so `stats` is 0 again on
opentitan; and a conflict the remaining walk detects was recorded and
ignored, now turned into exactly one ordinary rescan so startup and
rescan converge on the canonical spelling in the case no pre-check can
see. Nine fixtures assert index paths, definitions, prepareRename and
diagnostics agree across startup, rescan and restart, the genuine
duplicate still refused word for word.
- QA's second pass found the gate applied to the head walk and not to
the remaining walk: a same-named file symlink outside the open folder
still doubled the buffer. Fixed by the lead — both walks ask the same
`Aliased` question — with QA's fixture shipped. QA's third pass then
caught the lead's own regression: the gate in the remaining walk
matched a buffer opened mid-scan against its own file and dropped it,
so that module vanished from the index (a pre-existing test said so).
Fixed the same day: the gate is asked only about a path that is not a
buffer's own — the own spelling always lands, only other spellings are
dropped. Two QA findings on one gate is the record of what a lead fix
without its own QA costs; both are pinned now.
- The harness half (F2/F3) is the other agent's with two more bugs the
finishing lane found (a quiet-control row that could not record; a
scan duration used as an offset); a brand-new store now primes
untimed and the completion stamp is the scan's own end event.
- Out of scope, written down: a file-level symlink under a *different*
name is two files; a buffer opened mid-scan is not put through the
alias test (unchanged since 0.51.0).
+100
View File
@@ -834,6 +834,106 @@ wrong) and one documentation inaccuracy (`includes.rs`'s cited line count).
TODO §61.4's QA line ticked below.
### 2026-09-09 — independent 0.52.0 review: load-probe corrections needed
The publication improvement was independently reproduced against 0.51.0:
with two open buffers and 35 requests every 100 ms per process, three properly
warmed processes per version, median server scan duration fell 4,247 → 1,771 ms,
publishes 34 → 4, all 105 requests answered and all equal to the settled
target. The full-window request median fell 1,947 → 2.03 ms; this includes
post-scan responses. Cross-folder probes returned the settled target in all
750 candidate responses, versus 399 premature empty answers in the reference.
**Two harness findings, F2/F3 (P2), open:** `load_cell` labels a fresh store
warm without priming it (a separate proof measured 3,974 misses and 1,684 ms
parsing on the first nominally warm run, versus 3,974 hits and zero misses on
the second). Also, `settled_at` mistakes `wait_quiet`'s positive entry-time
delta for new scan activity. Candidate `settled_ms` follows the 3.4-second
request window even though the scan ends at about 1.77 seconds, and all 105
responses are mislabeled mid-scan. The review therefore uses a warmed rerun
and `publication.scan_total`, not the erroneous completion/partition fields.
No implementation was changed. [Full review and repair gates](../../performance_052_review.md),
[raw evidence](../../perf/review-052-20260909/README.md). These findings do not
assert that all previous warm runs were unprimed or invalidate the measured
publication-count reduction.
**2026-09-09, later — F2 and F3 are fixed** (dev, in the F1 lane; the harness
half of the same round). `phases_r4.prime` runs one untimed session before a
warm cell's first timed trial and `cell_status` refuses a warm cell whose trial
found nothing in the store: with a brand-new `--storage`, both timed trials now
report 3 975 hits and 0 misses. `Session.scan_completed_at` is stamped in the
reader thread on the indexing bar's own `$/progress` `end`, so `settled_ms`
reads 1 774 ms for a scan the server's own trace calls 1 768 ms — not the
3 406 ms of the request window — and the responses partition 32 mid-scan /
38 after-settle instead of every one of them mid-scan. Widening the window
3 500 → 5 000 ms leaves completion at 1 781/1 791 ms and grows only the
after-settle count (38 → 64), which is the review's own check. Details and
numbers: `docs/perf/take5-tracking.md`, the F2/F3 rows.
### 2026-09-09 — QA (Sonnet), TODO §62.2: PASS
**Verdict: PASS.** Read the diff (`tools/perf/lspclient.py`,
`tools/perf/phases_r4.py`) and reran both harness fixes against the
candidate server on opentitan, guarded, from the main tree.
**F2, a brand-new `--storage`, 2 independent tries (fresh directories
both times), `scanloadprobe` (the fast one-warm-cell loop):**
| Try | cache_hits | cache_misses | status |
|---|---|---|---|
| 1 | [3975, 3975] | [0, 0] | ok |
| 2 | [3974, 3974] | [0, 0] | ok |
Both timed trials hit on both tries — `phases_r4.prime`'s untimed session
does fill the store before the first timed measurement, and `cell_status`
found nothing to refuse. (I did not additionally force a warm cell to
report a real miss to see the "error" path fire — the diff's own
`cell_status` branch is a direct, three-line read: `if cache == "warm" and
any(hits == 0 ...)`, unambiguous by inspection.)
**F3, the same runs' scan-completion accounting:**
| Try | scan_completed_ms | server trace `scan_total` | scan_ends | mid_scan / after_settle |
|---|---|---|---|---|
| 1 | 1494.31 / 1494.86 | 1485.73 / 1486.24 | 1 / 1 | 30 / 40 |
| 2 | 1753.85 / 1745.77 | 1744.80 / 1736.47 | 1 / 1 | (not recorded) |
`scan_completed_ms` sits within 9 ms of the server's own reported
`scan_total` in both tries (well inside the ±20 ms the task asked to
check), exactly one `end` per session, and responses split sanely between
mid-scan and after-settle rather than all landing in one bucket.
**The widened window.** Copied `tools/perf/phases_r4.py` into my scratchpad
and changed `WINDOW_MS["warm"]` 3500 → 5000 only there (never in the main
tree), reran `scanloadprobe` against the candidate with a third fresh
`--storage`: `scan_completed_ms` ≈ 1745–1751 ms — unmoved in kind from the
3500 ms-window runs above (same corpus, same cursor, unrelated to how long
the offered-load window ran) — while `after_settle_answers` grew 40 → 64,
`mid_scan_answers` stayed in the same 30s band (36). Matches the review's
own acceptance: completion stable, after-settle count grows with the
window.
**The quiet-control row.** `load_cell`'s `record(**dict(got, ms=...))`
call for `rate=0` was exercised as a side effect of every `scanloadprobe`
run above's cell status line (`quiet control` is not itself a separate
call in `scanloadprobe`, so I additionally re-read the `record(...)` call
site at `tools/perf/phases_r4.py` — the merge is `dict(got, ms=...)` then
splatted, and `got` (from `summary()`) carries no key that collides with
the explicit `phase=`/`row=`/`fresh_process=`/`result_count=`/`rate_ms=`/
`open_buffers=`/`note=` keywords also passed, so the `record(**got)`
duplicate-keyword bug the tracker names as historical cannot recur here);
no exception in any of the runs above, which all reach that call.
**Gates.** Covered under the §62.1 entry above (same guarded `cargo fmt`/
`clippy`/`test --workspace` run; this feature's own files —
`tools/perf/*.py` — are not compiled). **opentitan** unchanged
throughout (checked alongside the §62.1 runs). **Guard**: every bench
invocation ran through `tools/guard.sh -m 8 -t 1800 --`; no kills; no
lingering processes.
**TODO §62.2's QA line is ticked.**
## Review
**2026-09-08 (lead).** Accepted, with one fix made by the lead and one
+36
View File
@@ -69,6 +69,12 @@ output). `NetDelay` now owns both of its gaps, `before_hash` and
`lucisv_server::state::Workspace::walked_files` is the server's only caller
and needed no change — its `sort`/`dedup` still runs, and now has less to
do. `vlog_linter` uses `walk::is_excluded` only, which is untouched.
**Amended 2026-09-09 (review finding F1):** the visited set is now a value a
caller may own and share between two walks (`DirectoryTracker`,
`collect_files_tracked`, `collect_files_below_tracked`), because the server's
startup scan discovers its scope in two walks and the enter-once rule has to
hold *between* them. The policy is unchanged and the old entries are
wrappers; see the work log below.
- **`vlog_parser::ast::NetDelay` → `vlog_formatter`** (topo §2.9-27, struck).
Two new public fields, `before_hash` and `after_hash`, both
`Vec<Comment>`. The only constructor is `Parser::parse_net_delay`; the only
@@ -282,6 +288,36 @@ together with the warning channel the walk lacks. The opentitan
reporting a same-directory symlink alias once — the intended change, noted
in 0.43.0's release notes.
**2026-09-09 — the identity is now shared across walks (review finding F1).**
43.1's contract — *each directory is entered once, by identity, and its files
are reported under the first path that reached it* — was a contract about one
`Walk`. The 0.52.0 startup scan discovers its scope in two walks (the user's
own folder, then the rest of the workspace: `docs/features/perf5r-first-answer/README.md`),
and two `Walk`s meant two `visited` sets, so a symlinked directory reached by
both was reported twice under two spellings and the index held every module in
it twice — a valid rename refused as ambiguous
([the review](../../performance_052_review.md#f1--p2--split-startup-discovery-duplicates-modules-behind-directory-aliases)).
The set is now a value a caller may own: `Walk::visited` became
`Walk.tracker: &mut DirectoryTracker`, and `collect_files_tracked` /
`collect_files_below_tracked` take one. The **policy is unchanged** — the same
`(dev, ino)` identity, the same enter-once rule, the same silent skip, the
same dangling-link handling, and `collect_files_with`/`collect_files_below`
still make a tracker of their own so a single walk behaves byte for byte as it
did. What is new is a second answer for the caller that shares one:
`DirStatus::PrecedenceConflict` says "already entered, under a path this one
sorts *before*" — which is the case where the enter-once rule and a walk of
the root would pick different spellings. A single walk never sees it (it meets
the first spelling first, by construction); only a split does, and the server
answers it with one ordinary rescan rather than by guessing.
Two `lucisv_core` unit tests pin the tracker itself
(`tracker_detects_precedence_conflict_when_alias_sorts_before`,
`tracker_allows_alias_sorting_after_without_conflict`); nine server fixtures
in `server/tests/startup.rs` pin what the server does about it, cycles
included — `sub/up -> ..` still terminates, still names each file once, and
now agrees with a plain walk about how it spells them.
## QA log
**2026-09-05 — QA (Sonnet).** Built `target/release/{lucisv,lucisv_server}` once