37 KiB
37 KiB
Index Lifecycle & Fast Tombstone Removal (Round 2)
Goal
Close four index/buffer lifecycle and symlink bugs identified in docs/topo.md (#49, #63, #50, #51):
- Topo #49 (
vlog_semanticfast tombstone removal +lucisv_serverdidClose):- Keep
FileIdslots stable acrossWorkspaceIndex::remove_filevia a paralleltombstoned: Vec<bool>mask and localizedreplace_facts(at, empty_facts(path))instead of shiftingFileIds and running a fullmerge(). - Compact tombstones on
merge()/absorb(), revive tombstoned slots cleanly onupdate_facts, hide tombstones from all public queries (files,file_id,path,defines,facts_for,files_spelling,files_mentioning,files_naming_in_macros,counts,table_sizes), and remap dense IDs insidefingerprint()so a tombstoned index matches a freshWorkspaceIndex::buildbyte-for-byte. - Reconcile
didCloseinlucisv_server(notification.rs/state/incremental.rs): remove closed excluded/unlisted buffers via the fast tombstonedremove_onepath (usingset_file_words+refresh_namesto keep removal sub-millisecond), and re-index dirty/unsaved closed in-scope buffers from disk via localizedreplace_facts(or remove if missing on disk).
- Keep
- Topo #63 (Owner decision 2: always keep disk index record for
doc.large):- Standardize on always keeping the on-disk index record (subject to
lucisv.index.maxFileSize) for opendoc.largebuffers across open, close, save,largeFile.thresholdflips, widen, and whole scans (state/discover.rs,state/rescan.rs,state/buffers.rs,state/incremental.rs), achieving zero index mutation ondidOpen,didClose, andlargeFile.thresholdflips.
- Standardize on always keeping the on-disk index record (subject to
- Topo #50 (Unheld buffers opened mid-scan):
- Reconcile buffers opened mid-scan (
state/rescan.rs,state/scan.rs,server/index.rs) so excluded, unlisted, or unsaved-edited non-large buffers opened while a scan is in flight are absorbed into the running scan equivalently to being opened before the scan started.
- Reconcile buffers opened mid-scan (
- Topo #51 (Symlinked files — one file, one canonical spelling):
- Deduplicate and resolve file identity via
(dev, ino)on Unix /fs::canonicalizefallback on non-Unix without basename-equality gating across discovery walks,overlay_buffers,begin_widen,state/buffers.rs,state/incremental.rs, andstate/watched.rs, enforcing one deterministic canonical spelling in the index regardless of which symlink is open.
- Deduplicate and resolve file identity via
Assumptions
WorkspaceIndex::files()keeps returning&[PathBuf]containing only live files in path order so existing slice callers remain source- and ABI-compatible.- Within a scope, canonical symlink spelling precedence follows deterministic path-sorted discovery order (the lexicographically smallest in-scope spelling for a given file identity), matching existing directory-symlink precedence and preserving symlinked workspace roots.
- During non-interleaved small scans (
scan.total() <= INTERLEAVE_ABOVE && !scan.discovery_pending()), notifications remain queued until afterscan_once()finishes, consistent withserver/index.rs.
Handshakes
- Dense
FileId(i)callers closed (vlog_semantic,lucisv_server,lucisv_mcp):- After tombstoned
WorkspaceIndex::remove_file,index.files()shrinks while remaining live files retain their pre-tombstoneFileIds until the next fullmerge()orabsorb(). - Added
WorkspaceIndex::live_files(&self) -> impl Iterator<Item = (FileId, &PathBuf)> + '_(crates/vlog_semantic/src/workspace/index.rs) yielding only live(FileId, &PathBuf)pairs. - Updated
crates/lucisv_server/src/state/sources.rs(want_macro_text),crates/lucisv_server/src/candidates.rs(macros_of, used byfrom_words,remove_file,absorb, andupdate_words),crates/lucisv_mcp/src/tools/names.rs(similar),crates/lucisv_mcp/src/tools/diagnostics.rs(Census::of), andcrates/lucisv_server/src/state/tests/reindex_perf.rsto iterateindex.live_files()instead of0..index.files().len()/.enumerate().
- After tombstoned
- Symlinked open-buffer identity lookup wired across server handlers:
Workspace(crates/lucisv_server/src/state/mod.rs,state/buffers.rs) exposesindex_file_id,held_path_for,index_path_for,is_same_file,open_document_for_path, anddocument_for_path, matching exact path first and falling back to(dev, ino)/ canonical path while preserving ASCII case-mismatch separation (case_only_mismatch).- Wired into
crates/lucisv_server/src/nav.rs,crates/lucisv_server/src/lint.rs(owninIndexMentionsand canonicalLintContextpath formodule-filename/package-filename/ config discovery),crates/lucisv_server/src/state/sources.rs,crates/lucisv_server/src/ports.rs,crates/lucisv_server/src/rename.rs,crates/lucisv_server/src/extract.rs,crates/lucisv_server/src/inline_module.rs,crates/lucisv_server/src/imports.rs,crates/lucisv_server/src/completion/related.rs,crates/lucisv_server/src/hierarchy/calls.rs,crates/lucisv_server/src/includes.rs(resolve_for_doc,reachable_from), andcrates/lucisv_server/src/hover.rs(narrowed_to_the_include_graph).
- Active-scan absorbed buffer tracking (
Workspace->didClose):Workspace(crates/lucisv_server/src/state/mod.rs) maintainsScanAbsorbed(canonical/open paths plusDirId -> PathBufwithcase_only_mismatchguard), cleared onbegin_scanandfinish_scan(state/rescan.rs), and populated whenever open-buffer text/facts are absorbed inbegin_scan,scan_step, orreconcile_open_buffers_into(state/reconcile.rs, coveringpos >= scan.at,pos < scan.atstaged updates, andpos == Noneexcluded/unlisted/oversize entries).Workspace::closing_affects_running_scan(state/incremental.rs) consultsscan_absorbedalongside out-of-scope and disk-mismatch checks without changingserver/mod.rsorserver/index.rssignatures.
IncludeGraph::remove_filelinear rebuild outside owned files:IncludeGraph::remove_file(crates/lucisv_server/src/includes.rs:284) callsrelearn(known)across all live paths and lowercase folded strings on each removal. That rebuild dominates excluded-filedidCloselatency on a 4k-file index (~2.49 ms/removal in release, ~10.19 ms in debug) whileWorkspaceIndex::remove_fileitself is tombstoned and constant-slot (in-scope clean open+close cycles average ~88.9 µs in release / ~134.7 µs in debug on a 2k-file index). Left untouched per lane file ownership for a follow-up incrementalIncludeGraphupdate.
Status / TODO
- Topo #49: Fast tombstoned
WorkspaceIndex::remove_fileanddidCloseindex reconciliation + 4k/2,000-cycle perf test - Topo #63: Always keep disk index record for
doc.large+ differential tests - Topo #50: Reconcile unheld/unsaved buffers opened mid-scan + regression tests
- Topo #51: Canonicalize symlinked file identities without basename gating across discovery, widen, buffers, incremental, watched + all 6
filelinkscenario tests - QA Fix Pass (F1–F5):
WorkspaceIndex::live_files+0..files().len()audit acrosslucisv_server/lucisv_mcp, non-canonical symlink handler wiring, mid-scan/widen oversize symlink canonicalization, andlargeFile.thresholddrop disk reconciliation - R2 Closing Pass (R2-F2 & R2-F3): Symlink-aware
`includeresolution / macro hover narrowing (includes.rs,hover.rs) andWorkspace::scan_absorbedtracking acrossbegin_scan/scan_step/reconcile_open_buffers_into/closing_affects_running_scan(state/{mod.rs,rescan.rs,reconcile.rs,incremental.rs})
Work log
- Topo #49 (
vlog_semantic+lucisv_server): Addedtombstoned: Vec<bool>toWorkspaceIndex(crates/vlog_semantic/src/workspace/{mod.rs,index.rs,update.rs}) soremove_fileclears the slot viareplace_facts(at, empty_facts(path))without shiftingFileIds or running fullmerge(), revives tombstones onupdate_facts, compacts onmerge()/absorb(), hides tombstones from queries/counts, and monotonically remapsFileIds infingerprint()to match a fresh build. WiredDidCloseTextDocumentincrates/lucisv_server/src/server/notification.rsandclose_and_reconcile/remove_oneincrates/lucisv_server/src/state/incremental.rsso closed excluded/missing buffers are removed via fast tombstones and dirty/unsaved in-scope buffers revert from disk. - Topo #63 (
lucisv_server): Standardized on Owner decision 2 (keeping on-disk index records subject tomaxFileSizefor opendoc.largebuffers) acrossstate/{buffers.rs,discover.rs,rescan.rs,incremental.rs}and updatedstate/tests/{large_file.rs,open_buffers.rs,widen.rs}+server/large_file.rscomment. - Topo #50 (
lucisv_server): Addedreconcile_open_buffers_intoinstate/rescan.rs(invoked fromopen_next) so unheld or unsaved-edited buffers opened mid-scan are absorbed into the finished index consistently with pre-scan opens. - Topo #51 (
lucisv_server): Replaced basename-gated symlink aliasing with(dev, ino)/ canonical-path deduplication (dedup_by_identity) and deterministic canonical precedence acrossstate/{mod.rs,buffers.rs,discover.rs,scan.rs,rescan.rs,watched.rs,incremental.rs}. - Tests: Added 9 server lifecycle integration tests in
crates/lucisv_server/src/server/tests/lifecycle_r2.rs(including all 6 same-name/different-name symlink scenarios,doc.largedifferential checks, mid-scan opens, and 2,000-cycledidClose/ open+close timings) alongside newWorkspaceIndextombstone/perf tests incrates/vlog_semantic/tests/workspace.rs. - 2026-11-26 QA Fix Pass (F1–F5):
- F1: Added
WorkspaceIndex::live_files()(crates/vlog_semantic/src/workspace/index.rs) and replaced0..index.files().len()/.enumerate()FileIdindexing acrossstate/sources.rs(want_macro_text),candidates.rs(macros_of),lucisv_mcp/src/tools/names.rs(similar),lucisv_mcp/src/tools/diagnostics.rs(Census::of), andstate/tests/reindex_perf.rs. Added MCP unit tests for tombstoned slot 0 innames.rsanddiagnostics.rsand un-ignored both F1 tests inlifecycle_r2.rs(extendingCandidates::remove_filecoverage). - F2: Added
Workspace::index_path_for/Workspace::is_same_file(state/mod.rs) andWorkspace::open_document_for_path(state/buffers.rs) while preservingcase_only_mismatchseparation inindex_file_idand open-buffer lookup; wired acrossnav.rs,lint.rs(ownand canonicalLintContextpath),state/sources.rs,ports.rs,rename.rs,extract.rs,inline_module.rs,imports.rs,completion/related.rs, andhierarchy/calls.rs. Un-ignoredqa_topo_51_non_canonical_symlink_open_buffer_breaks_references_lint_and_rename. - F3 & F4: Extracted
crates/lucisv_server/src/state/reconcile.rs(keepingstate/rescan.rswell under 600 production lines), carried in-scopecanonical_idsacrossoversizeskips onSources/Scan(state/{scan.rs,discover.rs,reconcile.rs}) so mid-scan non-canonical symlinks overmaxFileSizecanonicalize identically to pre-scan, and updatedbegin_widen(state/rescan.rs) so open non-large buffers promote to lexicographically earlier symlinks even when overmaxFileSize. Un-ignored both F3 and F4 tests inlifecycle_r2.rs. - F5: Added
Workspace::reconcile_large_buffer(state/reconcile.rs) and wiredServer::reclassify_large_buffers(server/large_file.rs,server/notification.rs) so buffers flippinglarge == false -> truereconcile back to disk (or drop if outside scope/oversize/missing) when dirty/previously indexed unsaved edits exist, while doing zero index work for clean buffers whose disk record matches. Un-ignoredqa_topo_63_threshold_drop_after_unsaved_edit_indexed_via_widen_diverges_from_fresh.
- F1: Added
- 2026-11-26 Closing Pass (R2-F3 Option B):
- R2-F3: Added
ScanAbsorbed(paths: HashSet<PathBuf>,ids: HashMap<DirId, PathBuf>withcase_only_mismatchguard) onWorkspace(crates/lucisv_server/src/state/mod.rs), cleared inbegin_scanandfinish_scan(state/rescan.rs), and recorded whenever open-buffer text/facts enter the running scan (begin_scanoverlays,scan_steppops frombuffered/analyzed, andreconcile_open_buffers_intoacrosspos >= scan.at,pos < scan.atstaged updates, andpos == Noneexcluded/unlisted/oversize entries instate/reconcile.rs). UpdatedWorkspace::closing_affects_running_scan(state/incremental.rs) to returntruewhenscan_absorbedmatches (including aliases before mid-scan publish and buffers flipped todoc.largewith no surviving alias), keepingserver/mod.rsandserver/index.rsuntouched. Un-ignoredqa_r2_f3_mid_scan_dirty_open_reverted_and_closed_leaves_stale_indexand addedr2_f3_mid_scan_dirty_reverted_and_closed_converges_across_all_scan_phasesincrates/lucisv_server/src/server/tests/lifecycle_r2.rs.
- R2-F3: Added
- 2026-11-26 Plan Review Surgical Fix (R2-F2b, R2-F3a, R2-F3b):
- R2-F2b: Normalized
includes::resolve_for_doc(crates/lucisv_server/src/includes.rs) output throughws.index_path_for(&found)so symlinked-directory includes resolve to canonical indexed paths. - R2-F3a & R2-F3b: Simplified
Workspace::closing_affects_running_scan(crates/lucisv_server/src/state/incremental.rs) to returntruewheneverself.scan_absorbed.contains(path, &target) || self.has_other_document_for(uri, path), covering bothalready_sameskipped secondary symlinks anddoc.large-flipped absorbed symlinks closed mid-scan while a second alias remains open. Un-ignored all threeqa_r2_*repro tests inlifecycle_r2.rs.
- R2-F2b: Normalized
QA log
- Verdict:
FAIL(5 concrete findings blocking acceptance: F1–F2 handshake regressions/breakages acrosslucisv_serverandlucisv_mcp, F3–F4#51/#50oversize symlink canonicalization gaps instate/rescan.rs, F5#63threshold-drop stale unsaved index inserver/large_file.rs).
Audit & Hygiene
- Production line counts & safety (verified on all 12 modified production files before
mod tests):crates/lucisv_server/src/server/large_file.rs(110),server/notification.rs(287),state/buffers.rs(110),state/discover.rs(487),state/incremental.rs(221),state/mod.rs(104),state/rescan.rs(590),state/scan.rs(137),state/watched.rs(123),crates/vlog_semantic/src/workspace/index.rs(351),workspace/mod.rs(167),workspace/update.rs(380) — all<= 600non-blank, non-comment lines with 0unwrap(),expect(),unsafe,panic!, or#[allowin modified production code. - Author stamp:
python3 tools/stamp_author.py --checkexited0(would stamp 0 files; left 249 untouched).
Findings
- Finding F1 —
#49Handshake Drift: callers iterating0..index.files().len()misalign/skip liveFileIds after tombstone removalcrates/lucisv_server/src/state/sources.rs:338(want_macro_text): Closing an excluded file (ignored/a_excl.sv,FileId(0)) shrinksindex.files().len()to2whilez_mac.svremains atFileId(2).want_macro_textskipsFileId(2), omittingz_mac.svfromrename_tracedmacro-text checks and causing divergent macro warnings vs a fresh server. Reproduced inqa_topo_49_tombstone_before_live_macro_breaks_rename_macro_text_fanout(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs).crates/lucisv_server/src/candidates.rs:837(macros_ofviaCandidates::from_words/Candidates::remove_file): Witha_excl.svtombstoned (files().len() == 1,z_mac.svatFileId(1)),macros_ofreturns[]instead of["LIVE_MAC"]. Reproduced inqa_topo_49_candidates_macros_of_breaks_when_tombstone_precedes_live_macro_file(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs).crates/lucisv_mcp/src/tools/names.rs:191-192(similar) andcrates/lucisv_mcp/src/tools/diagnostics.rs:267-269(Census::of): Same0..index.files().len()/enumerate()-to-FileIdassumption skipsFileId(1)defines ([]vs["LIVE_MAC"]) and assigns shiftedFileId(0)insideCensus::ofagainstown = Some(FileId(1))(makingCensus::outsidefalsely returntrue). Verified via transient unit tests on tombstonedWorkspaceIndexand reverted cleanly fromcrates/lucisv_mcp; notelucisv_mcp'sProject::refresh(crates/lucisv_mcp/src/project/mod.rs:175) currently updatesself.indexonly throughabsorb(...)(which compacts tombstones), solucisv_mcphits this only via directWorkspaceIndex::remove_filecallers.
- Finding F2 —
#51Handshake Drift: non-canonical symlink open buffer fails references, lint, and rename- When
a_link/link_a.sv -> z_real/real_b.svis canonically indexed asa_link/link_a.svand the client opensz_real/real_b.sv, callers matchingdoc.pathverbatim instead ofWorkspace::index_file_id/Workspace::held_path_for/Workspace::document_for_pathbreak live LSP operations. Reproduced inqa_topo_51_non_canonical_symlink_open_buffer_breaks_references_lint_and_rename(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs):textDocument/references(crates/lucisv_server/src/nav.rs:232,295) returns1ref instead of2(cross-file reference intb/tb.svdropped).- Diagnostics (
crates/lucisv_server/src/lint.rs:244) passown = NonetoIndexMentions, somentioned_outside("dead_sig", None)seesdead_sigin canonicala_link/link_a.svand suppressesunused-signal(andmodule-filenamechecks againstreal_b.svrather thanlink_a.sv). rename_traced(crates/lucisv_server/src/state/sources.rs:206) overlaysz_real/real_b.svover indexeda_link/link_a.svand refuses both fromz_real/real_b.svand fromtb/tb.svwithErr("`dut` is declared in more than one indexed file; lucisv will not guess which declaration this rename means.")(andcrates/lucisv_server/src/ports.rs:555encode_editsimilarly checksdoc.path.as_deref() == Some(path)).
- When
- Finding F3 —
#50+#51: mid-scan non-canonical symlink overmaxFileSizediverges from pre-scan opencrates/lucisv_server/src/state/rescan.rs:518-524(reconcile_open_buffers_into): When bothz_real/dut.svanda_link/dut.sv -> z_real/dut.svexceedmaxFileSize(remaining<= largeFile.threshold),a_link/dut.svis excluded byoversizeand absent fromscan.work. Openingz_real/dut.svmid-scan getspos = Noneand indexes non-canonicalz_real/dut.svinstead of canonicala_link/dut.sv(unlike pre-scanoverlay_buffers). Reproduced inqa_topo_50_mid_scan_non_canonical_symlink_over_max_file_size_matches_pre_scan(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs).
- Finding F4 —
#51: widening into lexical-earlier symlink overmaxFileSizefails to promote canonical spellingcrates/lucisv_server/src/state/rescan.rs:167(begin_widen): Whenz_real/real.sv(> maxFileSize,<= largeFile.threshold) is open in folder scope and widening intoa_link/discoversa_link/alias.sv -> z_real/real.sv,if path < existing && oversize(...).is_none()blocks promoting toa_link/alias.sv, leavingz_real/real.svinindex.files()instead ofa_link/alias.svas a fresh server does. Reproduced inqa_topo_51_widen_symlink_over_max_file_size_converges_like_fresh(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs).
- Finding F5 —
#63: threshold drop after unsaved edit indexed via widen leaves stale unsaved indexcrates/lucisv_server/src/server/large_file.rs:179-199(reclassify_large_buffers): When an unsaved edited in-scope buffer is indexed whiledoc.large == false(e.g. via widen) anddidChangeConfigurationdropslucisv.largeFile.thresholdsodoc.largeflipstrue,reclassify_large_buffersdoes not restore the on-disk record into the workspace index (stale unsaved buffer remains indexed whiledoc.large == trueuntil next save/widen/close). Reproduced inqa_topo_63_threshold_drop_after_unsaved_edit_indexed_via_widen_diverges_from_fresh(#[ignore]incrates/lucisv_server/src/server/tests/lifecycle_r2.rs).
Live OpenTitan Probe & Passing QA Coverage
- OpenTitan
/Users/lucio/repo/opentitan/hw(#63, read-only): Probed/Users/lucio/repo/lucisv/target/release/lucisv-server(persist: false, scratch env,largeFile.threshold = 50000) onhw/ip/aes/rtl/aes_reg_top.sv(55,523 B) andhw/ip/aes/rtl/aes.sv(13,993 B) across pre-scan open, post-scan open, threshold flips (20000,10000vs fresh10000,500000,50000),didClose, and folder-scope widen intohw/ip/aes/rtl. Settledworkspace/symbol,definition,references,codeLens, andlucisv/moduleHierarchymatched fresh server answers 100% (hier_files=1577, refs=2, syms=1in workspace scope);git -C /Users/lucio/repo/opentitan status --porcelainstayed clean. - Un-ignored QA checks passing:
qa_tombstones_survive_mixed_remove_add_revive_absorb_and_all_queries_match_fresh(crates/vlog_semantic/tests/workspace.rs) plusqa_topo_49_tombstone_at_zero_and_middle_navigation_symbols_hierarchy_codelens_diagnostics_completion,qa_topo_63_all_paths_and_threshold_drop_after_unsaved_edit,qa_topo_50_first_scope_passed_unreached_and_mid_scan_close, andqa_topo_51_same_name_nested_both_open_dirty_close_and_filelist_close(crates/lucisv_server/src/server/tests/lifecycle_r2.rs).
Final Gates (after last edit)
python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched)cargo fmt -p vlog_semantic -p lucisv_server -- --check-> exit0./tools/guard.sh -m 6 -t 600 -- cargo clippy --workspace --all-targets -- -D warnings-> exit0./tools/guard.sh -m 6 -t 600 -- cargo test -p vlog_semantic -p lucisv_server -p vlog_refactor -p lucisv_mcp -p vlog_linter --all-targets-> exit0(lucisv_serverunit:2061 passed; 0 failed; 53 ignored[includes 6 QA finding reproductions],e2e:106 passed; 3 ignored,grammar:3 passed,ifdef_folding:1 passed,opentitan_references:0 passed; 2 ignored;vlog_semanticworkspace:92 passed; 2 ignored+ remaining 19 binaries0 failed;vlog_linter:658unit +14lint_casespassed;vlog_refactor: all 20 binaries0 failed;lucisv_mcp: all 16 binaries0 failed).
2026-11-26 Round 2 Re-Verification (after DEV F1–F5 Fix Pass)
- Verdict:
FAIL(F1, F4, F5, and core F2/F3 scenarios pass; 2 new edge defects reproduced under adversarial F2/F3 attacks incrates/lucisv_server/src/server/tests/lifecycle_r2.rs). - Audit & Hygiene:
- Verified all 27 modified/created production
.rsfiles remain<= 600non-blank, non-comment lines beforemod tests(maxcrates/lucisv_server/src/state/discover.rs=505), with0unwrap(),expect(),panic!,unsafe, or#[allowin added/modified production lines. - Audited every
.files()andFileId(call site acrosscrates/— zero remaining dense0..files().len()or.files().enumerate()assumptions over potentially tombstoned indexes in production code. python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched).
- Verified all 27 modified/created production
- Confirmed Resolved:
- F1 (
live_files()): Allqa_topo_49_*pass; addedqa_r2_f1_multiple_tombstones_candidates_absorb_update_words_rename_and_completion(lifecycle_r2.rs) andqa_r2_f1_mcp_find_and_check_with_multiple_tombstones_preceding_live_files(crates/lucisv_mcp/src/tools/diagnostics.rs), confirmingCandidates::from_words/update_words/absorb,rename_tracedmacro-text warnings,Completion,mcp::check, andmcp::find(refs+ near-match suggestions) pass with 3 tombstones preceding live files. - F2 (core LSP handlers):
qa_topo_51_non_canonical_symlink_open_buffer_breaks_references_lint_and_renamepasses, plusqa_r2_f2_non_canonical_symlink_open_buffer_across_all_handlers_and_case_mismatchpasses for symbolhover, symbolgotoDefinition,ports::offers/resolve_for,extract::code_actions/execute,imports::offers/resolve,completionrelated_tier,callHierarchy(incoming+outgoing),design_hierarchy, and macOScase_only_mismatch(Foo.svvsfoo.sv). - F3 (simple mid-scan close) & F4 (widen symlinks):
qa_topo_50_mid_scan_non_canonical_symlink_over_max_file_size_matches_pre_scan,qa_r2_f3_mid_scan_open_dirty_symlink_and_close_mid_scan_matches_fresh(in-scope and overmaxFileSize),qa_topo_51_widen_symlink_over_max_file_size_converges_like_fresh, andqa_r2_f4_widen_symlink_pointing_outside_root_converges_like_fresh(under/over cap, closed/open outside targets) all pass. - F5 (
reclassify_large_buffers):qa_topo_63_threshold_drop_after_unsaved_edit_indexed_via_widen_diverges_from_freshandqa_r2_f5_reclassify_large_buffers_excluded_dirty_clean_and_round_trippass (cleanfalse -> truedoes 1 emptyDocument::large("")parse and leavesindex().fingerprint()/derived_fingerprint()unchanged; excluded unsaved drops from index; in-scope dirty preserves disk record acrossfalse -> trueandtrue -> false -> trueflips).
- F1 (
- Remaining / New Findings:
- Finding R2-F2 (
includes.rs:552,584&hover.rs:101) — Non-canonical symlink open buffer fails`includeresolution & macro hover narrowing:includes::resolved(crates/lucisv_server/src/includes.rs:552) andincludes::definition(:584) pass rawdoc.path.as_deref()instead ofws.index_path_for, andhover::narrowed_to_the_include_graph(crates/lucisv_server/src/hover.rs:101) filtersws.index().path(*file)viareachable.contains(p)without file-identity matching. Reproduced in#[ignore]dqa_r2_f2_symlink_include_related_macros_links_def_and_hover_narrowing: openingz_real/real_b.sv(whena_link/link_a.sv -> z_real/real_b.svis indexed alongsidea_link/link_h.svh) degradescompletionrelated_macros(sortText"5\LINK_HDR_MAC"vs"4`LINK_HDR_MAC"), returns[]fortextDocument/documentLinkand ``include`textDocument/definition`, and fails macro include-graph narrowing onSHARED_MAC `` ("defined 2 times"`). - Finding R2-F3 (
state/incremental.rs:192-203) — Mid-scandidOpen(dirty symlink)->didChange(disk)->didCloseleaves staleIN_BUFedit:Workspace::closing_affects_running_scanchecksfs::read_to_string(&target).ok().as_ref() != Some(&doc.text), returningfalseafterdidChangerestores disk text even though the earlier mid-scandidOpen(dirty)had already been absorbed into the running scan. Reproduced in#[ignore]dqa_r2_f3_mid_scan_dirty_open_reverted_and_closed_leaves_stale_index(ON_DISK = 0,IN_BUF = 1).
- Finding R2-F2 (
- Final Gates:
python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched)cargo fmt --all -- --check-> exit0./tools/guard.sh -m 6 -t 600 -- cargo clippy --workspace --all-targets -- -D warnings-> exit0./tools/guard.sh -m 6 -t 600 -- cargo test -p vlog_semantic -p lucisv_server -p vlog_refactor -p lucisv_mcp -p vlog_linter --all-targets-> exit0(lucisv_serverunit:2072 passed; 0 failed; 49 ignored[includes 2qa_r2_*#[ignore]d reproductions],e2e:106 passed; 0 failed; 3 ignored,grammar:3 passed,ifdef_folding:1 passed,opentitan_references:0 passed; 2 ignored;lucisv_mcp: all 16 binaries0 failed;vlog_linter:658unit +14lint_casespassed;vlog_refactor: all 24 binaries0 failed;vlog_semantic: all 21 binaries0 failed,workspace:92 passed; 0 failed; 2 ignored).
2026-11-26 Round 2 Closing-Pass QA Verification (after R2-F2 & R2-F3 Fixes)
- Verdict:
FAIL(both previously#[ignore]d R2-F2 and R2-F3 reproductions now pass un-ignored, anddidOpen(dirty) -> didSave(None) -> didCloseconverges, but adversarial multi-hop symlinked-directory andhas_other_document_fortwo-URI mid-scan close attacks uncover 3 concrete defects:R2-F2b,R2-F3a,R2-F3b). - Audit & Hygiene:
git status --short/git diff --stat: 35 modified + 2 untracked.rsfiles (reconcile.rs,lifecycle_r2.rs) +docs/features/index-lifecycle-r2/.- Verified all 29 modified/created production
.rsfiles remain<= 600non-blank, non-comment lines beforemod tests(maxcrates/lucisv_server/src/state/discover.rs=505,state/reconcile.rs=225,state/rescan.rs=480,state/incremental.rs=225,state/mod.rs=149,includes.rs=353,hover.rs=323), with0unwrap(),expect(),panic!,unsafe, or#[allowin added/modified production lines. python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched).
- Confirmed Resolved & New Passing QA Checks:
- R2-F2:
qa_r2_f2_symlink_include_related_macros_links_def_and_hover_narrowingruns un-ignored and passes. Added un-ignoredqa_r2_f2_multihop_transitive_symlink_headers(confirmingdocumentLink,`includedefinition,completionrelated_macrosfor transitiveH2_DEEP_MAC, andhovermacro narrowing overz_real/real_b.sv->a_link/link_h1.svh->a_link/link_h2.svh) andqa_r2_f2_multihop_symlink_directory_completion_and_hover_narrowing(confirming transitivecompletionrelated_macrosandhovermacro narrowing over symlinked directorya_link_dir -> z_real_dir, including non-canonical openz_real_dir/real_b.svand external callerrtl/caller.sv->../z_real_dir/h1.svh), all passing. - R2-F3:
qa_r2_f3_mid_scan_dirty_open_reverted_and_closed_leaves_stale_indexandr2_f3_mid_scan_dirty_reverted_and_closed_converges_across_all_scan_phasesrun un-ignored and pass. Added un-ignoredqa_r2_f3_mid_scan_dirty_open_saved_none_and_closed(coveringdidOpen(dirty) -> didSave(None) -> didClosemid-scan forin_scope_future,in_scope_past, andexcluded) andqa_r2_f3_two_symlink_uris_both_dirty_one_closed_mid_scan_converges(pos >= scan.at), all passing.
- R2-F2:
- New Findings (Reproduced as
#[ignore]d tests incrates/lucisv_server/src/server/tests/lifecycle_r2.rs):- Finding R2-F2b (
crates/lucisv_server/src/includes.rs:544-552) —resolve_for_docreturns non-canonical target for symlinked directory: Whena_link_dir -> z_real_diris a symlinked directory (a_link_dir/{real_b.sv,h1.svh,h2.svh}indexed) and the client opensz_real_dir/real_b.svcontaining`include "h1.svh",resolve_for_docreturnsgraph.resolve(doc.path.as_deref(), include)directly (z_real_dir/h1.svh) without normalizing throughws.index_path_for(...), sodocumentLinkand`includedefinitionpoint to non-canonicalz_real_dir/h1.svhinstead of canonicala_link_dir/h1.svh(diverging fromvia_canonandnav.rs). Reproduced in#[ignore]dqa_r2_f2_multihop_symlink_directory_links_and_def_return_non_canonical. - Finding R2-F3a (
crates/lucisv_server/src/state/reconcile.rs:192-194&crates/lucisv_server/src/state/incremental.rs:197-203) — closing clean canonical symlink atpos < scan.atwithhas_other_document_fordrops surviving dirty symlink buffer: When0_link/dut.sv -> z_real/dut.sv(pos < scan.at, already stepped cleanly from diskON_DISK) is opened withON_DISKalongsidez_real/dut.svwithDIRTY_Z,reconcile_open_buffers_intohandles0_link/dut.svfirst, takesif already_same { continue; }without callingscan_absorbed.record(...), and skipsz_real/dut.svviamatched_positions.insert(pos). Mid-scandidClose(0_link/dut.sv)then seesscan_absorbed == falseandhas_other == trueinclosing_affects_running_scan, returningfalseatif has_other { return false; }, so the scan finishes withON_DISKinstead of surviving openz_real/dut.sv'sDIRTY_Z. Reproduced in#[ignore]dqa_r2_f3_two_symlink_uris_one_closed_already_same_drops_surviving_dirty. - Finding R2-F3b (
crates/lucisv_server/src/state/incremental.rs:198-203) — closingdoc.large-flipped absorbed symlink withhas_other_document_forleaves stale absorbed edits: Whena_link/dut.sv(DIRTY_A, absorbed intoscanand recorded inscan_absorbed) andz_real/dut.sv(ON_DISK) are both open,didChangeflipsa_link/dut.svtodoc.large = true, anddidClose(a_link/dut.sv)runs mid-scan whilez_real/dut.svremains open,closing_affects_running_scanevaluates(!doc.large || !has_other)asfalseand returnsfalseatif has_other { return false; }. No follow-up rescan runs, leaving staleDIRTY_Afrom the closeda_link/dut.svin the finished index instead ofz_real/dut.sv'sON_DISK. Reproduced in#[ignore]dqa_r2_f3_two_symlink_uris_large_flip_one_closed_leaves_stale_index.
- Finding R2-F2b (
- Final Gates:
python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched)cargo fmt --all -- --check-> exit0./tools/guard.sh -m 6 -t 600 -- cargo clippy --workspace --all-targets -- -D warnings-> exit0./tools/guard.sh -m 6 -t 600 -- cargo test -p vlog_semantic -p lucisv_server -p vlog_refactor -p lucisv_mcp -p vlog_linter --all-targets-> exit0(lucisv_serverunit:2079 passed; 0 failed; 50 ignored[includes the 3qa_r2_*#[ignore]d reproductions],e2e:106 passed; 0 failed; 3 ignored,grammar:3 passed,ifdef_folding:1 passed,opentitan_references:0 passed; 2 ignored;lucisv_mcp: all 16 binaries0 failed;vlog_linter:658unit +14lint_casespassed;vlog_refactor: all 24 binaries0 failed;vlog_semantic: all 21 binaries0 failed,workspace:92 passed; 0 failed; 2 ignored)./tmpclean (0lucisvtemp files leftover);/Users/lucio/repo/opentitanuntouched (git status --porcelainempty).
2026-11-26 Round 2 Final QA Sign-Off (after R2-F2b, R2-F3a, R2-F3b & Cross-Platform DirId Fixes)
- Verdict:
PASS - Resolved Repros (un-ignored and passing in
crates/lucisv_server/src/server/tests/lifecycle_r2.rs):qa_r2_f2_multihop_symlink_directory_links_and_def_return_non_canonical(ok)qa_r2_f3_two_symlink_uris_one_closed_already_same_drops_surviving_dirty(ok)qa_r2_f3_two_symlink_uris_large_flip_one_closed_leaves_stale_index(ok)crates/lucisv_server/src/server/tests/lifecycle_r2.rsnow has0#[ignore]d tests.
- Edge-Case & Cross-Platform Audit:
crates/lucisv_server/src/includes.rs:544-552(resolve_for_doc):ws.index_path_for(&found)delegates toheld_path_for(found).unwrap_or_else(|| found.to_path_buf())(state/mod.rs:219-221), returningfoundunchanged whenfoundis a closed excluded header not present inself.index(and returning the indexed spelling if opened as non-large or if another symlink of the same file is indexed, while honoringcase_only_mismatch).crates/lucisv_server/src/state/incremental.rs:193-204(closing_affects_running_scan): returningtrueonself.scan_absorbed.contains(path, &target) || self.has_other_document_for(uri, path)preserves surviving dirty/clean/doc.largesymlink buffers on mid-scandidCloseacross allscan.atphases (pos < scan.atalready_sameskips,pos >= scan.at,doc.largeflips, andcase_only_mismatchisolation inhas_other_document_for) without breaking any existinglucisv_servertest.crates/lucisv_server/src/state/discover.rs:715-735andcrates/lucisv_server/src/state/reconcile.rs:206-215: non-UnixDirId(PathBuf) borrow-before-move ordering (&id/id.as_ref()beforecanonical_ids.entry(id)andadded_ids.insert(k)) passescrossfor bothx86_64-pc-windows-gnuandx86_64-unknown-linux-musl.
- Audit & Hygiene:
- Verified all 29 modified/created production
.rsfiles remain<= 600non-blank, non-comment lines beforemod tests:crates/lucisv_server/src/includes.rs(353),state/incremental.rs(221),state/discover.rs(510, max across all modified prod files),state/reconcile.rs(231), with0unwrap(),expect(),panic!(,unsafe, or#[allowin production sections. python3 tools/stamp_author.py --check-> exit0(would stamp 0 files; left 249 untouched).
- Verified all 29 modified/created production
- Final Gates (
./tools/gates.sh --only fmt,clippy,suite:vlog_semantic,suite:lucisv_server,suite:lucisv_mcp,cross, logs intarget/gates/20261126-111210):fmt->pass(exit0)clippy->pass(exit0)suite:vlog_semantic->pass(21binaries:438 passed; 0 failed; 4 ignored)suite:lucisv_server->pass(5binaries:2192 passed; 0 failed; 52 ignored; unit2082 passed; 0 failed; 47 ignored,e2e106 passed; 3 ignored,grammar3 passed,ifdef_folding1 passed,opentitan_references0 passed; 2 ignored)suite:lucisv_mcp->pass(16binaries:391 passed; 0 failed; 4 ignored)cross->pass(x86_64-pc-windows-gnu&x86_64-unknown-linux-muslforlucisv,lucisv_server,lucisv_mcp, exit0)/tmpclean;/Users/lucio/repo/opentitanuntouched (git status --porcelainempty).
Review
2026-11-26 — Lead review: PASS (Round 2 complete)
- Verified all Round 2 deliverables (
#49fast tombstones viaWorkspaceIndex::remove_file+live_files(),#50mid-scan open buffer reconciliation,#51(dev, ino)canonical symlink deduplication across handlers/includes/hover,#63least-performance-impact disk record preservation fordoc.large, andScanAbsorbedtracking + cross-platformDirIdborrow fixes) and checked thatcrates/lucisv_server/src/server/tests/lifecycle_r2.rshas 0#[ignore]d tests left. - All 29 modified/created production files stay
<= 600non-blank, non-comment lines beforemod tests, with0unwrap/expect/panic!/unsafe. - Handshakes closed in
docs/topo.md:#48(closed won't-fix per owner ruling: rely on VS Code),#49,#50,#51,#63. Full./tools/gates.sh(includingcross) and final QA sign-off gates verified green.