Root cause (lane A): not the fan-out. The default index scope (`folder`, depth 2) opened from hw/ip/aes/dv/tb/tb.sv indexes hw/ip/aes only, so the three *_pd_main.sv tops are never walked; with index.scope "workspace" the LSP answers 14/12, equal to the whole-set engine. Ruled out: the 1 MiB cap, autogen/ignore rules, the multi-line instantiation. The owner kept the design; the index.scope setting now says a rename of a module instantiated outside the scope leaves those sites unchanged. Tests: server/tests/references_scope.rs (3: the LSP equals the engine over the same file set in both scopes, a module rename reaches the top under `workspace`), tests/opentitan_references.rs (2, ignored: 14/12 workspace, 11/9 default). lucisv_server 1 865 passed, 0 failed; node 8/8. docs/features/references-fanout-pd-main. Co-Authored-By: Claude Opus 5.5 <[email protected]>
references-fanout-pd-main
Goal
TODO §65.2 (topo §2.9-36, MCP-6): on opentitan, textDocument/references at
the aes instantiation in hw/ip/aes/dv/tb/tb.sv and at its .clk_i
connection answered 11 and 9 locations, while the whole-set engine
(vlog_refactor::find_references over every file, as lucisv-mcp's
references runs it) answered 14 and 12 — the same plus the three generated
tops hw/top_{earlgrey,darjeeling,englishbreakfast}/rtl/autogen/*_pd_main.sv.
Find the cause, fix it at the cause, and pin the answer.
Root cause
It is the index scope, not the fan-out. The language server runs on the
shipped default lucisv.index.scope: "folder" with scopeDepth: 2
(settings.rs DEFAULT_SCOPE_DEPTH, ladder in state/scope.rs). Opening
hw/ip/aes/dv/tb/tb.sv raises its folder two levels to hw/ip/aes, and
that is the whole index: the three *_pd_main.sv tops are never walked, so
no index table (units, instantiations, reference postings, words) knows them.
lucisv-mcp hands the engine every file under the root, which is the
"workspace" rung's set. The two answers are over different file sets; over
the same set they are identical.
This is the documented behaviour of docs/features/index-scope ("cross-file
answers are scope-relative … find_references and a workspace rename all
answer within the active scope"; migration line "lucisv.index.scope": "workspace"), chosen 2026-08-27/28 for scan cost.
Evidence (release lucisv-server built at ec492cd, LSP client driving it over
stdio, root ot/hw, tb.sv opened, positions 45:3 aes and 50:6
clk_i, after the scan's progress end plus 5 s):
| scope | aes |
.clk_i |
files listed |
|---|---|---|---|
default (folder, depth 2) |
11 | 9 | all under hw/ip/aes/ |
index.scope: "workspace" |
14 | 12 | the 11/9 + darjeeling_pd_main.sv:1521/1538, earlgrey_pd_main.sv:2069/2086, englishbreakfast_pd_main.sv:933/950 |
The workspace-scope answer is exactly MCP-6's 14/12 list. Ruled out, as the
lead's pre-investigation suggested: the 1 MiB size cap (the tops are
62–141 kB and are indexed under the workspace scope), .gitignore/the walk
(autogen is walked under the workspace scope), and the multi-line
aes #( … ) u_aes ( shape (indexed and answered under the workspace scope).
state/sources.rs (module_sources, rename_sources_traced, fan_out_of)
and nav.rs's indexed-references path are correct: within the scope they
equal the engine over Workspace::sources().
Rename has the same scope relation and no gap of its own. Probe over the
same checkout: a rename of aes from tb.sv:45 edits 14 sites in 9 files
under the workspace scope (the three tops included) and 11 sites in 6 files
under the folder scope. The latter is the sharper consequence: under the
default scope a module rename from the testbench would leave the three tops
instantiating a module that no longer exists. That is the index-scope
README's stated trade-off, but it is a correctness hazard for a write, not
only an incomplete read — flagged for the lead below.
Assumptions
- "The whole-set engine" means
vlog_refactor::find_referencesover every file the client's root holds, aslucisv-mcpruns it; the server's answer is compared to it over the same file set. - The folder scope's documented behaviour stands until the lead rules (Handshakes); nothing in this lane changes which files are indexed.
Handshakes
- Ruling request → lead (the fix is outside this lane's files). The
cause is the shipped default scope, which lives in
crates/lucisv_server/src/settings.rs(IndexScope::default,DEFAULT_SCOPE_DEPTH) andstate/scope.rs, and is a product decision recorded indocs/features/index-scope. Not edited. Options:- Keep the design; close §65.2 as scope-relative by design. The tests below pin both halves. Optionally document it where users meet it (the VS Code setting's description, the README's LSP section).
- Widen only for writes. A cross-file rename (and port refactorings)
on a unit whose instantiations may exist outside the folder scope runs
against the workspace walk, or refuses with "outside the index scope —
set
lucisv.index.scope: workspace". Closes the hazard above without changing read latency. Touchesstate/sources.rs(fan_out_of/rename_sources_traced) and the rename handler. - Change the default to
"workspace"when the client has roots. Restores pre-2026-08-27 behaviour; costs the full scan the index-scope round removed (opentitan: ~4 000 files; the persistent cache and the interleaved scan now bound it).settings.rs, the index-scope README, release notes.
- Consumed, unchanged:
Workspace::sources(),WorkspaceIndex::files(),vlog_refactor::find_references. No handshake changed.
Status / TODO
- Reproduce at the LSP level (11/9 default scope; 14/12 workspace scope)
- Root cause named: the folder index scope (
hw/ip/aes), not the fan-out - Rename's fan-out checked: same scope relation, no separate gap
- Fixture regression tests (
server/tests/references_scope.rs, 3 tests) - Ignored opentitan test (
tests/opentitan_references.rs, 2 tests) - Fix — pending the lead's ruling (Handshakes); no code fix was needed in
sources.rs/nav.rs - QA
Work log
- 2026-10-19 (dev). Fast-forwarded the lane worktree from
75d2d37to the wave's baseec492cd(TODO-only commit). Built releaselucisv-serverand drove it with a scratch stdio LSP client: default scope 11/9, all locations underhw/ip/aes/;index.scope: "workspace"14/12, exactly MCP-6's list. So the gap is the scope, and the fan-out code is correct — nothing insources.rsornav.rschanged. Rename probe: 9 files/14 edits (workspace) vs 6 files/11 edits (folder) foraes; the.clk_irename under the workspace scope refuses over an unrelated implicit.clk_ibinding inhw/ip/keymgr_dpe/dv/tb.sv(the existing safety refusal), under the folder scope it edits 16 sites in 6 files. Tests:server/tests/references_scope.rs— opentitan's shape in miniature (ip/blk/rtl/blk.sv,ip/blk/dv/tb/tb.sv,top/rtl/autogen/top_pd_main.svwith a multi-lineblk #( … ) u_blk (): (1) whole workspace: LSP == engine over every file, for the module name andclk_i, each from its declaration and from a use, and the top is listed; (2) folder scope: the top is not in the index, LSP == engine overWorkspace::sources()at the same four positions, the top absent; opening the top widens the scope and the answer becomes the whole set's; (3) whole workspace: a module rename from the testbench edits the top.tests/opentitan_references.rs(ignored, skips without the checkout): pins 14/12 with the three tops under the workspace scope, and 11/9 all-in-hw/ip/aesunder the default. Ran both ignored tests against~/.cache/lucisv-eval/ot: pass (17.8 s, debug); withLUCISV_OPENTITAN=/nonexistentboth skip and pass.
QA log
Review
2026-10-19 — lead (owner's ruling). The owner chose keep as
designed: cross-file answers stay relative to the index scope, and §65.2
is closed as scope-relative by design rather than as a defect. The lane's
tests are merged as the pin of both halves (the workspace scope equals the
whole-set engine, the folder scope equals the engine over the scope, the
opentitan 14/12 vs 11/9). The rename consequence is now said in the
lucisv.index.scope setting's description (a rename of a module
instantiated outside the scope leaves those instantiations unchanged). No
production code changed, so no QA lane was run; the lead reviewed the
tests.