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]>
42 KiB
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_pathnow returns\-separated paths on Windows (C:\x.sv, not trunk'sC:/x.sv). Rust'sPathequality, hashing and ordering are component-wise on Windows, so everyHashMap<PathBuf>/BTreeMapkey andstrip_prefixbehaves the same; onlyDisplayof 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::Diskcomparison 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 treatsfile:///C%3A/xandfile:///c%3A/xas the same document. - UNC host case is preserved for the same reason (
Prefix::UNCcompares 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:\xwritesfile:///C%3A/x, which reads back asC:\x. The two name the same file; Rust'sstd::fsre-adds\\?\itself for long paths. They are notPath-equal in Rust, so a server path that is verbatim (onlystd::fs::canonicalizeproduces 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/%5Cinside a path segment decode to separators:file:///C:/a%2Fb.svreads asC:\a\b.sv, the same file asfile:///C:/a/b.sv, and%2F..%2Fis..exactly as a literal/../is — as trunk andvscode-uri'sfsPathdo. It adds no capability. (Inside the host an encoded separator is refused: F4.) localhostis 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), asvscode-urireads 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 — returnsNone, 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 asfe80--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\DavWWWRootround-trips asfile://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_uriis documented for absolute paths only.
Handshakes
- Consumes
lsp_types::Uri(fluent_uri0.x) only to validate text and readas_str(); no new dependency. - Promises (unchanged signatures):
uri::path_to_uri(&Path) -> Option<Uri>anduri::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/#fragmentno longer becomes part of the path.
- Windows: UNC shares, the four-slash form, verbatim paths and
query/fragment are now handled (table below); output paths use
- F5 — Windows index cache key changes once. On Windows the workspace
roots
uri_to_pathreturns change spelling (c:/proj→c:\proj), andindex_cache::workspace_key(index_cache.rs:735-745) hashesroot.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_mcphas nofile:URI code (its resources arelucisv://…with workspace-relative paths, and its roots arrive as--root <path>);lucisv_core,lucisvand thevlog_*crates have none either. No Handshake request filed. - Editor side:
hierarchyView.jscompares the server's definition URIs with the active editor's throughvscode.Uri.parse(...).toString(). Trunk's UNC URIs (file://///server/share/…) never matched VS Code'sfile://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 ofNATIVEfollowscfg!(windows). Windows shapes inuri/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) anduri/windows.rsunit tests. The six existing tests inuri.rsare textually untouched. mcp.js:findableacceptsC:\tools\lucisv-mcpwhenlucisv-mcp.exeis there (test inmcp_test.js).hierarchyView.js: a failing webview action warns instead of an unhandled rejection; a disposed view disposes its own listeners (tests inhierarchyView_test.js).hierarchyCurrent.js: read in full; no defect found, unchanged.- VS Code README:
lucisv.index.scopeDepthdefault, the eight missinglucisv.format.*rows, the stale "everything else ships in 0.10.2". - nvim README: references are workspace-wide,
--stdiois accepted. - Fix round (lead's rulings on QA F1–F7): F2
localhostonly before a drive, F3 no device/verbatim path read, F4 unspellable hosts refused, F1scopeDepthexample in README andpackage.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.jspasses a non-file:workspace folder'sfsPathas--root; whether VS Code ever activates this extension in a virtual workspace is not decidable from the manifest (nocapabilities.virtualWorkspaces).mcp.jschecks a relativelucisv.mcp.pathagainst the extension host's cwd while the spawn's cwd is the folder; relative paths are not documented.nvim/README.mdusesvim.lsp.buf.execute_command, which Neovim 0.11 deprecates forclient: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 whatdocs/features/lucisv-server/README.mdstill 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
%3Fgarbage, and a root-relative\rtlwrote a four-slash URI that reads back as a share. - Split
uri.rsinto aFlavor-parameterised core (encode_path,decode_uri) with the Windows shapes inuri/windows.rs;NATIVEis the onlycfg!(windows). Public signatures unchanged. Production lines (non-blank, non-comment, before tests):uri.rs81,uri/windows.rs60. - 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 --checkonly sees tracked files. - Checks run:
cargo fmt --all -- --checkclean;cargo clippy --workspace --all-targetsclean; guardedcargo test -p lucisv_server2 256 passed, 0 failed, 53 ignored (all pre-existing ignores; 18 of the passes are theuri::tests);node --test editors/vscode/*_test.js37/37 (14 files, the two edited ones gained a check function each);tools/gates.sh --only crosspass —cargo checkof thelucisv,lucisv_server,lucisv_mcpbinaries forx86_64-pc-windows-gnuandx86_64-unknown-linux-musl: compile only, no tests, no link. Additionallycargo 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::*atcrates/lucisv_server/src/state/tests/qa_walking.rs:14andthe_whole_workspace_flat is never usedatcrates/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_partsnow treatslocalhostas local only before a drive letter, takes a UNC host only throughunc_host(raw@ : [ ]refused, decoded host must bespellable), and refuses any read path the writer would refuse (writable).unc_shapeuses the samespellable, so the writer also refuses a NUL host. Production lines:uri.rs81,uri/windows.rs82. - 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, andevery_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 sharingspellable. - Posix flavour untouched (
windows.rsonly); the trunk differential and the two-delta test pass unchanged. - F1: README row and the
lucisv.index.scopeDepthmarkdownDescriptioncorrected (both wrong sentences in that description; no otherpackage.jsonchange).docs/site/src/content/docs/start/configuration.md:95andREADME.md:1064carry no example and are correct; no other copy found (grep forscopeDepthandhw/ip/aes/rtloverdocs/site/src,README.md,editors/,docs/*.md). Not edited, outside the ruling: the doc comment atcrates/lucisv_server/src/settings.rs:62says two levels turn "adv/tbor anrtlfile" into the IP block — thertlhalf is the same mistake. - Windows-only warnings:
#[cfg(unix)]onuse super::*instate/tests/qa_walking.rs(both its tests are unix-only) and onthe_whole_workspace_flatinserver/tests/startup.rs(its three users are unix-only). - Checks: fmt clean; clippy
--workspace --all-targets0 warnings; guardedcargo test -p lucisv_server2 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 crosspass; Windowscargo test --no-run --target x86_64-pc-windows-gnu -p lucisv_servercompiles and links all five test executables with 0 warnings (not run);stamp_author.py --check0 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 -- --checkis clean.cargo clippy --workspace --all-targetsreports 0 warnings, and still does after my test additions. Guardedcargo 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-ignoredthe threeqa_*tests fail as intended.node --test editors/vscode/*_test.js: 37 tests, 37 pass, 0 fail, 0 skipped.tools/gates.sh --only crosspasses.stamp_author.py --checkstamps 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.rs81 anduri/windows.rs60. Library code has nounwrap,expect,panic!,unsafeor#[allow]. - The six trunk tests are byte-identical to
36733e2, checked by diffing themod testsblock.percent_decodeis also byte-identical. - The dev's
trunkoracle module inflavor_tests.rsmatchesgit show 36733e2:…/uri.rsin substance. It drops the comments and thePath/Uriwrapping. It omits thecfg(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 thatgates.shuses, 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_uriwrites%3F/%23and they round-trip. That is covered by the fuzz and by the trunk testspaces_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 (urlcrate), 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 throughPathequality (state/buffers.rs:25open_document_for_path), so no document can be re-keyed under a second spelling.
- The clients I know of all percent-encode both characters in file paths:
VS Code (
- (b)
%5C. A\in a Unix file name now round-trips, and VS Code and Neovim both send%5C.nav.rs:109path_to_uri_or_selfre-spells a client's URI through its path. Trunk turned…/a%5Cb.svinto…/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_pathcaller (33 files) and everyHashMap<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{…},\\serverand\\?\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,CONandnulall behave as expected.- Reading
file:///%43:/x,file://%6Cocalhost/C:/x,file:///c%3a/xandfile://127.0.0.1/share/a.svworks.file:///C|/xis rejected byfluent_uribefore it reaches the decoder. - There were no panics.
- Of the URIs that read to a path, 26 001 read to one that
path_to_urithen refuses. These are mostlyfile:////xandfile://///…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:
aWindowsPathWithoutExeIsFoundfails at "win32: a directory part without .exe finds the .exe".aFailedActionIsReportedAndADisposedViewLetsGofails 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
.execandidate is added only whenprocess.platform === 'win32'. message()isasync(hierarchyView.js:264), so.catchalways 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 === viewguard 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 generatedlucisv.lint.rules.*, as the README says. - There are six
lucisv.index.*ids, as stated. - The claim that
lucisv.tomloutrankslucisv.format.*holds informat.rs:266-273. - In the nvim README, the statements about
--stdio, the two stderr lines and exit code 2 matchmain.rs:93-116. "References across the indexed workspace" matchesnav.rs:117-139. git diff editors/vscode/package.jsonis empty, and so areCargo.toml,Cargo.lock, the CHANGELOGs andTODO.md.
Findings, by severity:
-
F1 (low–medium; docs; introduced by this diff). The new
lucisv.index.scopeDepthrow ineditors/vscode/README.mdsays "2lets a file inhw/ip/aes/rtl/index all ofhw/ip/aes/". The code raises a file's own folderdepthtimes:state/scope.rs:116-133raised(), called fromopened_dirsatscope.rs:79. Depth 2 fromhw/ip/aes/rtltherefore reacheshw/ip/, which is every IP block.scope.rs:110-112says 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.
- A correct example is
-
F2 (low–medium; Windows; not a regression).
\\localhost\c$\a.svwritesfile://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 alocalhostauthority as this machine even when the path has no drive letter.vscode-urireads 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
localhostas local only before a/X:drive letter.
- Repro:
-
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\xfile://%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_shapealready 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→ writesfile://a/b/c. Neither is stable after one step.- Related:
[::1]andu@h:80hosts 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.
- Related:
-
F5 (low; Windows upgrade effect; not in Handshakes).
index_cache.rs:735-745workspace_keyhashesroot.to_string_lossy(). Roots come fromuri_to_path(main.rs:732-741,server/notification.rs:471), so a Windows root changes fromc:/projtoc:\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/%5Cinside a segment decode to separators:file:///C:/a%2Fb.sv→C:\a\b.sv, the same file asfile:///C:/a/b.sv.%2F..%2Fgives..traversal exactly as a literal/../does. This is the same as trunk and the same asvscode-urifsPath, 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.jsinside 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, anduri::is 24 passed with 0 ignored. There were no guard kills. - fmt is clean, and clippy
--workspace --all-targetsreports 0 warnings. - node: 37 pass, 0 fail, 0 skipped.
gates.sh --only crossand--only docsboth pass. Thevlog_lintervscodetests (package.jsonsync) are green.stamp_author.py --checkstamps 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.rs81,uri/windows.rs82. No unwrap/expect/panic/unsafe/#[allow]in library code.
- My three
- (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/%2Fhosts,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. - 21 427 have a
-
Dev's fuzz:
every_readable_windows_uri_is_stable_after_one_stepgenerateslocalhost,LocalHost,.,?,%2E,%3F,%2F,%5C,%00,@,:,[,]. That is rich enough to reach F2–F4. It composes fromfile://only, never from afile:////prefix with alocalhostshare, which is why it missed N1. -
Mutation check on a scratch copy, reverting each fix in turn:
- F2 (
localhostlocal everywhere) fails 3 tests, includingqa_a_localhost_share_round_trips. - F3 (
writableremoved) fails 2 tests. - F3 (namespace hosts accepted in
unc_host) survives alone, becausewritablestill refuses the result: a redundant second guard, not a gap. With both F3 mechanisms reverted, 3 tests fail, includingqa_no_uri_reads_as_a_device_path. - F4 (raw
@ : [ ]check removed) failsunspellable_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.
- F2 (
-
- (c) New refusals.
-
Every production caller handles
Nonefromuri_to_pathwithout panicking. The onlyexpectis infile_ops.rs:1633, insidemod tests(line 494). -
On
didOpen,set_document(state/buffers.rs:102-120) still stores the document under the client's URI withpath: None, exactly as for anuntitled: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) usefilter_map, so the root or event is dropped. -
Trunk read the same URIs as a host-dropped
\s\aon 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/aandfile://///srv/share/a.svread exactly as on trunk (/s/a,///srv/share/a.sv). The authority rules apply only under the Windows flavour, anddecode_uri's Posix arm is unchanged. -
Other shapes, all sane:
Input Read Written back file://LOCALHOST/c%3A/xc:\xfile:///c%3A/xfile://localhost/C|/xrejected by fluent_urifile://localhost/\\localhost\stable file://localhostNone\\localhost\C:\x(path) file://localhost/C%3A/x, which readsC:\x(N1)\\srv\c:\x(path) file://srv/c%3A/x, which reads back exactlyWebDAV \\srv@SSL\DavWWWRoot\a.sv(path) round-trips \\srv\c:\xis not a legal share name, but it is neither refused nor mangled.
-
- (d) F1.
- The corrected README row and
package.jsonexample matchstate/scope.rs:116-133raised(), which climbs from the buffer's own folder. They also matchstate/tests/folder_scope.rsa_scope_depth_of_one_reaches_the_folder_beside_it(rtl/+ 1 = the tree root). git diff editors/vscode/package.jsonis one line: thatmarkdownDescriptiononly.settings.rs:62was wrong in the same way, and I fixed the comment directly: adv/tbfile reacheshw/ip/aes, anrtlfile reacheshw/ip. It is a comment-only change and fmt is clean.
- The corrected README row and
- (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
localhostand whose share looks like a drive is written asfile://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 withfile:////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_shaperefuse hostlocalhostwith a drive-like share.
- Repro:
- N2 (info; Windows).
shape()(uri/windows.rs, the\\///match) does not recognise the mixed\/or/\UNC prefixes that Windows accepts.\/srv/share/awrites the non-canonicalfile:////srv/share/a. It still reads back as\\srv\share\a.\/srvwritesfile:////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.scopeDepthdescription (package.jsonand 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-372reads that folder flat only at depth 0, and walks it recursively at any depth ≥ 1. The testfolder_scope.rsa_rootless_session_reads_its_own_directory_flat_until_the_depth_is_raisedpins this. - So at the shipped depth 2, opening
~/x.svalone walks all of~. Trunk's advice "set it to0when you open single files on their own" was accurate, and dropping it loses a useful instruction.
- The folder part is right (
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#fragstripped), 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
Pathconversion itself has never run. - Ruling on re-QA N1: fixed by the lead —
unc_shaperefuses alocalhosthost 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
scopeDepthdescription inpackage.jsonand the README row say again that single files opened with no workspace folder want0(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/%5Cin a segment decode to separators, as invscode-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
vscodeonly. Left as features: non-file:workspace folders and a relativelucisv.mcp.pathinmcp.js. - No §2.9 rows opened or closed by this round.