dynamic-types: queues ($ as an expression primary -- one grammar
addition and [$], [$:N], q[$-1] all fall out of existing machinery),
dynamic [] and wildcard [*] dims (DimKind, the round's one
non-additive AST change: three consumers, all updated), empty {}
literals, named call arguments f(.a(x)) as ExprKind::NamedArg,
case ... inside with range labels, bare @event sensitivities (also
fixing a pre-existing invented-parens refusal), and macro items
before ident-dot statements. Everything structural, nothing
verbatim; verify.rs and fence.rs byte-identical. Corpus 578 ->
636/820 formattable (70.5% -> 77.6%), parse-error 242 -> 184, 58
gained / 0 lost by path, all 636 round-tripped, all 578 previously-
formattable files byte-compared old-vs-new with zero differences.
Two newly-reachable comment drops fixed in-round (one pre-existing,
one this round's own new code -- split documented honestly post-QA).
New top blockers: interface (25), the `else head-swap (13).
one-parse: LintContext::from_parse accepts pre-built parse products
(Backing enum forced by SourceFile: !Clone; new() stays a one-line
wrapper -- all 12 rule files byte-untouched); ParsedSource::parse
lexes once; vfmt check parses once per file; the server lints from
Document's own products, eliminating the per-keystroke second parse.
Behavior identity proven at the byte level (2.4MB corpus JSON, 13
server publishes, corpus-wide --fix); check --threads 1 20% faster,
server didChange latency roughly halved. protected_regions left
alone per its documented anti-drift signature. Lead fixes on
acceptance: the from_parse contract-cost doc sentence, and a stale-
tree guard test in the server (QA's sabotage passed all 773 tests --
nothing pinned text/tree agreement; now one test does, through the
merged diagnostics path where the stale warning actually lives).
791 workspace tests. Dev: 2 Fable agents; QA: 2 Opus agents; reviews
in docs/features/{dynamic-types,one-parse}/README.md.
Co-Authored-By: Claude Fable 5 <[email protected]>
one-parse
Goal
TODO §4's "one parse, two tools", delivered on the linter side: parse a file
once and lint from those products, instead of every consumer re-lexing and
re-parsing text somebody already parsed. LintContext gains a constructor
that accepts pre-built parse products; vfmt check builds the products once
per file; and vfmt_server — which already holds a fully analyzed Document
per buffer — lints from that document's own tokens and tree rather than
paying two extra lexes and an extra tolerant parse per keystroke. Behavior is
the hard gate: every finding, position, fix, diagnostic and exit code is
byte-identical to before; only duplicated work is removed.
Assumptions
- Behavior identity over speed. Anywhere "share the parse" and "identical
output" could conflict, identity wins. Concretely: on a file that fails to
lex, the shared-parse paths fall back to
parse_source_tolerant(which re-lexes the rare broken file once more) rather than hand-rolling the lex-error tree, so the tree and diagnostics are the old code path's own. - The token stream and the tree are two products, and the parser consumes
its tokens.
parse_tolerant(tokens, source)takesVec<Token>by value, so a consumer that needs both (the linter does: waivers and text rules read tokens, AST rules read the tree) clones the token vector once. One clone is cheaper than the lex it replaces, and changingvlog_parser's signature is out of scope (that crate is another round's). SourceFileis notClone. This is what forces the borrowing design below: the server'sDocumentowns one tree that must serve semantics, diagnostics and linting, so the lint context has to borrow it —std::borrow::Cowcannot hold a non-Clonetype, and a per-request tree clone is exactly the duplicated work this round removes.- Parse diagnostics are not a lint product. No rule reads them
(
LintContext::newalways discarded them), sofrom_parsedoes not take them andParsedSourcedoes not store them. The server, which does publish them, keeps them where they always were: onDocument. - The
--fixloop's per-round re-parse is inherent. Each round rewrites the text, and products of the old text describe nothing. Only the first round ofvfmt check --fix(and all of a plainvfmt check) saves work. - Per-change recompute stays the server's model. This round removes
duplicate work within one change/request; it adds no caching or
invalidation machinery beyond what
Documentalready is (TODO §6: "per-file recompute is fine at Verilog file sizes").
Handshakes
Promised by vlog_linter (additive; everything previously public is
unchanged in behavior):
LintContextis nowLintContext<'a>. Rule authors are untouched: theRule::check(&self, ctx: &LintContext)signature, and every accessor (source(),tokens(),file(),line_index(), ...), read exactly as before — the lifetime elides.pub fn LintContext::from_parse(source: &'a str, tokens: &'a [Token], file: &'a SourceFile, line_index: &'a LineIndex, path: Option<PathBuf>) -> LintContext<'a>— the pre-built-products constructor linter-core's Handshakes predicted. Borrows everything big;pathstays owned because aPathBufclone per lint run is noise. Caller contract (documented at the item): the four products must describe the same text — tokens lexed fromsource,filethe tolerant parse of those tokens,line_indexbuilt oversource.DocumentandParsedSourceboth satisfy it by construction.pub struct ParsedSource+ParsedSource::parse(source) -> ParsedSource+ParsedSource::context(&self, path) -> LintContext<'_>— the owned bundle of products for callers with noDocumentof their own (vfmt check, andrun/LintContext::newinternally).parselexes once and builds the tree from a clone of the token stream.LintContext::new(source, path)stays, as the convenience wrapper the task requires: it is one line,Backing::Owned(ParsedSource::parse(source))through the same private assemblyfrom_parseuses — a single code path derives the string-literal spans and defaults. (newcannot literally callfrom_parseand then own the products — that would be a self-borrow — so "single code path" is the shared assembly function, andParsedSource::parseis the single place the parse recipe lives.)- Dependency list unchanged:
vlog_parser+ std.
Consumed
vlog_parser::parse_tolerant(tokens, source)— newly consumed byvlog_linterandvfmt_server(both already depended on the crate; it was alreadypub). Relied on: with the same tokens it returns exactly the treeparse_source_tolerant(source)would (that function istokenize+parse_tolerant), and on a well-formed file the tree equalsparse's.vlog_formatter::fence::protected_regions(&str)— still called with text, still re-parses internally, on purpose; see the decision below.
Changed call sites
crates/vfmt/src/lint.rs::run_rules— parses once viaParsedSourceand hands the products to the context.crates/vfmt_server/src/state.rs::Document— gains thetree: SourceFilefield (it was parsed and thrown away afteranalyze), andDocument::newlexes once instead of twice.crates/vfmt_server/src/lint.rs::{violations, fixable}— the one call site server-lint's README predicted: both lint from the document's own products viafrom_parseinstead of re-parsingdoc.text.
The server's redundant-work catalog
Every place the server re-tokenized or re-parsed text it already held products for, per request, as of the start of this round:
| Site | Duplicate work per request | Verdict |
|---|---|---|
lint::violations (every didOpen/didChange/didSave publish) |
2 lexes + 1 tolerant parse of doc.text (via vlog_linter::run → LintContext::new) |
Eliminated — from_parse over Document's products |
lint::fixable (every codeAction request) |
2 lexes + 1 tolerant parse (via LintContext::new) |
Eliminated — same |
lint::fixable → fence::protected_regions(&doc.text) |
1 lex + 1 tolerant parse inside vlog_formatter |
Kept — see the protected_regions decision below |
Document::new (every buffer change) |
the text lexed twice: tokenize for doc.tokens, then parse_source_tolerant's internal tokenize |
Eliminated — one lex, tree built by parse_tolerant over a clone of the tokens; the lex-error fallback still goes through parse_source_tolerant so the error tree and diagnostic are byte-identical |
format::formatting / range_formatting |
format_source/format_range lex+parse strictly inside vlog_formatter |
Kept — the formatter's parse is the strict one (a tree Document does not hold), and the runtime safety net (equivalence + convergence) is defined over format_source doing its own work; sharing would need vlog_formatter API changes, which is the concurrent round's crate and a different feature |
Workspace::rebuild_index (initialize + every didSave) |
re-reads and re-parses every workspace file inside WorkspaceIndex::build, open unchanged buffers included |
Kept — the documented full-scan index model (TODO §6 defers incrementality to salsa); making it incremental is invalidation machinery this round explicitly must not build |
semanticTokens, hover, definition, references, documentSymbol, workspace/symbol, diagnostics::diagnostics |
none — all already read doc.tokens / doc.semantics / doc.defines / doc.diagnostics |
already clean (verified by grep for tokenize/parse over crates/vfmt_server/src) |
The protected_regions decision: left alone
fence::protected_regions takes &str and re-parses internally.
shared-fence-filter's Assumptions choose that signature deliberately: a
products-accepting variant would let the two front ends feed different trees
and get different fence answers, which is the exact drift that feature exists
to end. Could this round argue both callers "always hold the same tree by
construction"? Almost — the server would pass doc.tree and the CLI its
current round's tree — but "almost" is the problem: the CLI's --fix loop
rebuilds text every round, and a future caller passing last round's tree is
precisely the bug the &str signature makes unwritable. The cost lands only
on fix-application paths (vfmt check --fix, textDocument/codeAction),
never on the per-keystroke diagnostics path. Two further reasons to leave
it: it is vlog_formatter's code, which belongs to the concurrent
dynamic-types round this session; and the interior parse is of the current
text by construction, which is the property being bought. Decision: keep
the double parse there, documented as the acceptable price of one fence
answer.
Status / TODO
vlog_linter:LintContext<'a>,from_parse,ParsedSource,newkept as the wrapper; single-lex parse recipe in one place.- Rules, visitors, waivers untouched (they compile and read unchanged).
crates/vfmt/src/lint.rs:run_rulesparses once viaParsedSource.crates/vfmt_server:Document.treekept;Document::newsingle-lex;lint::violations/fixablelint from the document's products.- Server catalog above; semanticTokens/hover verified already clean.
- protected_regions decision written (left alone).
- Tests: products-in == source-in property over rule-test inputs; lex-error and broken-file paths; existing CLI + server suites green unmodified.
- Byte-identity: corpus
vfmt check(text + JSON) vs a HEAD worktree binary; server diagnostics vs a HEAD worktree binary over a real stdio session. - Timing before/after.
- TODO §4 checkbox + linter-core / server-lint annotation lines.
- Not done, deliberately:
vfmt formatsharing the parse. The formatter requires a strict parse and runs its safety net over its own products; wiringvfmt check --fix --formatworkflows is a future feature and is not blocked by anything here. - Not done, deliberately: any caching/invalidation in the server
beyond
Document's per-change recompute.
Work log
2026-08-19 — dev
- Read
CLAUDE.md, TODO §4, and the linter-core / server-lint / shared-fence-filter READMEs in full (QA logs and Reviews included) before writing anything, then the code:vlog_linter'scontext.rs/lib.rs,crates/vfmt/src/lint.rs, and every file incrates/vfmt_server/src. - The design was forced by one fact:
SourceFileis notClone. The server'sDocumentowns one tree that must serve semantics, published diagnostics and linting, so the products constructor has to borrow — and the task's requirement thatLintContext::new(source, path)survive as a self-contained convenience means the context must also be able to own. Hence the privateBackingenum (Owned(ParsedSource)/Borrowed { .. }) rather thanCowfields (CowneedsClone) or a lifetime-only struct (which would have killednew). Every accessor signature is unchanged, so the twelve rule files,visit.rsandwaiver.rscompile byte-for-byte untouched — verified bygit diff(onlycontext.rs,lib.rs's onepub useline, and the test helper changed in the crate). newcannot literally callfrom_parse— that would borrow a local and return it — so the single code path isassemble(one place derives string-literal spans and defaults) plusParsedSource::parse(one place holds the parse recipe). Recorded here so nobody "fixes" it into a self-borrow later.- The single-lex recipe and its one deliberate exception. Today's
LintContext::newlexed the text twice (its owntokenize, thenparse_source_tolerant's internal one).ParsedSource::parseandDocument::newnow lex once and build the tree viaparse_tolerant(tokens.clone(), source)— identical tree by definition, sinceparse_source_tolerantistokenize+parse_tolerant. A text that fails to lex keeps the oldparse_source_tolerantpath (a second lex of a rare broken file) becauseparser::error_fileispub(crate)and hand-rolling the all-error tree here is how two subtly different trees are born. The recipe exists in exactly two places because they need different outputs:ParsedSourcediscards diagnostics (no rule reads them),Documentpublishes them. - Server:
Documentgained thetree: SourceFilefield it was already paying to build (it parsed, analyzed, and threw the tree away);lint::violationsandlint::fixablenow share a four-linecontext(doc)helper overfrom_parse.vlog_linter::runis no longer imported there. The catalog above was compiled by greppingtokenize|parseovercrates/vfmt_server/srcand reading each hit. - Tests. The products-in == source-in property was put where it covers
the most ground: inside the rule-test harness's
assert_lint_with, so all 55 inline-marker cases (every rule × fires/quiet/waived/unused-waiver, plus the fence and class-body cases) assert thatParsedSourceproducts produce aDebug-identical violation list — rule, message, span and fix. Two new unit tests incontext.rs: borrowed-vs-owned accessor equality, and the lex-error fallback producing the exact old error tree. Existing CLI and server suites pass unmodified (git diffoncrates/vfmt/tests,crates/vfmt_servertests: empty). - Did not touch
vlog_parser,vlog_formatter,vlog_semantic,vfmt_core,editors/**, or anyCargo.toml/Cargo.lock(no dependency moved;parse_tolerantwas alreadypub). Did not rungit commit/git push. - Concurrency note. A dynamic-types round was announced live in
vlog_parser/vlog_formatterthis session.git statusstayed clean of their crates for the whole round (only this feature's files are modified), so the scratchpad-copy fallback was prepared but never needed; the HEAD worktree used for baselines doubles as the clean snapshot. Gates below are from the real tree.
Results.
cargo test -p vlog_linter: 118 unit + 55 integration + 1 doctest, green (118 was 116: the two newcontext.rstests).cargo test -p vfmt: green including all 69 CLI integration tests, unmodified.cargo test -p vfmt_server: 115 unit + 6 e2e, green, unmodified.cargo test --workspace: 770 passed, 0 failed.cargo clippy --workspace --all-targets: silent.cargo fmt -p vlog_linter -p vfmt -p vfmt_server -- --check: clean (scoped, per the concurrency rule). No#[allow], nounwrap/expect/panic!/unsafeoutside#[cfg(test)]in anything touched.- Byte-identity, CLI (HEAD worktree binary at
e9008b6vs this tree, both release):vfmt check corpus/: stdout, stderr and exit code (1) identical.vfmt check corpus/ --output-format json: 2 418 071 bytes of JSON, byte-identical, stderr identical, exit identical.check --fixover ten crafted shapes in twin directories (tabs + trailing whitespace, fence, fence-in-broken-file, waiver, lex failure, case-missing-default, module-filename mismatch, multi-byte + tab, unclosed fence, empty file): every rewritten file byte-identical, stdout/stderr identical (paths normalized), exit 1 from both.
- Byte-identity, server: a real stdio session (hand-framed JSON-RPC,
scratchpad/lsp_probe.py) over three scratch files — lint-only, parse error + lint + module-filename, and error-recovery + fence + lex-error — each opened and then edited once (edits flip the filename rule, add a waiver, and heal the lex error). All 6 published diagnostic lists byte-identical between the two binaries, canonicalized only by stripping the differing scratch-dir prefix from the URI. - Timing, CLI (release, median of 7, 860-file corpus):
vfmt check corpus/265.5 → 207.9 ms at--threads 1(−22 %), 79.7 → 70.5 ms at the default thread count (−12 %). The single-thread number is the honest one (the pool hides latency); the saving matches the arithmetic — the lint pipeline did 2 lexes + 1 parse per file and now does 1 lex + 1 token-clone + 1 parse. - Timing, server (informational): didChange → publishDiagnostics,
median of 15 full-text changes, empty workspace root:
picorv32.v(3049 lines) 18.0 → 11.0 ms,ibex_core.sv(2026 lines) 7.6 → 3.4 ms. Larger than the CLI's relative win because the server was paying the duplicate work twice over —Document::new's double lex and the lint path's full re-lex-and-parse — and now pays one lex, one clone, one parse per change.
2026-08-19 — dev (post-interruption verification)
- The session was cut by a usage limit after the results above were captured; on resume, disk state was re-verified intact (all six code files, this README, TODO §4, both annotation files — nothing lost).
- Mid-resume the concurrent dynamic-types round landed in-progress edits to
vlog_parser/vlog_formatter/vlog_semanticthat briefly broke the workspace test build (tests/spans.rsvs their newExprKind::NamedArg— their crate, their fix). Gates were therefore re-run with the scratchpad-copy technique: a fresh worktree at HEADe9008b6with only this round's six files overlaid —cargo test --workspace770 passed, 0 failed,cargo clippy --workspace --all-targetssilent, scopedcargo fmt -- --checkclean. Identical numbers to the pre-drift merged run recorded above. - The merged tree recovered while this was running (the other agent fixed
their spans test): merged
cargo test --workspace770 passed, 0 failed, clippy clean, as of this writing — noted with the caveat that their round is still in motion, so the isolated-copy numbers are this feature's own evidence. - Provenance of the identity/timing evidence above: captured before any
concurrent drift existed — at capture time
git statusshowed only this round's files modified, so the "new" binaries were exactly HEAD + one-parse, vs. the HEAD-worktree baseline binaries. That evidence stands as recorded.
QA log
2026-08-19 — QA
Setup / isolation. The concurrent dynamic-types round had by now modified
vlog_parser/src/{ast,parser}.rs, vlog_parser/tests/spans.rs,
vlog_formatter/src/format.rs, vlog_formatter/tests/verification.rs and
vlog_semantic/src/bind.rs in the shared tree, so every gate and every
identity run below was done in an isolated copy: scratchpad/qa-new =
a byte copy of the dev's HEAD worktree (scratchpad/head-wt, verified clean
at e9008b6) with exactly this round's six code files overlaid.
diff -rq head-wt qa-new reports those six files and nothing else. The
baseline binaries are head-wt/target/release/{vfmt,vfmt-server}; the "new"
ones were rebuilt from qa-new. corpus/ was never written to — the --fix
runs used copies.
Claim-by-claim.
- Constructor design — PASS.
SourceFileis#[derive(Debug)]only ate9008b6:crates/vlog_parser/src/ast.rs:125, soCowis genuinely unavailable and theBackingenum is forced.git diff --name-only HEAD -- crates/vlog_linterreturns exactlysrc/context.rs,src/lib.rs,tests/rules.rs— all twelve rule files,visit.rs,waiver.rs,registry.rs,naming.rs,violation.rs,rule_docs.rsbyte-untouched.crates/vlog_linter/Cargo.tomlstill listsvlog_parserand nothing else. Diagnostics genuinely unread by any rule:grep -rn diagnostic crates/vlog_linter/srchits only doc comments, the discarded binding atcontext.rs:46, andvisit.rs's own#[cfg(test)]block.new→assembleis the single path, andparse_source_tolerant's Ok arm ate9008b6:crates/vlog_parser/src/lib.rs:37is literallyparse_tolerant(tokens, source), so the substitution is exact by definition, not by hope. ParsedSource::parselexes once; lex errors fall back — PASS. Independent probe (scratchtests/qa_probe.rs, deleted after the run) over four lex-failing texts — unterminated block comment, unterminated string, a bare", a/*at EOF: tokens empty in every case, theDebugform ofParsedSource::parse(src).context(None).file()equal toparse_source_tolerant(src).0, andrun(src, …)equal tolint(&parsed.context(None), …). End to end the same fallback shows up in the server session below (f1 v4 lex errorpublishesunterminated block comment+no-tabs, identical on both binaries).- Server catalog complete — PASS.
grep -rn 'tokenize|parse_source_tolerant|parse_tolerant|format_source|format_range| rebuild_index' crates/vfmt_server/srcreturns exactly the sites the catalog names:state.rs:56-61(Document::new, one lex),format.rs:57,87(kept, strict parse),state.rs:123/137+server.rs:251(rebuild_index, kept),lint.rs:54(protected_regions, kept). The only othervlog_linter::runleft in the crate is atcode_action.rs:157, inside#[cfg(test)]— not a per-request parse. No uncataloged redundant parse survives.doc.treeis read (not dead):lint.rs'scontext(doc)andstate.rs:64'sanalyze(&tree, …). protected_regionsleft alone — PASS.git diff --name-only -- crates/vlog_formatter/src/fence.rsis empty; the file is untouched by this round (and by the concurrent one).- Behavior identity — PASS, re-run from scratch, not taken on trust.
vfmt check corpus/(820 files): stdout 692 198 bytes identical, stderr identical, exit 1 both.--output-format json: 2 418 071 bytes identical (matches the dev's figure exactly), stderr identical, exit 1 both.- Flag matrix on a 13-file crafted directory, stdout+stderr+exit compared
each time:
--select,--ignore,--select a,b --output-format json,--indent 4,--threads 1, an unknown rule name (exit 2 both), a missing file (exit 2 both),--unsafe-fixes, a single file, an empty file,check - --stdin-filename, and--select case-missing-default,module-filenameover the whole corpus. 12/12 identical. check --fixover 13 crafted shapes (multi-round tab+trailing, a real// verilog_format: off/onfence, the// vfmt: off/onalias, an unclosed fence,// vfmt: waive, unused + malformed + unknown-rule waivers, a lex-error file, a filename mismatch, CRLF, multi-byte + emoji + tab, an empty file, a class body, a parse-error file): every rewritten file byte-identical, stdout (path-normalized) and stderr identical, exit 1 both. Fenced regions provably untouched — the tab and the trailing run inside the fence survive byte-for-byte while the violations are still reported.check --fixover a full copy ofcorpus/(820 files, 48 rewritten): every file byte-identical old-vs-new, stdout (309 lines) and stderr identical, exit 1 both. This is a much wider--fixnet than the ten shapes in the work log and it holds.- Server: an independent hand-written stdio driver (
scratchpad/qa_lsp.py, not the dev's) over 3 scratch files and 13 publishes — parseable → parse-error → clean → lex-error → healed → empty → back; a filename-rule flip; a fence + error-recovery file losing its fence then being fixed. All 13 diagnostic lists byte-identical between the two binaries after stripping the scratch-dir prefix. - Server,
fixable/codeAction (the otherfrom_parsecall site, which the work log did not exercise):textDocument/codeActionover the whole buffer for 6 shapes (plain, fenced, waived, parse-error, lex-error, multi-byte) — 16 379 bytes of diagnostics + actions, identical, including the fence filter correctly withholding quick fixes.
- Timing direction — PASS. Release, median of 9, 820-file corpus, warm
cache:
--threads 1294.7 → 235.3 ms (−20.2 %); default threads 98.6 → 87.2 ms (−11.6 %). Absolute numbers run ~10 % above the dev's on this machine's load, the direction and magnitude reproduce. Server didChange → publishDiagnostics, median of 15 full-text changes:picorv32.v(3049 lines) 20.1 → 12.6 ms,ibex_core.sv(2026 lines) 8.2 → 3.7 ms (informational; dev reported 18.0 → 11.0 and 7.6 → 3.4). - Gates — PASS. In the isolated tree:
cargo test --workspace770 passed, 0 failed (27 result lines; vlog_linter 118 unit + 55 integration + 1 doctest, vfmt 30 unit + 69 CLI, vfmt_server 115 unit + 6 e2e — every count the work log claims).cargo clippy --workspace --all-targetsexit 0, zero warnings.cargo fmt --all -- --checkclean (not just the scoped set). In the merged tree the scoped crates are also green (cargo test -p vlog_linter -p vfmt -p vfmt_server: 30/69/115/ 6/118/55/1) with scoped clippy and fmt clean. Test churn is zero:git diff --numstat crates/vlog_linter/tests/rules.rsis 12 added, 0 removed, and no other test file invfmt/vfmt_server/vlog_linteris touched. Nounwrap/expect/panic!/unsafe/#[allow]outside#[cfg(test)]in any of the six files.
Attacks.
- Borrowed vs Owned, beyond the shipped property test. 14 inputs (plain,
tabs+trailing, fence, waiver, unused waiver, class body, parse-error, two
lex-error shapes, CRLF, CJK+emoji+combining, empty, whitespace-only,
case-without-default) × 3 path values (none, matching, mismatching) × 4
construction routes (
LintContext::new,ParsedSource::context, a hand-builtfrom_parsewith independently produced products, andrun). AllDebug-identical violation lists — rule, message, span, fix, applicability — plus equalsource(),tokens().len(),Debugoffile(), andcomments().len(). No divergence. - The four-products contract, violated on purpose. Five mismatch shapes
(tree of B over text A, tokens of B over text A, line index of B over text
A, everything-but-the-text from B, and short products over long text), with
A deliberately 14 bytes and B 111. Result: no panic, no abort, no
unsoundness — the crate contains no
unsafe, so it cannot be otherwise. The cost is exactly wrong findings:module-filenamereported a module name that is not in the text, and its reported span (7..33) pointed past the end of a 14-byte buffer. Corruption is nonetheless impossible even then:apply_fixes(crates/vlog_linter/src/violation.rs:118) already skips any edit withend > source.len()or a non-char-boundary start, and all five shapes applied cleanly with in-bounds output. See finding QA-2 for the one thing the README should add. - The
--fixloop. Multi-round convergence survives the parse-once first round:\twire a;\t\nconverges towire a;\n(tab expanded in one round, the trailing run removed in a later one), and a second--fixinvocation over the already-fixed directory is a no-op (diff -rqclean), i.e. the loop still terminates at a fixed point. Fenced fixes are still refused, for both fence spellings and for an unclosed fence. - Server, stale-tree. The
parseable → broken → parseablecycle tracks correctly: the parse diagnostic appears at v2 and is gone at v3, the lex diagnostic appears at v4 and is gone at v5,module-filenameclears the moment the module is renamed, a waiver added at v3 clears the lint. Nothing from an older version leaks into a newer publish.Documentis rebuilt whole per change (Workspace::set_document→Document::new), so there is no reuse point to go stale. - Sabotage. Made
Workspace::set_documentkeep the previous version's tree (doc.tree = old.tree) while everything else refreshed — the exact bug this round newly makes possible. It is a real, user-visible bug: the stdio session immediately diverges (a stalemodule-filenamewarning for the old module name survives the rename and persists into the next version). But see finding QA-1. Sabotage reverted;diffagainst the working tree'sstate.rsclean, and a rebuilt server reproduces the baseline 13-publish log byte-for-byte. The scratchqa_probe.rswas deleted;diff -rq head-wt qa-newis back to exactly the six feature files.
Findings.
- QA-1 (MEDIUM — missing coverage, not a defect in shipped behavior).
The stale-tree bug that this round newly makes possible is caught by no
test in the workspace. With the sabotage above in place,
cargo test -p vfmt_serverpasses 115 unit + 6 e2e, 0 failed, andcargo test --workspacepasses 773, 0 failed (770 + 3 scratch probes). Only a live stdio session caught it.Document.treeis now a cached derivation ofDocument.text, and nothing asserts they agree. The cheapest guard is one#[cfg(test)]case incrates/vfmt_server/src/lint.rsorstate.rs:set_documenta buffer whose module name mismatches the filename, thenset_documentthe renamed text, and assertviolationsno longer containsmodule-filename— an AST-rule finding, which is exactly the class that readsdoc.tree. Reported rather than fixed: writing a new test into another feature's crate is the dev's call, not QA's. - QA-2 (LOW — documentation).
from_parse's caller contract says what the caller must supply but not what breaking it costs. The measured answer is worth one sentence at the item and in Assumptions: violating it yields wrong findings and spans that may point outside the text; it is never unsound (nounsafe) and never corrupts a file, becauseapply_fixesindependently bounds-checks every edit. Left for the dev to word, since Assumptions is theirs. - QA-3 (INFORMATIONAL).
LintContext::newis declared insideimpl<'a> LintContext<'a>but returnsLintContext<'static>, so its'ais unused. Compiles, clippy-clean, callers unaffected; noted only so a later reader does not mistake it for an accident. - QA-4 (INFORMATIONAL, pre-existing, out of scope). On CRLF input,
no-trailing-whitespacedoes not fix the run before\r\n(observed on a craftedcrlf.sv:wire a; \r\nsurvives--fix). Byte-identical on both binaries, so it predates this round entirely — recorded here only because the CRLF shape was part of the identity matrix and someone will otherwise re-find it.
Verdict: no BLOCKING findings. No behavior divergence old-vs-new was found
anywhere — 820-file corpus check (text and JSON), 820-file corpus --fix, a
12-case flag matrix, 13 crafted --fix shapes, 13 server publishes and 6
codeAction rounds all byte-identical. No stale-tree reuse in the shipped code.
No memory unsafety is reachable, by construction. The one thing this round
leaves behind is an untested invariant (QA-1), not a broken one.
Review
2026-08-19 — lead. Verdict: accepted; commits with round 19. The duplicated-parse debt is paid: check is 20% faster single-threaded and the editor's per-keystroke latency roughly halved, with behavior identity proven at the byte level.
Points reviewed and accepted:
- The Backing enum was forced, not chosen — SourceFile is !Clone,
so borrowing was the only non-duplicating shape, and QA verified the
constraint at the type level. Keeping
new()as a one-line wrapper through the same private assemble is what kept all 12 rule files byte-untouched: an API migration with zero consumer churn. - The four-products contract was violated on purpose and the cost measured: wrong findings, possibly out-of-text spans, never unsoundness, never a bad write (apply_fixes independently rejects out-of-range edits). That measured answer is now in the doc comment (lead fix, QA-2).
- The server catalog is complete — QA's grep found no uncataloged redundant parse, and the kept-with-reasons list (protected_regions' anti-drift signature, the strict format parse, the documented rebuild-on-save index) shows restraint where restraint was correct.
- QA-1 closed by lead fix: the sabotage that kept a stale tree
passed all 773 tests — nothing pinned text/tree agreement. The new
set_document_rebuilds_the_tree_so_diagnostics_track_the_textguard in diagnostics.rs fails on exactly that sabotage (premise asserted through the merged all() path, where the stale lint warning actually lives — the first draft checked the parse-only path and was corrected before landing). - QA-3 (the unused 'a on new()) stands as a noted quirk; QA-4 (CRLF trailing-whitespace fix gap) is pre-existing and joins the linter's known-gaps list.