TODO §41 (docs/features/atomic-write-coordination). Closes topo §2.9-26
and repository-analysis finding 1.
`atomic::write_atomic` names its temp `.{name}.{pid}.{n}.lucisv-tmp` with
a per-process counter and opens it create-new (O_EXCL), retrying a used
name up to 32 times; on unix the temp is created 0600 when a target
exists and takes the target's mode through the open handle before the
bytes are written, so a 0600 file never has a readable moment. The CLI's
`dedup` keys on the canonical path when the file exists, so a symlink
alias reaches one worker; the reported path is the first spelling. Two
processes on one target remain last-writer-wins (rename is atomic, the
formatter idempotent), stated in the module doc. The audit's probe is a
test: 0 write errors in 200 calls.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
11 KiB
Repository analysis
Audited 2026-09-04 against HEAD d5abf81. The manifest still declares
v0.41.0; HEAD includes the accepted parser-skips work intended for
v0.42.0. This is a source and documentation audit, not a new performance or
full language-conformance measurement.
Assessment
lucisv is a complete developer-tool stack, with eight Rust crates (six libraries and two binaries), a VS Code extension, Neovim/Vim configuration, release/corpus scripts, and an Astro/Starlight documentation site. Its strongest architectural choices are shared language engines, runtime formatter checks, conservative semantic resolution, and a single owner for mutable LSP state.
The most consequential remaining issues found in this audit are coordination between atomic writers and disagreement between project-file and editor lint selection. The test suite passes, but neither result establishes those contracts: the atomic tests exercise sequential replacement, and editor rule-selection tests exercise client settings. Documentation had also fallen behind the recent implementation rounds.
Repository map
| Location | Responsibility and starting point |
|---|---|
crates/vlog_parser |
Lexer and trivia, strict/tolerant recursive descent, AST and source coordinates; start at src/lib.rs, then parser/ and ast/ |
crates/vlog_formatter |
AST → document IR → printer, alignment, fences, ranges, token equivalence and convergence; start at src/format/mod.rs and src/verify.rs |
crates/vlog_semantic |
File binding/resolution and workspace facts; start at src/lib.rs, bind/, workspace/, and facts.rs |
crates/vlog_linter |
73-rule registry, lazy analysis, options, severity, inline waivers and fixes; start at src/lib.rs, context.rs, and registry.rs |
crates/vlog_refactor |
Rename/references, port edits and instance plans; shared src/scope.rs, whole-edit checks in check.rs |
crates/lucisv_core |
Config, filelists, walking, format cache and atomic replacement; no language-engine dependency |
crates/lucisv |
CLI argument handling, discovery, worker pool, reports and writes; src/main.rs, args.rs, lint.rs |
crates/lucisv_server |
Synchronous LSP transport, workspace state, overlays, scans and capability handlers; src/main.rs, server/, state.rs |
editors/ |
VS Code client/grammar/settings/hierarchy UI, plus configuration examples for other editors |
tools/, scripts/, .gitea/workflows/ |
Resource guard, corpus evaluation, artifact audits and release automation |
docs/features/ |
Feature-specific contracts, implementation history, QA and review; 135 READMEs at audit time |
docs/site/ |
User-facing static documentation and tracked generated output |
topo.md gives dependency directions, recent cross-crate contracts, shared interfaces, and numbered open handshakes. The manifests are authoritative for crate edges; an absent documented edge alone does not prove two edits safe to perform concurrently.
Runtime behavior and limits
Formatting. format_source strictly parses input, renders a document tree,
re-lexes both versions and compares normalized tokens (including comments),
then parses/formats the output again and checks convergence. A failed check
returns an error instead of a candidate string. The CLI leaves the affected
source file alone. This protects lexical fidelity and stable layout; it does
not elaborate SystemVerilog or prove hardware equivalence. Fenced text still
has to parse. Ranges select items; fences can additionally protect statements
and class members.
Linting. ParsedSource shares a tokenization and tolerant parse, and
LintContext computes semantics lazily. Rules consume text, tokens, AST, and
optional project facts; malformed AST elements remain opaque. Inline waivers
filter findings, and severity is stamped centrally. The CLI/server filter
fixes through the formatter's fence API: apply_fixes alone does not provide
that protection. always-comb offers an unsafe fix; editor actions offer only
safe fixes.
Refactoring and editor state. Refactors use resolved source spans and check
the whole edit; source selectors must remain supersets of every file an engine
could edit or refuse over. The LSP loop owns workspace mutation, open documents
overlay disk facts, and stepped scans publish related index/include/completion
state together. Facts persist under FACTS_FORMAT = 17. Lazy port code actions
compute their edits on selection for capable clients. Recorded UTF-16 positions
avoid reads for closed-file file-scope definitions; members and open buffers
still use text-based locations.
Intentional scope. Neither parser mode performs cross-file macro expansion
or compiler elaboration. Missing definitions outside an index scope can mean
missing hints or conservative lint silence. Rootless indexing never climbs;
with depth 0 it reads siblings flat, while positive depth walks descendants.
The published 814/820 frozen-corpus result is historical feature QA evidence,
not a new corpus sweep performed by this audit. Performance reports under
docs/performance*.md and docs/perf/ likewise remain dated measurements.
Findings and follow-up priorities
1. Coordinate writes to a shared target
Evidence: atomic.rs canonicalizes the
target, then derives a temp name from the target filename and process ID.
fs::write opens that predictable path without exclusive creation.
CLI dedup folds lexical path components but
intentionally leaves symlinks unresolved. Two rayon jobs reaching one target
through different spellings can therefore share a temporary file.
A disposable probe compiled the actual atomic.rs and used two barrier-started
threads per round to write different 1 MiB buffers to one target. Across
100 rounds / 200 calls, 100 writes failed. The final file in every round
was a complete one-writer buffer; no mixed final bytes were observed. This
reproduces the helper's collision, not an end-to-end formatter corruption.
The probe used only /tmp files and ran under the resource guard.
Recommended follow-up: exclusive, unique per-operation temp files; coordinate or deduplicate writes by target identity; add a concurrent alias regression. The existing temp-and-rename helper is useful for sequential replacement, but its tests do not justify a same-target concurrency guarantee. Tracked as topology handshake 26.
Fixed by TODO §41 (0.43.0, 2026-09-05): the probe now runs as
atomic::tests::two_threads_writing_one_target_never_collide and reports
0 write errors in 200 calls (QA re-ran it at 4 and 8 threads: 0 in 400 and
0 in 800); the symlink alias closes as cli::a_symlink_and_its_target_are_one_file.
Two processes writing one target remain last-writer-wins, stated in
atomic.rs. See docs/features/atomic-write-coordination/README.md.
2. Define a consistent project lint configuration contract
Evidence: server linting selects rules in
enabled_rules from ClientSettings only. Its configured function discovers
lucisv.toml but reads lint_options and line length, not lint_select or
lint_ignore. In contrast, CLI linting consumes
project selection. The server also discards invalid project option entries
with let _ = options.set_raw(...); only invalid editor option settings
receive the corresponding per-entry log.
The docs now describe the implemented behavior: project selection controls CLI
runs; editor selection requires lucisv.lint.* settings; valid project rule
options are shared. Recommended follow-up: specify and test project/editor
selection precedence and surface rejected project rule options. Tracked as
topology handshake 28. This finding is from source inspection; no dedicated
wire-level configuration reproduction was run in this audit.
3. Keep traversal and semantic gaps explicit
The shared directory walker recursively
follows Path::is_dir() with no visited-directory set. Symlink cycles remain
an existing open issue (topology handshake 8); eventual filesystem refusal is
not an explicit traversal budget or cycle policy. Prioritize a deliberate
cycle policy before broadening traversal.
Other concrete open contracts include missing type spans (handshake 2),
package re-export resolution (16), inline aggregate type arguments (17), and
cross-file rename of an internal module net (23). The parser-skips regression
suite also retains a refusal for comments immediately before a net-delay #
(27). These limitations should remain visible when widening grammar or index
coverage; formatter verification must continue to reject unsupported output.
Documentation changes from this audit
- Expanded the README's architecture to cover all eight crates and documented the runtime checks, actual indexing behavior, documentation entry points, and guarded verification commands.
- Updated topology facts to codec 17, corrected moved module paths, recorded
recent recovery/lint/fence/atomic/LSP contracts, and closed the stale
programlinked-editing request using the existing module-shaped AST path. - Updated site configuration, formatter/linter guides, CLI, language tools, architecture and API navigation for current behavior. The API index now explicitly defers to rustdoc for exhaustive signatures and fields.
- Removed the stale
0.9.0product version from site structured metadata; release versions remain owned by the workspace/release files.
The parser-skips changes were already present when the audit started and were committed by another workflow during the audit. Their QA log now records PASS; the topology reflects that final state. This audit made no Rust implementation changes and did not modify their feature log or backlog checkboxes.
Validation
cargo fmt --all -- --check: passed.cargo clippy --workspace --all-targets -- -D warnings: passed.tools/guard.sh -- cargo test --workspace: 3,745 passed, 0 failed, 44 ignored, summed across 48 test/doc-test harnesses. Counts include the post-v0.41.0 parser-skip cases and one passing doctest; ignored measurement tests were not enabled.- Documentation build:
ASTRO_TELEMETRY_DISABLED=1 npm run buildindocs/sitepassed; 13 pages, Pagefind index and sitemaps generated. - Generated-site verification: 817 local links, assets and anchors checked,
zero failures; relative links in the repository documentation checked.
git diff --checkpassed. - Atomic-write probe: collision reproduced as described above, no repository source files written.
The first test attempt was stopped because sandboxed ps prevented the guard
from measuring memory; the successful rerun used an approved environment where
monitoring worked. No corpus sweep, OpenTitan sweep, ignored benchmark run,
release packaging, or external publishing was performed by this audit.