Files
lucisv/docs/features/windows-uri-editors-r11
Guoliang ChenandClaude Mythos 5.2 a479faf029 Round 11: Windows UNC file URIs and editor polish
uri.rs: pure-string Posix/Windows flavours; UNC shares read and written as
file://server/share/..., verbatim paths seen through, device and
unspellable hosts refused; Posix identical to trunk except backslash
(%5C) and query/fragment stripping. Windows is compile- and link-checked
only.
Editors: mcp.js finds a directory-qualified path without .exe on Windows;
hierarchyView.js reports failed actions and disposes its listeners;
README and scopeDepth description corrections.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-26 20:04:07 -08:00
..

windows-uri-editors-r11

Goal

Round 11 of the 7–12 series (docs/rounds-7-12-handoff.md §"Round 11"): bug fixes and polish only, no features. (1) Make crates/lucisv_server/src/uri.rs read and write Windows file: URIs correctly for every path shape RFC 8089 Appendix E and VS Code use — UNC shares above all, which trunk mangled in both directions — with the Windows logic as pure string code tested on every platform, and Unix behaviour byte-identical except where trunk was provably wrong. (2) Fix the demonstrable defects and stale statements in editors/vscode/{hierarchyView.js,hierarchyCurrent.js,mcp.js,README.md} and editors/nvim/README.md.

Assumptions

  • Path separators on Windows. uri_to_path now returns \-separated paths on Windows (C:\x.sv, not trunk's C:/x.sv). Rust's Path equality, hashing and ordering are component-wise on Windows, so every HashMap<PathBuf>/BTreeMap key and strip_prefix behaves the same; only Display of a path changes (to the spelling Windows itself uses).
  • Drive-letter case is preserved, in both directions. Windows is case-insensitive, but Rust's Prefix::Disk comparison is not, and every path held for a client document comes from that client's own URIs — so keeping the client's case is what keeps one file one key. VS Code itself treats file:///C%3A/x and file:///c%3A/x as the same document.
  • UNC host case is preserved for the same reason (Prefix::UNC compares case-sensitively); hosts are case-insensitive per RFC 3986 and VS Code lowercases them when it prints a URI, so the client matches either way.
  • A verbatim path reads back as its plain spelling. \\?\C:\x writes file:///C%3A/x, which reads back as C:\x. The two name the same file; Rust's std::fs re-adds \\?\ itself for long paths. They are not Path-equal in Rust, so a server path that is verbatim (only std::fs::canonicalize produces one) does not compare equal to the client's plain path — that was already true on trunk and is unchanged.
  • The legacy file:///C|/x (pipe for colon) is not read as a drive; no current client sends it.
  • F6 (QA, recorded). Trunk's own five-slash UNC URIs (file://///srv/share/a.sv) are now refused on read (they would read as the share-less \\\srv\…). Nothing persists URIs (the cache is keyed by path), so only a URI held across an upgrade inside one live session could meet this.
  • F7 (QA, recorded; unchanged from trunk). %2F/%5C inside a path segment decode to separators: file:///C:/a%2Fb.sv reads as C:\a\b.sv, the same file as file:///C:/a/b.sv, and %2F..%2F is .. exactly as a literal /../ is — as trunk and vscode-uri's fsPath do. It adds no capability. (Inside the host an encoded separator is refused: F4.)
  • localhost is this machine only before a drive letter (file://localhost/C:/x); before anything else it is a UNC host (file://localhost/c%24/a.sv → \\localhost\c$\a.sv), as vscode-uri reads it.
  • Hosts a UNC path cannot spell back are refused on read (decision for F4): a raw authority holding @, :, [ or ] — userinfo, a port, an IPv6 literal — returns None, as does a host that decodes to empty, ., ?, or anything holding /, \ or NUL. Refusing is the simplest rule that keeps URI → path → URI fixed after one step: a UNC path has no syntax for a port or userinfo, and Windows spells an IPv6 host as fe80--1.ipv6-literal.net, not [fe80::1], so any mapping would either name a host the client did not mean or not write back. Percent-encoded @/: are ordinary host characters (WebDAV's \\srv@SSL\DavWWWRoot round-trips as file://srv%40SSL/DavWWWRoot). The writer refuses the same decoded hosts (spellable), so the two directions agree.
  • A relative path is written as on trunk (rtl\a.sv → file:///rtl/a.sv); path_to_uri is documented for absolute paths only.

Handshakes

  • Consumes lsp_types::Uri (fluent_uri 0.x) only to validate text and read as_str(); no new dependency.
  • Promises (unchanged signatures): uri::path_to_uri(&Path) -> Option<Uri> and uri::uri_to_path(&Uri) -> Option<PathBuf>. Behaviour changes callers can observe:
    • Windows: UNC shares, the four-slash form, verbatim paths and query/fragment are now handled (table below); output paths use \.
    • Unix: two deliberate changes, both fixing a wrong file being named — a \ in a file name is written %5C (trunk wrote /), and a URI's ?query/#fragment no longer becomes part of the path.
  • F5 — Windows index cache key changes once. On Windows the workspace roots uri_to_path returns change spelling (c:/proj → c:\proj), and index_cache::workspace_key (index_cache.rs:735-745) hashes root.to_string_lossy(). So each Windows workspace gets a new cache key once: one full cold rescan and an orphaned old cache directory, no corruption (the old directory is simply never read again).
  • No same bug elsewhere. crates/lucisv_mcp has no file: URI code (its resources are lucisv://… with workspace-relative paths, and its roots arrive as --root <path>); lucisv_core, lucisv and the vlog_* crates have none either. No Handshake request filed.
  • Editor side: hierarchyView.js compares the server's definition URIs with the active editor's through vscode.Uri.parse(...).toString(). Trunk's UNC URIs (file://///server/share/…) never matched VS Code's file://server/share/…, so the current-file highlight could not light a module on a share; the server fix makes them match. No JS change was needed for that.

Status / TODO

  • Establish trunk behaviour for every requested URI/path shape (table below).
  • uri.rs: Flavor (Posix/Windows) as pure string code; only the choice of NATIVE follows cfg!(windows). Windows shapes in uri/windows.rs.
  • Tests: uri/flavor_tests.rs (Windows path and URI tables, canonical fixed point, verbatim, refusals, malformed input, a 4 000-input no-panic sweep, Posix diffed against a verbatim copy of trunk, the two deliberate Posix deltas) and uri/windows.rs unit tests. The six existing tests in uri.rs are textually untouched.
  • mcp.js: findable accepts C:\tools\lucisv-mcp when lucisv-mcp.exe is there (test in mcp_test.js).
  • hierarchyView.js: a failing webview action warns instead of an unhandled rejection; a disposed view disposes its own listeners (tests in hierarchyView_test.js).
  • hierarchyCurrent.js: read in full; no defect found, unchanged.
  • VS Code README: lucisv.index.scopeDepth default, the eight missing lucisv.format.* rows, the stale "everything else ships in 0.10.2".
  • nvim README: references are workspace-wide, --stdio is accepted.
  • Fix round (lead's rulings on QA F1–F7): F2 localhost only before a drive, F3 no device/verbatim path read, F4 unspellable hosts refused, F1 scopeDepth example in README and package.json, F5–F7 recorded, the two Windows-only test warnings gated #[cfg(unix)].
  • Release note needed (lead): on Windows the persisted index cache is rebuilt once after upgrading (F5), and UNC workspaces now work.
  • Windows runtime behaviour: not executed (no Windows host, no Wine).

URI shape table — Windows flavour

"Before" is trunk 36733e2 with cfg!(windows) true (emulated line for line from the trunk source); "after" is this round, asserted in flavor_tests.rs.

Input Before After
path C:\x.sv file:///C%3A/x.sv → C:/x.sv file:///C%3A/x.sv → C:\x.sv
path c:\x.sv file:///c%3A/x.sv → c:/x.sv file:///c%3A/x.sv → c:\x.sv
path C:\rtl\dir\ file:///C%3A/rtl/dir/ same; reads back C:\rtl\dir\
path \\server\share\dir\a.sv file://///server/share/dir/a.sv → ///server/share/dir/a.sv (broken) file://server/share/dir/a.sv → \\server\share\dir\a.sv
path \\server\share file://///server/share file://server/share
path \\?\C:\rtl\a.sv file://///%3F/C%3A/rtl/a.sv (broken) file:///C%3A/rtl/a.sv → C:\rtl\a.sv
path \\?\UNC\server\share\a.sv file://///%3F/UNC/server/share/a.sv (broken) file://server/share/a.sv → \\server\share\a.sv
path \rtl\a.sv file:////rtl/a.sv → //rtl/a.sv (a UNC!) file:///rtl/a.sv → \rtl\a.sv
path C:\a b\c#d%e\f?.sv file:///C%3A/a%20b/c%23d%25e/f%3F.sv same; reads back exactly
path \\server, \\.\COM1, \\?\Volume{…}\ garbage URIs None
URI file:///C:/x.sv C:/x.sv C:\x.sv → writes file:///C%3A/x.sv
URI file:///c%3A/x.sv (VS Code) c:/x.sv c:\x.sv → writes it back unchanged
URI file://localhost/C:/x.sv C:/x.sv C:\x.sv → file:///C%3A/x.sv
URI file://server/share/dir/a.sv /share/dir/a.sv (host dropped: wrong file) \\server\share\dir\a.sv → writes it back unchanged
URI file:////server/share/a.sv //server/share/a.sv → writes file:////… \\server\share\a.sv → file://server/share/a.sv
URI file://server/share/a%20b%23%25.sv /share/a b#%.sv \\server\share\a b#%.sv → back unchanged
URI file://server/share/%C3%A9.sv /share/é.sv \\server\share\é.sv → back unchanged
URI file:///C:/x.sv?query#frag C:/x.sv?query#frag C:\x.sv
URI file://server (no path), untitled:…, invalid UTF-8 None None
URI file://localhost/c%24/a.sv \c$\a.sv (with /) \\localhost\c$\a.sv → back unchanged (fix round, F2)
URI file://./pipe/x, file://%3F/GLOBALROOT/x /pipe/x, /GLOBALROOT/x None (round 1 read \\.\pipe\x; fix round, F3)
URI file://srv%5Cshare/x.sv, file://srv%2Fshare/x.sv /x.sv None (round 1 read host+share; fix round, F4)
URI file://user@srv/…, file://srv:445/…, file://[::1]/… /… (host dropped) None (F4 decision)
URI file:////x, file://///srv/share/a.sv //x, ///srv/… None (no share / share-less host)

URI shape table — Posix flavour

Byte-identical to trunk over 12 paths and 15 URIs (the_posix_flavour_is_byte_identical_to_trunk, against a verbatim copy of trunk's code), except:

Input Before After
path /tmp/a\b.sv file:///tmp/a/b.sv (names /tmp/a/b.sv) file:///tmp/a%5Cb.sv (round-trips)
URI file:///a.sv?q#f /a.sv?q#f /a.sv

file://server/share/a.sv still reads as /share/a.sv on Unix, as on trunk (no POSIX spelling reaches a remote host).

Canonical form

What the server writes is the form VS Code writes, so a URI the server sends back compares equal to the client's: file://<host>/<share>/… for a UNC path (never the four-slash form), file:///<drive>%3A/… for a drive path with the drive letter as the path spells it (trunk already wrote %3A, so no client that worked before sees a different string), and file:///… unchanged for Unix. Everything outside A–Z a–z 0–9 - . _ ~ / is percent-encoded with upper-case hex, as on trunk. A canonical URI is a fixed point of URI → path → URI (asserted for every row).

Editor audit items

The audit (docs/repository-analysis.md) names no concrete item for these five files — its only editor line is the inventory at line 63 — and TODO.md/docs/topo.md §2.9 have no open row naming them. Each fix below is therefore a defect found by reading, with its evidence:

File Defect Evidence
mcp.js findable On Windows a lucisv.mcp.path like C:\tools\lucisv-mcp was refused ("not found") although the spawn runs lucisv-mcp.exe the bare-name branch already tried .exe; the directory branch did not. aWindowsPathWithoutExeIsFound fails on trunk's mcp.js
hierarchyView.js A webview action that throws (open a definition whose file was deleted) was an unhandled rejection: VS Code ignores the listener's promise, the user saw nothing aFailedActionIsReportedAndADisposedViewLetsGo: on trunk the promise rejects
hierarchyView.js Each resolveWebviewView pushed its two listeners onto context.subscriptions, so a view VS Code disposed and resolved again left them behind until deactivation same test: on trunk the subscription count grows by 2 and nothing is disposed with the view
vscode/README.md:340 lucisv.index.scopeDepth default given as 0 package.json and settings.rs DEFAULT_SCOPE_DEPTH are 2 (changed 2026-08-28)
vscode/README.md:348, vscode/package.json:774 (fix round, QA F1) "2 lets a file in hw/ip/aes/rtl/ index all of hw/ip/aes/" (round 1 copied it from package.json); package.json also said a rootless session should set 0 state/scope.rs raised() climbs the file's own folder depth times, so rtl/ reaches hw/ip/; the true example is settings.rs:57-63 (hw/ip/aes/dv/tb/ → hw/ip/aes/). raised() returns the folder unchanged when there are no roots, so a rootless session never climbs
vscode/README.md Settings The eight lucisv.format.* overrides (begin, else, elseAfterLabel, portLists, listIndent, alignment, connectionAlignMin, uvmUtilsIndent) were missing from the table package.json contributes them; rows written from their own descriptions
vscode/README.md:361 "everything else ships in 0.10.2" lucisv.mcp.*, lucisv.hierarchy.*, lucisv.format.* and others shipped later (CHANGELOG)
nvim/README.md:99 "gr (references, in-file only for now)" nav.rs::references is workspace-wide; CHANGELOG 0.12.0/0.55.0
nvim/README.md --verbose "The server takes one argument … anything other than --verbose is refused … one usage line" main.rs verbose_flag also accepts --stdio; two stderr lines (error: unknown option, usage)

Every other README claim checked against code (all 119 contributed setting ids and defaults by script, the 8 commands, the five read-only MCP tools, the nine tools, the capabilities nvim/README.md lists, positionEncoding utf-16, the lucisv.instantiate argument order) matched.

Left alone, as features or as unprovable from this repository:

  • mcp.js passes a non-file: workspace folder's fsPath as --root; whether VS Code ever activates this extension in a virtual workspace is not decidable from the manifest (no capabilities.virtualWorkspaces).
  • mcp.js checks a relative lucisv.mcp.path against the extension host's cwd while the spawn's cwd is the folder; relative paths are not documented.
  • nvim/README.md uses vim.lsp.buf.execute_command, which Neovim 0.11 deprecates for client:exec_cmd; it still works and is Neovim's API, not ours.
  • nvim/README.md "the workspace index rebuilds on save" — the index now updates one file on save rather than rebuilding, but the staleness model it describes (cross-file answers as of the last write) is what docs/features/lucisv-server/README.md still states; left as is.

Work log

2026-11-26 (dev). Read CLAUDE.md, the handoff's Round 11, topo lucisv_server and §2.9, the audit. Traced every uri_to_path/path_to_uri caller: documents are keyed by the client's own Uri, and the server's written URIs go out in locations/edits, so the written form must match the client's spelling — hence VS Code's form as canonical.

  • Emulated trunk's Windows branch line for line to get the "before" column; UNC was broken both ways (five-slash URIs written, host dropped on read), verbatim paths wrote %3F garbage, and a root-relative \rtl wrote a four-slash URI that reads back as a share.
  • Split uri.rs into a Flavor-parameterised core (encode_path, decode_uri) with the Windows shapes in uri/windows.rs; NATIVE is the only cfg!(windows). Public signatures unchanged. Production lines (non-blank, non-comment, before tests): uri.rs 81, uri/windows.rs 60.
  • The two Unix deltas are deliberate and pinned by the_two_deliberate_posix_changes_against_trunk; everything else is diffed against a verbatim copy of trunk's code.
  • Editor fixes as in the table above; each JS test was run against trunk's file (copied to a scratch directory) and fails there.
  • Stamp headers/footers on the three new files (uri/windows.rs, uri/flavor_tests.rs, this README) written by hand in the repository's convention; stamp_author.py --check only sees tracked files.
  • Checks run: cargo fmt --all -- --check clean; cargo clippy --workspace --all-targets clean; guarded cargo test -p lucisv_server 2 256 passed, 0 failed, 53 ignored (all pre-existing ignores; 18 of the passes are the uri:: tests); node --test editors/vscode/*_test.js 37/37 (14 files, the two edited ones gained a check function each); tools/gates.sh --only cross pass — cargo check of the lucisv, lucisv_server, lucisv_mcp binaries for x86_64-pc-windows-gnu and x86_64-unknown-linux-musl: compile only, no tests, no link. Additionally cargo test --no-run --target x86_64-pc-windows-gnu -p lucisv_server (rustup stable + Homebrew mingw) compiles and links all five test executables; they were not run.
  • Seen while doing that, not mine to fix (files outside this round's scope): the Windows test build warns unused import: super::* at crates/lucisv_server/src/state/tests/qa_walking.rs:14 and the_whole_workspace_flat is never used at crates/lucisv_server/src/server/tests/startup.rs:66 — unix-only tests leaving their helpers unused on Windows.

2026-11-26 (dev, fix round — lead's rulings on the QA log).

  • F2/F3/F4 in uri/windows.rs: path_from_parts now treats localhost as local only before a drive letter, takes a UNC host only through unc_host (raw @ : [ ] refused, decoded host must be spellable), and refuses any read path the writer would refuse (writable). unc_shape uses the same spellable, so the writer also refuses a NUL host. Production lines: uri.rs 81, uri/windows.rs 82.
  • QA's three qa_* tests: #[ignore] removed, assertions unchanged, they pass. New: unspellable_hosts_and_shapes_are_refused_on_read, localhost_is_local_only_before_a_drive_letter, and every_readable_windows_uri_is_stable_after_one_step (100 000 generated URI texts from 34 pieces — separators, localhost, drives, ., ?, %2F, %5C, %00, %FF, @, :, [, ], UTF-8, query/fragment; asserts that every one that reads to a path reads to a path the writer writes, that the written URI reads back to the same path, and that writing again gives the same URI; 0 exceptions, and it asserts more than 5 000 of them were readable). Its first run found a case the rulings did not name (file:////h%00…: a NUL host reached through the four-slash form), fixed by sharing spellable.
  • Posix flavour untouched (windows.rs only); the trunk differential and the two-delta test pass unchanged.
  • F1: README row and the lucisv.index.scopeDepth markdownDescription corrected (both wrong sentences in that description; no other package.json change). docs/site/src/content/docs/start/configuration.md:95 and README.md:1064 carry no example and are correct; no other copy found (grep for scopeDepth and hw/ip/aes/rtl over docs/site/src, README.md, editors/, docs/*.md). Not edited, outside the ruling: the doc comment at crates/lucisv_server/src/settings.rs:62 says two levels turn "a dv/tb or an rtl file" into the IP block — the rtl half is the same mistake.
  • Windows-only warnings: #[cfg(unix)] on use super::* in state/tests/qa_walking.rs (both its tests are unix-only) and on the_whole_workspace_flat in server/tests/startup.rs (its three users are unix-only).
  • Checks: fmt clean; clippy --workspace --all-targets 0 warnings; guarded cargo test -p lucisv_server 2 262 passed, 0 failed, 53 ignored (unit 2152/0/48, e2e 106/0/3, grammar 3, ifdef_folding 1, opentitan_references 0/0/2); uri:: 24 passed, 0 ignored; node 37/37, 0 skipped; gates.sh --only cross pass; Windows cargo test --no-run --target x86_64-pc-windows-gnu -p lucisv_server compiles and links all five test executables with 0 warnings (not run); stamp_author.py --check 0 files.

QA log

2026-11-26 (QA). Verdict: PASS with findings. Nothing blocks the round. F1 is a documentation error this diff introduced. F2–F4 are Windows edge shapes: none is a regression for a real VS Code session against trunk, and each is pinned by a deliberately failing, #[ignore]d qa_* test in uri/flavor_tests.rs. Windows runtime is unverified: there is no Windows host and no Wine.

What was run:

  • cargo fmt --all -- --check is clean. cargo clippy --workspace --all-targets reports 0 warnings, and still does after my test additions. Guarded cargo test -p lucisv_server (-m 8 -t 600): 2 256 passed, 0 failed, 53 ignored. That matches the dev's count, and there were no guard kills. After my additions, uri:: gives 18 passed and 3 ignored; with --include-ignored the three qa_* tests fail as intended.
  • node --test editors/vscode/*_test.js: 37 tests, 37 pass, 0 fail, 0 skipped. tools/gates.sh --only cross passes.
  • stamp_author.py --check stamps 0 files. I also checked the stamps on the three new files by hand: header and footer are both present.
  • Production lines (non-blank, non-comment, before #[cfg(test)]): uri.rs 81 and uri/windows.rs 60. Library code has no unwrap, expect, panic!, unsafe or #[allow].
  • The six trunk tests are byte-identical to 36733e2, checked by diffing the mod tests block. percent_decode is also byte-identical.
  • The dev's trunk oracle module in flavor_tests.rs matches git show 36733e2:…/uri.rs in substance. It drops the comments and the Path/Uri wrapping. It omits the cfg(windows) drive branch, which is correct for a Posix oracle.
  • Windows cross-build: cargo test --no-run --target x86_64-pc-windows-gnu -p lucisv_server, using the rustup toolchain that gates.sh uses, built and linked all 5 test executables. The only two warnings are the pre-existing ones the dev named (state/tests/qa_walking.rs:14, server/tests/startup.rs:66). Both files are untouched by this diff. The executables were not run.

Posix differential (independent harness). I built a scratch crate containing trunk's uri.rs extracted with git show and the new uri.rs/uri/windows.rs copied unchanged, linked against lsp-types 0.97.0/fluent-uri 0.1.4. The inputs were 400 000 generated paths, plus 539 832 URI texts tried both raw and after Uri::from_str. The generators used ASCII punctuation including % # ? \ : space, non-ASCII text, .., //, trailing /, valid, invalid and mixed-case %XX escapes, NUL, DEL, file://host/, localhost, LOCALHOST, file:/, FILE:///, four- and five-slash forms, IPv4, IPv6 and userinfo hosts, and untitled:.

Result: 0 undeclared differences. Every path diff is exactly \→%5C, and every URI diff is exactly the ?/# cut. There were also 0 round-trip failures for absolute paths.

I judged the two deliberate changes on their merits:

  • (a) Stripping ?/#. path_to_uri writes %3F/%23 and they round-trip. That is covered by the fuzz and by the trunk test spaces_and_specials_are_percent_encoded.
    • The clients I know of all percent-encode both characters in file paths: VS Code (vscode-uri), Neovim (vim.uri_from_fname, RFC 3986 set), Helix (url crate), eglot and Kate. This comes from reading their source in the past, not from running them here. An unencoded ? meant a query on trunk as well; trunk merely misread it.
    • Documents are keyed by the client's own Uri. Path-to-document lookups go through Path equality (state/buffers.rs:25 open_document_for_path), so no document can be re-keyed under a second spelling.
  • (b) %5C. A \ in a Unix file name now round-trips, and VS Code and Neovim both send %5C.
    • nav.rs:109 path_to_uri_or_self re-spells a client's URI through its path. Trunk turned …/a%5Cb.sv into …/a/b.sv, which named a different file. The new code keeps %5C, so this is a fix, not a risk.
    • I grepped every path_to_uri/uri_to_path caller (33 files) and every HashMap<Uri,…>/HashSet<Uri>. None compares a server-written URI string with a client string.

Windows flavour (independent table and 400 000-input fuzz). I derived the expectations from RFC 8089 Appendix E and from vscode-uri's URI.file/fsPath. The vscode-uri behaviour comes from knowledge of its source; I did not run it.

  • Every row of the dev's before/after table reproduces, including the "before" column when trunk runs under emulated cfg!(windows).
  • Every absolute, non-relative path the writer accepts reads back as its canonical spelling (/→\, verbatim prefix dropped). I found no aliases and no invalid URIs.
  • Writing is refused for \\.\COM1, \\?\Volume{…}, \\server and \\?\UNC\srv.
  • C:, C:x.sv, C:/mixed\seps, //server/share, \\srv\c$\x, \\?\UNC\srv\c$\x, IPv4 hosts, dotted hosts, spaces, $, trailing dots and spaces, CON and nul all behave as expected.
  • Reading file:///%43:/x, file://%6Cocalhost/C:/x, file:///c%3a/x and file://127.0.0.1/share/a.sv works. file:///C|/x is rejected by fluent_uri before it reaches the decoder.
  • There were no panics.
  • Of the URIs that read to a path, 26 001 read to one that path_to_uri then refuses. These are mostly file:////x and file://///… shapes with no share. 39 URIs were unstable after one step, all in classes F2 and F4.

I checked the claim that \ separators are harmless by reading the code. is_excluded (lucisv_core/src/walk.rs:490) works on components, and includes.rs:273/342/446 folds a to_str() key. That key now agrees with walk-discovered paths, which always used \ (better than trunk). The include spelling replaces \ (file_ops.rs:345). I found no rsplit('/'), contains('/') or string-prefix work on URI-derived paths. One observable change is F5.

JS. On a scratch copy of editors/vscode with trunk's mcp.js and hierarchyView.js restored:

  • aWindowsPathWithoutExeIsFound fails at "win32: a directory part without .exe finds the .exe".
  • aFailedActionIsReportedAndADisposedViewLetsGo fails at the subscription-count assert. With that assert removed it fails at "the promise VS Code drops never rejects" (rejected). So both halves of the test are real.
  • The .exe candidate is added only when process.platform === 'win32'.
  • message() is async (hierarchyView.js:264), so .catch always has a promise to attach to. The catch covers only this one listener and warns once per rejection. A normal or cancelled action resolves and does not warn.
  • A re-resolved view gets fresh listeners, and the this.view === view guard keeps a late dispose of the old view from clearing the new one.
  • The listeners are no longer on context.subscriptions. They therefore rely on VS Code disposing the view at deactivation, which it does as far as I know. I did not verify this in VS Code.

READMEs.

  • I wrote a script to compare the settings table with package.json. All 44 rows exist, with matching defaults, types and enums. The 75 ids without a row are the generated lucisv.lint.rules.*, as the README says.
  • There are six lucisv.index.* ids, as stated.
  • The claim that lucisv.toml outranks lucisv.format.* holds in format.rs:266-273.
  • In the nvim README, the statements about --stdio, the two stderr lines and exit code 2 match main.rs:93-116. "References across the indexed workspace" matches nav.rs:117-139.
  • git diff editors/vscode/package.json is empty, and so are Cargo.toml, Cargo.lock, the CHANGELOGs and TODO.md.

Findings, by severity:

  • F1 (low–medium; docs; introduced by this diff). The new lucisv.index.scopeDepth row in editors/vscode/README.md says "2 lets a file in hw/ip/aes/rtl/ index all of hw/ip/aes/". The code raises a file's own folder depth times: state/scope.rs:116-133 raised(), called from opened_dirs at scope.rs:79. Depth 2 from hw/ip/aes/rtl therefore reaches hw/ip/, which is every IP block. scope.rs:110-112 says so itself ("raise … into ~/work/chip/hw/ip/").

    • A correct example is settings.rs:57-63: hw/ip/aes/dv/tb/ → hw/ip/aes/.
    • The wrong example was copied from package.json's description of the same setting. That description predates this round and is outside its scope; it is reported here, not edited.
  • F2 (low–medium; Windows; not a regression). \\localhost\c$\a.sv writes file://localhost/c%24/a.sv, which reads back as \c$\a.sv: a root-relative path on the current drive, so a different file.

    • Repro: qa_a_localhost_share_round_trips.
    • Cause: path_from_parts (uri/windows.rs:41-50) treats a localhost authority as this machine even when the path has no drive letter. vscode-uri reads the same URI as \\localhost\c$\a.sv.
    • So a folder VS Code opened through a localhost share gets server locations that name the wrong path. This contradicts "the canonical form is VS Code's" and the no-alias property.
    • Trunk was broken for every UNC path, so this is not worse than trunk.
    • Suggestion: treat localhost as local only before a /X: drive letter.
  • F3 (low; Windows; new reachable shape). The reader turns host . or ? into device or verbatim namespace paths that the writer refuses:

    • file://./PhysicalDrive0/ → \\.\PhysicalDrive0\
    • file://./pipe/x → \\.\pipe\x
    • file://%3F/GLOBALROOT/x → \\?\GLOBALROOT\x

    Trunk read these as /PhysicalDrive0/ and similar. A workspace folder or watched-file URI of this shape would make the server open a device or named pipe. Only the client can send one, so the risk is low.

    • Repro: qa_no_uri_reads_as_a_device_path.
    • Suggestion: refuse these hosts on read, as unc_shape already does on write.
  • F4 (low; Windows). The authority is percent-decoded without refusing separators. file://srv%5Cshare/x.sv → \\srv\share\x.sv: the host becomes host plus share. file://a%2Fb/c → \\a/b\c → writes file://a/b/c. Neither is stable after one step.

    • Related: [::1] and u@h:80 hosts write back percent-encoded (file://%5B%3A%3A1%5D/…) rather than as the client spelled them. Windows UNC takes no IPv6 literals anyway.
    • Repro: qa_an_encoded_separator_is_not_a_host_boundary.
  • F5 (low; Windows upgrade effect; not in Handshakes). index_cache.rs:735-745 workspace_key hashes root.to_string_lossy(). Roots come from uri_to_path (main.rs:732-741, server/notification.rs:471), so a Windows root changes from c:/proj to c:\proj. Every Windows user's persisted index cache key changes once. The result is one cold rescan and an orphaned old cache directory, not corruption. It is worth a line in Handshakes and the CHANGELOG.

  • F6 (info). Trunk's own five-slash UNC URIs (file://///srv/share/a.sv) now read as \\\srv\share\a.sv, which the writer refuses. I found no place where URIs are persisted (the cache is keyed by path), so only a URI held across an upgrade inside one live session could hit this.

  • F7 (info; unchanged from trunk). %2F/%5C inside a segment decode to separators: file:///C:/a%2Fb.sv → C:\a\b.sv, the same file as file:///C:/a/b.sv. %2F..%2F gives .. traversal exactly as a literal /../ does. This is the same as trunk and the same as vscode-uri fsPath, and it adds no capability.

Not verified:

  • Windows runtime: no host, no Wine, test executables not run.
  • Real VS Code, Neovim and other clients: their URI spellings come from knowledge of their source, not from running them.
  • hierarchyView.js inside a real VS Code.

Scratch directory removed. git -C /Users/lucio/repo/opentitan status --porcelain is empty.

2026-11-26 (QA, re-QA of the fix round). Verdict: PASS with findings. F1–F4 are fixed, and each fix is caught by a test. F5–F7 are recorded. Three new low or info findings are below: one shape the "fixed after one step" claim misses, one mixed-separator writer gap, and one incomplete sentence in the reworded scopeDepth description. None of them blocks the round. Windows runtime remains unverified.

  • (a) Gates.
    • My three qa_* tests are un-ignored, their assertions are unchanged (checked by reading them), and they pass.
    • Guarded cargo test -p lucisv_server: 2 262 passed, 0 failed, 53 ignored. The unit tests are 2152/0/48, and uri:: is 24 passed with 0 ignored. There were no guard kills.
    • fmt is clean, and clippy --workspace --all-targets reports 0 warnings.
    • node: 37 pass, 0 fail, 0 skipped. gates.sh --only cross and --only docs both pass. The vlog_linter vscode tests (package.json sync) are green. stamp_author.py --check stamps 0 files.
    • The Windows cargo test --no-run --target x86_64-pc-windows-gnu -p lucisv_server, built with the rustup toolchain, links all 5 executables with 0 warnings. Both #[cfg(unix)] gates are correct: every user of the gated items is unix-only.
    • Production lines: uri.rs 81, uri/windows.rs 82. No unwrap/expect/panic/unsafe/#[allow] in library code.
  • (b) Harness. I re-ran my scratch harness on the new files (fresh trunk extract, new files copied unchanged).
    • Posix: 400 000 paths and 545 943 URIs show 0 undeclared differences and 0 round-trip failures. The two declared deltas are still the only ones.

    • Windows: 400 000 paths plus 231 941 readable URIs, raw and validated. The generators now add localhost/LOCALHOST/%6Cocalhost, ., %2E, %3F, %40, %5C/%2F hosts, srv:445, [::1], u@h, WebDAV and \\localhost\C:\ heads.

    • 0 read paths the writer refuses, 0 invalid URIs written, and no panics.

    • 1 URI unstable after one step (N1 below). Every path→URI→path failure belongs to a class that names an illegal Windows path:

      • 21 427 have a \\localhost\X:… drive-like share (N1);
      • the rest are \C:… root-relative names, or \/… mixed-separator shapes (N2).

      : cannot appear in a Windows file or share name, so none of these is a real file.

    • Dev's fuzz: every_readable_windows_uri_is_stable_after_one_step generates localhost, LocalHost, ., ?, %2E, %3F, %2F, %5C, %00, @, :, [, ]. That is rich enough to reach F2–F4. It composes from file:// only, never from a file://// prefix with a localhost share, which is why it missed N1.

    • Mutation check on a scratch copy, reverting each fix in turn:

      • F2 (localhost local everywhere) fails 3 tests, including qa_a_localhost_share_round_trips.
      • F3 (writable removed) fails 2 tests.
      • F3 (namespace hosts accepted in unc_host) survives alone, because writable still refuses the result: a redundant second guard, not a gap. With both F3 mechanisms reverted, 3 tests fail, including qa_no_uri_reads_as_a_device_path.
      • F4 (raw @ : [ ] check removed) fails unspellable_hosts_and_shapes_are_refused_on_read.
      • F4 (separators accepted in the host) fails 3 tests, including qa_an_encoded_separator_is_not_a_host_boundary.
  • (c) New refusals.
    • Every production caller handles None from uri_to_path without panicking. The only expect is in file_ops.rs:1633, inside mod tests (line 494).

    • On didOpen, set_document (state/buffers.rs:102-120) still stores the document under the client's URI with path: None, exactly as for an untitled: buffer. Lint and format run on its text, and it has no on-disk identity.

    • Workspace folders (main.rs:734, notification.rs:472) and watched files (notification.rs:199) use filter_map, so the root or event is dropped.

    • Trunk read the same URIs as a host-dropped \s\a on the current drive, a wrong and possibly real file. Refusing degrades no worse than that.

    • On Posix, file://u@h:80/s/a, file://[::1]/s/a and file://///srv/share/a.sv read exactly as on trunk (/s/a, ///srv/share/a.sv). The authority rules apply only under the Windows flavour, and decode_uri's Posix arm is unchanged.

    • Other shapes, all sane:

      Input Read Written back
      file://LOCALHOST/c%3A/x c:\x file:///c%3A/x
      file://localhost/C|/x rejected by fluent_uri
      file://localhost/ \\localhost\ stable
      file://localhost None
      \\localhost\C:\x (path) file://localhost/C%3A/x, which reads C:\x (N1)
      \\srv\c:\x (path) file://srv/c%3A/x, which reads back exactly
      WebDAV \\srv@SSL\DavWWWRoot\a.sv (path) round-trips

      \\srv\c:\x is not a legal share name, but it is neither refused nor mangled.

  • (d) F1.
    • The corrected README row and package.json example match state/scope.rs:116-133 raised(), which climbs from the buffer's own folder. They also match state/tests/folder_scope.rs a_scope_depth_of_one_reaches_the_folder_beside_it (rtl/ + 1 = the tree root).
    • git diff editors/vscode/package.json is one line: that markdownDescription only.
    • settings.rs:62 was wrong in the same way, and I fixed the comment directly: a dv/tb file reaches hw/ip/aes, an rtl file reaches hw/ip. It is a comment-only change and fmt is clean.
  • (e) README. The before/after rows for the new refusals, the IPv6 and userinfo decision, the F5 handshake, the "Release note needed" item, and F6/F7 under Assumptions are all present and accurate. One exception: the "fixed after one step" claim, see N1.

New findings:

  • N1 (low; Windows; illegal names only). A UNC path whose host is localhost and whose share looks like a drive is written as file://localhost/X%3A/…. That reads back as the local drive path.
    • Repro: file:////localhost/C:/x.sv (a valid URI) → \\localhost\C:\x.sv → file://localhost/C%3A/x.sv → C:\x.sv. The same happens with file:////localhost/a:x.
    • This is a counterexample to "URI → path → URI is fixed after one step" (uri/windows.rs:10-11, Assumptions).
    • No real file is affected, because a share name cannot contain :.
    • Suggested fix: writable/unc_shape refuse host localhost with a drive-like share.
  • N2 (info; Windows). shape() (uri/windows.rs, the \\/// match) does not recognise the mixed \/ or /\ UNC prefixes that Windows accepts.
    • \/srv/share/a writes the non-canonical file:////srv/share/a. It still reads back as \\srv\share\a.
    • \/srv writes file:////srv, which the reader refuses.
    • Paths from client URIs and walks never take this spelling.
  • N3 (low; docs; fix-round change). The reworded end of the lucisv.index.scopeDepth description (package.json and the README row) says that with no workspace folder "a lone file indexes its own folder whatever this is set to".
    • The folder part is right (scope.rs:117-119). The read is not: discover.rs:360-372 reads that folder flat only at depth 0, and walks it recursively at any depth ≥ 1. The test folder_scope.rs a_rootless_session_reads_its_own_directory_flat_until_the_depth_is_raised pins this.
    • So at the shipped depth 2, opening ~/x.sv alone walks all of ~. Trunk's advice "set it to 0 when you open single files on their own" was accurate, and dropping it loses a useful instruction.

Not verified: Windows runtime; real-client URI spellings (Neovim, Emacs or Java UNC forms, from knowledge of their source only).

Scratch directory removed. opentitan status --porcelain is empty.

Review

2026-11-26 — lead: accepted after one fix round, a re-QA, and two small lead edits.

  • Delivered: Windows UNC file: URIs read and written in VS Code's form (file://server/share/…), verbatim paths seen through, device and unspellable hosts refused. The Posix flavour is trunk's except the two declared fixes (\ written %5C; ?query#frag stripped), confirmed by QA's own differential over ~950k inputs, twice.
  • Windows is compile- and link-checked only. No Windows host or Wine was available; every Windows rule was tested as string code on macOS. The Path conversion itself has never run.
  • Ruling on re-QA N1: fixed by the lead — unc_shape refuses a localhost host whose share is drive-shaped (\\localhost\C:\x, not a legal share), so the four-slash spelling no longer changes meaning after one step (a_localhost_share_named_like_a_drive_is_refused).
  • Ruling on re-QA N3: fixed by the lead — the scopeDepth description in package.json and the README row say again that single files opened with no workspace folder want 0 (any higher value reads the folder recursively, discover.rs:360-372).
  • Accepted limits: N2 (mixed \/ UNC prefixes are not canonicalised; no client or walk produces them); F6 (trunk's own five-slash URIs are refused; never persisted); F7 (%2F/%5C in a segment decode to separators, as in vscode-uri); URIs with a port, userinfo or IPv6 literal are refused on Windows — the document stays open as a pathless buffer, where trunk read a wrong path.
  • Release note owed (F5): on Windows a workspace root's spelling changes, so its saved index cache is rebuilt once and the old directory is orphaned.
  • Editor items: the audit named nothing concrete for these files; the three JS fixes and the README corrections are defects shown by a failing test on trunk's file or by the contradicting code. Tested against stubbed vscode only. Left as features: non-file: workspace folders and a relative lucisv.mcp.path in mcp.js.
  • No §2.9 rows opened or closed by this round.