A multi-line module instantiation now answers folding ranges, so VS Code's sticky scroll pins it (TODO §72, docs/features/instance-folding): one range from the module-type line, and one more per instance from the line its name is on when that is a later line, so both `aes_control_fsm #(` and `) u_aes_control_fsm (` stay pinned inside the connection list. The closing `);` line stays visible. - folding/instances.rs: what is an instantiation comes from vlog_semantic::instantiations::sites; where it closes is re-read from the tokens, and a statement whose tokens are not exactly that shape folds nothing. - folding.rs: in_answer_order is a stable sort by start line over scopes, branches, instances; every earlier fold is unchanged and first on a shared start line (0.66.0 against this tree on 4 933 files: identical once the instance folds are removed). - OpenTitan hw: 18 200 multi-line instantiations, none without its fold. - Not folded: two-dimensional instance arrays; an instance whose head an `ifdef splits. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
7527 lines
465 KiB
Markdown
7527 lines
465 KiB
Markdown
# TODO — best practices adopted from ruff and Verible
|
||
|
||
Curated backlog for lucisv, drawn from `astral-sh/ruff` (architecture, CLI/UX,
|
||
fix model) and `chipsalliance/verible` (formatter safety, alignment,
|
||
waivers, and especially test methodology). Items reference the current
|
||
draft's files. Roughly ordered by priority within each section.
|
||
|
||
Legend: **[V]** = practice from Verible, **[R]** = from ruff, **[V+R]** = both.
|
||
|
||
---
|
||
|
||
## 1. Correctness safety net (highest priority)
|
||
|
||
- [x] **[V] Token-stream equivalence verification.** Verible's formatter
|
||
re-lexes its output and asserts it is lexically equivalent to the input
|
||
(`verilog_equivalence.cc`); on mismatch it emits the *original* text.
|
||
Add `verify_equivalence(input, output)` to `vlog_formatter`: re-lex both
|
||
through `vlog_parser::lexer`, compare token kinds + text (whitespace
|
||
excluded, comments included). Run it inside `format_source()` on every
|
||
call — not just in tests. This turns "the formatter can never corrupt
|
||
code" from a test-suite property into a runtime guarantee.
|
||
- [x] **[V] Convergence (idempotency) verification at runtime.** Verible
|
||
formats twice and checks a fixed point before writing. Do the same in
|
||
`format_source()` (optionally behind `--no-verify` for speed later).
|
||
Today idempotency is only asserted in `tests/fixtures.rs`.
|
||
- [x] **[V] Failsafe fallback semantics.** On any internal verification
|
||
failure, return the input unchanged *with a diagnostic and nonzero exit*,
|
||
never partially formatted output. Parse errors already behave this way
|
||
(README notes it); extend the same contract to the two checks above.
|
||
- [x] **[R] Panic containment.** ruff catches panics per-file and reports
|
||
them as errors instead of killing the whole run. Wrap per-file work in
|
||
`crates/lucisv/src/main.rs` with `std::panic::catch_unwind`.
|
||
- [x] **`@(* )` fails to lex** (bug-fix QA find): `(*` followed by anything
|
||
but `)` is unconditionally lexed as an attribute (`lexer.rs`), so a bare
|
||
space inside `@( * )`-style spellings errors out. Make the attribute
|
||
scan back off when the contents are just `*`.
|
||
→ `docs/features/lexer-cleanup/README.md`, with the BOM and non-ASCII
|
||
message fixes and the `lucisv check` lex-error silence fix.
|
||
- [x] **Recursion-depth limit in the parser.** Found by cli-polish QA:
|
||
~150 levels of expression nesting overflow the stack and abort the whole
|
||
process — uncatchable by `catch_unwind`, so mid-batch files after the
|
||
crash never get processed. Add an explicit depth counter in
|
||
`vlog_parser::parser` that returns a parse error past a documented limit
|
||
(ruff does the same). Do the same in the formatter's recursive walk.
|
||
|
||
- [x] **Atomic in-place writes.** QA find during cli-filelist (2026-08-25,
|
||
pre-existing): `process_file` and the `--fix` path write with plain
|
||
`fs::write` (open/truncate/write) while `cache.rs` next door already
|
||
does tempfile+rename. Two workers reaching one inode through two
|
||
spellings (symlink alias — lexical dedup cannot see it) could tear a
|
||
file. Fix: tempfile+rename in both writers; optionally canonicalized
|
||
dedup keys as a second line of defense.
|
||
**Delivered by §36.3** (0.40.0): `lucisv_core::atomic::write_atomic` in all three writers.
|
||
|
||
## 2. Formatter features
|
||
|
||
- [x] **[V] Format-off fences.** Support `// verilog_format: off` /
|
||
`// verilog_format: on` (accept a `lucisv: off/on` alias). Verible
|
||
implements this as "emit the original byte range verbatim" — the trivia
|
||
in `Meta` already carries comments, so detect fences during formatting in
|
||
`format.rs` and splice source text by span. Requires nodes to carry
|
||
byte spans (see §5, it's needed for LSP anyway).
|
||
→ `crates/vlog_formatter/src/fence.rs`; grammar, item-level semantics and
|
||
join rules in `docs/features/format-fences/README.md`. Item scopes only —
|
||
statement-level fences are documented as not implemented.
|
||
- [x] **[V] Range formatting: `--lines M-N[,M-N...]`.** Format only
|
||
constructs intersecting the given line ranges; emit everything else
|
||
verbatim. This is what makes adoption in dirty legacy codebases possible
|
||
(Verible ships `git-verible-verilog-format.sh` on top of it). Follow-up:
|
||
a `lucisv --diff-base <rev>` or contrib script that derives ranges from
|
||
`git diff`.
|
||
→ `crates/vlog_formatter/src/range.rs` (`format_range`, `LineRanges`), the
|
||
CLI's `--lines`, the server's `documentRangeFormattingProvider`, and
|
||
`tools/lucisv-changed.sh` for the `git diff` half of the follow-up (a
|
||
`--diff-base` flag inside lucisv is still open). The unit is one item;
|
||
modules and packages are descended into so a three-line edit does not
|
||
reflow a two-thousand-line body; statements and generate regions are
|
||
deliberately atomic. Fences outrank ranges, the cache is bypassed, and the
|
||
runtime safety net runs over the whole output — the convergence half by
|
||
replaying the per-item decisions, since line numbers move when text does.
|
||
578 corpus files × 8236 range trials: 0 refusals, and whole-file output is
|
||
byte-identical to before. Semantics, interaction rules and the honest
|
||
limits in `docs/features/range-formatting/README.md`.
|
||
- [x] **[V] Alignment inference for declaration/port/connection groups.**
|
||
Verible's most-loved feature: infer align-vs-flush-left intent from the
|
||
original spacing (≥4 excess spaces = author wants alignment), and break
|
||
alignment groups at blank lines and standalone comments
|
||
(`--alignment_group_boundary`). Start with the three constructs where RTL
|
||
culture demands it: port declarations, named connections (`.clk (clk)`),
|
||
and localparam/parameter lists. This needs original-spacing info
|
||
preserved through the lexer — record "excess spaces before token" as
|
||
trivia.
|
||
→ `crates/vlog_formatter/src/align.rs`; all three constructs ship (ports
|
||
align the name column, connections the `(`, parameters the name and `=`
|
||
columns). No lexer trivia was needed after all: `name_span` plus the
|
||
source text the formatter already holds gives both the preceding gap and
|
||
the token's column, so the spans suite is untouched. Zero churn on the
|
||
397-case table; 291 of 578 formattable corpus files now format
|
||
differently, with 0 verification errors and 0 round-trip failures over
|
||
2312 config-sweep runs. Rule, fixed-point argument and the parked columns
|
||
(`#( ... )` parameter ports, the type column, the trailing-comment column)
|
||
in `docs/features/alignment/README.md`.
|
||
- [x] **Comment inside port/param lists and assignment patterns is
|
||
dropped → refused** (found at scale by format-fences QA: 112 of 1868
|
||
corpus injection trials refuse with exit 2). The failsafe holds, but
|
||
this is the largest remaining comment-attachment gap; fix alongside the
|
||
three documented expression refusals (replication, compact bracket,
|
||
assign-value) from docs/features/formatter-bug-fixes and corpus-bugs.
|
||
→ `Meta::before_sep` keeps a comment on its element's side of the
|
||
separator, at every list kind; replication, gate arguments, header
|
||
imports, event lists, a connection's own parens and the enum dangling
|
||
bucket all gained comment slots too. Injection-harness refusal rate
|
||
2.3% → 0.4%. Still refused (documented, not hacked around):
|
||
`[a : b]`-style bracket interiors and a comment before a *procedural*
|
||
statement's `;` — see `docs/features/comments-round/README.md`.
|
||
→ Round 2 closed the two shapes a plain line-insertion sweep still hit
|
||
(14 of 989 trials): a comment before a module/instantiation head's `#(`
|
||
or `(` (four new `Vec<Comment>` fields), and a comment written next to
|
||
an `(* attribute *)`, which `Fmt::leading` now interleaves by span
|
||
instead of printing all comments then all attributes. Sweep 14 → 0; the
|
||
exhaustive per-line sweep's survivors are the shapes parked above plus
|
||
a comment before `else` — see `docs/features/comments-round-2/README.md`.
|
||
→ QA round-1 follow-up closed three more shapes with no node of their
|
||
own: between `bind` and its target (and before the bound module name),
|
||
before a call's `(` / inside an empty `()`, and on either side of a
|
||
postfix `with`. Still parked: a comment before a procedural statement's
|
||
`;`, and one inside a `bind`'s `: instance, list`.
|
||
- [x] **Two leading comments separated by one blank line come out
|
||
separated by two** (format-fences QA find, pre-existing): `leading`
|
||
pushes a HardLine after each comment and a BlankLine before the next.
|
||
Fix churns snapshots; take it with the comments round above.
|
||
→ `Fmt::leading_comments` emits the break *before* each comment
|
||
instead of after; 6 corpus files became fixed points, zero test churn.
|
||
- [x] **[R] `--diff` mode.** Like `ruff format --diff` / Verible's autofix
|
||
`patch` mode: print a unified diff instead of rewriting, for CI logs and
|
||
code review.
|
||
- [x] **[R] `--stdin-filename <path>`.** Editors pipe buffer contents via
|
||
stdin; the filename is needed for good error messages and (later)
|
||
per-directory config resolution.
|
||
|
||
## 3. CLI / UX (mostly ruff)
|
||
|
||
- [x] **[R] Config file discovery.** Search upward from each input file for
|
||
`lucisv.toml` / `.lucisv.toml` (analog of `ruff.toml` / `pyproject.toml`).
|
||
Keys: `line-length`, `indent`, `exclude` globs. CLI flags override file
|
||
config. Keep Verible's philosophy of *few* knobs — don't grow a
|
||
clang-format-sized option surface.
|
||
→ `crates/lucisv_core/src/config.rs` (lifted from crates/lucisv by lucisv-core-lift); discovery rule, TOML subset and
|
||
precedence in `docs/features/config-discovery/README.md`.
|
||
- [x] **[R] Parallel file processing.** ruff's speed story is embarrassing
|
||
parallelism over files. `main.rs` formats serially; use `rayon`
|
||
par_iter over the collected file list (formatting is already pure).
|
||
→ `crates/lucisv/src/main.rs`; pool sizing (`vlog_parser::PARSE_STACK_SIZE`
|
||
worker stacks, per the recursion-limit handshake), the reworked panic hook and the
|
||
ordered-reporting determinism argument in
|
||
`docs/features/parallel-files/README.md`. `--threads N` pins the worker
|
||
count; output is byte-identical at any count. 3.6× on 10 cores.
|
||
- [x] **[R] Content-hash cache.** Skip files whose (content hash, config
|
||
hash, lucisv version) triple is unchanged, stored in `.lucisv_cache/`.
|
||
Do this *after* parallelism; it matters for big monorepo RTL trees.
|
||
→ `crates/lucisv_core/src/cache.rs` (`--no-cache`, `--cache-dir`); the key
|
||
stores the resolved `line-length`/`indent` *values*, and only the
|
||
"already formatted" verdict is ever cached — a would-reformat or an
|
||
error is re-checked every run, so `--check`/`--diff` cannot go stale.
|
||
Hand-rolled FNV-1a and a hand-rolled tab-separated store (no new
|
||
dependency); corrupt or another version's entries are ignored, never
|
||
fatal. Warm `--check` over the pre-formatted corpus: 7.7× on one
|
||
thread, 2.3× at the default thread count. Collision posture, the
|
||
semantics table and the cwd-relative-default limitation in
|
||
`docs/features/format-cache/README.md`.
|
||
- [x] **[R] Respect `.gitignore`** and add `--exclude` globs when walking
|
||
directories (`collect_files` in `main.rs` currently walks everything,
|
||
including e.g. generated netlists).
|
||
→ `--exclude` shipped with cli-polish; `.gitignore` is hand-rolled in
|
||
`crates/lucisv_core/src/walk.rs` (anchoring, directory-only, `!` negation,
|
||
nested files override) with a `--no-gitignore` escape hatch. The
|
||
supported subset and everything git does that this does not are listed
|
||
in `docs/features/parallel-files/README.md`.
|
||
- [x] **[V+R] Exit-code contract doc.** Already ruff-like (0 clean /
|
||
1 would-reformat / 2 error) — document it in README and freeze it; CI
|
||
scripts will depend on it.
|
||
|
||
## 4. Linter (`lucisv check`) — new crate `vlog_linter`
|
||
|
||
Design it ruff-style from day one (shared parse, fix model), with
|
||
Verible's rule ergonomics (waivers, configurable rules).
|
||
|
||
- [x] **[R] One parse, two tools.** `lucisv check` and `lucisv format` must
|
||
share `vlog_parser` output in a single invocation (`lucisv check --fix
|
||
--format` style workflows come free later). ~~*Not done:* `lucisv check`
|
||
re-parses today (tolerantly, which the formatter does not), and nothing in
|
||
`vlog_linter`'s API prevents sharing a tree later — only `LintContext` would
|
||
change.~~
|
||
→ Delivered on the linter side (`docs/features/one-parse/README.md`):
|
||
`LintContext::from_parse` accepts pre-built products, `ParsedSource` is the
|
||
owned bundle, `lucisv check` parses once per file (one lex instead of two —
|
||
corpus check 266 → 208 ms single-threaded), and `lucisv_server` lints from the
|
||
`Document` it already analyzed (didChange→publish 18 → 11 ms on picorv32.v).
|
||
Byte-identical output proven against a HEAD-worktree binary. The formatter
|
||
half stands unchanged by design: `lucisv format` needs the *strict* parse its
|
||
safety net is defined over, so a combined `check --fix --format` workflow
|
||
remains a future feature — but nothing in the API blocks it anymore.
|
||
- [x] **[V+R] Rule trait + registry.** Each rule: stable kebab-case name,
|
||
one-line summary, longer doc with style-guide rationale (Verible links
|
||
each rule to a style-guide section — do the same), and a
|
||
`check(node/token) -> Vec<Diagnostic>` over syntax tree or token stream.
|
||
→ `crates/vlog_linter`: `Rule` (name/summary/doc/check over a `LintContext`
|
||
carrying tokens, the tolerant AST, the source and a `LineIndex`),
|
||
`all_rules`/`default_rules`/`rule_by_name`/`select_rules`. Rules, waiver
|
||
grammar and the corpus baseline in `docs/features/linter-core/README.md`.
|
||
- [x] **[V] Diagnostic format `FILE:LINE:COL: message [rule-name]`** plus
|
||
**[R]** `--output-format json` for tooling from the start.
|
||
→ `lucisv check`; text sorted by file then position, JSON one array on stdout
|
||
(hand-rolled, no new dependency) with location, end_location, range and fix.
|
||
- [x] **[R] Fix applicability model.** ruff distinguishes *safe* vs
|
||
*unsafe* fixes (`--fix` vs `--unsafe-fixes`). Adopt it now — retrofitting
|
||
safety classification is painful.
|
||
→ `Fix { edits, applicability: Safe | Unsafe }` and `--fix` /
|
||
`--unsafe-fixes`. Only `no-tabs` and `no-trailing-whitespace` ship fixes
|
||
(both Safe); the unsafe path is plumbed and tested but no rule uses it yet.
|
||
- [x] **[V] Waiver mechanisms:** inline `// lucisv: waive rule-name` (accept
|
||
`verilog_lint: waive` for migration), `waive-start`/`waive-stop` ranges,
|
||
and external waiver files (`waive --rule=X --line=N --location=glob`) for
|
||
code you can't touch. ruff's lesson: also warn about *unused* waivers.
|
||
- [x] inline `waive`, `waive-start`/`waive-stop`, both spellings, and the
|
||
`unused-waiver` pseudo-rule (unused, unknown rule, malformed, unmatched
|
||
`waive-stop`). A `verilog_lint:` waiver naming a rule lucisv lacks is
|
||
ignored rather than reported, so Verible-annotated code lints unedited.
|
||
- [x] external waiver files — needs a file format, a discovery rule and a
|
||
precedence story against inline waivers. **Delivered by §39**: Verible's
|
||
format, discovered from `[lint] waivers`, `--waiver-file` and
|
||
`lucisv.lint.waivers`, union with the inline waivers, unused ones
|
||
reported by the CLI after the whole run.
|
||
- [x] **[V] Configurable naming rules via regex** (module/instance/
|
||
parameter/enum naming), with named presets like Verible's
|
||
(snake_case, ALL_CAPS, etc.).
|
||
→ Named presets ship, **without a regex dependency**: `parameter-name-style`,
|
||
`enum-name-style`, `struct-union-name-style` (Verible-default-on, Verible's
|
||
own names and patterns) and `module-name-style` (default-off — Verible has no
|
||
such rule to inherit a default from). Presets are character-class predicates
|
||
in `crates/vlog_linter/src/naming.rs`; the justification, the parked rules and
|
||
the corpus baseline are in `docs/features/lint-rules-2/README.md`.
|
||
*Not* done: making the style **configurable per rule** — that needs the
|
||
`lint` key in `lucisv.toml`, still open below.
|
||
- [x] **[V] `--generate_markdown`-style self-documentation** — generate the
|
||
rule reference from the registry so docs can't drift. ruff does the same
|
||
for its 900+ rules.
|
||
→ `vlog_linter::rules_markdown() -> String` renders the whole registry (name,
|
||
default on/off, fix applicability, summary, doc), with a golden shape test
|
||
and an "every registered rule appears" test. Renderable today via
|
||
`cargo run -p vlog_linter --example rules_markdown`; a `lucisv check
|
||
--rules-doc` flag is filed as a handshake for `crates/lucisv`.
|
||
- [x] Seed rules (all syntactic, all from Verible's default set):
|
||
no-tabs, no-trailing-spaces, explicit-parameter-storage-type,
|
||
case-missing-default, always-ff-non-blocking / always-comb-blocking,
|
||
forbid `wire`-reg mixups in SV files, module-filename match.
|
||
**All delivered** — every rule named here exists (`explicit-parameter-storage-type`, `case-missing-default`, `always-ff-non-blocking`, `always-comb-blocking`, `module-filename`, the two above); 73 rules as of 0.39.0.
|
||
- [x] `no-tabs`, `no-trailing-whitespace`,
|
||
`explicit-parameter-storage-type`, `case-missing-default`,
|
||
`always-ff-non-blocking`, `always-comb-blocking`, `module-filename` —
|
||
corpus baseline per rule in `docs/features/linter-core/README.md`.
|
||
- [x] `wire`/`reg` mixups in SV files — `wire-reg-mixup`, default on. The
|
||
SystemVerilog-ness decision is the **file extension** (`.sv`/`.svh`), so a
|
||
stdin buffer without `--stdin-filename` is silent. It flags the `reg`
|
||
keyword only; `wire` is legitimate SystemVerilog and is not flagged. Note
|
||
for the record: unlike the other seed rules this one is **not** from
|
||
Verible's default set — Verible has no wire/reg rule at all; the rationale
|
||
is IEEE 1800 (`logic` and `reg` are one type) and the lowRISC style guide.
|
||
See `docs/features/lint-rules-2/README.md`.
|
||
|
||
## 5. Testing — adapt Verible's methodology
|
||
|
||
Verible's formatter confidence comes from a few complementary layers
|
||
(`formatter_test.cc`, component tests, equivalence/convergence checks).
|
||
Adapt each:
|
||
|
||
- [x] **[V] Massive text-in/text-out table tests.** Verible's
|
||
`formatter_test.cc` is thousands of small `{input, expected}` pairs — the
|
||
backbone of the formatter. `small_cases` in
|
||
`crates/vlog_formatter/tests/fixtures.rs` is the seed; grow it into a
|
||
dedicated `tests/cases/` organized by construct (one file per area:
|
||
ports, expressions, case-statements, generate, comments, macros...).
|
||
Port cases directly from `formatter_test.cc` where our supported-syntax
|
||
overlaps — it encodes years of accumulated edge cases (translate expected
|
||
output to our style: 2-space indent matches, wrap style differs).
|
||
- [x] **[V] Run equivalence + convergence on *every* test case**, not just
|
||
snapshots — once §1's `verify_equivalence` exists, assert it in the
|
||
fixture harness too, so every new case buys three checks for free.
|
||
**Delivered:** `format_source` runs `verify_equivalence` and `verify_convergence` on every output (`format/mod.rs`), so every fixture, snapshot, corpus file and fuzz case buys all three checks.
|
||
- [x] **[V] Component-level tests.** Verible tests the pipeline stages
|
||
separately (`token-annotator_test.cc`, `tree-unwrapper_test.cc`). Ours:
|
||
unit tests for `lexer.rs` trivia attachment (comment → leading/trailing
|
||
decisions, blank-line counting), `parser.rs` per-construct parse tests,
|
||
and `printer.rs` group-breaking behavior on synthetic docs.
|
||
**Delivered incrementally:** `lexer.rs` carries 37 unit tests on trivia and tokens, `parser/tests/` is one module per construct, `printer.rs` has its own group-breaking tests.
|
||
- [x] **[V] Lint test harness with inline violation markers.** Port the
|
||
`LintTestCase` / `RunLintTestCases` idea: test cases embed expected
|
||
findings positionally in the source (Verible splices `ExpectedTokenInfo`
|
||
fragments inline). A Rust adaptation: annotate with a marker comment or a
|
||
`^^^` caret line, e.g.
|
||
`assert_lint::<NoTabsRule>("module m;\n\twire x;\n ^ no-tabs\nendmodule")`.
|
||
Exact-match: unexpected findings fail the test too.
|
||
→ File-driven: `crates/vlog_linter/tests/cases/*.lint` (76 cases, all 13
|
||
rules with violating/clean/waived/unused-waiver coverage) run by
|
||
`tests/lint_cases.rs` — `//^ <col> <rule>` markers carry the exact
|
||
`line:col` the CLI prints, matched exactly in both directions, with
|
||
stale-marker detection (a marker naming a dead rule fails the suite) and
|
||
12 self-policing tests pinning the failure reports. Format spec and
|
||
migration stats in `docs/features/lint-harness/README.md`.
|
||
- [x] **[V] `RunApplyFixCases` equivalent:** every autofix rule gets
|
||
`(input, fixed_output)` pairs, and the fixed output must itself be
|
||
lint-clean and formatter-idempotent.
|
||
→ A `----` section in a `.lint` case: the CLI's fix→re-lint loop must land
|
||
exactly on the expected text, leave nothing Safe-fixable, and the fixed
|
||
output must be accepted and converged by `vlog_formatter::format_source`
|
||
(inputs the formatter refuses must say `#tolerant`, enforced in both
|
||
directions like `#SKIP`; that population is empty today — all 5 fix cases
|
||
for the 2 fixable rules run the full cross-tool check).
|
||
- [x] **[V] Error-case tests.** Table of inputs that must *fail* to parse
|
||
with the expected error position — locks in the failsafe path.
|
||
**Delivered** by error-recovery / header-recovery: the `BROKEN` table in `vlog_parser/tests/error_recovery.rs` plus `a_diagnostics_span_is_the_token_its_line_col_names`.
|
||
- [x] **[R] Real-world corpus check (ruff's "ecosystem check").** ruff
|
||
CI runs against big OSS codebases and diffs results between commits. Do
|
||
the same with permissively-licensed RTL: e.g. lowRISC Ibex, OpenTitan,
|
||
PULP cores, picorv32. Script: clone pinned revs, run lucisv over every
|
||
`.sv/.v`, report parse-success rate + equivalence/convergence failures;
|
||
fail CI on regression. Also the honest tracker for the "not yet
|
||
supported" list in README.
|
||
→ `tools/corpus_fetch.sh` + `tools/corpus_check.sh`, baseline and
|
||
findings in `docs/features/corpus-check/README.md`. CI wiring is the
|
||
one part left open (network access is a separate decision).
|
||
→ Latest movement: classes/constraints
|
||
(`docs/features/classes/README.md`) took the corpus from 476/820
|
||
formattable (58.0%) to **578/820 (70.5%)** — 102 files gained, 0 lost,
|
||
0 verification errors, 0 crashes, checked by diffing the two TSVs by
|
||
path. 72 of the 142 `extends`-blocked files now format; the other 70
|
||
advanced to a second blocker, and the new top blocker is dynamic
|
||
arrays and queues (README roadmap item 4, 41 files).
|
||
→ Dynamic types (`docs/features/dynamic-types/README.md`) then took it
|
||
from 578/820 to **636/820 (77.6%)** — 58 files gained, 0 lost, 0
|
||
verification errors, 0 crashes, all 636 round-tripped individually.
|
||
Queues/dynamic arrays, named call arguments and `case ... inside` are
|
||
done; the new top blocker is `interface` declarations (25 files,
|
||
README roadmap item 8), then `` `else`` inside an element (13, the
|
||
documented directives-in-lists non-goal) and `` `uvm_field_int `` (11,
|
||
the documented macro-items lexer gap).
|
||
→ item-misc (`docs/features/item-misc/README.md`) then took it from
|
||
636/820 to **661/820 (80.6%)** — 25 files gained, 0 lost, passing set
|
||
verified as a strict superset. The `` `uvm_field_int `` gap is closed
|
||
(in the parser, at item position only — the lexer glue stays parked for
|
||
the reason `docs/features/lexer-cleanup/README.md` gives), along with a
|
||
bare macro item followed by a declaration on the next line,
|
||
`` `error``/`` `warning`` directives and elaboration system tasks
|
||
(`$error`/`$fatal`/`$warning`/`$info`) at item position. `interface`
|
||
(31 files) and `bind` (28) are now the top two blockers.
|
||
→ bind (`docs/features/bind/README.md`) then took it from 671/820
|
||
(81.8%, the baseline after round 21) to **699/820 (85.2%)** — all 28
|
||
`bind` files gained, 0 lost, passing set verified as a strict superset.
|
||
`interface` (31 files) is now the top blocker.
|
||
→ interfaces (`docs/features/interfaces/README.md`) then took it from
|
||
712/820 (86.8%, the baseline after round 21) to **740/820 (90.2%)** —
|
||
28 of the 31 `interface` files gained, 0 lost, passing set verified as
|
||
a strict superset and all 28 round-tripped individually.
|
||
`interface`/`modport`/`clocking` and `virtual` interface types in
|
||
every type position are done; the 3 files left advanced to blockers in
|
||
the `expressions` and `other` buckets. `dv-statements` (26 files) is
|
||
now the top blocker.
|
||
→ expressions-2 (`docs/features/expressions-2/README.md`) then took it
|
||
from 751/820 (91.6%, the baseline after round 21) to **772/820
|
||
(94.1%)** — 20 of the 21 `expressions` files plus the `dv_utils_pkg.sv`
|
||
`other` file gained, 0 lost, passing set verified as a strict superset.
|
||
Casts over any constant primary, streaming concatenations, `->`/`<->`
|
||
implication, drive strengths on continuous assigns, attributes on named
|
||
port connections, the `'{N{0}}` pattern replication, `inside` a macro
|
||
and `const ref` arguments are done; the one file left
|
||
(`compare_helper.sv`) advanced to a macro-items blocker
|
||
(`` `MACRO expr`` in expression position). `dv-statements` (26 files)
|
||
is still the top blocker.
|
||
→ dv-statements (`docs/features/dv-statements/README.md`) then took it
|
||
from 772/820 (94.1%, the baseline on the same tree) to **796/820
|
||
(97.1%)** — 24 of the 26 `dv-statements` files gained, 0 lost, passing
|
||
set verified as a strict superset. `randomize() with { ... }`,
|
||
array-method `with (expr)`, package-scoped and hierarchical `foreach`,
|
||
`randcase`, `wait fork`, block-level `import`, `let`, omitted call
|
||
arguments, statement labels and a stray `;` after a task/function
|
||
footer are done, along with a comment written before `else` (which had
|
||
been crossing the keyword and failing verification). The 2 files left
|
||
advanced to blockers other clusters own: `dv_base_vseq.sv` to
|
||
macro-items (a bare macro followed by `@` on the next line),
|
||
`riscv_instr.sv` to the `new obj` shallow-copy expression.
|
||
`directive-split` (14 files) is now the top blocker.
|
||
→ mop-up-2 (`docs/features/mop-up-2/README.md`) then took it from
|
||
796/820 (97.1%, the baseline on the same tree) to **800/820 (97.6%)**
|
||
— 4 files gained, 0 lost, passing set verified as a strict superset. A
|
||
macro statement that ends its line followed by a symbol on the next
|
||
one, the `new obj` shallow copy (IEEE 1800 §8.12), and a based number
|
||
whose digits are a macro (`` 32'h`DM_ADDR ``) are done; the
|
||
`lex-macro-number` bucket is gone. `compare_helper.sv` stays failing
|
||
and is not fixable: `` `X_EACH_CSR 1 `` needs the macro's body, which
|
||
lives in a file lucisv deliberately does not read. `directive-split` (14
|
||
files) is still the top blocker, and every remaining failure is in a
|
||
deliberately-unsupported category.
|
||
- [x] **[R] Fuzzing.** ruff fuzzes its parser. `cargo-fuzz` targets:
|
||
(a) parser must never panic on arbitrary bytes, (b) for inputs that
|
||
parse, format must satisfy equivalence + convergence.
|
||
**Delivered in-tree, without `cargo-fuzz`** (nightly + a dependency): the guarded truncation and single-character-deletion fuzzers in `vlog_parser/tests/error_recovery.rs` (a), and the formatter gap fuzzers from comment-slots (b), all run under `tools/guard.sh`.
|
||
- [x] **[R] Consider `insta`** for the snapshot harness (review workflow
|
||
`cargo insta review` beats `UPDATE_SNAPSHOTS=1`), keeping the
|
||
idempotency loop from `fixtures.rs`.
|
||
**Ruled 2026-09-04:** no. The `UPDATE_SNAPSHOTS=1` loop plus the idempotency suite has served 40 releases; a dependency for a review UI is not worth its weight.
|
||
|
||
## 6. LSP: full editor support (a first-class goal, not a maybe)
|
||
|
||
Goal (owner's requirement, 2026-08-19): lucisv becomes a language server
|
||
for VS Code and Vim/Neovim with feature parity, for Verilog/
|
||
SystemVerilog, with what the Python VS Code stack (ruff + Pylance)
|
||
offers over LSP — scoped to **synthesizable Verilog first**:
|
||
|
||
- semantic syntax highlighting (`semanticTokens`)
|
||
- formatting (document + range) and lint diagnostics as you type
|
||
- go-to-definition and find-all-references
|
||
- hover: declaration/type info, and **`` `define`` expansion on hover**
|
||
(hover a macro usage → see its value/body)
|
||
- document + workspace symbols; later: completion, rename, signature
|
||
help for module instantiation
|
||
- **cross-file resolution through header imports**: `import pkg::*;` /
|
||
`import pkg::name;` at the top of a file or in a module header must
|
||
resolve into the package's file anywhere in the workspace (workspace
|
||
index of modules/packages; `` `include`` paths resolved too)
|
||
|
||
One server binary serves both editors (VS Code via a thin extension,
|
||
Vim/Neovim via built-in LSP config); no editor-specific logic below the
|
||
protocol layer. Foundation decisions that are cheap now and expensive
|
||
later:
|
||
|
||
- [x] **Byte spans on every token and AST node.** Prerequisite for
|
||
everything in this section (and for §2 fences/range formatting).
|
||
`token.rs` / `ast.rs` should carry `TextRange { start, end }` offsets;
|
||
add a line-index utility (ruff's `ruff_source_file`) for offset↔line:col.
|
||
→ `docs/features/spans/README.md`. `vlog_parser::span::TextRange` on every
|
||
token, comment and node; `vlog_parser::line_index::LineIndex` for
|
||
offset↔line:col; token-level losslessness is a test
|
||
(`crates/vlog_parser/tests/spans.rs`).
|
||
- [x] **Error-tolerant parsing mode.** A formatter may refuse broken input;
|
||
an LSP cannot — code is mid-edit most of the time. Add recovery in
|
||
`parser.rs`: on statement-level error, record a diagnostic, skip to a
|
||
sync token (`;`, `end`, `endmodule`), continue. Formatter keeps requiring
|
||
zero errors; the LSP consumes the partial tree.
|
||
→ `vlog_parser::parse_source_tolerant(src) -> (SourceFile,
|
||
Vec<ParseDiagnostic>)`; unparsable ranges become `ItemKind::Error` /
|
||
`StmtKind::Error` leaves. Sync tokens, the four guarantees and the
|
||
deliberate gaps (no tolerant *lexer*, no recovery inside headers or lists)
|
||
in `docs/features/error-recovery/README.md`. `parse_source` unchanged.
|
||
- [x] **Keep the CST lossless.** Current design (trivia in `Meta`) is
|
||
format-oriented; verify every source byte is reachable from the tree
|
||
(tokens + trivia + spans). A `reconstruct(tree) == input` round-trip test
|
||
makes losslessness a tested invariant — this is what makes the same tree
|
||
serve formatter, linter, and highlighter. If gaps appear, consider a
|
||
rowan-style green tree (rust-analyzer / ruff direction) rather than
|
||
patching `Meta`.
|
||
**Ruled dropped by the owner, 2026-09-05:** the verifier is the invariant — token equivalence and convergence on every output byte-for-byte; the token-level half (`spans.rs`) stays.
|
||
- [x] **New crate `vlog_semantic`** (analog of `ruff_python_semantic`):
|
||
symbol tables per scope (module/package/function/block/generate), binding
|
||
→ references. Serves go-to-definition/hover first, then semantic lint
|
||
rules (unused-signal, undriven-net) which are the lint rules people
|
||
actually want and Verible *can't* do (it's syntax-only — this is the
|
||
differentiation opportunity).
|
||
→ `vlog_semantic::analyze(&SourceFile, src) -> Semantics`, never failing,
|
||
with `symbol_at` / `definition_of` / `references_of` / `document_symbols`.
|
||
Two-pass bind-then-resolve (so forward references work), imports of
|
||
in-file packages resolved and all others kept as
|
||
`Resolution::ExternalCandidate` for the workspace index below. Rules,
|
||
simplifications and the corpus baseline (79.5% of uses resolved in-file on
|
||
cleanly-parsed corpus files, 19.6% external, 0.9% unresolved) in
|
||
`docs/features/vlog-semantic/README.md`.
|
||
→ The crate's biggest named gap — "no name declared inside a class body
|
||
is indexed, hovered or navigable" (the classes round's handshake) — has
|
||
since closed: `docs/features/class-semantics/README.md` binds classes
|
||
(`SymbolKind::Class`, `ScopeKind::Class`, members, `extends`,
|
||
`this`/`super`, out-of-body methods, the honest
|
||
`Resolution::InheritedCandidate` for what only a base class could
|
||
supply), indexes classes and their members in the workspace layer, and
|
||
grows the corpus tables by +4 232 symbols / +16 631 references (clean
|
||
files: 74.0 % in-file, 17.9 % external, 7.1 % inherited, 1.0 %
|
||
unresolved, 0 unplaced).
|
||
- [x] **`` `define`` table for hover expansion.** Record every
|
||
`` `define`` (name, params, body text, source span) during lexing
|
||
instead of treating it as fully opaque — no expansion during
|
||
formatting (that non-goal stands), but the table feeds hover
|
||
(`` `WIDTH`` → "defined as 8 in defs.svh:12") and later single-step
|
||
macro expansion display. Cheap to collect now that directives carry
|
||
`RawText`.
|
||
→ `vlog_parser::defines::collect_defines(&tokens) -> DefineTable`, a
|
||
post-lex pass with zero lexer changes. `Define { kind, name, params,
|
||
body, span, name_span }`; every definition of a name is kept
|
||
(`all`/`latest`) and `` `undef`` is recorded as an event. Body
|
||
normalization (backslash-newline removed, nothing else touched) and the
|
||
gaps — no `` `ifdef`` evaluation, no cross-file `` `include`` — in
|
||
`docs/features/define-table/README.md`. Hover itself waits on
|
||
`lucisv_server`; this is only the table.
|
||
- [x] **Workspace index for cross-file navigation.** Map module/package/
|
||
typedef names → (file, span) across all workspace files, so header
|
||
imports (`import pkg::*;`) and instantiations resolve to definitions
|
||
in other files. Start as a full-scan-on-startup index (Verilog
|
||
codebases are small); ~~incrementality comes with salsa later~~ — one file
|
||
at a time since 2026-08-27, without salsa
|
||
(`docs/features/incremental-index/README.md`); and ~~re-scanned from zero on
|
||
every startup~~ — what a scan learns persists since 2026-08-27, so a reopened
|
||
workspace indexes from records rather than parses and an interrupted scan
|
||
resumes (`docs/features/index-persistence/README.md`).
|
||
→ `vlog_semantic::WorkspaceIndex::build(files) `+
|
||
`resolve_external(&Semantics, &WorkspaceIndex) -> ExternalResolutions`,
|
||
a two-layer design: the index is a full scan (860 corpus files in 0.7 s),
|
||
the answers arrive as an overlay keyed by `ReferenceId` and `Semantics`
|
||
is never mutated. Package/module members and per-file `` `define``
|
||
tables are indexed too, so `import p::*`, `p::x` and `.port(...)` all
|
||
reach into the other file. On cleanly-parsed corpus files the workspace
|
||
answers **87 % of the external candidates**, taking the unresolved-
|
||
external rate from 19.6 % to 2.6 % of all references. Duplicate-name
|
||
policy, `` `define`` lookup (no include graph → no resolution order) and
|
||
the honest gaps in `docs/features/workspace-index/README.md`.
|
||
→ The index's biggest named gap has since closed: accepting `` `ifdef``
|
||
inside a port/parameter/enum list (README roadmap item 6,
|
||
`docs/features/directives-in-lists/README.md`) means `picorv32`,
|
||
`picorv32_axi` and `picorv32_wb` index at all — 521 → 530 modules,
|
||
8044 → 9174 exported members, external candidates answered 87.0 % → 93.6 %
|
||
on cleanly-parsed files (unresolved-external rate 2.6 % → 1.3 % of all
|
||
references). The instantiation half followed in
|
||
`docs/features/directives-in-instances/README.md` (directives in an
|
||
instantiation's `#( ... )` overrides and an instance's `( ... )`
|
||
connections); after it **no corpus file is blocked on a compiler directive
|
||
at all**, so nothing is left unindexed for this reason. The *index* counts
|
||
above did not move (530 modules, 9174 exported members, 502 defines — the
|
||
six files it unblocked have headers that already parsed, so their modules
|
||
were already indexed); what moved is 6 more files that now format, and with
|
||
them external candidates answered 93.6 % → **94.0 %** on cleanly-parsed
|
||
files (unresolved-external rate 1.3 % → **1.2 %**).
|
||
- [x] **New crate `lucisv_server`** (analog of `ruff_server`): LSP over
|
||
stdio via `tower-lsp` or `lsp-server`. Order of capabilities:
|
||
1. `textDocument/formatting` + `rangeFormatting` (reuses §2 `--lines`),
|
||
2. publish parse/lint diagnostics,
|
||
3. `semanticTokens` for highlighting (needs only the lexer + spans),
|
||
4. `hover` (decl info + define table) / `definition` / `references`
|
||
(needs `vlog_semantic` + workspace index),
|
||
5. document/workspace symbols; then completion, rename, signature
|
||
help for instantiations.
|
||
→ `crates/lucisv_server`, binary `lucisv-server`, on `lsp-server` +
|
||
`lsp-types` (synchronous, no async runtime). **Shipped:**
|
||
`textDocument/formatting`, `textDocument/rangeFormatting` (round 18, on §2's
|
||
`--lines`), parse diagnostics on didOpen/didChange/didSave,
|
||
`semanticTokens/full`, `hover` (in-file and workspace `` `define``
|
||
expansion, declaration snippets), `definition` (both resolution layers,
|
||
all locations when ambiguous), `references` (in-file), `documentSymbol`
|
||
and `workspace/symbol`. **Not shipped, deliberately:** ~~`rangeFormatting`
|
||
(waits on §2 `--lines`)~~ **delivered**, lint diagnostics (waits on
|
||
`vlog_linter`) **delivered**, cross-file references,
|
||
completion/rename/signature help. Byte↔UTF-16
|
||
position conversion, the state/staleness model and the dependency audit
|
||
are in `docs/features/lucisv-server/README.md`.
|
||
- [x] **Editor packaging.** A minimal VS Code extension (launch the
|
||
server, register file types) and a documented Vim/Neovim `lspconfig`
|
||
snippet. No editor-specific features beyond launching.
|
||
→ `editors/vscode/` (41-line plain-JS `extension.js` on the official
|
||
`vscode-languageclient`, pinned `9.0.1`; one setting, `lucisv.serverPath`;
|
||
`.v`/`.vh`→`verilog`, `.sv`/`.svh`→`systemverilog`; no grammar — semantic
|
||
tokens come from the server; no commands, no status bar) and
|
||
`editors/nvim/README.md` (`vim.lsp.config` for Neovim 0.11+, plus
|
||
`nvim-lspconfig`, Vim 9 `vim-lsp` and coc.nvim). `editors/vscode/smoke.js`
|
||
is the pre-publish check: zero-dependency node, spawns the server with the
|
||
extension's exact contract and drives `initialize`/`didOpen`/`shutdown`/
|
||
`exit` over hand-rolled framing. Manual install steps only — CI packaging
|
||
and Marketplace publishing are out of scope, and `publisher` is a
|
||
placeholder. `docs/features/editor-packaging/README.md`.
|
||
- [x] **Salsa-style incrementality — defer.** ruff's `ruff_db` uses salsa;
|
||
don't take that dependency until hover/definition across files exists.
|
||
Per-file recompute is fine at Verilog file sizes.
|
||
**Partly answered without salsa, 2026-08-27**
|
||
(`docs/features/incremental-index/README.md`): `WorkspaceIndex::update_file`
|
||
replaces one file's contribution and provably gives the index a whole build
|
||
would have, so a save costs 33 ms instead of 1.5 s over the corpus. No query
|
||
graph and no dependency tracking — the salsa question is still open, and is
|
||
still deferred. **A second piece answered without salsa, 2026-08-27**
|
||
(`docs/features/index-persistence/README.md`): every file's `FileFacts` are
|
||
written to a content-keyed store as a scan parses them, so the recompute a
|
||
*new session* would otherwise repeat is skipped instead — 1.8x on a whole
|
||
corpus rescan, and a scan interrupted halfway resumes where it stopped.
|
||
**A third piece answered without salsa, 2026-08-28**
|
||
(`docs/features/change-debounce/README.md`): the per-keystroke recompute a
|
||
query graph would have made unnecessary is instead *not started* — a burst
|
||
of `didChange`s is coalesced into one reanalysis. Still no query graph and
|
||
no dependency tracking; the salsa question remains open and deferred.
|
||
Measured costs for what a recompute actually is are now recorded in
|
||
`docs/perf/README.md`. **Round 2, 2026-08-28**
|
||
(`docs/features/interactive-latency/README.md`): that recompute is now
|
||
broken down stage by stage, and 79 % of it is lexing and parsing. If the
|
||
salsa question is ever reopened, that is the number it has to beat —
|
||
incremental *lexing and parsing*, not incremental queries over a whole-file
|
||
parse, and it lands squarely on `CLAUDE.md`'s hard invariants 1 and 2.
|
||
**A fourth piece answered without salsa, 2026-08-28**
|
||
(`docs/features/hover-line-index/README.md`): a derived fact a query used to
|
||
recompute — the *line* a declaration is written on, which cost a whole file
|
||
read and a whole `LineIndex` per request — is now computed once when the
|
||
file is indexed and stored beside the span (`Def::lines`, `FACTS_FORMAT`
|
||
3 → 4), and the one thing still needing that file's text is served from a
|
||
small bounded cache of closed files. A repeat hover into a 12 MB closed file
|
||
goes 5.75 ms → 0.95 µs; a whole scan is unchanged and the store grows 2.9 %.
|
||
Still no query graph: what is cached is a value, invalidated at four named
|
||
points, not a node in a dependency graph. **The larger number the same round
|
||
measured is not an incrementality problem at all**: the first request of a
|
||
session waits out the startup scan (780 ms cold, 287 ms warm), because
|
||
`Server::new` scans before the message loop starts. Filed there, not fixed.
|
||
→ **Fixed 2026-08-28** (`docs/features/scan-interleave/README.md`): the scan
|
||
is now per-file steps with the message queue drained between them, so a
|
||
startup scan of more than 64 files answers requests while it runs — 780 ms →
|
||
**15.5 ms** cold, 287 ms → **12.8 ms** warm, with the scan's own total moving
|
||
under a percent (860-file corpus: 351 → 353 ms cold, 187 → 189 ms warm). The
|
||
merge cost was measured first and ruled per-file feeding out: a merge is a
|
||
pass over the whole index, so one per file would have cost 631 ms of merging
|
||
on 200 files against 464 ms of parsing. Records are staged per file and folded
|
||
in with one `WorkspaceIndex::absorb` per *drain*, and a drain only happens
|
||
when a message is waiting — so a scan nobody is waiting on pays nothing.
|
||
Answers given mid-scan read the index as of that moment, and only the startup
|
||
scan gives them: a request queued behind a message that asked for a rescan
|
||
waits for that rescan, which is the order contract the loop always kept.
|
||
**Ruled 2026-09-04:** not needed. `incremental-index` (per-file `update_file`, batch publish) and the persistent facts store answer every cross-file question without salsa.
|
||
- [x] **Release prep.** `LICENSE` (MIT), `CHANGELOG.md` (v0.2.0), version
|
||
bumped to 0.2.0 across the workspace and the extension, `tools/release.sh`
|
||
(release binaries + `.vsix` + `SHA256SUMS` into a gitignored `dist/`) and
|
||
`tools/RELEASING.md`. `docs/features/release-prep/README.md`.
|
||
**Publishing (owner actions):** fully optional and deferred per the owner
|
||
(2026-08-19) — sideloading the `.vsix` is the supported path. If it is ever
|
||
revisited, only the owner can do it: create a Marketplace publisher id and
|
||
replace `REPLACE-ME` (done 2026-08-25: publisher `guoliangchen`, author
|
||
Guoliang Chen), hold the `vsce`/`ovsx` tokens, supply an extension
|
||
icon, and confirm the public repo URL. Commands are in `tools/RELEASING.md`'s
|
||
appendix.
|
||
|
||
## 7. Deliberate non-goals (also a best practice)
|
||
|
||
- No preprocessor expansion *in the formatter*: like Verible, format
|
||
unpreprocessed source and never expand macros into the output. (The
|
||
LSP's define table in §6 *records* definitions for hover display —
|
||
that is bookkeeping, not expansion, and doesn't weaken this rule.)
|
||
- No option explosion: Black/ruff's lesson — every knob halves the value
|
||
of a canonical style. Alignment inference (§2) is the culturally
|
||
necessary exception.
|
||
- No semantic claims in v1 lint rules: syntax-only rules first (Verible's
|
||
scope), semantic rules only after `vlog_semantic` exists.
|
||
|
||
## 8. Refactoring — the rope port (owner request, 2026-08-24)
|
||
|
||
Port the ideas of `python-rope/rope` to Verilog/SV, server-first. The full
|
||
rope→Verilog mapping, feature checklist and milestone specs live in
|
||
`docs/features/refactor/README.md` — that file is the source of truth; this
|
||
section only tracks the milestones.
|
||
|
||
- [x] **M1 `filelist`** — EDA `.f` filelist defines the index scope
|
||
(`-f` nesting, `+incdir+`/`+define+` recorded, env vars); fallback:
|
||
~~workspace walk, then current file's directory when rootless~~
|
||
**the open files' own folders since 2026-08-27 (index-scope), with the
|
||
workspace walk behind `lucisv.index.scope: "workspace"`; the filelist
|
||
still outranks both. See `docs/features/index-scope/README.md`.**
|
||
**Since 2026-08-28 a rescan no longer re-parses the buffers it already
|
||
analyzed** — an open buffer's index facts and completion words come from the
|
||
analysis it holds — so a scope-widening `didOpen` with a 1.4 MB buffer open
|
||
costs ~23 ms rather than ~228 ms. **And since 2026-08-28 a widen indexes only
|
||
the folders it added** rather than rescanning every folder reached so far, so
|
||
the wait a jump puts in front of the next request stops growing with the
|
||
session: over opentitan's 3 979 files, 120/132/137/169 ms per jump became
|
||
22/18/12/44 ms.
|
||
- [x] **M2 `refactor-rename`** — new crate `vlog_refactor`; LSP
|
||
`prepareRename`/`rename` for every symbol kind `vlog_semantic` resolves,
|
||
cross-file, whole-edit-or-nothing verified by re-parse.
|
||
**2026-09-23 (TODO-MCP M3.5):** a rename no longer cuts a `.name` or `.*`
|
||
connection — the binding is written out explicitly (`.q(p)`, `.n(m)`) and
|
||
warned about, the unreadable cases are refused, and the verifier prints
|
||
every implicit binding before and after (`docs/features/refactor-rename/README.md`,
|
||
"Implicit connections").
|
||
- [x] **M3 `refactor-ports`** — add/remove/propagate module ports across
|
||
the declaration and every instantiation (named/ordered/`.*`).
|
||
**Amended 2026-08-28** (`docs/features/refactor-ports/README.md`): a
|
||
`textDocument/codeAction` no longer reads the in-scope file set from
|
||
disk per cursor move. The engine is handed the cursor's module's own
|
||
fan-out through the index — definers, instantiation edges, reference
|
||
postings, open buffers — by one builder both the code action and the
|
||
three commands use, and the answer is asserted equal to the
|
||
whole-workspace one. Over opentitan a code action went 4.56 s → 7.1 ms
|
||
(2.93 s → 83 ms for a module instantiated in 36 files); it was the
|
||
request every queued definition and hover had been waiting behind.
|
||
- [x] **M4 `refactor-instantiate`** — module hinting: instantiation
|
||
skeleton completion from the definition, auto-connect, signature help.
|
||
- [x] **M5 `completion-core`** — keyword + project-wide identifier
|
||
completion (token-harvested, comments/strings excluded), merged with
|
||
M4's module snippets; version 0.3.0.
|
||
- [x] **M6 `completion-templates`** — context-gated statement/item snippet
|
||
completion from the server (if/else, case, always, loops, declarations),
|
||
reconciled with the static VS Code snippets; version 0.4.0.
|
||
- [x] **M7 `references-nav`** — cross-file find-all-references (reuse
|
||
M2's collection machinery), document highlight, folding ranges from the
|
||
rainbow's pair data.
|
||
- [x] **M8 `inlay-hints`** — port-name hints on ordered connections and
|
||
parameter-name hints on ordered `#(...)` overrides, from the index.
|
||
- [x] **M9 `file-watching`** — `workspace/didChangeWatchedFiles` for
|
||
sources and the filelist; reindex on external changes (git pull,
|
||
filelist edits outside the editor).
|
||
- [x] **M10 `include-nav`** — clickable `` `include`` lines resolved
|
||
through the filelist's `+incdir+`s; cross-file `` `define`` lookup
|
||
along the include graph.
|
||
- [x] **M11 `hierarchy`** — module hierarchy both directions (who
|
||
instantiates X / what X instantiates) over LSP callHierarchy.
|
||
- [x] **M12 `semantic-lints`** — unused-signal, undriven-net,
|
||
multiply-driven: the first semantic lint rules on `vlog_semantic`.
|
||
- [x] **M13 `cli-filelist`** — `lucisv -f files.f` on the command line,
|
||
reusing M1's parser; format/lint exactly the project's files.
|
||
- [x] **M14 `macro-expansion`** — single-step macro expansion on hover
|
||
(the define-table README's promised follow-up); version 0.5.0 with a
|
||
CHANGELOG entry covering M7–M14.
|
||
- [x] Backlog (~~extract module~~, ~~inline~~, ~~`.*` expansion~~, ~~ANSI
|
||
conversion~~, ~~organize imports~~, …) — triaged in the umbrella README after M5.
|
||
**`.*` expansion shipped 2026-09-05 (§50,
|
||
`docs/features/expand-wildcard/README.md`)**: the wildcard written out as
|
||
the named connections it stands for, per IEEE 1800 §23.3.2.4, with a code
|
||
action and `lucisv.expandWildcard`. It leaves one thing behind, added to
|
||
this backlog: **a `.*` written in a `bind` directive**, which binds in the
|
||
target's scope rather than the one it is written in — elaboration, not
|
||
lexical lookup, and 57 of OpenTitan's 66 wildcard sites.
|
||
**Non-ANSI → ANSI conversion shipped 2026-09-05 (§51,
|
||
`docs/features/ansi-conversion/README.md`)**: a Verilog-2001 header rewritten
|
||
the modern way, each port declaration merged with the net or variable
|
||
declaration that completes it per IEEE 1800 §23.2.2.2, with a code action and
|
||
`lucisv.convertToAnsi`. It leaves two things behind, added to this backlog:
|
||
**an `interface`'s non-ANSI header**, which needs the `modport`s that name
|
||
the same ports read first; and **an attribute instance on an absorbed
|
||
declaration** (`(* keep *) input a;`), which the conversion refuses rather
|
||
than moves — where a `(* ... *)` belongs in an ANSI port list, and whether
|
||
the same one may be split across the ports a multi-name declaration
|
||
declares, is a design question the merge rule does not answer.
|
||
**Organize imports shipped 2026-09-05 (§52,
|
||
`docs/features/organize-imports/README.md`)**: the imports nothing uses
|
||
removed, exact duplicates merged and the run at a scope's top sorted, with a
|
||
`source.organizeImports` code action, `lucisv.organizeImports`, and the same
|
||
judgement as the `unused-import` lint rule. It leaves three things behind,
|
||
added to this backlog: **a module header's `import`** (`module m import
|
||
p::*;`), which is judged but never moved because it has no line of its own;
|
||
**an unused import carrying a comment**, kept with a warning rather than
|
||
deleted, because the comment would have to go with it; and — the one that
|
||
decides how useful the feature is on real verification code — **a scope
|
||
holding a macro call or a `` `include ``**, which lucisv refuses to judge at
|
||
all: 32 of the corpus's 40 multi-import scopes and 33 of 33 OpenTitan UVM env
|
||
packages.
|
||
**Extract module shipped 2026-09-05 (§53.1,
|
||
`docs/features/extract-inline-module/README.md`)**: a selection of whole
|
||
module items becomes a module of its own, with ports and parameters inferred
|
||
from the dataflow across the boundary, the `import`s it needs carried across,
|
||
and the instantiation that replaces it rendered from the new module's own
|
||
text — into a file beside its own where the editor can create one, below the
|
||
module it came from where it cannot. `refactor.extract` plus
|
||
`lucisv.extractModule`, whose name comes from an input box the VS Code
|
||
extension puts in front of it. **Inline module (§53.2) is not started**, so
|
||
the backlog line above keeps it. Extract leaves four things behind, added to
|
||
this backlog: **a task or function used on both sides** of the selection,
|
||
which would have to move or be duplicated; **a hierarchical reference**
|
||
crossing the boundary, which no port can carry; **an `initial`/`final`
|
||
block**, whose meaning is when it runs; and **an unpacked-array or
|
||
interface-typed name** crossing, which the port renderer will not write.
|
||
**All five delivered in loop 2** (§50–§53 across 0.46.0–0.49.0); what each one deliberately refuses is listed under "Open items for loop 3" in the Loop 2 order section.
|
||
|
||
## 9. LSP 3.18 protocol audit (2026-08-26)
|
||
|
||
Systematic comparison of `lucisv_server` against the LSP 3.18
|
||
specification. What we implement: hover, definition, references,
|
||
documentHighlight, documentLink, document/workspace symbols, folding,
|
||
semanticTokens/full, inlayHint, completion, inlineCompletion (3.18),
|
||
signatureHelp, codeAction + executeCommand, rename + prepare,
|
||
callHierarchy, formatting + rangeFormatting, push diagnostics, dynamic
|
||
file-watcher registration, configuration push. Below is everything
|
||
major that's missing, ordered by priority. The `resolve` endpoints
|
||
(completionItem, codeAction, inlayHint, documentLink, workspaceSymbol)
|
||
are **deliberately** unadvertised — every item is returned complete —
|
||
and are not gaps.
|
||
|
||
### 9a. Compliance and high-value (round 1)
|
||
|
||
- [x] **`executeCommand` must deliver its edit via `workspace/applyEdit`.**
|
||
Today `ports::execute`'s `WorkspaceEdit` is returned as the request's
|
||
*result* (`server.rs`, `ports.rs:79`), which the spec does not define
|
||
and standard clients drop on the floor — `vscode-languageclient` does
|
||
not apply executeCommand results and `editors/vscode/extension.js`
|
||
has no custom handler, so `lucisv.addPort`/`removePort`/`propagate`
|
||
invoked as *commands* currently do nothing in every stock client (the
|
||
code-action path is unaffected: those carry the edit inline). Fix:
|
||
push a `workspace/applyEdit` request, return `null` as the command
|
||
result, and read the `ApplyWorkspaceEditResponse` (the one client
|
||
response we can no longer ignore wholesale). Gate on the client's
|
||
`workspace.applyEdit` capability with the old return-the-edit
|
||
behavior as the documented fallback.
|
||
→ `docs/features/apply-edit/README.md`; the edit is pushed with a
|
||
`lucisv: <command>` label, the result is `null`, and a refusal is shown
|
||
as an ERROR naming the command. Watcher-registration answers stay
|
||
ignored; `editors/vscode/extension.js` needed no change.
|
||
- [x] **Pull diagnostics (3.17): `textDocument/diagnostic` +
|
||
`workspace/diagnostic`.** The modern model — client controls timing,
|
||
prioritizes visible editors, caches via `resultId`/`unchanged`.
|
||
Advertise `DiagnosticOptions` (`inter_file_dependencies: true` — a
|
||
save can change other files' diagnostics through the index;
|
||
`workspace_diagnostics`), compute from the same parse+lint pass that
|
||
feeds `publish`, answer `Unchanged` when the buffer version and index
|
||
generation both stand. Keep push for clients that don't send
|
||
`text_document.diagnostic` capability; never run both models for the
|
||
same client (double diagnostics).
|
||
→ `docs/features/pull-diagnostics/README.md`; one generation counter is
|
||
the whole `resultId` (bumped by `set_document` and `reindex`), the
|
||
push gate sits in `send_diagnostics` so the `didClose` clear is
|
||
suppressed too, and `workspace/diagnostic` reports the open buffers —
|
||
the honest limit, stated there.
|
||
- [x] **`textDocument/selectionRange`** — expand-selection. Cheap for
|
||
us: the scope-pair matcher (`pairs.rs`) and AST spans already give
|
||
the nesting chain; walk offset → enclosing token → statement → item →
|
||
scope → file, one linked chain per input position.
|
||
→ `docs/features/selection-range/README.md`
|
||
(`crates/lucisv_server/src/selection.rs`); token, AST, scope-pair and
|
||
file ranges are collected and filtered down to what strictly nests. No
|
||
expression step — deliberate, and recorded there.
|
||
|
||
### 9b. High-value, next rounds
|
||
|
||
- [x] **Incremental text sync** (`TextDocumentSyncKind::INCREMENTAL`).
|
||
Full-buffer sync on every keystroke scales poorly; apply
|
||
range-scoped `contentChanges` in order, with a full-text fallback on
|
||
any malformed change. Touches `set_document` and the staleness model
|
||
in `docs/features/lucisv-server/README.md`.
|
||
→ `docs/features/incremental-sync/README.md`
|
||
(`crates/lucisv_server/src/sync.rs`); one pure
|
||
`apply_changes(text, changes) -> String` over `convert::Positions`, a
|
||
fresh line table per change so each range sees the previous one's
|
||
result, rangeless changes still replacing the whole buffer, and every
|
||
desynced position clamped (line past EOF, character past line end,
|
||
surrogate half rounds forward, `start > end` becomes an insertion).
|
||
Still one `set_document` — one reparse, one generation bump, one
|
||
publish — per notification. Advertised as `TextDocumentSyncOptions`
|
||
with the open/close and `save.includeText: false` values a bare `Kind`
|
||
already implied, so no client's save behavior moved.
|
||
**Amended 2026-08-28** (`docs/features/change-debounce/README.md`): a
|
||
`didChange` now only records the composed text; the reparse, the
|
||
generation bump and the publish happen at the next *flush* — the next
|
||
request, the next non-`didChange` notification, or a 150 ms quiet period —
|
||
so a typing burst costs one of each instead of one per keystroke. The
|
||
buffer's text is still exactly current after every notification; only its
|
||
analysis is deferred, and intermediate diagnostics states are no longer
|
||
published. **Measured 2026-08-28**
|
||
(`docs/features/interactive-latency/README.md`): a burst of ten keystrokes
|
||
over the wire produces exactly one `publishDiagnostics`, and a keystroke a
|
||
request follows — the shape a real editor sends — round-trips in 4.8 ms at
|
||
1 000 lines and 37 ms at 10 000.
|
||
- [x] **`textDocument/willSaveWaitUntil`** — the protocol-native
|
||
format-on-save hook (client-side `editor.formatOnSave` already works;
|
||
this serves the editors without it).
|
||
→ `docs/features/will-save-wait-until/README.md`; advertised as
|
||
`willSaveWaitUntil: true` (the plain `willSave` notification stays
|
||
unadvertised — there is nothing for us in it), and gated on a new
|
||
`lucisv.formatOnSave` setting that is **off** by default, so a client
|
||
with its own format-on-save never formats twice. On, it is
|
||
`textDocument/formatting` with a different trigger: same engine, same
|
||
all-or-nothing edit, same `[]` for an already-formatted buffer, and the
|
||
settings ladder minus its `tabSize` rung because the request carries no
|
||
`FormattingOptions`. Every save reason formats; an unopened buffer and
|
||
the off state both answer `null`.
|
||
- [x] **Semantic tokens `range` + `full/delta`** — we set
|
||
`range: None` and no delta, so clients re-request whole-file token
|
||
sets on every edit. Delta needs `resultId` bookkeeping per buffer.
|
||
→ `docs/features/semantic-tokens-delta/README.md`; `tokens.rs` split
|
||
into classification → absolute form → filter → one pure encoder, so
|
||
all three requests share a tokenizer. `range: Some(true)` answers the
|
||
overlapping tokens whole, **re-encoded from the start of the
|
||
document** (a range answer is self-contained, not a slice), carries
|
||
no `resultId` and is not what a later delta diffs against; an empty
|
||
range answers nothing. `full: Delta { delta: true }` answers one
|
||
`SemanticTokensEdit` replacing everything between the common prefix
|
||
and the common suffix — **the suffix capped to what the prefix left**,
|
||
because identical lines of Verilog encode identically and an uncapped
|
||
suffix claims the same tokens twice. `resultId`s are minted per
|
||
answer, stored by `full` and `full/delta` alike, dropped on
|
||
`didClose`; an id the server does not hold is answered in full. No
|
||
token request bumps the diagnostics generation. Not done:
|
||
`workspace/semanticTokens/refresh`.
|
||
- [x] **Work-done progress** — `reindex()` is a synchronous full
|
||
rescan on every save with no `window/workDoneProgress` reporting;
|
||
on a big filelist the server just goes quiet.
|
||
→ `docs/features/work-done-progress/README.md`; every workspace
|
||
rescan — the startup build, a save, a watched file, a changed
|
||
`lucisv.exclude`/`filelist` — is wrapped in one
|
||
`window/workDoneProgress/create` plus a `$/progress` begin/end pair
|
||
on a fresh `lucisv-index-N` token, gated on the client's
|
||
`window.workDoneProgress` (a client that did not ask is sent nothing
|
||
at all, as the spec requires). `begin` goes out without waiting for
|
||
the create's answer, because the rescan blocks the loop the moment
|
||
it returns; the create's answer is ignored on the same path the
|
||
watcher registrations' is. No percentage and no intermediate report
|
||
— the rescan is one opaque call — and the `end` names the indexed
|
||
file count, read off the index's own file list. The bar covers the
|
||
scan, ending before the scope warnings and the republishes.
|
||
→ **Superseded in part, 2026-08-27**: the rescan is no longer opaque.
|
||
`docs/features/indexing-ux/README.md` adds
|
||
`vlog_semantic::IndexBuilder`/`index_order`, so the bar now carries
|
||
`n/total file.sv` and a counted percentage (throttled to at most
|
||
1000 reports per rescan), a per-file `window/logMessage` under
|
||
`lucisv.index.logFiles`, and a 1 MiB default walk-file size cap under
|
||
`lucisv.index.maxFileSize` whose skips the `end` message counts.
|
||
→ **Extended again, 2026-08-27**
|
||
(`docs/features/index-persistence/README.md`): a file restored from the
|
||
persistent index cache logs `cached:` rather than `indexing:` and is counted
|
||
in the `end` message — `860 files indexed, 860 from cache` — so a rescan that
|
||
flew past says why.
|
||
→ **Extended once more, 2026-08-28**
|
||
(`docs/features/index-scope/README.md`): a file that went into the index from
|
||
an open buffer's own finished analysis — no parse, no store — logs
|
||
`analyzed:` and adds nothing to the `end` message, so "from cache" still
|
||
means the persistent store alone.
|
||
→ **The other half of the size story, 2026-08-27**
|
||
(`docs/features/large-file-mode/README.md`): the walk cap covers files
|
||
nobody opened, and `lucisv.largeFile.threshold` (4 MiB) now covers the file
|
||
that *is* open. Over it, a buffer is line-indexed and nothing else — 41 ms
|
||
for 100 MB — coloured a viewport at a time by `semanticTokens/range`,
|
||
answered `null`/empty everywhere else, and left out of the index entirely
|
||
(the one exception to "an open buffer is never capped"). It logs
|
||
`large-file fast path: <path> (<bytes> bytes)` once per buffer.
|
||
Everything else above — the capability gate, the token scheme, the
|
||
create's ignored answer, the ordering against the republish — is
|
||
unchanged.
|
||
- [x] **`$/cancelRequest`** — the loop handles requests sequentially
|
||
and ignores cancellation; at minimum answer already-cancelled queued
|
||
requests with `RequestCancelled`.
|
||
→ `docs/features/cancel-request/README.md`; **completes §9b.** `run()`
|
||
now reads in bursts — one blocking receive, then everything already
|
||
queued behind it — and handles the burst **in arrival order**, so a
|
||
`didChange` ahead of a request is still applied before that request is
|
||
answered. A request the same burst also carries a cancel for is
|
||
answered `RequestCancelled` (-32800) without being dispatched; the
|
||
cancels themselves are consumed there and never reach
|
||
`notification()`. A cancel naming no request in its burst is dropped
|
||
on the spot — it refers to a request already answered, or to one that
|
||
never arrived — so the feature holds no state between bursts, and a
|
||
double cancel is harmless. `shutdown` is honoured before the cancelled
|
||
set is consulted and so is never cancellable. Numeric and string ids
|
||
both read; malformed cancels dropped. The design's one correction:
|
||
`lsp-server` 0.10 wires its stdio transport with `bounded(0)`
|
||
*rendezvous* channels, so a backlog never sits on
|
||
`connection.receiver` at all — the loop forwards messages onto an
|
||
unbounded `std::sync::mpsc` queue of its own on one small thread
|
||
(std-only, no new dependency), which stops at `shutdown` so
|
||
`handle_shutdown` still reads the `exit` that follows. Nothing already
|
||
running is cancelled; that needs the worker pool §6 defers.
|
||
|
||
### 9c. Moderate value, Verilog-shaped
|
||
|
||
- [x] **Goto type definition** — from a net/variable use to its
|
||
typedef/struct/enum/interface declaration; real value once
|
||
`vlog_semantic` tracks declared types of bindings.
|
||
→ delivered 2026-08-26 by `docs/features/type-definition/README.md`:
|
||
`typeDefinitionProvider` + `crates/lucisv_server/src/type_def.rs`.
|
||
`vlog_semantic` was *not* changed — a binding still carries no type,
|
||
but the type name it was declared with is already a `Reference`, so
|
||
the answer is `nav::definition` of that name's own offset, found from
|
||
the parse tree. Covers typedefs (alias/enum/struct), interfaces,
|
||
classes, module instances, `pkg::t`, `import pkg::*`, header
|
||
parameters and task arguments; one hop per keypress on an alias
|
||
chain; built-ins answer an empty list. Two requests recorded there:
|
||
`vlog_semantic` should report an unqualified lexical miss as an
|
||
external candidate (stood in for by a fenced index lookup), and
|
||
`vlog_parser` cannot parse an ANSI header whose first port has no
|
||
direction. Both landed: the first on 2026-08-26 by
|
||
`docs/features/overlay-promotion/README.md`, the second the same day by
|
||
`docs/features/ansi-first-port/README.md`.
|
||
- [x] **Linked editing range** — edit `module m` and its
|
||
`endmodule : m` label together (`end : label`, `endfunction : name`,
|
||
etc.). A genuinely good fit for SV's closing labels.
|
||
→ delivered 2026-08-26 by `docs/features/linked-editing/README.md`:
|
||
`linkedEditingRangeProvider` + `crates/lucisv_server/src/linked.rs`.
|
||
No engine change — the AST already records both name spans on one
|
||
node (`name_span` + `end_label_span`), so the pair is a lookup and
|
||
never a text match, which is what makes `begin : x begin : x ...
|
||
end : x end : x` answer syntactically. Covers module/macromodule/
|
||
interface, package, class, function, task, clocking, named
|
||
`begin`/`fork`, generate blocks and the prefix-labelled `b : begin
|
||
... end : b`. Two deliberate `null`s: an absent closing label (there
|
||
is nothing to co-edit and this never offers to create one) and a
|
||
mismatched one (the spec requires identical text, and linking would
|
||
silently rewrite broken code). Escaped identifiers are excluded and
|
||
the SV `wordPattern` is sent. `program ... endprogram : p` and the
|
||
verbatim blocks (`property`/`sequence`/`covergroup`) are the only
|
||
labelled constructs left out, because `vlog_parser` keeps no name
|
||
span for them — recorded in that README's Handshakes.
|
||
- [x] **Code lens** — "N instantiations" above each module header from
|
||
the hierarchy index; `codeLens/resolve` unnecessary (counts are
|
||
cheap), `workspace/codeLens/refresh` on reindex.
|
||
→ delivered 2026-08-26 by `docs/features/code-lens/README.md`:
|
||
`codeLensProvider` (`resolveProvider: false`) +
|
||
`crates/lucisv_server/src/lens.rs`. One lens per module *and*
|
||
interface declaration, on the declaration's own name span, reading
|
||
"no instantiations" / "1 instantiation" / "N instantiations". The
|
||
count is not a second census: `hierarchy::incoming` was split into
|
||
`hierarchy::callers_of_each`, a batched form of the same walk, so the
|
||
lens counts exactly what the call hierarchy would list — asserted by
|
||
an equality test, not by restating the arithmetic. The batch is the
|
||
primitive because `Workspace::sources()` re-reads the file set, so a
|
||
three-module file is one walk (133 ms over the corpus) rather than
|
||
three (93 ms each). Clicking runs `lucisv.showInstantiations`, which
|
||
answers every site as a `Location` and pushes a `window/showDocument`
|
||
for the first when the client advertised it; a module with no
|
||
instantiations gets a display-only lens instead of a click that leads
|
||
nowhere. `workspace/codeLens/refresh` goes out from `reindex()` after
|
||
the progress bar comes down, gated on
|
||
`workspace.codeLens.refreshSupport`. One request recorded there: an
|
||
instantiation-edge table in `WorkspaceIndex` would make both this and
|
||
`callHierarchy/incomingCalls` a lookup instead of a workspace walk —
|
||
**delivered 2026-08-27, `docs/features/incremental-index/README.md`**:
|
||
`instantiations_of` is the table, the walk is gone, and a whole file's
|
||
lenses went 92 ms → 0.26 ms over the corpus.
|
||
- [x] **On-type formatting** — conspicuous absence for a
|
||
formatter-first server; candidate trigger: newline (indent the new
|
||
line per block nesting), `;` (reformat the finished statement).
|
||
→ delivered 2026-08-26 by `docs/features/on-type-formatting/README.md`:
|
||
`documentOnTypeFormattingProvider` (`"\n"` + `[";"]`) +
|
||
`crates/lucisv_server/src/on_type.rs`. Both candidate triggers, and
|
||
only those two — not `}`, since SV closes its blocks with the word
|
||
`end`. `;` goes through `format::range_formatting` unchanged, over
|
||
the `;`'s own line, so that half is `textDocument/rangeFormatting`
|
||
with a different trigger and no new formatting logic at all. `\n` is
|
||
new logic outside the verified engine, so it is fenced two ways: the
|
||
edit it builds can structurally only replace one line's leading
|
||
whitespace with spaces (a wrong answer is a wrong indent, never a
|
||
moved byte), and a corpus-wide agreement test formats every checked-in
|
||
file with the real engine and forbids the model from disagreeing with
|
||
the printer on any line of the output — 77 528 answered, 36 647
|
||
declined, 0 disagreements, with a coverage floor so it cannot pass
|
||
vacuously. Nine of the ten rules the model needed were found by that
|
||
test rather than predicted, including that `vlog_formatter` cuddles a
|
||
`begin` onto its header but not a `fork`. **The path never speaks**: a
|
||
refusal is `[]` with no popup, and — a correction to the design — a
|
||
broken `lucisv.toml` is not reported here either, because
|
||
`warn_about_config`'s dedup is re-armed by the `didChange` every
|
||
keystroke produces and would give one popup per character. One
|
||
deviation recorded there: the `;` range is the `;`'s own line rather
|
||
than its enclosing AST node's span, which is the same answer wherever
|
||
both are defined and avoids asking for a whole-module reformat when
|
||
the `;` is the one closing a module header. `pairs.rs` gained three
|
||
`pub(crate)` accessors so the matcher and the indent model read one
|
||
keyword table.
|
||
- [x] **Type hierarchy (3.17)** — arguably the semantically correct
|
||
home for the module hierarchy (and later interface/class extends
|
||
chains); keep callHierarchy as the compatibility surface.
|
||
→ delivered 2026-08-26 by `docs/features/type-hierarchy/README.md`:
|
||
`typeHierarchyProvider` + `crates/lucisv_server/src/type_hierarchy.rs`,
|
||
all three requests. **Classes, not modules** — the lead's scope call:
|
||
an instantiation is a containment edge and `extends` is an inheritance
|
||
edge, so the module hierarchy stays on callHierarchy exactly as this
|
||
item's second clause asks, and typeHierarchy serves one node kind
|
||
well. `supertypes` is not a new lookup: `extends Base` is already a
|
||
`vlog_semantic` reference and overlay-promotion already made a bare
|
||
cross-file class name reachable through it, so the answer is
|
||
`definition_of` asked at the last byte of the extends name span —
|
||
which is the tail of `pkg::base`, the whole of a bare `base`, and the
|
||
bare name of a parameterized `base #(8)`. A base the workspace does
|
||
not index (every UVM chain top) yields no item rather than a guess.
|
||
`subtypes` is `hierarchy::callers_of_each`'s census in another key —
|
||
~~one `sources()` pass, substring prefilter, deterministic sort — at
|
||
55 ms over the 860-file corpus, 53 ms of it file I/O; the
|
||
inheritance-edge table that would make it a lookup is filed beside the
|
||
instantiation-edge table §9c's code-lens item already recorded.~~
|
||
**Both tables shipped 2026-08-27** (`docs/features/incremental-index/README.md`):
|
||
`subclasses_of` makes `subtypes` a lookup, 55 ms → 0.71 ms. Two
|
||
gaps recorded there: `lsp-types` 0.97 has no `typeHierarchyProvider`
|
||
field, so the capability is inserted into the serialized `initialize`
|
||
result by hand, and `vlog_parser` rejects `interface class`, so
|
||
`implements` can never resolve and no item can carry
|
||
`SymbolKind::Interface`.
|
||
- [x] **File operations** — `workspace/willRenameFiles`: renaming a
|
||
`.sv/.svh` rewrites `` `include`` lines that reference it (the
|
||
include graph exists); `didRename/didDelete` as cheaper index nudges
|
||
than the watcher round-trip.
|
||
→ delivered 2026-08-27 by `docs/features/file-operations/README.md`:
|
||
`workspace.fileOperations` + `crates/lucisv_server/src/file_ops.rs`.
|
||
An include is rewritten only when the graph says it **resolves** to
|
||
the renamed file — never on a filename match, so two `defs.svh` in
|
||
one workspace stay two files. The new spelling preserves the form
|
||
where the new location allows it (bare stays bare when a rung reaches
|
||
it, angled resolves through `+incdir+`s only, absolute stays
|
||
absolute), shortest resolving suffix first, with a `../`-relative
|
||
spelling as the last resort — which is also what answers a renamed
|
||
include *directory*, since lucisv does not edit filelists. An include
|
||
no spelling can reach is left exactly as written and named in a
|
||
`window/showMessage` warning ("log all, show the first", the
|
||
filelist rule): the server never invents a path that would not
|
||
resolve. **Folders are handled**, not declined — LSP sends only the
|
||
folder's URI and a folder is a path prefix, which is the same
|
||
operation a file rename already was. The rule shipped with a mirror
|
||
half the brief did not ask for: an include written *in* a file that
|
||
moves breaks the same way and is re-spelled too. Every edit covers
|
||
the path token alone (never the backtick, the delimiters or a
|
||
trailing comment) and is verified three ways before it is emitted —
|
||
re-scanned, re-lexed, and re-resolved against the filesystem the
|
||
rename will leave behind. `didRename`/`didDelete` reindex through
|
||
the same scope predicate the watcher uses, not deduplicated against
|
||
it (a double rebuild is a re-read, never a different answer). One
|
||
sweep is 54 ms over the 860-file corpus. `verify.rs` untouched.
|
||
`includes.rs` gained `resolve_as_if` (so there is still exactly one
|
||
copy of the EDA search order) and `normalize` became public; the
|
||
standing request to extract one `lucisv_core::path::normalize` for
|
||
the three private copies is still open.
|
||
- [x] **`workspace/didChangeWorkspaceFolders`** — roots are read once
|
||
at initialize; adding/removing a folder mid-session is ignored.
|
||
→ delivered 2026-08-27 by `docs/features/folders-and-config/README.md`:
|
||
`workspace.workspaceFolders { supported, changeNotifications }` +
|
||
`Workspace::change_roots`. One rescan per *notification* — the event
|
||
carries both lists, and the progress bar, the code-lens refresh and the
|
||
diagnostics generation all ride inside the existing `reindex()`. An
|
||
event that leaves the root set where it was costs nothing: a folder
|
||
already held, one never held, an empty event, params that do not parse,
|
||
a non-`file:` folder. A removed folder's files leave the index while
|
||
its **open buffers stay open and keep being diagnosed** — no code was
|
||
needed for that, since `collect_sources` appends every open document
|
||
after the scope ladder has spoken — and removing the *last* folder
|
||
simply becomes rung 3 of that ladder, the rootless case. The watcher
|
||
determination is recorded there: the source glob is a base-less string
|
||
pattern and so is workspace-wide (no re-registration), while the
|
||
filelist watcher is an absolute path anchored at the first root and is
|
||
re-registered when a folder change moves it. `state.rs` gained exactly
|
||
one 8-line method.
|
||
- [x] **`workspace/configuration` (server-pull)** — we rely solely on
|
||
push `didChangeConfiguration`; clients are moving to the pull model.
|
||
→ delivered 2026-08-27 by `docs/features/folders-and-config/README.md`:
|
||
one `workspace/configuration` for the `lucisv` section at startup and
|
||
again on every *empty* `didChangeConfiguration` (the 3.17 client's
|
||
"something changed, ask me"), gated on `workspace.configuration`. A
|
||
push with a payload still applies directly, so the legacy path is
|
||
untouched; a client without the capability keeps exactly today's
|
||
behaviour, empty-payload semantics included. **One parser** — the
|
||
answer's entry 0 is wrapped back into the push shape and read by the
|
||
same `settings::from_payload` — and **one applier**, so `exclude`/
|
||
`filelist` cost the same rescan and the same watcher re-registration
|
||
whichever door they came in. An error, a `null`, an empty array or junk
|
||
all resolve to the defaults and none of them says anything to the user.
|
||
The outstanding-request tracking was refactored from `applying:
|
||
HashMap<RequestId, String>` to `pending: HashMap<RequestId, Pending>`,
|
||
one map and one `match`, with the three-way interleave
|
||
(applyEdit + progress create + configuration) under test. Known and
|
||
stated, not fixed: a pulled setting can land after the first index
|
||
build, exactly as a pushed one always could.
|
||
- [x] **3.18 additions:** `textDocument/rangesFormatting` (multi-range,
|
||
feeds format-modified-lines), snippet edits in `WorkspaceEdit`
|
||
(would improve `addPort` cursor placement), and
|
||
`workspace/textDocumentContent` (could serve a read-only "expanded
|
||
macro" document).
|
||
→ 2026-08-27 by `docs/features/lsp-318-extras/README.md`: **one
|
||
shipped, two parked with evidence.** *Shipped* —
|
||
`textDocument/rangesFormatting`, served as the `n`-range case of
|
||
`rangeFormatting`: the ranges become one sorted, merged `LineRanges`
|
||
(the constructor `--lines 3-9,40` already used, so unsorted,
|
||
overlapping, adjacent and repeated ranges all normalize in the one
|
||
place) and one `format_range` call, which keeps the all-or-nothing
|
||
contract over the *union* rather than making it a per-range promise.
|
||
`range_formatting` is now defined as the one-element call of it, so
|
||
the reply shape, the refusal and the config warning are the same
|
||
values and cannot drift; an empty `ranges` array is an ask for
|
||
nothing, not an error. The capability is advertised by widening
|
||
`documentRangeFormattingProvider` from `true` to
|
||
`{ "rangesSupport": true }` — the spec's own
|
||
`boolean | DocumentRangeFormattingOptions` union — **gated on the
|
||
client having sent `textDocument.rangeFormatting.rangesSupport`**, so
|
||
every client that shipped before this round sees the identical byte
|
||
and only a 3.18 client sees the object; the handler is registered
|
||
unconditionally. `lsp-types` 0.97 spells neither half, so the
|
||
capability goes out through the `initialize_value()` JSON insertion
|
||
(the type-hierarchy precedent) and the client flag is read from the
|
||
**raw** initialize params before the typed decode drops it.
|
||
*Parked* — **snippet `WorkspaceEdit` edits**: `lsp-types` 0.97 has no
|
||
`SnippetTextEdit`, `WorkspaceEditClientCapabilities` has no
|
||
`snippetEditSupport`, and the pinned `vscode-languageclient@9.0.1`
|
||
has neither string anywhere in it, so a server sending one would be
|
||
writing a literal `${1:name}` into the user's buffer. *Parked* —
|
||
**`workspace/textDocumentContent`**: absent from `lsp-types` 0.97 and
|
||
from the pinned client, and serving a custom URI scheme in VS Code
|
||
needs a content provider the deliberately thin `extension.js` does
|
||
not register; the expanded-macro view it would serve is also
|
||
hover-sized today, not document-sized. Both have an exact re-check
|
||
trigger recorded (one `node_modules` grep each). **This completes
|
||
§9c.**
|
||
|
||
### 9d. Deliberately skipped (no Verilog use case)
|
||
|
||
Notebook sync, moniker (LSIF), inline value (debugger), document
|
||
color, goto implementation, goto declaration (Verilog has no
|
||
declaration/definition split lucisv models). Recorded here so the
|
||
audit doesn't repeat.
|
||
|
||
## 10. Performance wave (2026-08-28) — docs/performance.md findings
|
||
|
||
Source: `docs/performance.md` (benchmark of every LSP action against
|
||
opentitan, 3 976 files). Tracking for the two-worktree parallel round;
|
||
each lane's dev ticks only its own lines. Lane file ownership is the
|
||
merge contract — a lane touches no file outside its list.
|
||
|
||
### Done before the wave (trunk)
|
||
|
||
- [x] `textDocument/codeAction` 3.1–4.6 s per cursor move →
|
||
7.1 ms (83 ms at a 36-file fan-out): `Workspace::module_sources`
|
||
subset instead of `ws.sources()` — refactor-ports README,
|
||
2026-08-28 work log + Review.
|
||
|
||
### Lane A — rename family (worktree A; files: crates/vlog_refactor/*,
|
||
crates/lucisv_server/src/{rename.rs,file_ops.rs,state.rs,perf.rs},
|
||
docs/features/{refactor-rename,file-operations}/README.md,
|
||
docs/perf/README.md)
|
||
|
||
- [x] `prepareRename` 2.5–3.0 s (F2 blocks everything) → buffer+index
|
||
answer, < 1 ms; refusal-by-refusal parity table in the README.
|
||
**1.663 s → 139 ns on OpenTitan**; parity table and six
|
||
byte-by-byte parity suites in refactor-rename's README, plus 564
|
||
offsets of a real `tb.sv` swept identical, zero deferrals.
|
||
- [x] `rename` 3.6–8.7 s → reference-postings fan-out subset with a
|
||
written sufficiency argument; verifier integrity proven.
|
||
**3.467 s → 105.5 ms on OpenTitan**, edits byte-identical at every
|
||
cursor checked (7 files at `aes`, 114 files at `clk_rst_if`), the
|
||
capture refusal still firing on a real workspace. QA found one
|
||
lost refusal (a dangling use of the *new* name); closed by a sixth
|
||
rung, `WorkspaceIndex::files_spelling` — 852 µs worst case on
|
||
OpenTitan. One accepted residue remains —
|
||
macro-**invocation**-argument warnings in files outside the
|
||
fan-out, costing no edit and no refusal.
|
||
- [x] `willRenameFiles` same `ws.sources()` shape (file_ops.rs:120) →
|
||
include-graph/index-bounded subset. **249 ms of `sources()` → a
|
||
14.1 ms whole answer on OpenTitan** (331 includers of 3 976).
|
||
|
||
### Lane B — hot path + UX (worktree B; files:
|
||
crates/lucisv_server/src/{completion.rs,candidates.rs,nav.rs,
|
||
settings.rs,perf.rs}, crates/lucisv_server/tests/e2e.rs,
|
||
editors/vscode/package.json, docs/features/{completion-core,
|
||
references-nav,index-scope}/README.md, docs/perf/README.md)
|
||
|
||
- [x] `completion` 34–66 ms per keystroke (worst at 0–4 chars) →
|
||
profile, then < 5 ms with item-identical answers pinned.
|
||
Profiled: the whole cost was tier 0, the module skeletons — every
|
||
other tier is 0.19 ms at every prefix. Tier 0 now parses the
|
||
declaring file's *header* instead of all of it, and reads the
|
||
module names off a table built with the index instead of sorting
|
||
the workspace's whole symbol table per keystroke. **3.17 ms** at
|
||
the empty prefix on a 4 000-file generated corpus (was 53.2 ms);
|
||
**13–15 ms** worst case on opentitan (was 34–66), and typing
|
||
`aes_reg_top` 201 ms → 64.5 ms. Items pinned identical by a
|
||
fifteen-shape plan-equality test and a module-table equality test.
|
||
- [x] `documentHighlight` answered 0 results at every opentitan
|
||
position while references answered — root-cause and fix (or
|
||
prove the benchmark request wrong and correct docs/performance.md).
|
||
**A real bug, not a benchmark mistake**: the handler asked only
|
||
single-file `Semantics`, so a name this file uses but does not
|
||
declare — an instantiated module, a `.port` connection — had no
|
||
symbol to find, while `references` read the workspace overlay.
|
||
Fixed in `nav::external_occurrences`, with a unit regression test
|
||
and the two opentitan positions pinned over the wire.
|
||
- [x] Default `lucisv.index.scopeDepth` 0 → 2 (folder scope indexed
|
||
exactly one file in opentitan's dv/tb layout; every cross-file
|
||
answer empty until a jump widens) — behavior change, CHANGELOG
|
||
callout at release. Also removed the *rootless* climb, which had
|
||
no root to clamp against and would have walked an unnamed tree at
|
||
the new default. Cost measured rung by rung: 1 / 1 / 21 / 252
|
||
files at depths 0 / 1 / 2 / 3.
|
||
|
||
### Take 2 follow-up (2026-08-29) — the first RTL open at the default scope
|
||
|
||
Measured in `performance_take2.md` §5b: opening `hw/ip/aes/rtl/aes.sv`
|
||
at `scopeDepth: 2` raises the scope to `hw/ip` and costs 1.4–1.7 s.
|
||
Files: `crates/lucisv_server/src/{candidates.rs,state.rs,server.rs,perf.rs}`,
|
||
`docs/features/index-scope/README.md`, `docs/perf/README.md`.
|
||
|
||
- [x] Diagnosis corrected against the running binary: the widen already
|
||
takes the cheap path for a subsuming scope and already diffs by
|
||
**file against the index** (the bar reads 1 685, not 1 807, when
|
||
the old block's 124 files are inside the new root), so nothing was
|
||
re-indexed. The chooser's `Whole` arm is still unreachable. Pinned
|
||
by `state::tests::a_widen_that_subsumes_the_old_scope_reads_only_the_files_it_adds`
|
||
and a `widen_of` table row.
|
||
- [x] The real cost found and fixed: folding a widen's words into the
|
||
completion table inserted each new word into a sorted `Vec` on its
|
||
own, which is quadratic in the batch — **403 ms of the 935 ms** on
|
||
opentitan's `hw/ip`. Counted per batch and merged once: 43 ms.
|
||
Warm **935 / 881 → 555 / 564 ms**, cold **1 529 → 1 175 ms**.
|
||
- [x] **Still slow, filed:** what is left of that jump is real work over
|
||
1 683 genuinely new files — 325 ms re-lexing them for the
|
||
completion word table (the persistent store holds a file's facts
|
||
but not its words), ~100 ms walking and reading them, ~80 ms
|
||
hashing and decoding records. Storing the word list beside the
|
||
facts is the next lever and is `index-persistence`'s call: it is a
|
||
`FACTS_FORMAT` change.
|
||
**Delivered by `FACTS_FORMAT` 13** (semantic-lints-on, 2026-09-02): the word census is a fact, so a cached hit brings its words and a scan never re-lexes for the table (`state.rs`, "Read off the record").
|
||
- [x] **Not done, deliberately:** a widen still does not interleave, so
|
||
this is a bar the user watches once per session per big widen. The
|
||
coalescing rule is unchanged.
|
||
**Ruled 2026-09-04:** stays as is; a widen is one bar per session per big widen.
|
||
|
||
### Deferred, filed
|
||
|
||
- [x] `codeAction` costs 185–201 ms at a 128-file fan-out and offers
|
||
**zero** actions there (`performance_take2.md` §6a): ~1.4 ms per
|
||
instantiating file plus a ~13 ms floor, paid before anything knows
|
||
there is nothing to offer. Wants either the lazy resolve below or
|
||
a cheap zero-detector that answers before the fan-out is walked.
|
||
**Delivered by §37.1**: the offer is flat at 54–59 µs from a 3- to a
|
||
128-file fan-out, both cursor shapes.
|
||
- [x] `inlayHint` returns **0 hints at the default scope** where the
|
||
workspace scope returns 4 (`performance_take2.md` §8): investigate
|
||
before assuming it is scope-relative-answers working as intended —
|
||
the hinted instantiation's module may be in scope and still unhinted.
|
||
**Investigated by §37.2 and ruled correct**: the four hints are
|
||
`pins_if`'s, declared in `hw/dv/sv/common_ifs`, which the widen to
|
||
`hw/ip/aes` does not reach; hover and definition answer nothing for it
|
||
either. Finding and two default-scope tests in
|
||
`docs/features/lazy-code-action/README.md`.
|
||
- [x] codeAction lazy resolution (`codeAction/resolve`): make the offer
|
||
index-only (~0 ms regardless of fan-out), edits computed on
|
||
lightbulb click — kills the 83 ms worst case. Owner-approved
|
||
direction, after the wave. **Delivered by §37.1.**
|
||
- [x] Rename over an index-stale workspace: Lane A must state the
|
||
staleness premise; if the verifier cannot catch a hidden
|
||
reference, the honesty gate is the lead's review call. Stated
|
||
verbatim under "The staleness premise, stated exactly" in
|
||
refactor-rename's README, with what it costs (a file whose disk
|
||
copy moved unseen is neither rewritten nor refused over) and the
|
||
one exemption (open buffers, always in the set). Both residues
|
||
ruled on: the dangling-use lost refusal was rejected and fixed
|
||
(rung 6, `files_spelling`); the macro-invocation warning loss is
|
||
accepted as documented, with the `FileFacts` macro census filed
|
||
as the real fix.
|
||
|
||
## VS Code design-hierarchy sidebar (2026-08-29)
|
||
|
||
Feature by codex; this section is that round plus the lead's QA finding
|
||
and three owner items. See
|
||
`docs/features/vscode-hierarchy-sidebar/README.md`.
|
||
|
||
- [x] `lucisv/moduleHierarchy` + `lucisv/moduleHierarchyChanged`, gated
|
||
on `initializationOptions.hierarchyView`; Activity Bar container,
|
||
webview view, navigation, context menu, bookmark.
|
||
- [x] `FACTS_FORMAT` 4 → 5: `Def::decl_span`, per-instance
|
||
`InstanceOccurrence`s on the statement edge, and client positions
|
||
on file-scope declarations and instance occurrences. Call
|
||
hierarchy and code-lens counts unchanged.
|
||
- [x] **Lead's HIGH finding — the snapshot read every module-declaring
|
||
file per request.** Fixed by index-carried positions (zero file
|
||
I/O), `WorkspaceIndex::units_of`, and a schema-2 wire (file
|
||
table, four-number ranges, no ids, no per-instance definition
|
||
copies). On opentitan, server-side handler **145–167 ms → 17–20 ms**
|
||
warm, response **11.6 MB → 2.3 MB**, a definition pipelined behind
|
||
a snapshot **263 ms → 41 ms**. Store cost of the positions: +1.7 %
|
||
on the corpus, +1.9 % on opentitan.
|
||
- [x] `complete` tightened to `!scanning && !must_wait()` and the
|
||
window it has to be honest about written down and tested.
|
||
- [x] Owner: the five-line hover source preview removed — the feature's
|
||
last consumer of file text.
|
||
- [x] Owner: every tree level collapsed by default; expansion state
|
||
survives a refresh on stable row ids.
|
||
- [x] Owner: search freeze fixed. The model is flat and resident, tree
|
||
levels are built lazily, and a query is one pass over a prebuilt
|
||
lowercased index with a character-mask pre-filter and a counting
|
||
top-K — 3–8 ms per query over a generated 120 000-entry
|
||
hierarchy, asserted in the node suite.
|
||
- [x] Filed, not done: rewire `locate::location` onto `DeclPositions`
|
||
so `textDocument/definition`, references, the lens and both
|
||
hierarchies stop reading a file to convert an indexed span. Every
|
||
unit's range is now in the index for free. **Delivered by §37.3**
|
||
for the file-scope answers `nav.rs` and `symbols.rs` give
|
||
(27.9 µs → 0.42 µs per definition on opentitan); references, the
|
||
lens and the hierarchies answer from `ReferenceSite`/`InstantiationEdge`
|
||
spans, which are not `Def`s and record no `DeclPositions`, and
|
||
`references`' one `Def` span (`includeDeclaration`) is converted in the
|
||
same one-fetch batch as that file's reference sites — filed again
|
||
there rather than silently dropped.
|
||
- [x] Manual extension-host acceptance (themes, keyboard-only, zoom,
|
||
screen readers, an old server binary, both VSIX shapes).
|
||
**Checklist prepared 2026-09-05** (`docs/manual-acceptance.md`); the owner runs it.
|
||
|
||
## 11. Testbench-syntax wave (2026-08-29) — syntax_coverage.md findings
|
||
|
||
Source: `syntax_coverage.md` (opentitan sweep, 96.2% → the gap). The top
|
||
two buckets both edit `vlog_parser/src/parser.rs`, so per CLAUDE.md's
|
||
parallel-lane rule they run serially; the wave's first two lanes pair
|
||
the constraints round with the TOPO-independent formatter bugs instead.
|
||
|
||
### Lane A — out-of-class constraints (worktree; files:
|
||
crates/vlog_parser/src/parser.rs, crates/vlog_parser/tests/*,
|
||
crates/vlog_semantic if an arm is needed, docs/features/
|
||
out-of-class-constraints/README.md, TODO.md §11 Lane A lines)
|
||
|
||
- [x] `constraint C::name { ... }` at file/package/class-external scope
|
||
— 45 files blocked, and the tolerant-mode cascade (300+ bogus
|
||
diagnostics per file) is the real LSP damage. Expected shape: the
|
||
classes feature's verbatim capture reused (justify if not).
|
||
Done: `parse_constraint` reuses `parse_method_name`, no new AST
|
||
variant. OpenTitan 151 → 107 failures; 44 of the 45 clean, the
|
||
45th advances to bucket 10. Tolerant diagnostics over the 45:
|
||
1 349 → 1. `docs/features/out-of-class-constraints/README.md`.
|
||
|
||
### Lane B — formatter round-trip bugs (worktree; files:
|
||
crates/vlog_formatter/src/* EXCEPT verify.rs forgiveness,
|
||
crates/vlog_formatter/tests/*, docs/features/formatter-bug-fixes/
|
||
README.md, TODO.md §11 Lane B lines)
|
||
|
||
- [x] The 12 files the safety net refused (comment / `else if` merging
|
||
shapes in syntax_coverage.md §bucket 2): fix the formatter so its
|
||
output verifies; verify.rs forgiveness may NOT be widened (any
|
||
widening needs masked-corruption attack tests per invariant 4 —
|
||
prefer no widening at all). **11 of 12 fixed; `verify.rs`
|
||
untouched.** The 12th (`keymgr_scoreboard.sv`) had its bucket-2
|
||
bug fixed and a second, distinct, *parser*-side bug behind it —
|
||
`Parser::take_before_open` (parser.rs:757) drains the whole
|
||
pending-comment queue, so a comment written after `if (` is
|
||
swallowed by the condition's first call. Out of Lane B's file set;
|
||
filed as a handshake in `docs/features/formatter-bug-fixes/
|
||
README.md`.
|
||
- [x] Owner/lead: the one-line parser fix above (Lane A's file), which
|
||
closes the last of the 12.
|
||
**Delivered 2026-08-29** by directive-in-statements (`take_before_open` request, formatter-bug-fixes README).
|
||
|
||
### Serial, after Lane A merges (parser.rs frees up)
|
||
|
||
- [x] Directive-split for expressions/statements: `` `ifdef `` splitting
|
||
an assign RHS / instantiation head (chip_if.sv:1192 anchor; blocks
|
||
both top_* tb.sv testbenches). 5-file floor, high leverage.
|
||
Done: the mirror of `directive-split` — the failure lands on the
|
||
`` `ifdef `` that *opens* a region inside a construct, not on the
|
||
`` `else `` that closes one around it. Verbatim capture, at item and
|
||
at statement level; no new AST variant or field, so no printer arm.
|
||
Plus one guard in `take_list_directives` so an outer region's seam
|
||
is not harvested as a list element, which is all the two tb.sv files
|
||
needed. OpenTitan 107 → 100 failures: all 5 bucket-7 files, both
|
||
`top_{earlgrey,darjeeling}/dv/tb/tb.sv`, zero regressions, corpus
|
||
gate byte-identical at 813/820.
|
||
`docs/features/directive-in-statements/README.md`.
|
||
Also delivered there: the `Parser::take_before_open` handshake Lane B
|
||
filed (`docs/features/formatter-bug-fixes/README.md`), which unblocks
|
||
the 12th bucket-2 file, `keymgr_scoreboard.sv`.
|
||
- [x] Mop-up bundle (~26 files): enum member ranges, cast-base drive
|
||
strengths, local typedef statement, gate delays, virtual+modport,
|
||
rand-on-struct, foreach-skip-dim, hierarchical bind instance list.
|
||
Done: nine shapes, **47** files (the estimate was low, and two of
|
||
`syntax_coverage.md`'s bucket labels were mis-diagnoses — bucket 6 is
|
||
a *system function call* as the casting type, `$bits(x)'(y)`, not a
|
||
drive strength; bucket 12 has six files, not five). Real grammar
|
||
throughout, no verbatim capture, `verify.rs` untouched. One new
|
||
`StmtKind` variant (the block-scoped `typedef`, which is the item form
|
||
exactly) and four new fields; seven of the nine buckets needed no AST
|
||
surface at all. OpenTitan 88 → 43 failures: 45 files clean, 2 advance
|
||
to the `iff`-in-event-control gap, **zero** newly failing, and zero
|
||
output change on any of the 3,896 previously-passing files. Corpus
|
||
gate byte-identical at 813/820. Tolerant diagnostics over the failing
|
||
set 1 644 → 1 290, none worse anywhere.
|
||
`docs/features/testbench-mopup/README.md`.
|
||
- [x] Skipped there, one file: a gate's drive strength
|
||
(`pullup (weak1) u (...)`, spi_host/dv/tb.sv:101) — a different
|
||
production from the cast bases bucket 6 named, costing two AST changes
|
||
for one file. See that README's Status for the exact shape.
|
||
Done in Round 2 below, at the amortized cost that round predicted.
|
||
|
||
### Round 2 (clocking wave) — every remaining grammar bucket, one round
|
||
|
||
Serial in the main tree (`docs/features/clocking-wave/README.md`). Baseline
|
||
43 failures over 3,943 files at `5ad0772`; **43 → 11**, and the eleven left
|
||
are the two OUT rows — macro fragments that need a preprocessor, and vendor
|
||
files that are not SystemVerilog. Zero newly failing; one previously-passing
|
||
file's output moves, and it moves because 55 lines that used to be swallowed
|
||
into an opaque blob are now parsed (see below). Corpus byte-identical at
|
||
813/820 over all 860 files; `verify.rs` untouched.
|
||
|
||
- [x] **Clocking signal bindings** — `output tms = _tms_internal;`, IEEE 1800
|
||
§14.4's `clocking_decl_assign`. **7 files.** Deviation from the brief:
|
||
clocking is already a modelled node with a printer, spans and a linter
|
||
guard, so the fix is the one missing field, not a verbatim capture that
|
||
would have thrown that model away. The *opacity* the brief wanted is
|
||
where it already lived — `analyze` keeps the block a leaf and the linter
|
||
takes the whole item span, binding included, out through `opaque_spans`
|
||
— and is now pinned by a lint case.
|
||
Files: `crates/vlog_parser/src/{ast,parser}.rs`,
|
||
`crates/vlog_formatter/src/format.rs`.
|
||
- [x] **`default disable iff expr;`** (IEEE 1800 §16.12) — **7 files**, and not
|
||
a clocking construct at all: the bucket label came from the error text,
|
||
and reading all 14 sites is what split it 7 + 7. Verbatim capture, the
|
||
round's only one, with six masked-corruption attack pairs.
|
||
- [x] **A macro as a concurrent assertion's action statement** — not in the
|
||
brief; the next blocker on 6 of the above once they parsed.
|
||
`assert property (p) else \`ASSERT_ERROR(A)` has no `;` to scan to, so
|
||
`skip_action_stmt` used to run through whatever followed. **This is the
|
||
one change with a whole-tree output effect**: `prim_sync_reqack.sv` had
|
||
~55 lines of generate-block code absorbed into an assertion's opaque
|
||
bytes; they are now parsed and laid out.
|
||
- [x] **`iff` on an event-control term** (§9.4.2) — **5 files**. LRM scope
|
||
checked: `iff` gates one event-expression term, so `@( … )` is the only
|
||
position; the paren-less form and `wait` have no `iff` alternative.
|
||
- [x] **Bare event control over an indexed hierarchical path** —
|
||
`@cfg.agents["k"].vif.cb`, **3 files** (the rstmgr shape). Also closed a
|
||
pre-existing hole: that loop boxed a layer per `.name` without charging
|
||
the chain budget.
|
||
- [x] **`program … endprogram`** (§24.3) — **3 files**, one dispatch arm
|
||
reusing `parse_module`.
|
||
- [x] **Chain limit 256 → 1024, `PARSE_STACK_SIZE` 16 → 32 MiB** — **7 files**,
|
||
an engineering measurement, not a grammar change. Real generated register
|
||
files need up to **567** links (`pinmux_reg_top.sv`); 9.20 KiB of debug
|
||
stack per postfix link; the new worst case is **9 894 KiB** (a maximal
|
||
chain inside nesting), so 32 MiB keeps the 2.7×-or-better margin. This
|
||
round retires the feature's own "chains do not move the worst case" —
|
||
true at 256, false at 1024 — while re-verifying the phase argument that
|
||
keeps the two budgets additive.
|
||
`docs/features/recursion-limit/README.md` round 4.
|
||
- [x] **Skipped, `jtag_if.sv`**: its clocking blocker is fixed; a
|
||
**pre-existing** one sits behind it. Two rival, bracket-*balanced*
|
||
interface headers in an `` `ifdef ``/`` `else `` region, which
|
||
`at_split_conditional` does not fire on (it requires an open bracket), so
|
||
the parser nests them. Handshake request to a future `directive-split`
|
||
round; reproduced on trunk grammar alone.
|
||
**Delivered by §38.1** (2026-09-04): `parse_module`'s body loop detects
|
||
the rival, `at_split_conditional`'s fourth condition is now "bracket
|
||
open **or** rival header" and `scan_split_extent` runs to the unit's own
|
||
closing keyword, so the whole unit is one `ItemKind::Verbatim`. The file
|
||
parses and formats; its body is not laid out — the standing
|
||
`directive-split` trade. `docs/features/parser-skips/README.md`.
|
||
- [x] **Skipped, `SimDTM.sv`**: a net delay written *after* the type
|
||
(`wire [31:0] #0.1 x = y;`), which is where the LRM puts it — lucisv
|
||
parses it only before. One `DataDecl` field has one print position, so
|
||
accepting both spellings needs a positional field or the safety net
|
||
rightly refuses the reordered tokens. One vendor file in `tb/unused/`.
|
||
**Delivered by §38.2** (2026-09-04): the positional field is
|
||
`NetDelay { expr, after_type }`; the parser accepts either position and
|
||
never both, and the formatter prints it where it was written, so no
|
||
token moves. `docs/features/parser-skips/README.md`.
|
||
- [x] **Skipped, `kmac_reduced_tb.sv`**: a trailing comma in a *named*
|
||
parameter override list. Not legal SystemVerilog; rejecting it is
|
||
correct.
|
||
**Closed 2026-09-04:** rejecting it is correct; nothing to do.
|
||
- [x] **Recommended instead of grammar work**, for the sweep's non-SystemVerilog
|
||
files: exclude patterns `**/*.tpl.sv`,
|
||
`**/vendor/google_riscv-dv/**`, `**/pulp_riscv_dbg/tb/unused/**`.
|
||
**Ruled 2026-09-04:** not excluded; the six failures (all in the three trees named here) stay in the 814/820 count as the honest number, and are listed in the release gates each round.
|
||
|
||
## 12. Inline instantiation wave (2026-08-30) — owner request
|
||
|
||
Two-level module-instantiation snippet expansion, sized for opentitan
|
||
(~4 000 files, ~43k declarations). Single lane (one dev, one QA), no
|
||
concurrency. Files: crates/lucisv_server/src/{inline.rs, completion.rs,
|
||
candidates.rs, settings.rs}, crates/lucisv_server/tests/e2e.rs,
|
||
editors/vscode/{package.json, smoke.js},
|
||
docs/features/inline-instantiation/README.md (new), handshake
|
||
amendments in docs/features/{completion-core, refactor-instantiate,
|
||
inline-templates, completion-templates}/README.md, TODO.md §12 lines.
|
||
|
||
- [x] **Level 1 — popup names only.** `completion.rs::module_tier`
|
||
stops planning skeletons per keystroke (up to 64 file reads +
|
||
header parses today): module items insert just the module name.
|
||
Owner ruling 2026-08-30 supersedes the M4 completion-skeleton
|
||
byte-for-byte pins; flip them to name-only. Signature help and
|
||
inlay hints keep consuming `instantiation_plan` unchanged.
|
||
- [x] **Level 2 — exact-match ghost.** New trigger in `inline.rs`:
|
||
cursor at the end of an `Ident` whose text exactly
|
||
(case-sensitively) matches an indexed module name, at a position
|
||
where an instantiation is legal, rest of line blank → ghost the
|
||
full instantiation (parameters + all ports, tabstopped snippet)
|
||
planned for exactly one module through the existing
|
||
`module_definition` → `module_header` slice → `instantiation_plan`
|
||
path and the `FileView` cache. Relative `\t` indentation per the
|
||
inline indentation contract.
|
||
- [x] **Exact-match probe.** `Candidates` exposes an O(log n) exact
|
||
lookup over its sorted module table; the non-matching keystroke
|
||
does no file I/O and no planning.
|
||
- [x] **Setting.** `lucisv.inlineInstantiation` (unset = on), following
|
||
the `lucisv.inlineTemplates` pattern; package.json entry.
|
||
- [x] **Pins.** e2e: accept the name-only popup item, then
|
||
`inlineCompletion` at the landing cursor ghosts the skeleton
|
||
("before or after autocomplete"); negatives (partial name,
|
||
expression position, text after cursor, setting off, no-lex
|
||
buffer); accepted ghost parses.
|
||
- [x] **QA on opentitan** (read-only: `--check`/`--stdout` only, git
|
||
status after): timing via `--verbose` — non-matching keystroke
|
||
well under 1 ms, matching ghost sub-ms warm / few ms cold, popup
|
||
module tier no longer reads files.
|
||
|
||
### §12 round 2 (2026-08-30, owner rulings after live use)
|
||
|
||
Files: same lane list as round 1 (inline.rs, completion.rs, candidates.rs
|
||
if needed, state.rs ONLY if a selector is needed there, e2e.rs,
|
||
package.json description, smoke.js, the feature README + amendments,
|
||
TODO.md §12).
|
||
|
||
- [x] **Space-armed trigger.** The ghost offers only after
|
||
`name<space>`: the identifier must end exactly one space before
|
||
the cursor (`aes ` ghosts; `aes` alone never does — `aes_dft`
|
||
may still be coming). Ghost text loses its leading space
|
||
accordingly. Popup round trip becomes accept-name, type space,
|
||
ghost.
|
||
- [x] **Every indexed module expands.** A module declared in more than
|
||
one file no longer declines: pick the definition whose path
|
||
shares the longest common prefix with the requesting document's
|
||
path (the same top's copy in opentitan), tie-broken by
|
||
lexicographic path; deterministic and pinned. `ast_dft` and
|
||
`io_osc` (duplicated across top_earlgrey/top_darjeeling) are the
|
||
motivating cases.
|
||
- [x] **QA sweep on opentitan**: request a ghost for every module name
|
||
in the index at a synthetic legal site; every non-ghosting name
|
||
needs a written reason (escaped identifiers, unparseable
|
||
definition file); `ast_dft`, `io_osc`, `aes` verified by hand.
|
||
1 131/1 131 ghosted, 0 declined; 199 names duplicated across 2-61
|
||
files, all resolved. One non-blocking finding (nearest-definition
|
||
tie-break on a nested-subdirectory sibling) — see the feature
|
||
README's round-2 QA log.
|
||
|
||
## 13. Fuzzy completion wave (2026-08-30) — owner request
|
||
|
||
Subsequence ("fuzzy") matching for identifier completion, VS Code
|
||
policy: prefix matching below 3 typed characters, fuzzy from 3 up
|
||
(`clkenq` reaches `clk_osc_en_q`). Sized by the lead's benchmark on
|
||
the real opentitan word list (139,800 words): char-bitmask prefilter
|
||
+ two-pointer scan = 0.07-0.32 ms/keystroke; naive scan 3.4 ms;
|
||
1-2-char queries stay prefix so the degenerate single-letter case
|
||
never runs fuzzy. Single lane. Files:
|
||
crates/lucisv_server/src/{candidates.rs, completion.rs},
|
||
crates/lucisv_server/tests/e2e.rs,
|
||
docs/features/fuzzy-completion/README.md (new), amendment in
|
||
docs/features/completion-core/README.md, TODO.md §13.
|
||
|
||
- [x] **Mask table in `Candidates`.** Per-word 32-bit character mask
|
||
for the words and units tables, built with the index and
|
||
maintained by every mutation path (build, update_words, absorb,
|
||
remove_file); query mask subset-check prunes before the
|
||
subsequence scan.
|
||
- [x] **Fuzzy tiers at ≥3 chars.** Words, index (project
|
||
declarations) and scope-visible tiers match by case-insensitive
|
||
subsequence when the typed word is 3+ chars; below 3, today's
|
||
prefix behavior byte-for-byte. Module tier unchanged
|
||
(substring, its own semantics). Dedup across tiers preserved.
|
||
- [x] **Ranking.** Prefix hits outrank fuzzy hits within a tier;
|
||
fuzzy hits scored (word-boundary bonus at `_`/case/digit
|
||
boundaries, contiguity, gap penalty), deterministic, stable
|
||
tie-break by name; top-K under the existing LIMIT.
|
||
- [x] **isIncomplete correctness.** The 2-char prefix response must
|
||
be marked incomplete or VS Code filters locally and the 3rd
|
||
keystroke never reaches the server (the prefix→fuzzy transition
|
||
is the trap); truncated fuzzy responses incomplete too.
|
||
- [x] **Pins.** clkenq→clk_osc_en_q end to end; boundary-scored
|
||
ranking; 1-2 char = prefix only; textEdit still replaces the
|
||
typed word; no fuzzy hit whose letters are out of order; e2e
|
||
over the wire incl. the 2→3 char transition.
|
||
- [x] **QA on opentitan** (read-only, --check/--stdout only, git
|
||
status after): fuzzy keystroke adds ≤0.5 ms warm vs today's
|
||
2.6-3.2 ms popup; <3-char path unchanged; index build/absorb
|
||
not measurably slower from mask maintenance; clkenq finds
|
||
clk_osc_en_q in a real ast buffer.
|
||
**Dev note (2026-08-30): the ≤0.5 ms bar does not hold on the
|
||
widest three-letter queries.** Measured on the real checkout:
|
||
`clkenq` +0.05 ms, `clk` +0.52 ms, `prim_` +0.77 ms, `aes`
|
||
+0.80 ms; 1-2-char requests unchanged. Numbers, the reason
|
||
(three common letters leave 39 362 of 100 022 names past the
|
||
mask and half of them really match) and the two untaken levers
|
||
are in docs/features/fuzzy-completion/README.md, *Performance*
|
||
— for the lead to rule on.
|
||
**QA verdict (2026-08-30): SHIP.** Gates clean (fmt, clippy,
|
||
`cargo test --workspace` 2691/0/36 exact match, debug+release
|
||
builds, smoke.js). git status on opentitan confirmed unchanged
|
||
(only the three pre-existing owner edits) before and after every
|
||
session. `clkenq` confirmed live over the wire against the real
|
||
`clk_osc_en_q` in `hw/top_earlgrey/ip/ast/rtl/gfr_clk_mux2.sv`
|
||
(ast.sv itself doesn't declare it; grepped for the closest real
|
||
name as instructed), both from another buffer and from inside
|
||
that file's own buffer. Ten adversarial attack tests written
|
||
against the matcher (mixed case, `$`/digit/`_` queries, a
|
||
non-ASCII byte in a table entry, ranking determinism, absorb
|
||
overwriting a path, remove-then-readd) — all ten passed, no
|
||
corruption found; reverted after running (nothing to fix).
|
||
Server "answered in" timings (fairer than wall-clock; still pays
|
||
JSON marshalling the dev's isolated number does not): `aes`
|
||
1.7-2.2 ms, `clkenq` 0.4-0.5 ms, 1-2-char queries 0.9-2.0 ms
|
||
(matches the unchanged-path claim in shape). **New finding**:
|
||
`ena` (a common real RTL fragment) measured 2.95-4.05 ms,
|
||
worse than `aes` — the *Performance* section's "aes is the
|
||
worst case" is not shown to be a proven upper bound, just the
|
||
case the dev tried. Informational, not blocking: same
|
||
architecture, same order of magnitude, still within the ~1.1 ms
|
||
absolute framing the lead already accepted. See the feature
|
||
README's QA log for the full latency table and repro.
|
||
|
||
## 14. Null items wave (2026-09-01) — owner report "for loop inside generate"
|
||
|
||
Lead diagnosis: the generate-for itself parses in every spelling
|
||
(genvar in the header, declared outside, region-less; the three
|
||
systemverilog.io examples all round-trip). What fails is the stray
|
||
`;` the owner wrote after `endgenerate` — a **null item**, legal SV
|
||
(IEEE 1800-2017 A.1.4 `package_or_generate_item_declaration ::= … | ;`
|
||
and `class_item ::= … | ;`; slang warns `-Wempty-member`, "an
|
||
unnecessary semicolon in a non-procedural scope"). Rejected today at
|
||
module scope, inside `generate…endgenerate`, after a generate block's
|
||
`end`, in package/interface/class bodies and at file scope; the
|
||
procedural null *statement* already works; `endfunction;`/`endtask;`
|
||
already survive via `end_semi`. Single lane. Files:
|
||
crates/vlog_parser/src/{ast.rs,parser.rs}, crates/vlog_parser/tests/
|
||
spans.rs, crates/vlog_formatter/src/format.rs (+align.rs only if a
|
||
group rule needs it), crates/vlog_formatter/tests/cases/
|
||
null_items.cases (new), crates/vlog_formatter/tests/verification.rs,
|
||
crates/vlog_semantic/src/bind.rs (arm), crates/vlog_linter/src/
|
||
rules/empty_item.rs (new) + registry + a .lint case + rule docs,
|
||
compile-fix arms elsewhere as the compiler demands (listed in
|
||
Handshakes), docs/features/null-items/README.md (new), TODO.md §14.
|
||
|
||
- [x] **`ItemKind::Empty`** — a first-class null item wherever an
|
||
item may appear (module, generate region, generate-block body,
|
||
package, interface, program, class body, file scope), span =
|
||
the `;` token, comments attached through the ordinary `Meta`.
|
||
No cascade: tolerant mode emits no diagnostic for it.
|
||
- [x] **Formatter layout, token-preserving**: a null item on the same
|
||
line as the previous item's last token prints glued
|
||
(`endgenerate;`, `end;`, `;;`); one on its own line prints `;`
|
||
at the current indent. Idempotent both ways; alignment groups
|
||
are not joined across it. Corpus byte-identical (813/820).
|
||
- [x] **Blast radius arms**: `format.rs`, `bind.rs`, `tests/spans.rs`
|
||
(+ any other exhaustive match the compiler names).
|
||
- [x] **Safety-net template**: `verify.rs` untouched; rejection pairs
|
||
added anyway (dropped `;`, `;` moved across a comment, `;`
|
||
moved into a procedural block).
|
||
- [x] **Lint `empty-item`** (slang's `-Wempty-member`): warn on a null
|
||
item, safe auto-fix removes it; default on; `.lint` case with
|
||
the fix output verified by the harness.
|
||
- [x] **Online-example pins**: the three systemverilog.io generate
|
||
examples (16-input mux, arbiter assertions, nested memory case)
|
||
as formatter cases, plus the owner's `endgenerate;` shape and
|
||
slang's two warning examples.
|
||
- [x] **QA**: adversarial null-item placements (before/after
|
||
directives, between `` `ifdef `` arms, after attributes, with
|
||
trailing/leading comments, CRLF), idempotency, opentitan sweep
|
||
unchanged at 11 failures (read-only), LSP diagnostics show the
|
||
lint (not a parse error) with the quick fix.
|
||
|
||
## 15. DV class semantics wave (2026-09-01) — owner request
|
||
|
||
Round 1: **class-member-access**. `handle.member` through a class-typed
|
||
variable resolves (hover / definition / references), inherited members
|
||
chased through `extends` in-file and cross-file, `this.x`/`super.x`
|
||
chased the same way (delivers topo §2.9-9), and an out-of-class method
|
||
body (`task c2::update(...)`) sees its class's members. Design by the
|
||
lead from the Explore map: today `a.b` records a reference for the head
|
||
only (bind.rs `ExprKind::Member` arm, vlog-semantic rule 8), `Symbol`
|
||
carries no declared type, `resolve_external` never chases
|
||
`InheritedCandidate::base`, and the index has no base-class-of lookup.
|
||
Single lane. Files: crates/vlog_semantic/src/{model.rs, bind.rs,
|
||
resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/tests/*
|
||
(+ new member_access.rs), crates/lucisv_server/src/{hover.rs, nav.rs}
|
||
only if a rendering detail needs it, crates/lucisv_server/tests/e2e.rs,
|
||
docs/features/class-member-access/README.md (new), amendments in
|
||
docs/features/{class-semantics, overlay-promotion, vlog-semantic}/
|
||
README.md, TODO.md §15.
|
||
|
||
- [x] **`Symbol::type_name`** — the declared type as written (`c1`,
|
||
`pkg::c1`), captured where declarators bind (Var, TfArg, Port,
|
||
class properties); additive field, `None` for everything else.
|
||
- [x] **Tail reference for `head.member`** when the head is a plain
|
||
identifier: new `Target::MemberOf`, tail span via `member_tail`;
|
||
resolves the head lexically → its `type_name` → the class
|
||
(in-file scope, else `ExternalCandidate { paths: ["C::member"] }`)
|
||
→ the member in the class scope, else chase `Scope::extends`
|
||
in-file, else `InheritedCandidate { base, paths }`.
|
||
- [x] **Index-side inheritance chase**: `WorkspaceIndex::base_of(class)`
|
||
as a reverse map built from the existing inheritance-edge census
|
||
(no new facts field); `resolve_external` follows
|
||
`InheritedCandidate::base` upward with a visited set until a
|
||
member hit or an unknown base. Also serves `this.x`/`super.x`
|
||
misses (§2.9-9 delivered).
|
||
- [x] **Out-of-class method bodies** (`task C::m(...)`): names inside
|
||
resolve in class `C` first (in-file scope chain; cross-file via
|
||
`InheritedCandidate { base: C }`), so `address = in_item.user_id`
|
||
resolves both sides in the owner's example.
|
||
- [x] **`FACTS_FORMAT` 5 → 6** — the reference census grows (new tail
|
||
postings), so stores written by older builds must be discarded;
|
||
`fingerprint`/`absorb`/`update_one` equalities re-pinned.
|
||
- [x] **Hover renders the member's declaration** (`rand bit user_id;`
|
||
with file:line for cross-file) through the existing external
|
||
path; definition/references follow for free and are pinned.
|
||
- [x] **Pins**: the owner's three-file example (base/c1/class2) in-file
|
||
and split across files; inherited member two hops up; cycle in
|
||
`extends` terminates; unknown base → graceful `None`; module
|
||
instance heads unchanged (`a_hierarchical_name_resolves_only_its_head`
|
||
stays green); rename of `user_id` renames the tail use.
|
||
- [x] **QA on opentitan DV** (read-only; 2026-09-01): `item.a_addr`
|
||
(`tl_seq_item`, cross-file) resolves correctly, 0.12 ms cold /
|
||
0.01 ms warm; `cfg.clk_rst_vif` (type-parameterized `cfg`)
|
||
correctly answers nothing; no `uvm_pkg.sv` in the tree, so every
|
||
UVM-base chase ends at an unknown base by construction; cold
|
||
full-workspace scan 2956 ms / warm 1521 ms (3976 files), matching
|
||
`docs/performance_take2.md`'s baseline; diagnostics unchanged on
|
||
3 sampled DV files; store size +9.56% on the whole opentitan tree
|
||
(28 200 598 → 30 895 566 bytes). **First-pass QA verdict: REWORK**
|
||
— finding 1: a typedef-typed (struct, enum or plain alias) local
|
||
variable's member access is documented to record no reference at
|
||
all but instead became an `ExternalCandidate`, which a same-named
|
||
unit elsewhere in the workspace could wrongly answer (hover/
|
||
definition landing on an unrelated declaration). Confirmed live in
|
||
real opentitan DV code (`cip_base_scoreboard.sv`'s
|
||
`expected_alert_t`/`exp_alert`, harmless there for lack of a naming
|
||
collision) and by three isolated repros.
|
||
**Fixed by the dev (rework round, same day)**: `resolve.rs`'s
|
||
`member_of` now routes through a three-way `TypeHere::{Scope,
|
||
NotAUnit, Absent}` — only `Absent` (nothing in this file declares
|
||
the type name at all) reaches the workspace; a type declared here
|
||
as a typedef (`NotAUnit`) records no reference, full stop. Four new
|
||
permanent pins in `member_access.rs`. **Re-verified 2026-09-01: all
|
||
three original repros now pass; the live collision scenario
|
||
(`bus_t` struct in A vs. unrelated `class bus_t` in B) answers
|
||
`null`/`[]` over the release server, never B's member; the
|
||
corrected live opentitan occurrence
|
||
(`cip_base_scoreboard.sv:469`, `exp_alert.is_fatal`/`.max_delay`)
|
||
now answers nothing; `item.a_addr` still resolves at the same
|
||
timing; honest positives (owner's example, both file layouts,
|
||
inherited `base_field`, out-of-body `address`, rename) unchanged
|
||
byte-for-byte; corpus references 97 892 → 97 454 (−438 bogus
|
||
postings removed), unresolved unchanged at 1 256. Gates:
|
||
`cargo test -p vlog_semantic` 176/0/1, `-p lucisv_server`
|
||
1431/0/36, `--workspace` 2736/0/37, fmt/clippy clean.
|
||
**Final QA verdict: SHIP.**
|
||
- Round 2 (filed, not this round): chains `a.b.c` needing
|
||
`Def::type_name` in the index; instance heads `u.port` via the
|
||
module member table; struct-typed variables (`s.field`, needs
|
||
§2.9-13 first); and a `base` field on `ReferenceFact` (another
|
||
`FACTS_FORMAT` bump) so a use whose *only* handle on its declaration
|
||
is the recorded base — `this.x`, `super.x`, a bare miss inside an
|
||
extending class — gets an index posting too, and cross-file
|
||
find-references lists it. Every use carrying a path, which is every
|
||
`handle.member` tail, already posts.
|
||
|
||
### §15 round 2 — member chains and instance heads (2026-09-01)
|
||
|
||
Rides on round 1's shape (`Symbol::type_name`, `Target::MemberOf`,
|
||
`TypeHere`, `base_of`/`member_chain`). Same feature README, new
|
||
round-2 section. Files: crates/vlog_semantic/src/{model.rs, bind.rs,
|
||
resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/tests/
|
||
member_access.rs (+ others as needed), crates/lucisv_server/tests/
|
||
e2e.rs, docs/features/class-member-access/README.md, amendments in
|
||
docs/features/vlog-semantic/README.md (rule 8), TODO.md §15 round 2.
|
||
|
||
- [x] **`Def::type_name`** on indexed declarations (members and
|
||
units' ports), same capture rule as `Symbol::type_name` (none on
|
||
unpacked declarators); **`FACTS_FORMAT` 6 → 7**.
|
||
- [x] **Chains `a.b.c`**: the tail carries the head's spelling plus the
|
||
links before it (`Target::MemberOf { head, mids }`) rather than the
|
||
inner tail's reference — the in-file walk hops declared type to
|
||
declared type, and a chain that leaves the file arrives as **one
|
||
composed path** (`item_t::hdr::addr`) in the existing path
|
||
contract, which `follow_one` walks member by member. No new
|
||
`Resolution` variant, and the index's own postings come free, so
|
||
hover, cross-file references and rename cannot disagree. Any link
|
||
that cannot be resolved honestly stops the chain.
|
||
`item.hdr.addr`, `tb.dut_i.u_core.sig`.
|
||
- [x] **Instance heads `u.port` / `u.internal`**: an instance symbol's
|
||
type is its module (not for an instance array), and `type_here`
|
||
already accepted a `Module` scope, so `u.port`, `u.internal_sig`
|
||
and hierarchical tb paths resolve; `.*`/positional connections are
|
||
unchanged. `a_hierarchical_name_resolves_only_its_head` flipped,
|
||
old assertion kept for an untyped head.
|
||
**Ruling against the plan: modules go on exporting ports and
|
||
parameters only.** Exporting nets and vars costs +24 % of the
|
||
corpus store (3 112 102 → 3 871 557 bytes) *and* makes a `.port`
|
||
connection resolve to the module's internal net — a wrong answer
|
||
(`an_internal_net_of_another_module_is_not_reachable` fails).
|
||
Separating the two lookups is a workspace-index decision; left for
|
||
the lead with the numbers. `u.internal_sig` resolves in-file.
|
||
- [x] **Typedef alias chase**: `typedef c1 my_t; my_t h; h.x` follows
|
||
the typedef's own `type_name` (in-file and, via `Def::type_name`,
|
||
cross-file), visited-guarded; a typedef of a non-unit still
|
||
records nothing (round-1 pins stay). Cross-file only for a
|
||
file-scope typedef; one inside a package is filed.
|
||
- [x] **`this.x`/`super.x` index postings**: a `base` on
|
||
`ReferenceFact` so cross-file references from the declaration
|
||
side list inherited-member uses (round-1 residue). `rename`'s
|
||
`files_spelling` fan-out is deliberately unchanged; the rung-6
|
||
question it raises is filed in the feature README's Handshakes.
|
||
- [x] **Pins**: two- and three-link chains in-file and across three
|
||
files (both index orders); a chain broken by a struct link records
|
||
nothing past the break, including against a same-named class
|
||
elsewhere; a chain through an inherited member; instance port,
|
||
parameter and internal signal through a module in another file;
|
||
hierarchical tb path in one file and across two; alias one and two
|
||
hops; alias cycle; ambiguous hop; record round-trip and every
|
||
index mutation; e2e hover/definition/references/rename on a
|
||
chain's third link and hover on an instance port.
|
||
- [x] **Filed, fixed by the lead**: `crates/vlog_refactor/tests/
|
||
rename.rs:818` `a_hierarchical_tail_is_left_alone_and_named_as_such`
|
||
pinned round 1's truth — a rename of `sig` leaves `u_sub.sig` alone and
|
||
warns. Round 2 resolves that tail, so the rename correctly edits it;
|
||
the pin was stale. The lead split it into
|
||
`a_hierarchical_tail_that_resolves_is_renamed_with_its_declaration`
|
||
(resolves, is edited) and
|
||
`a_hierarchical_tail_that_cannot_resolve_is_left_alone_and_named_as_such`
|
||
(unknown module: left alone, correctly, but the old `stray_reason`
|
||
warning no longer fires — the tail now carries an `ExternalCandidate`
|
||
the workspace cannot answer, which is neither an edit nor a warning
|
||
today). The rename engine needed no other change. The lost warning is
|
||
filed as `docs/topo.md` §2.9-20, not a REWORK item — the edit behavior
|
||
itself is correct in both directions.
|
||
- [x] **QA on opentitan DV/RTL** (read-only, 2026-09-01): real chains
|
||
in `hw/ip/aon_timer/dv/env/aon_timer_scoreboard.sv:496`
|
||
(`cfg.m_tl_agent_cfg.vif.h2d.a_valid`, a class-parameterized `cfg`
|
||
— head resolves, every link past it correctly answers nothing per
|
||
the no-elaboration assumption) and
|
||
`hw/ip/uart/dv/env/uart_scoreboard.sv:195` (`ral.ctrl.tx`, `ral`
|
||
typed `RAL_T` — same shape, same correct "nothing"); a hierarchical
|
||
tb path `hw/ip/uart/dv/tb/tb.sv:84` (`dut.uart_core.rx_sync` — `dut`
|
||
resolves, `uart_core` is an instance of `uart` in another file and
|
||
answers nothing cross-file since a module exports ports/parameters
|
||
only, `rx_sync` (an internal signal two hops deep) likewise); the
|
||
round-1 positive case re-verified (`item.a_addr` →
|
||
`tl_seq_item.sv:45`, cross-file, ~35-42 ms including RPC/parse) and
|
||
the round-1 negative case re-verified (`exp_alert.is_fatal` /
|
||
`.max_delay` against the real non-macro line,
|
||
`cip_base_scoreboard.sv:469` — both still answer nothing; no
|
||
coincidentally-named external unit). **15 probes, zero wrong
|
||
answers.** Store: `FileFacts::of` + `encode()` over all 3979
|
||
`.sv`/`.v`/`.svh` files, trunk (v0.22.0, `91b7c2f`, detached
|
||
worktree) vs this tree: 30 821 130 → 35 440 798 bytes (**+4 619 668,
|
||
+15.0%**), matching the internal 860-file corpus's own +15.4%
|
||
closely; read time ~1.8 s both trees (noise-dominated, no
|
||
regression). `git -C opentitan status --short`: only the three
|
||
pre-existing owner files, untouched by this QA pass. Diagnostics:
|
||
not independently re-measured this round — `vlog_parser` and
|
||
`vlog_linter` are outside this round's diff (confirmed by `git diff
|
||
--stat`), and diagnostics are produced from parse/lint alone, so
|
||
they structurally cannot move; round 1's own before/after
|
||
measurement already stands for the shared code paths.
|
||
|
||
## 16. Interface semantics wave (2026-09-01) — coverage_gaps C2/H2
|
||
|
||
Interfaces are `SymbolKind::Module` (hover labels them "module");
|
||
modports and clocking blocks declare no symbol and the signal names
|
||
inside them are not references; `is_exported(Module, ·)` passes ports
|
||
and params only, so `vif.sig` through a `virtual my_if vif` handle
|
||
resolves in-file but never across files (H2). `virtual my_if.mp vif`
|
||
already records `type_name = my_if` (the modport half is dropped);
|
||
`b_if.mp` in a connection resolves nothing (the C2 "wrong answer" was
|
||
the head's "module" label, re-probed against HEAD). Delivers topo
|
||
§2.9-7. Single lane. Files: crates/vlog_semantic/src/{model.rs,
|
||
bind.rs, resolve.rs, workspace.rs, facts.rs}, crates/vlog_semantic/
|
||
tests/* (+ new interfaces.rs), mechanical kind arms in
|
||
crates/lucisv_server/src/{symbols.rs, hover.rs, tokens.rs,
|
||
completion.rs, candidates.rs, type_def.rs, design_hierarchy.rs,
|
||
hierarchy.rs} and crates/vlog_refactor/src/{ports.rs, instantiate.rs}
|
||
(Module-only filters widened to Module|Interface so behavior is
|
||
unchanged), crates/lucisv_server/tests/e2e.rs,
|
||
docs/features/interface-semantics/README.md (new), amendments in
|
||
docs/features/{interfaces, ansi-first-port, type-definition,
|
||
class-member-access}/README.md, TODO.md §16.
|
||
|
||
- [x] **`SymbolKind::Interface`** for `interface … endinterface`
|
||
(`program` stays `Module` this round, documented). Every
|
||
Module-exact match gains the arm (resolve.rs `Target::Module`/
|
||
`Target::Port`/`container_scope`/`member_scope`, workspace
|
||
`is_unit`/`counts`, facts `kind_name`/`kind_of`, server labels
|
||
and LSP kinds — hover says "interface", `SymbolKind::INTERFACE`
|
||
/ `CompletionItemKind::INTERFACE`); interfaces stay in the
|
||
module table, the design hierarchy and code lens (an interface
|
||
instance is an instantiation edge) — pinned unchanged.
|
||
- [x] **Export rule for interfaces**: `Net | Var | Port | Param |
|
||
Typedef | Function | Task | Modport | Clocking` — an interface's
|
||
signals ARE its surface, so the module ruling (ports/params
|
||
only) does not apply. `vif.sig` and `vif.cb.sig` resolve
|
||
cross-file.
|
||
- [x] **Modport symbols**: `SymbolKind::Modport` declared in the
|
||
interface scope from `ModportDecl.name_span`; each modport port
|
||
name / `import`/`export` name / `clocking cb` name becomes a
|
||
reference to the interface's signal, method or clocking block;
|
||
`b_if.mp` (connection) and the `.mp` half of an interface-typed
|
||
port or `virtual my_if.mp` type resolve to the modport (bound as
|
||
a member of the type in `bind_data_type`, where ansi-first-port
|
||
said "the tail is where to bind them"). Hover shows
|
||
`modport mp (…)`.
|
||
- [x] **Clocking block symbols**: `SymbolKind::Clocking` for named
|
||
blocks, with `type_name` = the enclosing interface's name so
|
||
`vif.cb.data` hops cb → interface → `data` through round 2's
|
||
machinery unchanged (the clocking signal aliases the interface
|
||
signal; answering the signal's declaration is honest); each
|
||
`ClockingSignal.name` is a reference to the interface signal
|
||
(and `= expr` values bind as expressions).
|
||
- [x] **`FACTS_FORMAT` 7 → 8** (new kinds; older stores discarded).
|
||
- [x] **Pins**: kind flips in tests/workspace.rs (`an interface is a
|
||
Module symbol` → Interface); modport/clocking symbols and
|
||
references in-file and cross-file; `vif.sig`, `vif.cb.sig`,
|
||
`virtual my_if.mp vif; vif.sig`, `b_if.mp` hover/definition;
|
||
rename of an interface signal rewrites its modport list, clocking
|
||
block and `vif.sig` uses (e2e); the refactor test
|
||
`renaming_the_modport_half_of_a_port_type_is_refused` is
|
||
re-examined by the lead at merge (a modport is a symbol now —
|
||
renaming it should rename its type-position uses).
|
||
- [x] **QA on opentitan DV** (read-only) — 2026-09-01, verdict SHIP.
|
||
17 probes over the real server (cfg.vif.* class-parameter chains,
|
||
`vif.cb.scl_i` genuine cross-file resolution in `i2c_monitor.sv`,
|
||
modport/clocking hovers in `uart_if.sv`/`tl_if.sv`, interface
|
||
instance hovers in `tb.sv`): zero wrong answers, sub-ms hover
|
||
(cold and warm). Store: index-cache +0.81% (31 949 117 →
|
||
32 208 241 bytes); cold scan 3 976 files unchanged at ~3.0s;
|
||
diagnostics 0→0 on 5 DV files with interfaces. Full table in
|
||
`docs/features/interface-semantics/README.md`'s QA log.
|
||
|
||
## 17. Struct members wave (2026-09-01) — coverage_gaps H1 + topo §2.9-13
|
||
|
||
`typedef struct packed {…} bus_t; bus_t s; s.field` records nothing.
|
||
Mapped state: `SymbolKind::StructMember`/`ScopeKind::Struct` exist and
|
||
the struct scope already hangs on the Typedef symbol's `child_scope`;
|
||
every member declarator has a name span and its own `DataType`; the
|
||
`MemberOf` pending use exists. Missing: `resolve.rs::member_scope`
|
||
excludes `Typedef` (the whole in-file gap); members are declared with
|
||
`declare`, not `declare_typed` (no `type_name`, so no nested hop);
|
||
`is_exported` has no `Typedef` arm (no cross-file `Def`s); anonymous
|
||
aggregates (`struct {…} s;`, `enum {A,B} x;`, inline nested struct
|
||
members — the opentitan register-package shape) produce no symbols
|
||
because `ty.name` is empty. Single lane. Files: crates/vlog_semantic/
|
||
src/{bind.rs, resolve.rs, workspace.rs, facts.rs, model.rs if a field
|
||
is needed}, crates/vlog_semantic/tests/* (+ new struct_members.rs),
|
||
crates/lucisv_server/src/type_def.rs (member-type descent, small),
|
||
crates/lucisv_server/tests/e2e.rs, docs/features/struct-members/
|
||
README.md (new), amendments in docs/features/{types-decls,
|
||
vlog-semantic, class-member-access}/README.md, TODO.md §17.
|
||
|
||
- [x] **In-file**: `member_scope` accepts a `Typedef` whose child scope
|
||
is a `Struct` scope (unions included — one node); struct members
|
||
declared with `declare_typed` so `s.hdr.addr` hops through a
|
||
member's own type; an alias of a struct typedef follows to it;
|
||
enum/int-alias typedef heads still record nothing (`.name()`
|
||
etc. are built-ins); the in-file struct answers in-file — never
|
||
a stranger class of the same name elsewhere (round-1 pin stays).
|
||
- [x] **Cross-file**: `is_exported(Typedef, StructMember)`; members of
|
||
a struct typedef nested in a package land under the typedef's
|
||
bare name like nested classes do (collisions across packages →
|
||
the existing ambiguity refusal, documented); `Def::type_name` on
|
||
members; `pkg::bus_t s; s.field` from another file.
|
||
- [x] **Anonymous forms (§2.9-13)**: `enum {A,B} x;` declares its
|
||
variants in the enclosing scope exactly like a typedef enum; an
|
||
anonymous `struct {…} s;` gives the declarator a `Struct` child
|
||
scope with its members, and `link_type` follows a head symbol's
|
||
own child scope when it has no type name; an INLINE nested struct
|
||
member (`struct packed { struct packed {…} q; } reg2hw_t;`) gets
|
||
a child scope in-file and, cross-file, its inner members exported
|
||
under a synthesized key `reg2hw_t::q` carried as the member's
|
||
`Def::type_name` — so `reg2hw.ctrl.q` walks
|
||
`reg2hw_t` → `ctrl` → `reg2hw_t::ctrl` → `q` without bare-name
|
||
collisions (`q`/`d`/`qe` are everywhere in register packages).
|
||
Cross-file anonymous *variables* (`pkg::cfg.f`) stay in-file only,
|
||
documented.
|
||
**Done 2026-09-01, one deviation**: the synthesized key joins with
|
||
a **`.`**, not `::` — `member_type` calls `last_segment` on a
|
||
`Def::type_name` before using it, so `reg2hw_t::ctrl` would have
|
||
collapsed back to the bare `ctrl` the key exists to avoid. A `.`
|
||
survives it whole and is unwritable as a type name. Argued in
|
||
`docs/features/struct-members/README.md`.
|
||
- [x] **`FACTS_FORMAT` 8 → 9**.
|
||
- [x] **type_def.rs**: `typeDefinition` on a struct member's type name
|
||
inside the body (descend into `TypedefKind::Struct` members).
|
||
- [x] **Pins to flip/keep**: `a_struct_typedef_typed_head_records_nothing`
|
||
→ resolves; `an_alias_of_a_struct_records_nothing` → follows;
|
||
`a_chain_broken_by_a_struct_link_records_nothing_past_the_break`
|
||
→ continues; `a_local_typedef_is_never_looked_up_in_a_same_named_class_elsewhere`
|
||
stays (answers the struct's own field); enum/int-alias pins stay;
|
||
rename of a struct member rewrites `s.field` uses in-file and
|
||
cross-file (the existing declaration-only rename pin grows uses);
|
||
corpus: unresolved must fall or hold, store delta reported.
|
||
**Done 2026-09-01**: the cross-file half of
|
||
`a_chain_broken_by_a_struct_link_...` stays a *refusal* (two `hdr_t`
|
||
in the workspace — deviation argued in the feature README); every
|
||
other pin landed as briefed. `vlog_refactor`'s existing
|
||
declaration-only rename pin keeps passing untouched; the new
|
||
cross-file use rename is pinned in this lane's own e2e. Corpus:
|
||
unresolved **1 203 → 1 162**, unplaced 0, store **3 216 689 →
|
||
3 179 905 bytes (−1.14 %)** while indexed members grew 12 298 →
|
||
12 642 — the anonymous-enum variants turn external postings into
|
||
local ones. `cargo test --workspace`: **2 810 passed, 0 failed, 38
|
||
ignored**; fmt clean, clippy zero warnings, smoke OK.
|
||
- [x] **QA on opentitan** (read-only): `reg2hw.<reg>.q` /
|
||
`hw2reg.<reg>.d` / `.de` in hw/ip/*/rtl/*.sv against the
|
||
generated `*_reg_pkg.sv` (cross-file, nested inline structs);
|
||
`tl_i.a_address`-style struct-typed ports; DV struct members;
|
||
sub-ms hover; store delta (register structs are large); zero
|
||
wrong answers.
|
||
**Done 2026-09-01, verdict SHIP**: 28 probes across 6 IPs (uart,
|
||
spi_device, aes, i2c, usbdev, tlul) plus one DV file — 23 resolved
|
||
correctly (three planted sibling-name acid-test pairs hand-verified
|
||
against `*_reg_pkg.sv`: i2c `rxfull`:546/`fmtfull`:549, usbdev
|
||
`avsetup_rst`:417/`avout_rst`:420, spi_device
|
||
`tpm_csb`:481/`csb`:484 — never the wrong sibling), 5 misses all the
|
||
same pre-existing documented indexed-mid-chain limitation
|
||
(`reg2hw.key_share0[i].q`, unrelated to struct-members — confirmed
|
||
by three other AES chains through the same wildcard-imported type
|
||
answering correctly with no index). Zero wrong answers. Hover/def
|
||
0.00–0.52 ms (first request pays warm-up, rest sub-ms). Cold scan
|
||
3 976 files: trunk `95f930c` 3 543.79 ms → this tree 3 925.48 ms.
|
||
Opentitan on-disk index-cache: 32 208 241 → **33 583 533 bytes
|
||
(+4.27 %)** — the predicted-direction gain from real
|
||
`*_reg_pkg.sv` files, opposite of the synthetic corpus's −1.14 %.
|
||
Diagnostics 0→0 on all 7 opened files. `git -C opentitan status`
|
||
unchanged. Full table in `docs/features/struct-members/README.md`'s
|
||
QA log.
|
||
- Follow-on lane (filed): **member completion after `.`** — no dot
|
||
context exists in completion.rs today; with member resolution in
|
||
place, `item.` / `reg2hw.` / `vif.` listing members is the natural
|
||
next DV/RTL daily driver.
|
||
|
||
## 18. Member completion wave (2026-09-01) — the DV/RTL daily driver
|
||
|
||
`item.` / `reg2hw.ctrl.` / `vif.` / `vif.cb.` / `pkg::` / `this.` /
|
||
`super.` list members. Mapped state: `typed_word` already yields an
|
||
empty word with an empty replace range right after `.`/`::`, so today
|
||
the cursor after a dot gets the whole-index dump (scope + index + 181
|
||
keywords + every project word, capped at 512, `isIncomplete`) — that
|
||
is what this lane replaces; no dot/scope context exists anywhere in
|
||
completion.rs; `trigger_characters: None` (main.rs:284, two pins);
|
||
`WorkspaceIndex::members_of(unit)` is `pub`, documented for `pkg::`
|
||
and uncalled, but omits inherited members; every chain-resolving
|
||
helper (`resolve::member_of` prefix, `link_type`, `type_here`,
|
||
`member_chain`, `member_type`, `aliased_unit`) is private. Single
|
||
lane. Files: crates/vlog_semantic/src/{lib.rs, resolve.rs,
|
||
workspace.rs} (public API only — one walk, no second resolver),
|
||
crates/vlog_semantic/tests/*, crates/lucisv_server/src/{completion.rs,
|
||
main.rs} (+ server.rs only if context plumbing is needed),
|
||
crates/lucisv_server/tests/e2e.rs, editors/vscode/smoke.js (optional
|
||
pin), docs/features/member-completion/README.md (new), amendment in
|
||
docs/features/completion-core/README.md (the "every other tier ignores
|
||
position" sentence; the stale five-row tier table), TODO.md §18.
|
||
|
||
- [x] **Public prefix walk in `vlog_semantic`**: `Semantics::member_site
|
||
(from, head, mids) -> Option<MemberSite { Scope(ScopeId) |
|
||
Unit(String) }>` — the prefix of `resolve::member_of`, which is
|
||
refactored to call it (one walk); `WorkspaceIndex::members_of_chain
|
||
(unit) -> members incl. inherited/aliased`, walking the same
|
||
`member_chain` hops nearest-first with subclass-overrides-base
|
||
dedup, and `WorkspaceIndex::member_unit(unit, member)` (=
|
||
`member_type`) to fold mids cross-file; an in-file class whose
|
||
`extends` leaves the file merges its scope members with the
|
||
chain's cross-file members.
|
||
- [x] **`Word` learns its separator**: `.` or `::` immediately before
|
||
the run, plus the head spine (`a.b.c` identifiers, balanced
|
||
`[…]` index suffixes stripped so `q[i].` works; anything else →
|
||
no head). `this.`/`super.` map to the class scope / its base
|
||
chain.
|
||
- [x] **Exclusive member tier**: with a separator, the answer is the
|
||
members of the site and nothing else (kind from
|
||
`completion_kind`, detail = kind label + declared type, table-only
|
||
— no file reads), prefix-filtered below 3 typed chars and fuzzy
|
||
from 3 (the house rule), `isIncomplete` only when the list is
|
||
truncated; an unresolvable head answers **nothing** (no popup)
|
||
instead of the 512-item dump. `pkg::` lists the package's
|
||
members; `cls::` its static-visible members.
|
||
- [x] **Triggers**: `trigger_characters: [".", ":"]` (the two main.rs
|
||
pins updated); the handler decides from the buffer, not the
|
||
trigger context; a lone `:` (label/ternary) falls through to
|
||
ordinary completion unchanged.
|
||
- [x] **Pins**: class in-file and cross-file with inherited members
|
||
from a base in another file; struct fields incl. nested via
|
||
synthesized key (`reg2hw.ctrl.`); interface signals + modports +
|
||
clocking (`vif.`, `vif.cb.`); `pkg::`; `this.`/`super.`; typed
|
||
prefix after the dot filters; the edit range is empty at the
|
||
cursor; unresolvable head → None; absent base stops the chain
|
||
but the known members still list; e2e over the wire with the
|
||
trigger character; the two-to-three-char rule after a dot.
|
||
- [x] **Connection and parameter lists** (lead ruling 2026-09-02, taken as
|
||
rework inside this lane rather than filed): a `.` inside `sub u (...)`
|
||
lists the module's **ports** and a `.` inside `sub #(...)` its
|
||
**parameters** — in-file through `Semantics::instantiable_scope` (the
|
||
call `Target::Port` itself makes), across files through the index's
|
||
member table, which exports exactly those two kinds. The list is
|
||
`signature.rs`'s own `enclosing_list`, lifted to `pub(crate)` so the
|
||
popup and the signature card above it cannot disagree; already-connected
|
||
names are dropped; a module nothing declares answers an empty list and a
|
||
`.` in no list at all answers nothing — never the whole-index dump.
|
||
Two shapes stay filed (an unpacked array head, cross-file `pkg::cls::`)
|
||
in `docs/features/member-completion/README.md`.
|
||
- [x] **QA on opentitan** (read-only): `item.`, `cfg.`, `reg2hw.`,
|
||
`reg2hw.<reg>.`, `vif.`, `vif.cb.`, `tlul_pkg::`, `this.` in
|
||
real DV/RTL buffers — member lists complete (cross-check a
|
||
sample against the declaring file), inherited members present
|
||
for known bases, sub-ms answered-in, no whole-index dump after a
|
||
dot anywhere; zero wrong members. **2026-09-02 QA: 15 probes run,
|
||
all member/scope/interface/package lists exact-matched their
|
||
declaring files, zero dumps — REWORK finding on the parameter-list
|
||
half: a `localparam` inside a module's `#(...)` header (e.g.
|
||
`hw/ip/prim/rtl/prim_fifo_sync.sv`'s `DepthW`, ~79 files in
|
||
`hw/ip/*/rtl` alone use the idiom) is offered by `#(.` as if
|
||
overridable — root cause `bind_param_ports` in
|
||
`vlog_semantic/src/bind.rs` (out of this lane's file scope; `ast.rs`
|
||
already carries `ParamPort.kw` to distinguish it). See the QA log
|
||
in `docs/features/member-completion/README.md`. **2026-09-02
|
||
re-verification (SHIP): `SymbolKind::LocalParam` fix confirmed live
|
||
on the original repro plus 3 new real sites in 3 other IPs (usbdev,
|
||
spi_device, hmac/tlul) — zero strangers; sticky rule holds under a
|
||
two-run header, a generate-block body and an interface header;
|
||
empty-answer `isIncomplete` and the corpus fingerprint sweep
|
||
(172 files, 30 mutation checks) both hold; 2887/0/38 over 40
|
||
binaries. Full re-verification log in
|
||
`docs/features/member-completion/README.md`.
|
||
- [x] **`localparam` is its own `SymbolKind`** — QA's rework finding, fixed at
|
||
the root on the lead's ruling (2026-09-02). `bind.rs` never read
|
||
`ParamPort::kw`, so every `#( … )` header entry *and* every body
|
||
`localparam` was bound as `SymbolKind::Param`. Added
|
||
`SymbolKind::LocalParam`, bound from the keyword with the **sticky**
|
||
continuation rule `vlog_refactor::instantiate::params` had always
|
||
applied — so the two layers now agree because they read the same field
|
||
the same way. `FACTS_FORMAT` **9 → 10** (an older store calls every
|
||
localparam a `param`, a wrong answer rather than a stale label). Every
|
||
site that matched `Param` decided explicitly (table in the feature
|
||
README): a localparam is exported, hovered, iconed and highlighted
|
||
exactly as a `Param`, and `u_fifo.DepthW` still resolves; the only
|
||
behavioural difference is that a `#(.` list offers `Param` **only**.
|
||
The popup and `instantiation_plan` are now pinned against each other,
|
||
and hover says "localparam" where it used to say "parameter" over a
|
||
`localparam` declaration. QA finding 2 (a cold cross-directory request
|
||
answering empty before the scope ladder widened) is documented as
|
||
`index-scope`'s ladder, with one change: an empty member answer is now
|
||
always `isIncomplete`, so the client comes back instead of caching the
|
||
emptiness.
|
||
|
||
## 19. Escaped identifiers wave (2026-09-02) — owner report
|
||
|
||
`wire \my-signal ;` was rejected outright: *verification failed: token
|
||
stream diverges … input has identifier `\my-signal` … output has
|
||
identifier `\my-signal;`*. An escaped identifier ends at the next
|
||
whitespace and at nothing else (IEEE 1800-2017 §5.6.1); the lexer stops
|
||
the token before that whitespace (correct), and the formatter then
|
||
printed every name bare, so the following `;`, `(`, `,` or `:` was
|
||
swallowed into the name on re-lex. Nothing was ever corrupted — the
|
||
safety net refused the file — but no design carrying an escaped
|
||
identifier could be formatted at all, which is every Vivado netlist
|
||
(`\u_x/y_reg[3] `, `\gen[0].u `). Zero formatter or lexer tests
|
||
existed with an escaped identifier. Single lane; `verify.rs` untouched
|
||
(invariant 4). Files: crates/vlog_formatter/src/format.rs,
|
||
crates/vlog_formatter/tests/cases/escaped_identifiers.cases (new),
|
||
crates/vlog_formatter/tests/verification.rs,
|
||
crates/vlog_parser/src/lexer.rs (tests only),
|
||
docs/features/escaped-identifiers/README.md (new), TODO.md §19.
|
||
|
||
- [x] **One choke point**: `format::named(&str) -> String` (plus
|
||
`name_doc`, its `Doc` twin) appends the terminating space when the
|
||
string ends inside an escaped name; every name emission in
|
||
`format.rs` — 50 sites, declarators through end labels, including
|
||
each `format!` splice, `join_names` and `join_paths` — goes
|
||
through it. The audit list lives in the helper's doc comment. The
|
||
predicate is `ends_escaped`, not `starts_with('\')`, because
|
||
several names arrive as already-joined composites (`a.\b`,
|
||
`pkg::\x`, a `bind` head) — the same rule
|
||
`vlog_refactor::instantiate` already carries.
|
||
- [x] **End of line**: the helper always writes the space; the
|
||
printer's existing trailing-space trim (`newline`, `BlankLine`,
|
||
`render` at EOF) removes it before a break, which terminates the
|
||
name by itself. No `printer.rs` / `doc.rs` change. Both shapes
|
||
pinned idempotent.
|
||
- [x] **Attack pairs** in `tests/verification.rs`, `verify.rs`
|
||
untouched: `\a;` glued, the space before a connection's `(`
|
||
dropped, two escaped names merged (`\a \b` → `\a\b`), the same
|
||
glue inside a class body, a label glued to what follows it — all
|
||
rejected; plus the flip side, that writing the space is a
|
||
whitespace-only difference.
|
||
- [x] **Cases**: `escaped_identifiers.cases`, 18 live cases —
|
||
declarators, ANSI/non-ANSI ports, package/interface/class/module
|
||
names with end labels, typedefs, enum members, struct fields,
|
||
instances and connections, hierarchical and scoped expressions,
|
||
generate/block/fork/statement labels, `disable`, `foreach`,
|
||
modport, clocking, imports, `let`, `defparam`, case labels, an
|
||
aligned group, a broken connection list, an out-of-class method,
|
||
a Vivado-style netlist fragment, and an escaped type name inside an
|
||
aligned port group.
|
||
- [x] **Lexer pin**: the token extent excludes the terminating
|
||
whitespace (`src[span] == text`), a tab terminates, `\a;` is one
|
||
identifier, and a name may end the file.
|
||
- [x] **Corpus**: 813/820 held, and neutral by construction — every
|
||
backslash in the 860 corpus files is inside a string literal or a
|
||
comment, so no corpus file reaches the new branch. Same for the
|
||
read-only opentitan sweep (13 failures, all parse/lex, zero
|
||
verification errors).
|
||
- [x] **Follow-up for a parser lane**: `Parser::parse_scoped_name`
|
||
joins `pkg::name` into one `String`, losing the boundary, so a
|
||
`\my-pkg ::\state-t` type (or instantiated module, or `bind`
|
||
target) is still rejected by the net — an error, never a
|
||
corruption. Keep the segments. Recorded as the file's one `#SKIP`
|
||
case and as
|
||
`an_escaped_name_in_a_scoped_type_is_rejected_rather_than_corrupted`.
|
||
**Delivered by escaped-identifiers** (2026-09-02): `push_scope_segment` keeps the terminating space, the `#SKIP` is gone, the verification pin is inverted (README, "How it was answered").
|
||
- [x] **QA (2026-09-02)**: gates clean (fmt, clippy 0, tests 2819/0 after
|
||
one QA-added attack pair, corpus 813/820 unchanged); scope matches
|
||
the file list above exactly, `verify.rs` confirmed absent from the
|
||
diff; 23 additional corruption-hunt shapes beyond the `.cases` file
|
||
(punctuation after a name, adjacent names, EOF, comments, `` `define
|
||
``/macro args, `bind`, `defparam`, `import`, struct/enum members,
|
||
implicit connections, instance arrays, hierarchical paths, CRLF) all
|
||
formatted correctly and idempotently, with the one rejection being
|
||
exactly the filed scoped-name gap; added
|
||
`a_space_dropped_before_a_scope_operator_is_rejected` to
|
||
`verification.rs` to close a gap in the attack-pair coverage
|
||
(dropped space before `::`, confirmed rejected); opentitan `--check
|
||
--no-cache` failure/would-reformat/unchanged sets byte-identical
|
||
between this worktree and a trunk `v0.25.0` build (3869/97/13, same
|
||
13 files); opentitan `git status` unchanged (3 pre-existing owner
|
||
files only). **QA verdict: SHIP.** Full log in the feature README's
|
||
QA log.
|
||
## 20. Constraint bodies wave (2026-09-02) — coverage_gaps C1, round 1
|
||
|
||
Constraints (`constraint c { … }`, `constraint C::c { … }`,
|
||
`randomize() with { … }`) are opaque verbatim: no name span (the
|
||
parsed name is discarded, parser.rs:1895), nothing inside binds, so a
|
||
rename of a class property leaves `constraint c { user_id < 5; }`
|
||
untouched with only a generic "cannot attribute" warning — and none
|
||
at all when the file got no other edits. Covergroups are round 2.
|
||
Design: `ItemKind::Constraint { scope, name, name_span, body }` with
|
||
`ConstraintBody::{Items(Vec<ConstraintItem>), Verbatim(RawText)}` —
|
||
the structured parse is attempted first and a body that does not fit
|
||
the grammar REWINDS to today's verbatim capture (tolerant by
|
||
construction; the opentitan sweep must not move); `ConstraintItem::{
|
||
Expr { soft, expr }, Dist, Implication { cond, block }, IfElse,
|
||
Foreach { var(s), array, block }, SolveBefore, Unique, DisableSoft }`
|
||
with `ExprKind::Dist { expr, weights }` added to the expression
|
||
parser (`dist`, `:=`, `:/`); `WithConstraint.block` gains the same
|
||
body type. Formatter: canonical layout (one constraint item per line,
|
||
nested blocks indented, `dist` weight lists broken like connection
|
||
lists) — the classes README's "no layout convention worth inventing"
|
||
is superseded by ruff-style canonical layout now that the bodies are
|
||
navigable; `verify.rs` untouched, the existing constraint attack pairs
|
||
re-derived for the new layout plus new ones (dropped `soft`, swapped
|
||
`:=`/`:/`, reordered solve-before). Binder: constraint name is a
|
||
`SymbolKind::Constraint` in the class (or a stand-in scope for the
|
||
out-of-class form, as class-member-access did for methods); every
|
||
identifier inside binds lexically in the class scope (`this.`
|
||
implicit), `foreach` loop vars declare in a constraint-local scope;
|
||
so rename/references/hover reach inside. Linter: `visit.rs` descends;
|
||
`signals.rs` stops routing constraints to `opaque_spans`. Blast
|
||
radius: format.rs, bind.rs, spans.rs arms + visit.rs real arm.
|
||
Files: crates/vlog_parser/src/{ast.rs, parser.rs, token.rs (dist/
|
||
soft/solve/before keywords — grammar lock: editors/vscode/syntaxes
|
||
+ tests/grammar.rs)}, crates/vlog_parser/tests/spans.rs,
|
||
crates/vlog_formatter/src/format.rs, crates/vlog_formatter/tests/
|
||
cases/constraints.cases (new) + classes.cases/out_of_class_
|
||
constraints.cases rewrites, crates/vlog_formatter/tests/
|
||
verification.rs, crates/vlog_semantic/src/{bind.rs, model.rs,
|
||
workspace.rs (export), facts.rs (FACTS_FORMAT 9 → 10)},
|
||
crates/vlog_semantic/tests/*, crates/vlog_linter/src/{visit.rs,
|
||
signals.rs}, crates/lucisv_server compile-fix arms + e2e, docs/
|
||
features/constraint-bodies/README.md (new), amendments in classes /
|
||
out-of-class-constraints / dv-statements / class-semantics READMEs,
|
||
TODO.md §20. Runs AFTER §19 (both touch format.rs/verification.rs).
|
||
- [x] parser + fallback · [x] formatter layout + attack pairs ·
|
||
[x] binder + facts · [x] linter descent · [x] pins incl. rename of
|
||
a property used in a constraint (in-file, cross-file) ·
|
||
[x] QA on opentitan DV (read-only): sweep unchanged at 11, constraint
|
||
bodies in hw/dv/sv sequence items format canonically and round-trip,
|
||
rename of a rand field rewrites its constraint uses, hover inside a
|
||
constraint.
|
||
QA, 2026-09-02: verdict **REWORK**. Gates green (41 binaries, 2,944
|
||
passed incl. 2 new attack pairs), corpus 813/820, opentitan 48 DV
|
||
files / 16 IPs read-only-swept — 48/48 idempotent, comment streams
|
||
byte-identical input↔output, checkout untouched. Fallback exactness
|
||
confirmed on a real file (`aes_message_item.sv`). Semantics/linter
|
||
tests read and green. Finding: a comment placed immediately after
|
||
`soft`, `dist`, `disable soft`, or around `solve`/`before` — the
|
||
round's own four text-matched keywords — is dropped from the AST;
|
||
`format_source`'s safety net catches it every time (file refused,
|
||
never corrupted; not a widened-forgiveness bug) but the file cannot
|
||
be formatted at all, a regression from v0.26.0's verbatim capture.
|
||
`Implication`/`If` got explicit comment fields for their own new
|
||
joints (`->`, `else`); these four did not. Full repros and the fix
|
||
direction in the feature README's QA log. Closed a checklist-flagged
|
||
gap in `verify.rs`'s attack pairs (dist weight reordered, `soft`
|
||
moved to another item) with two new tests, confirmed failing before
|
||
and passing after.
|
||
Dev, 2026-09-02: `ItemKind::Constraint` + `ExprKind::Dist`, structured
|
||
body with an exact rewind-to-verbatim fallback; canonical layout;
|
||
`SymbolKind::Constraint` / `ScopeKind::Constraint`, out-of-class
|
||
stand-in scope, `randomize() with` bound against the randomized
|
||
object (`Target::InlineConstraint`); `FACTS_FORMAT` 10 → 11 (not 9 →
|
||
10 — member-completion had already taken 10). Four words are matched
|
||
by **text**, not reserved, so `token.rs`, `pairs.rs` and the editor
|
||
grammar are untouched — argument in the feature README. OpenTitan
|
||
`hw` (3,975 files, read-only `--check`): failure set **unchanged**,
|
||
1,993 of 2,009 constraint declarations parse structured (16 fall
|
||
back: 10 macro-item bodies, 6 non-LRM shapes), 13 of ~122 `with`
|
||
blocks fall back (mostly `local::`). Corpus gate 813/820, 0
|
||
verification errors; 37 of 860 corpus files change layout, all
|
||
verified.
|
||
Dev rework, 2026-09-02 (QA HIGH: a comment after any text-matched word
|
||
was dropped, so `format_source` refused the file). Fixed by giving
|
||
every keyword and punctuation position this round introduced a named
|
||
comment field — 14 of them — plus two rules that keep one owner per
|
||
gap (`ConstraintItemKind::takes_semi`, `Parser::gap_before`). Found
|
||
and re-verified with an exhaustive gap fuzzer (insert a comment into
|
||
every inter-token gap of 15 fixtures = 358 gaps) diffed against a
|
||
v0.26.0 worktree run over the *same* constructs written outside a
|
||
constraint: **96 regressions → 40**, and all 40 remaining are in five
|
||
shared functions (`take_member_prefix`, `parse_method_name`,
|
||
`parse_foreach_target`, index expressions, `inside`/value ranges) that
|
||
fail identically on v0.26.0 — filed, not fixed. All six QA repros plus
|
||
56 unnamed slots fixed. Parse of comment-free source unchanged:
|
||
opentitan counts and the 1,105 tolerant diagnostics are identical to
|
||
v0.26.0, failure set still 12.
|
||
QA re-verification, 2026-09-02: verdict **SHIP**. Gates green (41
|
||
binaries, 2,950 passed, 0 failed — matches dev exactly), corpus
|
||
813/820. All six original repros now format, are idempotent, and
|
||
round-trip comments byte-for-byte. Independently re-derived the
|
||
fuzzer claim on 3 fresh fixtures (dist-heavy, nested if/else-if/
|
||
foreach, out-of-class `pkg::cls::c`): 150 gaps, 36 failing, all 36
|
||
classified by testing the equivalent non-constraint construct on a
|
||
v0.26.0 worktree — 21/21 also fail on v0.26.0, so **zero new
|
||
findings, zero constraint-bodies-specific regressions** (four of the
|
||
nine failure shapes weren't in the dev's five-row table — class/
|
||
package header names, a bare `rand`/`int` gap, an array-dimension
|
||
declarator — but each reproduces on a plain declaration with no
|
||
constraint at all). Opentitan: 48/48 files re-swept idempotent with
|
||
identical comment streams; `--check` over the full tree now shows 13
|
||
failures (not 12) but the set is byte-identical between this build
|
||
and a fresh v0.26.0 build on the same checkout — the drift is the
|
||
owner's `ast.sv` edits evolving between QA passes, not a regression;
|
||
checkout confirmed untouched otherwise. `verify.rs` still untouched;
|
||
both QA-added attack pairs still present and green. Full tables in
|
||
the feature README's QA log.
|
||
|
||
## 21. Covergroup bodies wave — §20 round 2 (planned 2026-09-02)
|
||
|
||
`covergroup … endgroup` is still a flat token scan into
|
||
`ItemKind::Verbatim` (parser.rs `parse_covergroup`: header, `with
|
||
function sample(...)`, coverpoints, bins, crosses, options and the
|
||
`endgroup : g` label all inside `RawText`); no name span, nothing
|
||
inside binds, so a `rand` field's rename leaves `coverpoint addr`
|
||
untouched and coverpoint names are unreachable. Same shape as §20:
|
||
structured attempt with the `Rewind`-to-verbatim fallback (character-
|
||
for-character v0.26.0 capture), no keywords reserved (`coverpoint`,
|
||
`bins`, `cross`, `binsof`, `intersect`, `wildcard`, `ignore_bins`,
|
||
`illegal_bins`, `option`, `type_option` matched by text), canonical
|
||
layout with the attack pairs re-derived, and a binder that declares
|
||
`SymbolKind::Covergroup` + `Coverpoint`/`Cross`/`Bin`(?) symbols and
|
||
binds every sampled expression to the class scope. Files: the §20 set
|
||
minus nothing (ast/parser/spans, format.rs + cases, verification.rs,
|
||
bind/model/workspace/facts (FACTS 11 → 12), linter visit/signals,
|
||
server kind arms, e2e), docs/features/covergroup-bodies/README.md.
|
||
- [x] AST: `ItemKind::Covergroup(CovergroupDecl { name, args, sample:
|
||
Option<SampleFn>, event: Option<SensList>, items:
|
||
Vec<CoverItem>, end_label })`; `CoverItem::{ Coverpoint { label,
|
||
expr, iff, bins: Option<Vec<BinDecl>> }, Cross { label, items,
|
||
iff, body }, Option { path, value }, Directive, Empty }`;
|
||
`BinDecl { kind: bins|ignore_bins|illegal_bins, wildcard, name,
|
||
array: Option<Dim>, spec: BinSpec::{ Values(Vec<Expr>),
|
||
Transitions(Vec<Trans>), Default, DefaultSequence, With(Expr),
|
||
Binsof(Expr) }, iff }`.
|
||
- [x] Parser with rewind fallback; `constraint_fallbacks` becomes a
|
||
per-construct census.
|
||
- [x] Layout: `covergroup g @(posedge clk);` header (`with function
|
||
sample(...)` on the header), one cover item per line, `{ }` bin
|
||
bodies like constraint sets, `endgroup : g` at the header column.
|
||
- [x] Binder: `Covergroup` in the enclosing class/module scope with a
|
||
child scope holding `Coverpoint`/`Cross` symbols (so `cg.cp` and
|
||
`cross a, b` bind); sampled expressions bind lexically; the
|
||
`sample()` args declare TfArg-like symbols visible in the body.
|
||
- [x] Pins mirroring §20's (rename of a sampled field, comments in
|
||
every slot, `binsof … intersect`, transition bins `(a => b)`,
|
||
`default sequence`, `with (item % 2)`, wildcard bins, option
|
||
assignments, `iff`, macro-body and non-LRM fallbacks byte-exact).
|
||
- [x] QA on opentitan DV (read-only): every `covergroup` under hw/dv
|
||
and hw/ip/*/dv (the fpv/cov files) round-trips idempotently
|
||
with comments preserved; sweep unchanged; structured-vs-fallback
|
||
census; rename of a coverpoint operand.
|
||
|
||
**Dev, 2026-09-02.** Done, `docs/features/covergroup-bodies/README.md`.
|
||
`ItemKind::Covergroup` with the `Rewind`-to-verbatim fallback; ten words
|
||
matched by text and `token.rs` untouched; canonical layout; `FACTS_FORMAT`
|
||
11 → 12 with `SymbolKind::Covergroup`/`Coverpoint`/`Cross` and
|
||
`ScopeKind::Covergroup`; `covergroup` left `on_type.rs`'s `OPAQUE`. The gap
|
||
fuzzer was written *first* this time and ships as a test (329 gaps, 52
|
||
failing, every one classified against a non-covergroup analogue that fails
|
||
too — `docs/topo.md` §2.9-22). OpenTitan `hw`: **544 covergroups structured,
|
||
0 fallbacks**, failure set and per-file tolerant diagnostics identical to
|
||
v0.27.0, 81 files re-laid-out and verified, 87 DV covergroup files idempotent.
|
||
Corpus 813/820, 0 verification errors, +1 139 references of which 1 135 are
|
||
answered. `verify.rs` untouched; twelve new attack pairs anyway.
|
||
|
||
**QA, 2026-09-02.** SHIP. All gates, the census (544/0 opentitan, 27/0
|
||
corpus) and the corpus resolution column reproduced exactly. Both shared-
|
||
machinery guards (`at_postfix_segment`'s `[*/[->/[=` refusal, `no_with`)
|
||
attacked directly and hold, including outside a covergroup and against a
|
||
pathological nested `with ... with` (correctly falls back rather than
|
||
mis-parsing). Independent fuzzer re-derivation on 3 fresh fixtures (340
|
||
gaps, 37 failing) found zero covergroup-bodies-specific regressions — all
|
||
nine failing shapes reproduce on v0.27.0. 87/87 DV files idempotent, 87/87
|
||
comment streams equal (the one apparent mismatch is a pre-existing,
|
||
non-covergroup block-comment reflow identical to v0.27.0). OpenTitan `hw`
|
||
full sweep and this repo's `corpus/` both reproduced (13/13 and 7/7 failure
|
||
sets byte-identical; 81 and 10 files re-laid-out, all covergroup-only).
|
||
Gap found and closed: a dropped bin-array `[]` marker had no attack pin —
|
||
added `a_dropped_bin_array_marker_is_rejected`. `cargo test --workspace`:
|
||
43 binaries, 3 010 passed, 0 failed.
|
||
|
||
|
||
## 22. Fragment mode + define continuation (2026-09-02) — coverage_gaps H4, corrected
|
||
|
||
Mapped: class-body and module-item `.svh` fragments ALREADY parse (the
|
||
file-scope item loop is the class-item loop). Three fragment shapes do
|
||
not — a **statement list**, an **enum-member list** (`CUSTOM_1,` —
|
||
riscv-dv's `riscv_custom_instr_enum.sv`, included between enum
|
||
members), a **covergroup-item list** — and all three fail at one site,
|
||
`parse_ident_item`'s "expected declaration or instantiation". Separately,
|
||
`cip_base_vseq__tl_errors.svh` is NOT a fragment problem: its `` `define``
|
||
formal-argument list spans lines 8–9 with no backslash, which tools
|
||
accept and lucisv's line-oriented directive lexing does not (lines
|
||
30–588 alone format today). The other opentitan residue is macro shapes
|
||
(4 files — preprocessing decision) and one unbalanced source. Single
|
||
lane. Files: crates/vlog_parser/src/{ast.rs, parser.rs, lexer.rs},
|
||
crates/vlog_parser/tests/spans.rs, crates/vlog_formatter/src/format.rs,
|
||
crates/vlog_formatter/tests/cases/fragments.cases (new),
|
||
crates/vlog_formatter/tests/verification.rs, crates/vlog_semantic/src/
|
||
bind.rs (+ facts only if a census changes), crates/vlog_linter/src/
|
||
visit.rs if an arm is needed, crates/lucisv_server compile-fix arms,
|
||
docs/features/fragment-mode/README.md (new), amendments in
|
||
docs/features/{define-table, lexer-cleanup, include-nav, error-recovery}
|
||
/README.md, docs/coverage_gaps.md (H4 correction), TODO.md §22.
|
||
|
||
- [x] **Fragment fallback**: when the FIRST file-scope item fails in
|
||
`parse_ident_item`, rewind and try, in order, a statement list,
|
||
an enum-member list, a covergroup-item list — each must consume
|
||
the whole file to EOF to win; `SourceFile::fragment:
|
||
Option<Fragment::{Statements(Vec<Stmt>), EnumMembers(…),
|
||
CoverItems(Vec<CoverItem>)}>` with `items` empty. A file that fits
|
||
none keeps today's single error node (no cascade). Strict mode
|
||
succeeds on a fragment (so `format_source` formats it). Existing
|
||
loops become shared helpers (`parse_enum_members`,
|
||
`parse_cover_items`, a statement-list helper) — one grammar, no
|
||
copies.
|
||
- [x] **Formatter**: a fragment prints at indent 0 through the existing
|
||
statement / enum-member / cover-item printers; idempotent;
|
||
`verify.rs` untouched; attack pairs (a dropped statement, a
|
||
reordered enum member, a dropped trailing comma).
|
||
- [x] **Binder**: statements bind in a file-level `Block` scope, enum
|
||
members declare `EnumVariant`s at file scope, cover items bind
|
||
their expressions; no index change unless the census needs it
|
||
(argue; FACTS stays 12 if nothing new is exported).
|
||
- [x] **Define continuation**: a `` `define NAME(`` whose formal
|
||
argument list is still open at end of line continues the
|
||
directive token until the `)` closes (balanced), no backslash
|
||
needed; the macro body still needs backslashes. `DefineTable`
|
||
records params as before. Pins in lexer.rs and define-table
|
||
tests; `cip_base_vseq__tl_errors.svh` formats.
|
||
- [x] **Pins**: each fragment shape formats and round-trips; a real
|
||
class-body fragment still formats (regression); garbage that fits
|
||
no shape → one error; a file that is a valid item list is never
|
||
re-read as a fragment; the riscv enum fragment verbatim; comments
|
||
in fragment slots; e2e: hover on an enum variant in a fragment
|
||
file; diagnostics on a fragment file = 0.
|
||
- [x] **QA on opentitan** (read-only; run by the dev and re-run by QA): sweep failures drop by exactly
|
||
the two files (enum fragment + tl_errors.svh); nothing else
|
||
moves; corpus `invalid-or-fragment` bucket 3 → 2; lint on the
|
||
fragment files no longer silent.
|
||
- [x] Correct `docs/coverage_gaps.md` H4 (dev). The clocking-wave README's
|
||
"class body with no class" line is still the lead's.
|
||
|
||
Done 2026-09-02 — `docs/features/fragment-mode/README.md`. Three deviations,
|
||
argued in that work log: the trigger is "the first structural item failed"
|
||
rather than the ident-item message (a keyword-initial statement fragment does
|
||
not produce that message); each shape gets a freshly-lexed token stream rather
|
||
than a `Rewind` (a `Rewind` does not restore the tokens' comment buckets); and
|
||
the shape order is cover items → enum members → statements, narrowest first,
|
||
because `cp: coverpoint a;` is a labelled declaration to the statement grammar.
|
||
QA verdict SHIP with one MEDIUM, fixed the same day: the `` `define`` formal-list
|
||
scan was quadratic on an *unclosed* list (20 000 lines took 2.5 s and grew with
|
||
the square), so it is now incremental — `DefineParams` carries the paren depth
|
||
and string/comment state across lines, with a `#[cfg(test)]` byte counter as
|
||
the structural pin and a 20 000-line wall-clock pin. 20 000 lines: 2.504 s →
|
||
556.8 µs, and linear thereafter.
|
||
|
||
Gates: fmt/clippy clean, `cargo test --workspace` 3 059 passed / 0 failed,
|
||
corpus 814/820 (`invalid-or-fragment` 3 → 2, baseline bumped to 814), opentitan
|
||
`--check` over `hw` 12 → 10 failures — exactly `riscv_custom_instr_enum.sv` and
|
||
`cip_base_vseq__tl_errors.svh`, nothing else moved, and the set is byte-identical
|
||
before and after the QA rework — and `smoke.js` OK.
|
||
|
||
**QA, 2026-09-02.** SHIP. All gates reproduced exactly (45 binaries, 3 054/0,
|
||
corpus 814/820, `invalid-or-fragment` 3 → 2 with `latch_map.v`/`testbench.v`
|
||
the two survivors). Detection hunted with 27 false-positive attacks
|
||
(directive/macro-then-item, only-includes, only-comments, empty, a leading
|
||
`typedef enum`, an unwrapped class body, garbage, an unbalanced `begin`, both
|
||
`UNIT_OPENERS` guards, the two documented "first construct is also an item"
|
||
limits, shape-priority edge cases around `option`/`type_option`/bare commas) —
|
||
zero misclassifications. Tolerant/strict parity re-attacked on 20 more shapes
|
||
(`foreach`/`fork`/`case`/timing/`for`/`while`/`repeat`/`wait`/`disable` and
|
||
more) — no second bug beside the dev's own `if/else` fix. Independent gap
|
||
fuzzer (fresh Python tokenizer, 3 fixtures, 86 gaps, 29 failing) found 9
|
||
positions not in the dev's table (a `case` label's `:`, all 8 internal
|
||
`for`-header positions) — all 9 reproduce identically on a v0.28.0 detached
|
||
build outside any fragment, zero fragment-specific regressions. Opentitan
|
||
sweep reproduced with the expected one-file live-checkout drift (13 → 11 here
|
||
vs. the dev's 12 → 10; same two files moved, same phenomenon
|
||
`constraint-bodies`/`covergroup-bodies` QA both logged); corpus lint
|
||
byte-identical before/after (7 934 lines); both fixed files idempotent with
|
||
identical comment streams; hover/diagnostics/outline e2e confirmed green.
|
||
Semantics: 8 fragment tests read, plus an independent `WorkspaceIndex`
|
||
`fingerprint`-equality check (`build` vs. `update_file`/`absorb`) over mixed
|
||
fragment files — no drift, no panic. One small fix applied directly:
|
||
`coverage_gaps.md`'s status table had this row's release column stale
|
||
("next"); corrected to `0.29.0`. **Finding, MEDIUM (performance, not
|
||
correctness):** `define_params_open` (`lexer.rs`) rescans the whole directive
|
||
from scratch on every line while a formal list stays open, making a
|
||
pathological *unclosed* `` `define`` list quadratic — 2 000 never-closing
|
||
parameter lines format in 0.10 s, 20 000 (10×) take 9.90 s (~100×). No
|
||
corruption (the runaway directive prints back byte-for-byte, confirmed
|
||
idempotent) and no hang in the literal sense, but a large real vendor file
|
||
with one dropped `)` could read as one. Not blocking; filed for a follow-up
|
||
(track paren/string/comment depth incrementally instead of re-deriving it).
|
||
|
||
Dev reply, same day (not a follow-up — done): `define_params_open` is now
|
||
`DefineParams`, an incremental scanner that carries the paren depth and the
|
||
in-string / in-comment state across lines and walks only the bytes added since
|
||
the last question. Reproduced first (31 ms at 2 000 lines, 2.504 s at 20 000 —
|
||
10× input for 81× time), then fixed and re-measured: 54.3 µs and 556.8 µs, with
|
||
200 000 lines at 6.08 ms — linear. Three pins, deliberately separated: an
|
||
equivalence test against a from-scratch reference kept in the test module over
|
||
14 directive shapes, a **structural** pin using a `#[cfg(test)]` byte counter
|
||
(it fails on a 42-byte fixture if the scan ever restarts — verified by
|
||
reintroducing the regression by hand), and a 20 000-line wall-clock bound
|
||
through `tokenize`. Workspace suite 3 059 passed / 0 failed; corpus, opentitan
|
||
set (byte-identical to QA's sweep) and `smoke.js` all unchanged. See the
|
||
`fragment-mode` README's work log.
|
||
|
||
## 23. Vendor & formal collateral grammar (planned 2026-09-02) — coverage_gaps M1–M3, L1/L2/L4/L5, corrected
|
||
|
||
Evidence correction: the analysis's "13 corpus `checker` files" are
|
||
UVM protocol-checker filenames/identifiers, not declarations. Measured
|
||
declarations of `specify`/`specparam`, `primitive`/`table`, `checker`,
|
||
`interface class`, `config`/`library`, `alias`, statement `expect`,
|
||
`tagged`: **0 in the corpus, 0 in opentitan hw**. The one live use is
|
||
`expect(...)` as a plain task call (40 sites) — so `expect` is matched
|
||
by text (on_type.rs already does), never reserved. Value is
|
||
completeness for vendored cell/IO/memory models and formal
|
||
collateral, not measured pain; scope is kept to opaque leaves except
|
||
where a real node is one arm. Files: crates/vlog_parser/src/{token.rs
|
||
(+`checker`, `endchecker`, `config`, `endconfig`, `library` — measured
|
||
0 code-shaped collisions), parser.rs, ast.rs (StructType.tagged;
|
||
ItemKind::Alias)}, editors/vscode/syntaxes/systemverilog.tmLanguage.json
|
||
(the hand-edited alternation — tests/grammar.rs names any drift),
|
||
crates/lucisv_server/src/{pairs.rs (+3 RULES rows: checker, config,
|
||
table), on_type.rs (OPAQUE + specify/primitive/checker/config)},
|
||
crates/vlog_formatter/src/format.rs (Alias, tagged), tests/cases/
|
||
vendor_formal.cases (new), verification.rs, crates/vlog_semantic/src/
|
||
{bind.rs (checker/primitive names as instantiable symbols — argue),
|
||
classes.rs (interface class collected), model.rs if a kind is added},
|
||
crates/lucisv_server/src/type_hierarchy.rs (`implements` supertypes),
|
||
docs/features/vendor-formal-grammar/README.md (new), amendments in
|
||
interfaces / type-hierarchy / editor-scopes / corpus-check READMEs,
|
||
docs/coverage_gaps.md (M2 evidence corrected), TODO.md §23.
|
||
|
||
- [x] Opaque scans via one `parse_opaque_block(open, close)` (the
|
||
`parse_covergroup_verbatim` template): `specify…endspecify`,
|
||
`primitive…endprimitive` (swallows `table…endtable`),
|
||
`checker…endchecker`, `config…endconfig`; `SYNC_CLOSERS` gains
|
||
their closers; `specparam` outside specify as a param-like item.
|
||
- [x] `interface class … endclass` routed to `parse_class` with a kind
|
||
marker; `ClassDecl.implements` already parsed — type hierarchy
|
||
adds `implements` to `supertypes` (the two blocking pins flip);
|
||
classes.rs collects it; `SymbolKind::Class` with an
|
||
interface-class flag or a new kind (argue; FACTS bump if new).
|
||
- [x] `alias a = b = c;` as `ItemKind::Alias(Vec<Expr>)`; statement
|
||
`expect (…) action;` text-matched into the concurrent-assertion
|
||
verbatim path; `union tagged` flag on StructType (formatted);
|
||
`tagged Valid 5` / `case … matches` left filed (pattern grammar).
|
||
- [x] Pins: each construct formats + round-trips (opaque byte-exact),
|
||
pairs/folding for the new pairs, grammar lock green, `expect(x);`
|
||
as a task call unchanged (the 40-site regression guard), a
|
||
module named `checker_x` unaffected; corpus 813/820 unchanged;
|
||
opentitan sweep unchanged.
|
||
- [x] **QA (2026-09-02)**: verdict **SHIP**. Gates reproduced exactly
|
||
(fmt/clippy clean, tests 3 092/0/39, grammar lock green, corpus
|
||
814/820, release build + smoke.js OK, `verify.rs` untouched).
|
||
Census re-derived independently (0/0/0 for
|
||
config/library/checker across corpus + opentitan hw). Keyword-
|
||
boundary, `expect`-disambiguation, opaque-block and
|
||
unclosed-block attacks all landed as documented; gap-parity pin
|
||
reproduced directly against `defparam`. Regression net
|
||
(spiflash_tb.v, otbn tb.sv, rom_ctrl scoreboard) and a 30-file
|
||
opentitan sample byte-identical against a trunk `c40e720` build;
|
||
opentitan tree held only its 3 pre-existing owner files. One
|
||
informational, non-blocking finding (pre-existing, confirmed on
|
||
trunk too): an unquoted library wildcard path containing `/*`
|
||
lexes as an unterminated block comment. Full log in the feature
|
||
README's QA log.
|
||
|
||
## 24. Semantic lints on by default (planned 2026-09-02) — coverage_gaps M7 via topo §2.9-6 + §2.9-4
|
||
|
||
Mapped: `unused-signal`/`undriven-net`/`multiply-driven` ship off because
|
||
a per-file analysis cannot see a signal read or driven from another
|
||
file's hierarchy; `LintContext` has no workspace handle at all; the
|
||
server has NO rule-selection surface (`lucisv.lint.*` absent, no `lint`
|
||
key in lucisv.toml — §2.9-4), so on-by-default without an off switch
|
||
is hostile; the CLI has no index. The index's `files_spelling` is
|
||
name-only and misses hierarchy-root heads (`top.x` where `top` is not a
|
||
local instance) and `bind` connections (§2.9-15); the server's
|
||
`Candidates::per_file` word table is the textual census that catches
|
||
everything but lives server-side only. Design: (1) **a per-file
|
||
identifier census in `FileFacts`** (`words`: sorted, dedup'd `Ident`
|
||
tokens incl. macro/directive words — the same harvest as
|
||
`candidates::words_in`, lifted into `vlog_semantic` so there is one
|
||
harvest) with `WorkspaceIndex::files_mentioning(name)`; this closes
|
||
§2.9-6, gives §2.9-18's macro-argument census for free, and lets the
|
||
server build its completion word table from facts instead of re-lexing
|
||
at startup (TODO §10's deferred item). `FACTS_FORMAT` 12 → 13; store
|
||
delta measured and ruled. (2) **`LintContext` gains a `MentionOracle`**
|
||
trait (`mentioned_elsewhere(name) -> bool`); the server implements it
|
||
over `files_mentioning` minus the current file; the CLI implements it
|
||
over the job set (harvest words in the existing par_iter, then lint) —
|
||
a single-file/stdin CLI run has no oracle. `unused-signal` and
|
||
`undriven-net` say nothing when the oracle says yes (the
|
||
false-negative-safe direction the in-file mention guard already takes).
|
||
(3) **Default flip**: the three rules `default_on() == true` WHEN an
|
||
oracle is present; without one (single-file CLI) they stay off —
|
||
document the asymmetry. (4) **The off switch**: `[lint] select = […]`
|
||
/ `ignore = […]` in lucisv.toml (§2.9-4, CLI > config precedence) and
|
||
`lucisv.lint.select/ignore` settings (package.json), both through the
|
||
one settings parser; per-rule config left for later. Files: crates/
|
||
vlog_semantic/src/{facts.rs, workspace.rs, lib.rs, candidates harvest},
|
||
crates/vlog_linter/src/{context.rs, registry.rs, rules/{unused_signal,
|
||
undriven_net,multiply_driven}.rs, rule_docs.rs} + .lint cases,
|
||
crates/lucisv/src/{lint.rs, main.rs, args.rs}, crates/lucisv_core/src/
|
||
config.rs, crates/lucisv_server/src/{lint.rs, diagnostics.rs,
|
||
settings.rs, candidates.rs (words from facts)}, editors/vscode/
|
||
package.json, docs/features/semantic-lints-on/README.md (new),
|
||
amendments in semantic-lints / linter-core / index-persistence /
|
||
completion-core READMEs, docs/site rules.md regenerated, TODO.md §24.
|
||
- [x] words census + `files_mentioning` + FACTS 13 + store delta
|
||
→ `vlog_semantic::words` (the one harvest, lifted out of
|
||
`lucisv_server::candidates`), `FileFacts::words`,
|
||
`WorkspaceIndex::{files_mentioning, mentioned_outside}`. No inverted
|
||
index: a linear walk over the per-file sorted lists, `files_spelling`'s
|
||
own shape, argued in the feature README. The harvest splits macro
|
||
invocations, directive lines and attributes into their words (QA
|
||
finding, fixed the same day — the lexer hands each over as one token,
|
||
so a signal a testbench names only inside `` `uvm_info(...) `` was not
|
||
in the census); a quoted run inside such a token is a value and is
|
||
skipped. Store delta **+16.9 %** on the corpus and **+15.0 %** on
|
||
opentitan, both measured. This also delivers §2.9-18's macro-argument
|
||
census as a substrate — rename can read `files_mentioning`; not wired
|
||
here.
|
||
- [x] `MentionOracle` in LintContext; server + CLI implementations
|
||
→ the server asks the index minus the buffer's own `FileId`; the CLI
|
||
builds a census in a parallel pre-pass over the job list and subtracts
|
||
each file's own harvest. A single-file or stdin run has no oracle.
|
||
- [x] rules consult the oracle; default flip conditional on an oracle
|
||
→ `Rule::needs_workspace()` + `workspace_rules()` beside an unchanged
|
||
`default_rules()`. `unused-signal`/`undriven-net` consult the oracle;
|
||
`multiply-driven` cannot be wrong about a cross-file use and does not,
|
||
but shares the default gate (argued).
|
||
- [x] `[lint]` config key + `lucisv.lint.*` settings + precedence pins
|
||
→ `lucisv.toml`'s first table, per file, CLI-over-config key by key;
|
||
`lucisv.lint.select`/`ignore` + `package.json`, with a republish (no
|
||
rescan) when the selection changes mid-session. `[lint.<rule>]` is
|
||
still open and is now named in the parser's error rather than ignored.
|
||
- [x] completion word table from facts (startup re-lex retired) — argue
|
||
or file if it does not fall out
|
||
→ retired. Two alternated A/B pairs on one machine, one line changed:
|
||
a 667-file scan went 652.5 → 471.8 ms and 857.1 → 593.1 ms (−28 %,
|
||
−31 %). TODO §10's deferred item. The completion table is the census
|
||
minus one thing — a name the workspace `` `define``s, which the macro
|
||
tier owns and offers by prefix only — filtered at the reader, not at
|
||
the harvest, so `fuzzy-completion`'s ruling survives unedited.
|
||
- [x] Pins: the QA two-file FP fixture from semantic-lints (README
|
||
:500-541) no longer fires; corpus census before/after (the
|
||
picorv32 debug-tap cluster should vanish where a testbench file
|
||
reads them); selection precedence; every existing .lint case
|
||
unchanged under `#select`
|
||
→ all four. Corpus: `unused-signal` 52 → 44, `undriven-net` 3 → 0,
|
||
`multiply-driven` 0 → 0, **nothing added**; all eight silencings
|
||
hand-checked and every one a whole-word false negative. picorv32's 33
|
||
debug taps stay (the corpus holds no testbench for them, verified by
|
||
grep) and go to 31 the moment a testbench reads `uut.dbg_reg_x1`/`x2`.
|
||
A new `#workspace` header in the `.lint` harness carries the on-by-
|
||
default and silencing cases; the 163 existing cases are untouched. The
|
||
macro-argument shape is pinned end to end
|
||
(`a_signal_named_only_inside_a_macro_argument_is_not_reported_unused`),
|
||
together with its inverse: a `"probe=%b"` format string does not
|
||
silence a signal called `probe` in another file.
|
||
- [x] QA on opentitan (read-only): `lucisv check` over hw with the
|
||
rules on — opentitan is lint-clean under its own tools, so every
|
||
finding is a suspect FP: hand-verify a sample of ≥30, report the
|
||
FP rate by mode; server diagnostics on 10 RTL files; settings
|
||
round trip over the wire; store/scan deltas.
|
||
→ dev's census over `hw` (3 947 files): `unused-signal` 10 in 6 files,
|
||
`undriven-net` 4 in 2 files, `multiply-driven` 0. Fourteen findings is
|
||
the whole sample there is; three were read against source and all three
|
||
are true (`i3c_dat.sv:134`, `sha3pad.sv:776`, and `mm_ram.sv:124`, a
|
||
real dangling signal read at lines 476/480 and assigned nowhere). QA
|
||
owns the remaining eleven.
|
||
→ **QA, 2026-09-02**: re-ran `lucisv check --select unused-signal,
|
||
undriven-net,multiply-driven hw` independently — same 14 findings, 0
|
||
files failed to check bar the one pre-existing `.tpl.sv` lex error. All
|
||
14 hand-verified TRUE (0% FP rate), the dev's three included: every
|
||
declared name was grepped whole-word across the *entire* opentitan repo
|
||
(not just `hw`), not just the census's own file set. 20 DV files under
|
||
`hw/dv/sv` with `rand` fields read only in constraints/covergroups/
|
||
`with` blocks (`--select unused-signal,undriven-net`): **0 findings**.
|
||
Full report and the oracle-attack table in
|
||
`docs/features/semantic-lints-on/README.md`'s QA log — one real finding
|
||
there: the census does not see an identifier used only as a macro
|
||
invocation's argument (`` `uvm_info(id, dut.sig) ``-shaped), which
|
||
contradicts this feature's own Assumptions section (\"a VPI probe named
|
||
in a macro argument\" is claimed as covered but is not); did not
|
||
manifest in any of the 14 opentitan findings or the corpus run.
|
||
## 25. Small-correctness residue (planned 2026-09-02) — §2.9-22, H5, M11, §2.9-20, §2.9-21
|
||
|
||
Mapped: comment "loss" is re-attachment — `bump` queues every comment
|
||
and `take_meta` hands it to the NEXT node, so a slot with no field
|
||
prints the comment one node later and the safety net (which compares
|
||
comments too) refuses the file. Six fix families cover every filed
|
||
slot: **G1** postfix segments (`.`/`::`/`[` branches of
|
||
`parse_postfix_inner` — three bare `bump()`s beside a `(` branch that
|
||
already keeps `CallComments`; `parse_foreach_target_inner` is a
|
||
hand-copied duplicate of the same loop) → one `SegmentComments
|
||
{before_open, after_open, before_close}` on Member/Scope/Index/Range
|
||
and one shared loop; **G2** the `[a:b]` range grammar written three
|
||
times (`parse_value_range`, the inlined `inside` copy, `parse_dims`)
|
||
→ one function with `RangeComments`, and `ExprKind::Inside` gets the
|
||
`BinaryComments` its operator peers carry; **G3** `keyword (` headers
|
||
(statement `if`/`case`/`foreach`, `@`, `#`) → the existing boxed
|
||
`HeaderComments`; **G4** the gap before a statement's `;` →
|
||
`Stmt.before_semi` + `StmtKind::takes_semi()` (constraint-bodies'
|
||
"one owner of the `;`", widest blast radius); **G5** segment-preserving
|
||
scoped names (`parse_scoped_name` joins a `String`) → `Vec<Name>` with
|
||
per-`::` comments — closes §2.9-21 too (the escaped segment's space);
|
||
**G6** per-construct fields: enum member `=`, sens-item edge keyword,
|
||
`take_member_prefix`, `parse_label`, class/module header gaps,
|
||
`parse_tf_ports` (the bulk of the covergroup count, 38 of 52). Plus
|
||
three small fixes: **H5** `nav::definition` gains the macro branch hover
|
||
already has (`DefineTable::latest` / `WorkspaceIndex::find_define`
|
||
return file+`name_span`; the include-graph narrowing is factored);
|
||
**M11** the cast's type binds (`bind_expr`'s `Cast { expr, .. }` drops
|
||
`ty`; a `bind_type_expr` mirroring `bind_data_type`'s three shapes —
|
||
type_def.rs's own doc claim about casts becomes true); **§2.9-20** the
|
||
rename warning for a candidate reference that stayed
|
||
`StillUnresolved` through the overlay ("`sig` after `.` could not be
|
||
resolved — module `unknown_mod` not indexed"), `unaccounted_warnings`
|
||
run over all files that mention the name (as `macro_use_warnings`
|
||
does), the premise pin inverted in the same commit. Files:
|
||
crates/vlog_parser/src/{ast.rs, parser.rs}, tests/spans.rs,
|
||
crates/vlog_formatter/src/format.rs, tests/verification.rs (drive
|
||
`EXPECTED_FAILING_GAPS` and `EXPECTED_FAILING_FRAGMENT_GAPS` to 0, delete
|
||
the two analogue tests in the same commit, commit the constraint
|
||
fuzzer that was never committed), cases/comment_slots.cases (new),
|
||
crates/vlog_semantic/src/bind.rs (+ tests), crates/lucisv_server/src/
|
||
{nav.rs, hover.rs shared narrowing, type_def.rs test}, tests/e2e.rs,
|
||
crates/vlog_refactor/src/rename.rs + tests/rename.rs, docs/features/
|
||
comment-slots/README.md (new), amendments in escaped-identifiers /
|
||
overlay-promotion / type-definition / refactor-rename / the three
|
||
fuzzer READMEs, docs/topo.md rows 20/21/22 struck (lead), TODO §25.
|
||
Runs AFTER §23 (parser/format/bind collide), in parallel with §24.
|
||
- [x] G1 · [x] G2 · [x] G3 · [x] G4 · [x] G5 (+§2.9-21) · [x] G6
|
||
- [x] fuzzers to zero (covergroup 329, fragment 153, constraint 395,
|
||
RTL 352 — all 0 failing); both analogue tests deleted; constraint
|
||
fuzzer committed; RTL fuzzer added; corpus 814/820 unchanged and
|
||
byte-identical over all 860 files; opentitan sweep unchanged
|
||
(3 975 files, 0 output differences, the same 10 failures)
|
||
- [x] H5 define definition (in-file + cross-file + include-narrowed +
|
||
a define inside a fragment file; unit + e2e)
|
||
- [x] M11 cast type reference (`bind_type_expr`; semantic, typeDefinition
|
||
and rename pins; `FACTS_FORMAT` 13 → 14)
|
||
- [x] §2.9-20 rename warning + pin inverted
|
||
- [x] QA: fuzz 5 fresh fixtures to zero failures; comment-stream
|
||
equality over 48 opentitan DV files + 20 RTL files; rename of a
|
||
typedef used in casts; `define` definition on opentitan macros
|
||
(`uvm_*` absent → nothing, project macros → the define site).
|
||
|
||
## 26. Bind, macro spacing, and the instantiate command (planned 2026-09-02) — M4/M5/M6 corrected, §2.9-15, §2.9-19
|
||
|
||
Evidence correction (list-robustness map): **M4** was closed at item and
|
||
statement position by item-misc (2026-08-20; `at_spaced_macro_call`);
|
||
the 21 opentitan files with `` `uvm_field_int (x, y) `` all format. The
|
||
residue is expression/list position (`assign x = \`WIDTH (a + b);`, a
|
||
parameter override `` `MACRO (1) ``, an ordered connection): the file
|
||
PARSES as a call, the formatter tightens the space, and the safety net
|
||
refuses — a formatter fix (preserve the author's gap between a macro
|
||
identifier and its `(`), not a lexer one. **M5**'s headline shape
|
||
(`.a(` ⏎ `` `ifdef `` ⏎ … ⏎ `)`) has been captured verbatim since
|
||
directive-in-statements — 53 opentitan files carry it, 0 failures — the
|
||
cost is that the whole instantiation becomes opaque bytes (no
|
||
instantiation edge, no connection references, no lens/hierarchy site);
|
||
still hard errors: a directive inside an ANSI port-list ELEMENT and the
|
||
one-line spelling. **M6** (indexed `bind` target `top.gen[0].u_core`)
|
||
is real, untested, and `bind` records only the instantiated module
|
||
(§2.9-15). **§2.9-19** has every piece (`plan_for`, `render`,
|
||
`nearest_definition`, `ports::execute`/`deliver`). Files:
|
||
crates/vlog_parser/src/{ast.rs, parser.rs} (bind path segments with
|
||
`[expr]`; `ExprKind::Verbatim` for a balanced region holding a
|
||
conditional directive inside an expression), crates/vlog_formatter/
|
||
src/format.rs (macro-call gap preserved; the expression verbatim arm),
|
||
tests/cases, verification.rs, crates/vlog_semantic/src/bind.rs (bind
|
||
target head → `Target::Module`; connections' port half →
|
||
`Target::Port(inst.module)`; expression half → a target-scope walk on
|
||
the `InlineConstraint` precedent, refuse-on-uncertainty), tests,
|
||
crates/lucisv_server/src/{ports.rs or a new instantiate.rs (the
|
||
`lucisv.instantiate` command), main.rs commands()}, tests/e2e.rs,
|
||
editors/nvim/README.md, docs/features/bind-semantics/README.md (new),
|
||
amendments in bind / macro-items / directives-in-instances /
|
||
inline-instantiation READMEs, docs/coverage_gaps.md M4/M5 corrected,
|
||
TODO §26. Runs after §25 (parser/format overlap).
|
||
- [x] M4 residue: the formatter keeps the source's gap between a macro
|
||
identifier and `(` in expression/list position (read from `src`
|
||
spans, as `glued_null_item` does); the two verify pins stay.
|
||
- [x] M5 residue: a conditional directive inside a connection/argument
|
||
EXPRESSION becomes `ExprKind::Verbatim(RawText)` so the
|
||
instantiation node survives (edge, lens, hierarchy, port
|
||
references kept; the one verbatim expression records nothing);
|
||
the ANSI port-list element and the one-line spelling stay filed
|
||
unless the same arm covers them.
|
||
- [x] M6 + §2.9-15: `BindDirective.target` → `Vec<PathSegment { name,
|
||
span, index: Option<Expr> }>`; `at_bind_directive` scans past
|
||
`[…]`; binder resolves the head as a module (or leaves an
|
||
instance path unresolved), the port half of each connection
|
||
against the bound-in module, the expression half in the TARGET
|
||
module's scope with the `InlineConstraint` refuse-on-uncertainty
|
||
shape; the escaped-segment case rides §25's G5.
|
||
- [x] §2.9-19: `lucisv.instantiate [uri, position, module]` →
|
||
`plan_for` → plain `render` → `workspace/applyEdit`; registered
|
||
in `commands()`; `at_instantiation_site` validates the position;
|
||
escaped-identifier plans inserted as plain text (M4's ruling);
|
||
nvim README rewritten; e2e over the wire.
|
||
- [x] Pins: the 21 spaced-macro files' shapes in expression position
|
||
format + round-trip; a directive-inside-connection file keeps its
|
||
instantiation edge and lens count; indexed bind targets parse,
|
||
format, resolve; a bind's `.x(top.x)` hover resolves in the
|
||
target; the command inserts the same text the ghost would.
|
||
- [x] QA on opentitan (read-only, 2026-09-02): the "53" was corrected by
|
||
the dev to 3 (the literal `.name(` ⏎ `` `ifdef `` shape: 0 hits by
|
||
independent census) — QA's own grep-based scan (a directive inside
|
||
a named connection's own paren-balanced value, whole tree) also
|
||
finds exactly 3: the two files that now format canonically and
|
||
`hw/top_earlgrey/dv/tb/tb.sv`, unchanged (directive-split, filed).
|
||
`bind` files under `hw/ip/*/dv/sva` (aes, hmac, rv_dm, ...) are lone
|
||
unindexed module targets, the resolved shape; three spot-checked
|
||
re-format byte-identically. Sweep unchanged (`git status
|
||
--porcelain` on opentitan showed only the owner's three files
|
||
throughout). See QA log.
|
||
|
||
## 27. SVA bodies as real nodes (planned 2026-09-02) — the SVA half of C1/M8, plus §2.9-18
|
||
|
||
Mapped: `property`/`sequence` declarations, concurrent `assert`/`assume`/
|
||
`cover`/`restrict property` and `expect`/`cover sequence` are captured
|
||
verbatim (`parse_concurrent_assertion`, `parse_property_decl`,
|
||
`parse_expect_statement` → `RawText`), so a signal named only inside one
|
||
is invisible to rename, references and the lints — the last correctness
|
||
residue of `docs/coverage_gaps.md` (C1's "SVA expressions can follow";
|
||
M8). Population: opentitan 82 `property`/`sequence` declarations in 23
|
||
files and 106 concurrent assertions (its 4 643 `` `ASSERT* `` macro uses
|
||
are macro tokens — §2.9-18's problem, carried here); corpus 80
|
||
concurrent assertions in 6 files. Plan, on the constraint-bodies /
|
||
covergroup-bodies precedent (real nodes behind a `Rewind` snapshot,
|
||
byte-exact verbatim fallback per construct, no keyword reserved —
|
||
`and`/`or`/`not`/`until`/`throughout`/`within`/`intersect`/`nexttime`/
|
||
`always`/`eventually`/`implies`/`iff` and the `s_`/`sync_` forms are
|
||
text-matched in SVA position only): **P1** grammar — `sequence_expr` /
|
||
`property_expr` as one precedence-climbing extension of `parse_expr`
|
||
(cycle delay `##n`/`##[a:b]`/`##[+]`/`##[*]`, repetition suffixes
|
||
`[*n]`/`[*a:b]`/`[=n]`/`[->n]`, binary `and`/`or`/`intersect`/`within`/
|
||
`throughout`/`|->`/`|=>`/`#-#`/`#=#`/`until`/`until_with`/`implies`/
|
||
`iff`, unary `not`/`nexttime`/`always`/`eventually`/`strong`/`weak`/
|
||
`first_match`/`accept_on`/`reject_on`/`sync_*`, property `if … else` and
|
||
`case … endcase`, a leading `@(…)` clocking and `disable iff (…)`,
|
||
sequence instances with arguments, `.triggered`/`.matched`, local
|
||
variable assignments `(a, x = b)`); **P2** declarations — property/
|
||
sequence headers with typed formals (`sequence`/`property`/`untyped`/
|
||
data types, defaults), local variable declarations in the body,
|
||
`endproperty : name`, and the concurrent assertion's action block as the
|
||
statement it already is; **P3** formatter — canonical layout with one
|
||
rule: the spec's top-level operators (`|->`, `|=>`, `##`, `and`, `or`)
|
||
break one-per-line at the parent's indent, everything else inline; the
|
||
verbatim fallback keeps bytes; **P4** semantics — a property/sequence
|
||
declares a `SymbolKind::Property`/`Sequence` symbol with a scope for its
|
||
formals and local variables, every identifier in a body is an ordinary
|
||
use, an instance names the declaration (`FACTS_FORMAT` bump), so rename/
|
||
references/hover/document symbols/the semantic lints all see inside
|
||
(M8 closes by construction for what parses); **P5** what stays verbatim
|
||
still *speaks*: a whole-word text scan of any remaining SVA verbatim
|
||
region feeds rename an "inside an assertion lucisv could not structure"
|
||
warning, the `macro_use_warnings` shape; **P6** §2.9-18 — those macro
|
||
warnings answered from `FileFacts::words` for files with no other
|
||
relationship to the name (the census exists since §24; only the wiring
|
||
is missing); **P7** an SVA gap fuzzer (every inter-token gap of the
|
||
fixture set takes a `/*C*/`; zero failures) on the comment-slots
|
||
precedent, and the 12 assertion attack pairs kept with new ones for
|
||
every token an SVA slot is defined between. Files:
|
||
crates/vlog_parser/src/{ast.rs, parser.rs}, tests/spans.rs,
|
||
crates/vlog_formatter/src/format.rs, tests/cases/{assertions.cases,
|
||
sva_bodies.cases (new)}, tests/verification.rs, crates/vlog_semantic/
|
||
src/{bind.rs, facts.rs, resolve.rs, model.rs}, tests/sva.rs (new),
|
||
crates/vlog_refactor/src/rename.rs + tests/rename.rs,
|
||
crates/lucisv_server/src/{symbols.rs, hover.rs} (kinds), tests/e2e.rs,
|
||
crates/vlog_linter (exhaustive-match arms only), docs/features/
|
||
sva-bodies/README.md (new), amendments in assertions / refactor-rename /
|
||
semantic-lints READMEs, docs/coverage_gaps.md C1/M8 rows, docs/topo.md
|
||
§2.9-18 struck (lead), TODO §27. Runs after §26 (parser/format/bind
|
||
collide); no parallel lane.
|
||
- [x] P1 grammar (real nodes behind `Rewind`, byte-exact fallback,
|
||
nothing reserved)
|
||
- [x] P2 declarations + action blocks; `expect`, `cover sequence`,
|
||
`default clocking`/`default disable iff` as nodes or explicitly
|
||
left verbatim (say which) — all four are nodes; `default clocking`
|
||
already was one (`clocking-wave`), the other three are this round's
|
||
- [x] P3 canonical layout — one rule, stated in the README; corpus
|
||
moves only in assertion text (QA reads every diff)
|
||
- [x] P4 semantics — `SymbolKind::{Property, Sequence}`, formals and
|
||
locals scoped, instances resolve; `FACTS_FORMAT` 15 → 16; rename of
|
||
a signal named inside a property edits it (pin), references list
|
||
it, document symbols show the declaration. The `unused-signal` half
|
||
of the pin could not be written as stated and is pinned inverted:
|
||
that rule's mention guard already shielded a name inside a verbatim
|
||
region, so it never fired; the rule that *does* change verdict is
|
||
`undriven-net`, exactly as in `covergroup-bodies`.
|
||
- [x] P5 verbatim-SVA rename warning (pin: a fallback region spelling
|
||
the old name warns, never silent)
|
||
- [x] P6 §2.9-18 wiring (pin: a file whose only relationship to the name
|
||
is a macro argument still warns) — the **engine half is done and
|
||
pinned**; the server fan-out (`Workspace::rename_sources`,
|
||
outside the round's file list) is filed as Handshake request 1 in
|
||
`docs/features/sva-bodies/README.md`, with the unbounded-read-set
|
||
objection that makes it a lead's call rather than a mechanical wiring. **Delivered by §29** (macro-word census, `unread_macro_warnings`).
|
||
- [x] P7 SVA gap fuzzer at zero (705 gaps, 0 failures); the 12 assertion
|
||
attack pairs kept plus 46 new ones; `verify.rs` untouched
|
||
- [x] Measurement: opentitan **79/79 declarations and 97/97 assertions**
|
||
structured, **zero fallbacks**, and corpus 8/8 and 63/63 the same
|
||
(the brief's 82/106 are grep counts and include files that do not
|
||
parse and `` `ASSERT* `` macro uses, which are directive tokens);
|
||
corpus 13 files moved and opentitan 36, all inside assertion text;
|
||
both sweeps otherwise byte-identical; the 4 854 `` `ASSERT* ``
|
||
invocations byte-identical
|
||
- [x] QA on opentitan (read-only): structured counts re-derived; every
|
||
moved file's diff read; rename of a signal used in
|
||
`hw/ip/*/rtl/*_assert*.sv` properties; sweep unchanged
|
||
|
||
## 28. Decomposition (planned 2026-09-02) — the file-size rule applied to the eight files over 1 200 lines
|
||
|
||
The rule (CLAUDE.md "File and function size"): 300–600 production
|
||
lines per file, split at 800+, a written reason above 1 200; functions
|
||
10–50, a reason above 150. Measured on 2026-09-02: thirteen files over
|
||
800, eight over 1 200, led by `parser.rs` 8 786 production lines
|
||
(+5 044 test), `format.rs` 5 444, `ast.rs` 3 313, `server.rs` 2 559
|
||
(+6 293 test), `bind.rs` 2 378, `workspace.rs` 1 975, `ports.rs` 1 778,
|
||
`completion.rs` 1 716 (+2 463 test). These are also exactly the files
|
||
every feature lane collides in — after this round, lanes that touch
|
||
different grammar domains can run in parallel.
|
||
|
||
**Rules for every lane in this round** (the merge contract): a split is
|
||
a **pure move** — no behaviour change, no renamed public item, every
|
||
public path preserved by re-exports from the old module (`pub use`), so
|
||
no other crate's imports change; doc comments travel with their items;
|
||
`#[cfg(test)]` blocks move with the code they test or to a sibling
|
||
`tests.rs`/`tests/` file, and the **test count per crate does not
|
||
drop** (the summed `cargo test` counts are pinned in each README);
|
||
byte-identity of every corpus and opentitan file against a baseline
|
||
build of the trunk commit the lane branched from (the same
|
||
`--stdout` comparison QA runs); `cargo fmt -p`, clippy clean; no
|
||
`#[allow]` introduced. Function splitting is *allowed* only where a
|
||
function exceeds 150 lines and is not a dispatch table over an enum;
|
||
each such split is named in the work log. `git blame` continuity is
|
||
lost for moved code — accepted, and the work log says which module
|
||
each old line range went to.
|
||
|
||
Lanes (each in its own worktree; disjoint crates; run in parallel):
|
||
|
||
- **Lane A — `vlog_parser`**: `parser.rs` → `parser/mod.rs` (the
|
||
`Parser` struct, token cursor, `Rewind`, comment plumbing —
|
||
`bump`/`take_meta`/`take_gap`/`gap_before`, error/recovery) plus
|
||
`parser/{expr, decl (data types, declarators, typedef/enum/struct,
|
||
params), module (header, ports, items, generate, instantiation,
|
||
bind), stmt, class (classes, constraints, covergroups, DV items),
|
||
sva, directive (macros, conditionals, includes, fragment mode), and
|
||
recovery/opaque capture}.rs`; `ast.rs` → `ast/{mod (Meta, Comment,
|
||
spans, RawText), expr, decl, module, stmt, class, sva}.rs` with
|
||
`pub use` so `vlog_parser::ast::*` is unchanged; the 5 044 test lines
|
||
move beside the code they test (`parser/tests/*.rs` or per-module
|
||
`#[cfg(test)]`). `lexer.rs` (996) stays.
|
||
- **Lane B — `vlog_formatter`**: `format.rs` → `format/mod.rs` (`Fmt`,
|
||
`Doc` builders, comment slots `slot_comments`/`inline_comments`,
|
||
settings) plus `format/{item, decl, module (headers, ports,
|
||
instantiations, connections, bind), stmt, expr, class (constraints,
|
||
covergroups), sva, list (the shared list/alignment machinery),
|
||
directive}.rs`; `stmt_kind` (280) and `expr` (240) are dispatch
|
||
tables — they stay whole with the reason commented.
|
||
- **Lane C — `lucisv_server`**: `server.rs` — first move its 6 293 test
|
||
lines to `server/tests.rs` (`#[cfg(test)] mod tests;`), then split
|
||
`server/{dispatch (answer_request — a dispatch table, stays whole),
|
||
lifecycle (initialize/shutdown/documents), diagnostics, workspace
|
||
(events, watchers, config), progress, client (transport, logging)}.rs`;
|
||
`completion.rs` → `completion/{mod, members, modules, templates,
|
||
keywords, symbols, fuzzy}.rs` with its tests beside each provider;
|
||
`perf.rs` (1 190) split by what it measures if a one-sentence
|
||
description needs an "and".
|
||
- **Lane D (after A/B/C, or in parallel if truly disjoint — check
|
||
topo)** — `vlog_semantic`: `bind.rs` → `bind/{mod, items, stmts,
|
||
exprs, types, classes, sva}.rs`; `workspace.rs` → `workspace/{mod,
|
||
index, scan, resolve_external, persistence}.rs`. `vlog_refactor`:
|
||
`ports.rs` → `ports/{mod, plan, execute, warnings}.rs`; `rename.rs`
|
||
(1 044) → `rename/{mod, occurrences, warnings}.rs`.
|
||
|
||
Docs: one `docs/features/decomposition/README.md` for the round (each
|
||
lane a subsection with its module map, line-range table and pinned
|
||
counts), `docs/topo.md` §3.1 primary-home matrix updated to the new
|
||
module names, `README.md`'s architecture section updated. Runs AFTER
|
||
§27 (every lane touches its files).
|
||
- [x] Lane A `vlog_parser` — parser/ and ast/ module maps; tests moved;
|
||
counts pinned; byte-identity proven
|
||
- [x] Lane B `vlog_formatter` — format/ module map; counts; byte-identity
|
||
- [x] Lane C `lucisv_server` — server/ and completion/ module maps;
|
||
tests out of server.rs first; counts; e2e unchanged; vsix smoke
|
||
- [x] Lane D `vlog_semantic` + `vlog_refactor`
|
||
- [x] Docs: decomposition README (one per lane: decomposition-{parser,
|
||
formatter,server,semantic}), topo §1.3/§3.3, README.md architecture
|
||
- [x] QA per lane: `cargo test` counts equal to the lane's baseline,
|
||
corpus + opentitan `--stdout` byte-identical (0 differing), no
|
||
public path changed (`cargo doc` item list diffed against the
|
||
baseline), longest-function census reported before/after
|
||
|
||
## 29. Small items, round 1 (planned 2026-09-02) — `Scope` promotion, the macro-word census for rename warnings (§2.9-18 server half), `lucisv check --rules-doc` (§2.9-5, M12's second half)
|
||
|
||
Three independent items in one lane; disjoint from §30's files. Dev
|
||
Opus 5, QA Sonnet 5. Feature README: `docs/features/macro-word-census/
|
||
README.md` (Goal names all three; Work log per item).
|
||
|
||
**29.1 `vlog_refactor::rename::scope` → crate root.** `rename/scope.rs`
|
||
(69 production lines) holds `Scope`/`Analysis`/`display` — the in-scope
|
||
files, the index built from them, the analyses computed so far — and its
|
||
own `//!` says nothing in it is rename-specific; `ports/`, `references`
|
||
and `instantiate` reach it through `rename`. Pure move: `git mv
|
||
crates/vlog_refactor/src/rename/scope.rs crates/vlog_refactor/src/scope.rs`;
|
||
`lib.rs` gains `mod scope;` (crate-private); `rename/mod.rs` keeps
|
||
`pub(crate) use crate::scope::{display, Scope};` so every in-crate path
|
||
(`crate::rename::Scope`, `super::scope::…` in `warnings.rs`) still
|
||
resolves — change the importers to `crate::scope::` where you touch
|
||
them anyway and leave the re-export for the rest; the `//!` loses its
|
||
"it lives under `rename` because …" sentence. Proof: `cargo test -p
|
||
vlog_refactor` counts identical (86/5/52/63/0), workspace green, no
|
||
public path changes (`Scope` is `pub(crate)`).
|
||
|
||
**29.2 Macro-word census, and the rename warning it enables.** Today
|
||
`FileFacts::words` (§24) is one sorted list of every identifier-shaped
|
||
word in a file, plain tokens and raw text (macro invocations, directive
|
||
lines, attributes) folded together, so it cannot say *where* a word was
|
||
seen. Rename's `macro_use_warnings` (engine, pinned in §27 by
|
||
`a_file_whose_only_relationship_to_the_name_is_a_macro_argument_is_warned_about`)
|
||
only runs over the files `Workspace::rename_sources` hands the engine,
|
||
and a file whose only relationship to the name is a macro argument is
|
||
in none of its rungs — the lead's ruling in `docs/topo.md` §2.9-18: no
|
||
`files_mentioning` rung (untagged, so it would re-read every file
|
||
spelling `clk` and bring back the 2.5–3.0 s `prepareRename` cost), but a
|
||
separate census the server can *warn from without reading*. Plan:
|
||
(a) `vlog_semantic::words`: alongside `harvest`, a `harvest_raw(tokens)
|
||
-> Vec<String>` (sorted, deduped) of the words `raw_words` finds inside
|
||
macro-invocation `Ident`s, `Directive` and `Attribute` tokens only —
|
||
factor the raw-token match out of `harvest` so the two cannot drift;
|
||
pin `harvest_raw ⊆ harvest` and that a word seen only as a plain
|
||
identifier is absent from it. (b) `FileFacts::macro_words: Vec<String>`
|
||
written and read beside `words` (tag `M`), `FACTS_FORMAT` 16 → 17 with
|
||
the reason in the doc comment (a 0.33.0 store has no `M` records and
|
||
would answer "no file names it in a macro"), `fingerprint` unchanged
|
||
(the census is derived from the same text). (c) `WorkspaceIndex::
|
||
files_naming_in_macros(name) -> impl Iterator<Item = FileId>` by binary
|
||
search, the twin of `files_mentioning`; `update_file`/`remove_file`/
|
||
`absorb` carry the field the way they carry `words` (they do, if it
|
||
lives in `FileFacts`; say so). (d) `lucisv_server/src/rename.rs`: after
|
||
the engine returns `(edit, warnings)`, append one warning per file in
|
||
`files_naming_in_macros(old_name)` that is **not** among the paths the
|
||
engine was handed (`rename_sources` result) and not an open buffer:
|
||
"`old` also appears inside a macro invocation in <path>, which this
|
||
rename did not read; check it by hand — a macro argument cannot be
|
||
edited." Same for `prepareRename`? No — a prepare answers a range, not
|
||
warnings. (e) Pins: `vlog_semantic` unit tests for `harvest_raw` and the
|
||
codec round-trip (FACTS 17 record with and without `M`); a server test
|
||
with three files — `sub.sv` declares `wire sig`, `top.sv` uses `u.sig`,
|
||
`far.svh` contains only `` `uvm_info("x", $sformatf("%0d", sig), UVM_LOW) ``
|
||
and nothing else naming `sub` — asserting the rename edits `sub.sv` and
|
||
`top.sv`, that `far.svh` is not in `rename_sources`, and that the
|
||
returned warnings name `far.svh`; a control where `far.svh` also
|
||
instantiates `sub` (then it IS a source and the engine's own warning
|
||
appears exactly once — no double warning). (f) `docs/topo.md` §2.9-18
|
||
struck by the lead; the refactor-rename and semantic-lints-on READMEs
|
||
amended; index-persistence README notes format 17.
|
||
|
||
**29.3 `lucisv check --rules-doc`.** `vlog_linter::rules_markdown()` has
|
||
existed since lint-rules-2 with only an example binary
|
||
(`crates/vlog_linter/examples/rules_markdown.rs`) to print it. Plan:
|
||
`args.rs` — `Options::rules_doc: bool`, parsed from `--rules-doc`,
|
||
listed in `check_flag_scopes` as lint-only, documented in the usage
|
||
text under `lucisv check`; `main.rs::run_check` — when set, print
|
||
`rules_markdown()` to stdout and return exit 0 before `select_rules`
|
||
and before any path is gathered (paths given alongside are an error:
|
||
"--rules-doc takes no files"); a `crates/lucisv/tests/` case running
|
||
the binary with `--rules-doc` and asserting the first line and that
|
||
every registered rule name appears once; if `docs/lint-rules.md` (or
|
||
the docs-site rules page) is checked in, a drift test that it equals
|
||
the generated text, and regenerate it in this round; the example
|
||
binary's doc comment updated (or the example removed — the lead
|
||
prefers removed, the flag is the tool now). `docs/topo.md` §2.9-5
|
||
struck by the lead; the lint-rules-2 README's handshake ticked.
|
||
|
||
Files: crates/vlog_refactor/src/{lib.rs, scope.rs (moved),
|
||
rename/mod.rs, rename/warnings.rs, ports/*.rs, references.rs,
|
||
instantiate.rs (imports only)}, crates/vlog_semantic/src/{words.rs,
|
||
facts.rs, workspace/{mod,index,update,record}.rs} + tests,
|
||
crates/lucisv_server/src/rename.rs (+ state.rs only if
|
||
`rename_sources` must expose its path set — prefer returning it from
|
||
the existing function rather than a new rung) + tests/e2e.rs,
|
||
crates/lucisv/src/{args.rs, main.rs} + tests, crates/vlog_linter/
|
||
examples/rules_markdown.rs (removed), docs/lint-rules.md (regenerated
|
||
if present), docs/features/macro-word-census/README.md (new),
|
||
amendments in refactor-rename / semantic-lints-on / index-persistence /
|
||
lint-rules-2 READMEs, TODO §29. Runs in parallel with §30 (disjoint
|
||
files; topo: §29 touches the FACTS handshake, §30 the AST — no shared
|
||
edge).
|
||
- [x] 29.1 `Scope` at the crate root, counts identical
|
||
- [x] 29.2 `harvest_raw` + `FileFacts::macro_words` (FACTS 17) +
|
||
`files_naming_in_macros` + the server warning; the three-file pin
|
||
and its control — the group's tag is `MW`, not `M` (already the
|
||
member group); no new `Workspace` rung (`rename_sources` returns
|
||
the path set the server subtracts)
|
||
- [x] 29.3 `--rules-doc`; usage text; tests; example removed;
|
||
`docs/lint-rules.md` regenerated if present — it is not present,
|
||
and the docs-site rules page is hand-written prose, not generated
|
||
text, so there was nothing to regenerate and no drift test
|
||
- [x] Gates: fmt/clippy/`cargo test --workspace` (3 226/0/42 over 48
|
||
binaries, from 3 215/0/40); corpus gate 814/820, the same six;
|
||
store measurement +123 402 bytes (+3.11 %) on the corpus and
|
||
+743 873 (+1.66 %) on opentitan; opentitan `lucisv check` sweep
|
||
byte-identical, working tree untouched
|
||
- [x] QA: rename of `clk` in an opentitan IP with the server, timing
|
||
before/after (must not regress; the warning list must name only
|
||
files outside the source set), the pins re-derived
|
||
|
||
## 30. Small items, round 2 (planned 2026-09-02) — M13: modport method prototypes, `const` tf arguments, unnamed DPI formals
|
||
|
||
Three grammar arms `docs/coverage_gaps.md` M13 lists as "each a small
|
||
grammar arm"; zero corpus population, so the value is that an interface
|
||
or DPI file written by the book opens without an error node. Dev Opus 5,
|
||
QA Sonnet 5. Feature README: `docs/features/interface-dpi-arms/README.md`.
|
||
|
||
**30.1 Modport method prototypes** (IEEE 1800-2017 §25.5.4,
|
||
`modport_tf_port ::= method_prototype | tf_identifier`). Today
|
||
`parse_modport` (`parser/module.rs`) reads `import`/`export` followed
|
||
by a name list; `import task drive(int x)` errors at `task`. Plan:
|
||
(a) `ast/module.rs`: `ModportPort` gains `prototype: Option<Box<
|
||
TfPrototype>>` where `TfPrototype { kind: TfKind (Function|Task), ret:
|
||
Option<DataType>, name: Name, ports: TfPorts, after_kw/before_name/
|
||
before_args comment slots }` — one struct, since a modport prototype is
|
||
a header with no body; `names` is empty when `prototype` is `Some`.
|
||
(b) `parser/tf.rs`: factor the header parse — keyword, lifetime
|
||
qualifiers, return type, name, `parse_tf_ports` — out of
|
||
`parse_function_decl`/`parse_task_decl` into `parse_tf_header(kind) ->
|
||
PResult<TfPrototype>`-shaped code both call (a pure refactor inside
|
||
the file; counts unchanged), and call it from `parse_modport` when the
|
||
token after `import`/`export` is `task` or `function`; the prototype
|
||
ends at the `,`/`)` of the modport list, never at `;`. Comments in
|
||
every new gap get an owner (the comment-slots rule); a `/*c*/` before
|
||
`task`, before the name, inside `()` are the cases. (c) `format/
|
||
module.rs`: print `import task name(args)` through the same header
|
||
printer `routine.rs` uses (factor it the same way), one prototype per
|
||
list element, alignment untouched. (d) `bind/item.rs`: the prototype's
|
||
name is a use (`Target::Lexical`, resolving to the interface's task or
|
||
function) and its formals are declared in a `ScopeKind::Block` opened
|
||
for the prototype so they neither leak nor go unbound; types bind as
|
||
types. (e) `tests/spans.rs` arm; parser tests; `interfaces.cases`
|
||
entries (import and export, task and function, with and without
|
||
formals, mixed with `input` groups, comments); a semantic test that
|
||
hover on `drive` in the prototype lands on the interface's task.
|
||
|
||
**30.2 `const` task/function arguments.** `parse_tf_ports` already
|
||
accepts `const ref` (tf.rs:177, the corpus shape). Verify with a probe
|
||
whether anything M13 meant is still missing — `const ref int q[$]`
|
||
formats today; a bare `const` direction is not legal (LRM 13.5.2 only
|
||
has `const ref`) — and close the item with a pinned case rather than
|
||
code, unless the probe finds a real gap (then fix it in the same arm).
|
||
Correct the M13 row in `docs/coverage_gaps.md` either way.
|
||
|
||
**30.3 Unnamed DPI formals** (§35.5.5: `import "DPI-C" function int
|
||
f(int, chandle);` — a formal may omit its name in a DPI import
|
||
prototype only). Today `parse_tf_ports` does `expect_name` and errors
|
||
at `,`. Plan: (a) `parse_tf_ports(allow_unnamed: bool)` — the DPI path
|
||
(`parse_dpi_import` → `parse_function_decl(Some(dpi))`/`parse_task_decl`)
|
||
passes `true`, every other caller `false`; when allowed and the token
|
||
after the type is `,` or `)`, the formal has **no name**. (b) AST: keep
|
||
`TfArg::name: Name` and use the crate's existing empty-name convention
|
||
(`foreach (arr[, j])`, `declare` ignores an empty name) — `name.text`
|
||
empty, `name_span` empty — rather than an `Option` that would touch
|
||
every consumer (formatter, binder, ports refactoring, signature help);
|
||
document it on the field. (c) Formatter: an unnamed formal prints its
|
||
direction and type only; `tf_args` alignment treats the missing name
|
||
as zero width. (d) Binder: `declare` already ignores empty names — pin
|
||
it. (e) Signature help (`lucisv_server/src/signature.rs`) shows the
|
||
type alone for such a parameter — check and pin. (f) Cases in
|
||
`dpi.cases` (or the file DPI imports live in): `int`, `chandle`,
|
||
`logic [7:0]`, a mix of named and unnamed, `input int` unnamed, and
|
||
the negative: an unnamed formal in a non-DPI function is still an
|
||
error naming the position.
|
||
|
||
Files: crates/vlog_parser/src/{ast/module.rs, ast/decl.rs (TfArg doc),
|
||
parser/module.rs, parser/tf.rs, parser/item.rs}, tests/spans.rs +
|
||
parser tests, crates/vlog_formatter/src/format/{module.rs, routine.rs},
|
||
tests/cases/{interfaces.cases, dpi.cases or where DPI lives},
|
||
crates/vlog_semantic/src/bind/item.rs + tests, crates/lucisv_server/
|
||
src/signature.rs (check + pin only) + tests, docs/coverage_gaps.md
|
||
(M13 row), docs/features/interface-dpi-arms/README.md (new),
|
||
amendments in interfaces / dpi-export READMEs, TODO §30. Runs in
|
||
parallel with §29.
|
||
- [x] 30.1 modport prototypes end to end (parse, format, bind, spans,
|
||
hover pin) — `TfPrototype` on `ModportPort`, one shared header
|
||
parse (`parse_tf_header`) and one shared header printer
|
||
(`Fmt::tf_header`); the name resolves with `Target::InScope`, not
|
||
`Lexical` (reason in the feature README). One prototype per
|
||
`import`/`export` group, not the LRM's list.
|
||
- [x] 30.2 `const` arguments verified and pinned (or fixed), M13 row
|
||
corrected — `const ref` already worked; the probe found one real
|
||
gap, a comment *between* `const` and `ref`, now `TfArg::after_const`
|
||
- [x] 30.3 unnamed DPI formals (parse behind the DPI flag, format,
|
||
bind, signature help pin, negative pin) — signature help turned
|
||
out not to apply (it answers only for instantiation lists), so
|
||
that pin is a recorded finding rather than a test
|
||
- [x] Gates: fmt/clippy/`cargo test --workspace`; `cargo test -p
|
||
vlog_formatter`; corpus 814/820 byte-identical to 0.33.0 (zero
|
||
population, so nothing may move); opentitan read-only sweep
|
||
unchanged — 3 223/48 tests, 0 clippy warnings, 814/820 with the
|
||
same six failures, 0 diffs over 860 corpus and 3 947 opentitan
|
||
files
|
||
- [x] QA: hand-written interface + DPI files in every listed shape,
|
||
idempotent, comments kept; the negative pin; sweep unchanged
|
||
|
||
## 31. Format fences at statement level and inside class bodies (planned 2026-09-02) — M9, §2.9-3
|
||
|
||
Mapped (read-only exploration, file:line in the feature README to be):
|
||
fences are an exact-match `//` comment (`verilog_format: off|on`,
|
||
`lucisv: off|on`, `fence.rs::fence_of`) turned into `Region { fence,
|
||
start, end }` by `fence::collect`, a **comment scan over item scopes**
|
||
(`scan_scope` walks one `Vec<Item>` plus its `dangling`; `scan_nested`
|
||
enters Module/Package/GenerateRegion/GenIf/GenFor/GenCase and nothing
|
||
else — `_ => {}` is why a fence inside a class body, an `always`
|
||
block, a case item or a port list is inert). The formatter asks three
|
||
questions of the list (`verbatim.rs`: `slot`, `is_verbatim`,
|
||
`opens_at`) and splices `Doc::Verbatim(src[start..end])`, a column-0,
|
||
break-forcing leaf that must follow a line break; `region_at` is a
|
||
`partition_point` binary search that needs the list sorted by both
|
||
ends. `protected_regions` (the `--fix`/quick-fix backstop) is already
|
||
the union with a line scan, so it sees class-body and statement fences
|
||
today — this round closes that asymmetry, it does not open one. The
|
||
corpus holds zero fences (any output movement is a bug). Dev Opus 5,
|
||
QA Sonnet 5. Feature README: `docs/features/statement-fences/README.md`.
|
||
|
||
**31.1 Class bodies — one arm.** `ClassDecl` holds `items: Vec<Item>` +
|
||
`dangling` and the formatter already prints them through the
|
||
fence-aware `item_seq`/`dangling`; add `ItemKind::Class(c) =>
|
||
scan_scope(src, &c.items, &c.dangling, out)` in `scan_nested` (and the
|
||
same for any other item that carries an item list and is printed by
|
||
`item_seq` — check `Interface`/`Program`/`Checker`, say which). Cases:
|
||
a fence around one class item, around a nested class, an unmatched
|
||
`off` running to `endclass` only (not past it), comments before the
|
||
`off`. Closes §2.9-3; the classes README's handshake ticked; the QA-log
|
||
probe in that README re-run.
|
||
|
||
**31.2 Statement lists.** A `Stmt` is fence-ready (`meta.leading` with
|
||
spans; `span` = code extent, comments out). Add `scan_stmt_scope(src,
|
||
stmts, dangling, out)` mirroring `scan_scope` (leading comments as
|
||
units, `scope_end` = last statement's `span.end` extended by
|
||
`with_trailing_comments`, an unmatched `off` runs to the list's end
|
||
only), and `scan_nested_stmt` entering `StmtKind::{Block, ForkJoin,
|
||
If (both arms), For, Foreach, While, DoWhile, Forever, Repeat, Case
|
||
(each item's body), Timing/Wait bodies}` — **statement lists only**:
|
||
`begin … end`, `fork … join*`, function/task bodies, `initial`/`always`
|
||
bodies reached from the item (`ItemKind::{Always, Initial, Final,
|
||
Function, Task}` and a class method); a bodyless `if (x) y = 1;` is not
|
||
a scope, for the reason `scan_gen_block` refuses `!is_block`. Merge
|
||
statement regions into `collect`'s output through the same global sort
|
||
+ "drop a region whose `fence` precedes the previous `end`" filter so
|
||
`region_at`'s precondition holds; `range.rs` manufactures regions into
|
||
the same list — re-check its planner with a statement region inside a
|
||
selected range (a fence outranks a range, as today). Formatter:
|
||
`stmt_seq` gains `item_seq`'s two rules (a swallowed statement emits
|
||
nothing and contributes no separator); `Fmt::stmt` checks `opens_at`/
|
||
`is_verbatim` before `with_meta` and drops the dangling `HardLine` the
|
||
way `item_docs` does; `block_doc`'s `dangling` already goes through the
|
||
fence-aware path. Idempotency gate: a region may only open at a
|
||
`line_start` (a fence written after `begin` on the same line is an
|
||
ordinary comment — pin it); comment preservation: a statement scope's
|
||
end includes the last statement's trailing comment and never leaks past
|
||
the enclosing `end`/`endfunction`/`join`.
|
||
|
||
**31.3 Not this round, written down**: port lists and case-item label
|
||
lists (elements printed inside a `Group` mid-line; `Doc::Verbatim` is
|
||
column-0 and `Doc::Inline` carries no region indentation — a different
|
||
primitive), same-line fences (trailing trivia; unblocked since `Meta.
|
||
trailing` carries a span, still deferred). The cross-level pairing rule
|
||
stays: an item-level `off` closed by a statement-level `on` is an
|
||
unmatched `off` today and becomes a stray `on` in another scope —
|
||
behaviour unchanged, the fences.cases entry "a statement-level fence has
|
||
no effect this round" inverts, and `docs/features/format-fences/
|
||
README.md` §"Out of scope" plus `README.md` "Turning the formatter off"
|
||
are rewritten in the same change.
|
||
|
||
Proof: the `tests/fences.rs` triple (byte-exact + `verify_equivalence`
|
||
+ second-pass fixed point) for every new scope; corrupted-region attack
|
||
pairs for a statement region and a class-body region (the five in
|
||
`fences.rs` as the model; `verify.rs` untouched — a region is source
|
||
bytes, equivalence holds by construction); `protected_regions` and
|
||
`is_protected` signatures untouched so `lucisv/src/lint.rs` and
|
||
`lucisv_server/src/lint.rs` are byte-identical; corpus 814/820 and
|
||
byte-identical to 0.33.0 (zero fences); opentitan sweep unchanged
|
||
(grep its fence count first; if any exist inside statements, their
|
||
files may now move — list them).
|
||
Files: crates/vlog_formatter/src/{fence.rs, format/{stmt.rs, item.rs,
|
||
verbatim.rs, class.rs}, range.rs (planner check)}, tests/{fences.rs,
|
||
cases/fences.cases, ranges.rs}, docs/features/statement-fences/README.md
|
||
(new), amendments in format-fences / classes / shared-fence-filter
|
||
READMEs, README.md "Turning the formatter off", docs/topo.md §2.9-3
|
||
struck (lead), TODO §31. Runs after §29/§30 merge (format/ collides
|
||
with §30's routine.rs only at merge; disjoint files otherwise — the
|
||
lead may start it in parallel if §30's files are settled).
|
||
- [x] 31.1 class bodies (+ any other item-list carrier), cases, §2.9-3 —
|
||
`Interface`/`Program` are `ItemKind::Module` and were already scanned,
|
||
there is no `Checker` node, and `PropSeqDecl.locals` is deferred (it is
|
||
the one `Vec<Item>` not printed through `item_seq`)
|
||
- [x] 31.2 statement lists: scan, merge, `stmt_seq`/`stmt` rules,
|
||
line-start gate, trailing-comment end, range planner re-check — the
|
||
planner now merges `collect`'s fences into `Plan.regions`, without
|
||
which `--lines` would have reformatted a fenced statement
|
||
- [x] 31.3 docs rewritten (format-fences README, README.md, the
|
||
inverted case), deferrals listed with reasons
|
||
- [x] Attack pairs + the fences.rs triple per scope; verify.rs untouched
|
||
- [x] Gates: fmt/clippy/`cargo test --workspace` 3 244/0/42 (was
|
||
3 234/0/42); corpus 814/820, 860 files byte-identical to the 0.34.0
|
||
binary; opentitan census 9 fenced files of 3 947 — 4 moved, each
|
||
keeping its own fenced bytes, `--check` counts unchanged
|
||
- [x] QA: fences in every statement scope listed and in the three
|
||
deferred places (must be inert, never corrupt); an `off` with no
|
||
`on` in each scope (runs to the scope end only); nested fences;
|
||
`--lines` over a fenced statement; `--fix` still declines inside
|
||
|
||
## 32. Error recovery inside headers and lists (planned 2026-09-02) — M10
|
||
|
||
Mapped (read-only exploration; file:line to be carried into the feature
|
||
README): tolerant parsing is one grammar with a `tolerant` flag; the
|
||
only recovery is `recover` (`parser/recover.rs`: push the diagnostic,
|
||
`skip_to_sync` to the next depth-0 `;` or a sync keyword, slice the
|
||
skipped source into `ItemKind::Error`/`StmtKind::Error`) at eleven
|
||
list sites (file scope, module/package/generate/class bodies, tf
|
||
bodies, `begin`/`fork` lists, case items). **Two facts make headers the
|
||
damage:** (1) an error anywhere inside a header escapes to the nearest
|
||
enclosing *item/statement list*, so a typo in a port list, parameter
|
||
list or tf-port list destroys the whole `Module`/`FunctionDecl` — the
|
||
body then re-parses at the wrong scope and the orphaned `endmodule`/
|
||
`endfunction` is a second (third) error; (2) `skip_to_sync`'s bracket
|
||
counter starts at zero at the failure point, so brackets consumed
|
||
before the failure are invisible and the skip stops at a `;` inside
|
||
`for (…; …; …)` or runs past a `)`. QA's shape: `module m #(parameter
|
||
W = , parameter X = 4) (input a); wire ok; endmodule` → three items
|
||
(error, a top-level `wire ok;`, an error for `endmodule`), 2
|
||
diagnostics. The server publishes one diagnostic per `ParseDiagnostic`
|
||
with no suppression; document symbols, scoped completion, inlay, lens,
|
||
hierarchy and linked editing all read `doc.tree.items`/`semantics` and
|
||
lose the module. Nothing asserts today that symbols above the cursor
|
||
survive a header typo. Dev Opus 5, QA Sonnet 5. Feature README:
|
||
`docs/features/header-recovery/README.md`.
|
||
|
||
**32.1 A third error shape, not a third mechanism.** An `Error(RawText)`
|
||
*element* in the list element types: `AnsiPort`/`NonAnsiPort` (or the
|
||
port-list item enum), `ParamPort`, `Connection` (named and ordered),
|
||
`TfArg` — one new arm each, so every exhaustive match (formatter,
|
||
`bind/`, `spans.rs`) must decide; the formatter prints it through
|
||
`raw_text` (unreachable from `format_source`, as `ItemKind::Error` is),
|
||
`bind/` ignores it (mirroring `bind/item.rs`'s `Error` arm), the linter
|
||
treats it as an opaque span (mirroring `signals.rs`). Pre-agreed
|
||
cross-crate one-liners; nothing else in those crates changes.
|
||
|
||
**32.2 One shared helper, `element_or_recover`**, on the
|
||
`item_or_recover` model: mark, call the element parser, on `Err` in
|
||
tolerant mode record the diagnostic, skip to a **list-local** sync set
|
||
and wrap the skipped source. The set: `,` (not consumed — it separates
|
||
the next element), the list's own closer `)` (not consumed), `;` (not
|
||
consumed — the header was abandoned), and a **line change** (the next
|
||
token's line differs from the failing token's — the one line-based
|
||
rule, and the one that pays for `input logic a, inp⏎`). Bracket-
|
||
balanced like `skip_to_sync`, with the counter **seeded from the list's
|
||
own open bracket** — the root-cause fix. Strict mode is untouched
|
||
(`Err` propagates as today).
|
||
|
||
**32.3 Headers keep their node.** `parse_port_list`,
|
||
`parse_param_port_list`, `parse_tf_ports` and `parse_connections` cannot
|
||
fail in tolerant mode: they return the elements that were typed plus
|
||
error elements, and the caller closes the list (`expect_closer`-style:
|
||
a missing `)` is a diagnostic, not a failure). `parse_module`,
|
||
`parse_function_decl`/`parse_task_decl` and `parse_instantiation`
|
||
therefore always return their node with the name, the typed elements
|
||
and the body, so the body binds in the right scope and there is no
|
||
orphaned closer.
|
||
|
||
**32.4 `for` headers and `if`/`while`/`case` conditions** get the
|
||
smallest version: on a failure inside the parentheses, skip to the
|
||
matching `)` with the seeded counter (the header's inner `;` are
|
||
invisible) and substitute `ExprKind::Error(RawText)` (new arm; formatter
|
||
`raw_inline`, binder ignores, `spans.rs` arm); the statement survives
|
||
with its body. Kills the documented second diagnostic of the `for`
|
||
case (error-recovery README §"known shapes").
|
||
|
||
**32.5 Pins.** In `crates/vlog_parser/tests/error_recovery.rs`, one test
|
||
per shape with exact counts: the QA source above → 1 diagnostic, 1
|
||
item, `ItemKind::Module` named `m` holding `wire ok;`, `param_ports`
|
||
of length 2 with `[0]` an error element; `module m (input logic a,
|
||
inp⏎ output b);` (line-change sync, `b` survives); `#(parameter W = 8,`
|
||
at end of file; `for (int i = 0; i <` inside `begin…end` (1 diagnostic,
|
||
the `for` a `StmtKind::For` with an `Error` condition, the next
|
||
statement intact); `sub u (.a(x), .b(` followed by `wire w;` (the
|
||
existing pin inverts: `wire w;` is now a sibling item); `function int
|
||
f(input int a,` followed by a body and `endfunction` (1 diagnostic, the
|
||
function and the module both intact); `if (a &&` with a then-branch.
|
||
`tolerant_parse_equals_strict_parse_on_valid_sources` (550 sources)
|
||
stays green unchanged — the regression net for "no cost on a clean
|
||
file"; every new branch sits behind `self.tolerant` on the error path.
|
||
Extend `error_recovery.rs`'s `walk_item`/`walk_stmt` and `spans.rs`'s
|
||
nesting walker for the new shapes (do not add a second walker), so
|
||
span nesting and `source[span] == text` hold for them automatically.
|
||
Fuzz: the existing truncate-anywhere / delete-any-character tests must
|
||
stay green (no panic, no infinite loop — the list-local skip must
|
||
always advance).
|
||
|
||
**32.6 The user-visible contract, pinned in the server.** In
|
||
`crates/lucisv_server`: a test that opens a buffer with a broken port
|
||
list and asserts `document_symbols` still lists the module and its
|
||
already-typed ports, that `visible_symbols` at a cursor inside the
|
||
broken list still answers from the module's scope (completion), that
|
||
exactly one diagnostic is published, and that `pairs::missing_end_
|
||
diagnostics` adds nothing for it. Re-check the three validity probes
|
||
that assert `parse_source_tolerant(probe).1.is_empty()`
|
||
(`inline.rs`, `templates.rs`, `completion/tiers.rs`): they must keep
|
||
their verdicts (a probe that is broken must still produce a
|
||
diagnostic — recovery does not mean silence).
|
||
|
||
**32.7 Docs.** The error-recovery README: Assumptions gain the header
|
||
sentence its Review claims is there (the discrepancy the exploration
|
||
found); Status/TODO's "Not done" line inverts; the "known shapes" table
|
||
updated. `docs/coverage_gaps.md` M10 row closed. Measure: `perf.rs`'s
|
||
`parse_tolerant` harness before/after on the largest corpus file (must
|
||
be within noise), and the diagnostics count over the corpus with every
|
||
file truncated at its midpoint (a census: before/after totals; expect a
|
||
drop).
|
||
|
||
Files: crates/vlog_parser/src/{ast/{module,decl,expr,stmt}.rs (the
|
||
error arms), parser/{recover.rs, module.rs, tf.rs, instance.rs,
|
||
stmt.rs, keyword_stmt.rs, expr.rs}}, tests/{error_recovery.rs,
|
||
spans.rs}, crates/vlog_formatter/src/format/{module,instance,routine,
|
||
expr,stmt}.rs (one arm each), crates/vlog_semantic/src/bind/{item,
|
||
decl,expr,stmt}.rs (ignore arms), crates/vlog_linter/src/{signals.rs,
|
||
visit.rs, context.rs} (opaque-span arms, if the match is exhaustive),
|
||
crates/lucisv_server/src/{symbols.rs, diagnostics.rs}/tests (pins
|
||
only), crates/lucisv_server/src/perf.rs (measurement only), docs/
|
||
features/header-recovery/README.md (new), amendments in error-recovery
|
||
README, docs/coverage_gaps.md M10, TODO §32. Runs after §31 (parser +
|
||
formatter collide with §30's tf.rs/module.rs at merge; sequential).
|
||
- [x] 32.1 error elements in the four list types + `ExprKind::Error`;
|
||
cross-crate arms pre-agreed — one generic `ListElem<T>` over five
|
||
lists (a class's parameter ports are the fifth)
|
||
- [x] 32.2 `element_or_recover` with the list-local, bracket-seeded
|
||
sync set (`,` `)` `;` line change)
|
||
- [x] 32.3 headers keep their node (port, param, tf-port, connection
|
||
lists infallible in tolerant mode; closers via `expect_closer`)
|
||
- [x] 32.4 `for`/`if`/`while`/`case` conditions recover inside the
|
||
parentheses (`repeat` and `do…while` too, same helper)
|
||
- [x] 32.5 parser pins per shape with exact counts; walkers extended;
|
||
550-source equality and the fuzzers green
|
||
- [x] 32.6 server pins: symbols survive, completion scope survives, one
|
||
diagnostic, validity probes unchanged
|
||
- [x] 32.7 docs + measurements (parse_tolerant timing, truncated-corpus
|
||
diagnostic census — error nodes 622 → 555, diagnostics 1 702 →
|
||
1 826: the constructs that now survive report their own missing
|
||
closers)
|
||
- [x] Gates: fmt/clippy/`cargo test --workspace`; corpus 814/820
|
||
byte-identical (strict path untouched); opentitan read-only sweep
|
||
unchanged
|
||
- [x] QA: type each of the (a)–(f) shapes into the real server against
|
||
an opentitan file and read the published diagnostics and the
|
||
outline; the fuzzers re-run; strict-mode parity re-derived
|
||
|
||
## 33. Linter expansion, wave 1 (planned 2026-09-02) — severities, per-rule editor toggles, and the Error/Warning-class rules
|
||
|
||
Owner's ask: expand the linter toward what Verible's linter covers (62
|
||
rules, https://chipsalliance.github.io/verible/lint.html), expose every
|
||
rule in VS Code as a toggle grouped by severity so a user can enable or
|
||
disable rules one at a time or a whole severity at once, and put the
|
||
style rules and the "would likely fail to compile or synthesize" rules
|
||
first. Today: 17 rules, no severity notion (`Rule` has `name`,
|
||
`summary`, `doc`, `default_on`, `needs_workspace`, `fix`, `check`), every
|
||
editor diagnostic is `WARNING`, the editor surface is
|
||
`lucisv.lint.select`/`ignore` lists. Dev Opus 5, QA Sonnet 5. Feature
|
||
README: `docs/features/linter-expansion-1/README.md`. Runs in a
|
||
worktree in parallel with §31 (fences: `vlog_formatter`, README.md's
|
||
"Turning the formatter off" section only); this lane owns
|
||
`vlog_linter`, `lucisv/src/lint.rs` + args, `lucisv_server/src/
|
||
{settings,lint}.rs`, `editors/vscode/{package.json,README.md}`, README.md's
|
||
"Linting" section, `docs/site/.../reference/rules.md`.
|
||
|
||
**33.0 Severity, end to end.**
|
||
(a) `vlog_linter`: `pub enum Severity { Error, Warning, Style }` with
|
||
`as_str` (`error`/`warning`/`style`) and `Rule::severity(&self) ->
|
||
Severity` (no default — every rule states it; the reason goes in the
|
||
rule's `doc`). Assignments for the 17: **Error** — `multiply-driven`
|
||
(two procedural drivers of one variable is an elaboration error in
|
||
SystemVerilog), `wire-reg-mixup` (a procedural assignment to a net is a
|
||
compile error); **Warning** — `always-comb-blocking`,
|
||
`always-ff-non-blocking`, `case-missing-default`, `undriven-net`,
|
||
`unused-signal`; **Style** — `empty-item`, `enum-name-style`,
|
||
`explicit-parameter-storage-type`, `module-filename`,
|
||
`module-name-style`, `no-tabs`, `no-trailing-whitespace`,
|
||
`parameter-name-style`, `struct-union-name-style`, `unused-waiver`.
|
||
`Violation` carries the severity (set by the runner from the rule, not
|
||
by each rule). (b) `select_rules(select, ignore, …)` accepts a severity
|
||
name wherever a rule name is accepted — `--select style`, `--ignore
|
||
warning`, `[lint] ignore = ["style"]` — expanding to every rule of that
|
||
severity; an unknown name still fails naming the file. (c) CLI text
|
||
output becomes `FILE:LINE:COL: error|warning|style: message [rule]`
|
||
(the severity word is new; pin the old tests to the new shape); JSON
|
||
gains `"severity"`. Exit codes unchanged. (d) Editor:
|
||
`DiagnosticSeverity::ERROR` / `WARNING` / `INFORMATION` respectively;
|
||
`source` unchanged. (e) `--rules-doc` and `rules_markdown()`: a
|
||
Severity column, sections grouped by severity, the intro explaining the
|
||
three words.
|
||
|
||
**33.1 Editor toggles, generated from the registry.** In
|
||
`editors/vscode/package.json`: three master switches
|
||
`lucisv.lint.severity.error`, `.warning`, `.style` (boolean, default
|
||
true, `order` 10/11/12, description naming what each class means), and
|
||
one boolean per rule `lucisv.lint.rules.<rule-name>` (default = the
|
||
rule's default; `markdownDescription` = `**severity** — summary`; the
|
||
project-only rules say "on where lucisv can see the project"; `order`
|
||
sorted by severity then name so the Settings UI groups them; the
|
||
existing `lucisv.lint.select`/`ignore` stay, documented as the
|
||
power-user spelling). Generated, not hand-written: a
|
||
`crates/vlog_linter/examples/vscode_lint_settings.rs` (or a `tools/`
|
||
script driving `cargo run --example`) that prints the JSON fragment,
|
||
and a `crates/lucisv_server` test that parses package.json and asserts
|
||
the `lucisv.lint.rules.*` set, defaults and descriptions equal the
|
||
registry — the drift guard, so a new rule cannot ship without its
|
||
toggle. The server (`settings.rs`) reads all of them; the enabled set
|
||
is computed in one documented function `enabled_rules(settings,
|
||
has_oracle)` with this precedence, top to bottom: (1) the base set is
|
||
the defaults (`default_on`, and `needs_workspace` rules only with an
|
||
oracle); (2) a non-empty `select` replaces the base set; (3) a severity
|
||
switch that is off removes every rule of that severity; (4) an
|
||
explicitly set per-rule toggle sets or clears that rule; (5) `ignore`
|
||
removes — the off switch of last resort. Pinned by a table test.
|
||
Changing any of them republishes every open file, as select/ignore do.
|
||
The CLI has parity through select/ignore with severity names; no
|
||
per-rule flags (`--ignore rule` is that).
|
||
|
||
**33.2 New rules, Error class** (each a file under `rules/`, its own
|
||
tests, its doc with the Verible name where one exists, and a measured
|
||
false-positive count on opentitan — see QA):
|
||
- `mismatched-labels` (Verible, off there; **on** here, Error): an end
|
||
label that does not match its block's name (`end : wrong`, `endmodule
|
||
: other`) — a compile error. Reuse what linked-editing already pairs.
|
||
- `duplicate-declaration` (Error): the same name declared twice in one
|
||
scope (port and signal, two signals, two params). Ask the binder:
|
||
`Binder::declare` sees the second declaration — record it (a
|
||
`Semantics` query `duplicates()` or a per-scope check), skip generate
|
||
scopes and macro-expanded text; no false positive on `input clk`
|
||
+ `logic clk` non-ANSI redeclaration (legal) — pin it.
|
||
- `undeclared-identifier` (Error, `needs_workspace`): a use the file
|
||
did not resolve and the workspace overlay left `StillUnresolved`/
|
||
`NotFound`, excluding: names inside macro invocations, system names,
|
||
names a `` `define`` in scope produces, names the file's macro-word
|
||
census contains, hierarchical tails, names in a package this file
|
||
wildcard-imports when that package is not indexed. Measured on
|
||
opentitan; ships default-on only if the count of unexplained
|
||
findings on that tree is 0 — otherwise default-off with the
|
||
measurement and the reason in the doc.
|
||
- `unknown-port` and `unknown-parameter` (Error, `needs_workspace`): a
|
||
named connection `.x(…)` / override `.P(…)` naming a port or
|
||
parameter the instantiated module does not declare (the index
|
||
exports both). Silent when the module is not indexed or is declared
|
||
twice with different shapes.
|
||
|
||
**33.3 New rules, Warning class** (Verible name, default there → here):
|
||
- `forbid-defparam` (on → on): `defparam` is deprecated and rejected by
|
||
some tools.
|
||
- `invalid-system-task-function` (on → on): `$psprintf`, `$random`
|
||
(use `$urandom`), `$dist_*`, `$srandom` … Verible's list, cited.
|
||
- `truncated-numeric-literal` (on → on): a sized literal whose value
|
||
does not fit its width (`4'hFFF`).
|
||
- `undersized-binary-literal` (on → on, safe fix pads): `8'b1`; binary
|
||
only by default, as Verible.
|
||
- `suspicious-semicolon` (off → **on**): `if (x);`, `for (…);`,
|
||
`while (…);` — a body that is a null statement.
|
||
- `packed-dimensions-range-ordering` (on → on): a packed dimension
|
||
written `[0:N-1]`.
|
||
- `module-port` and `module-parameter` (on → on): positional
|
||
connections/overrides when more than one port/parameter.
|
||
- `explicit-function-task-parameter-type` (on → on): an untyped tf
|
||
argument is a 1-bit `logic` — a silent truncation.
|
||
- `plusarg-assignment` (on → on): `$value$plusargs` result unused /
|
||
`$test$plusargs` misuse, as Verible defines it.
|
||
- `instance-shadowing` (off → **on**): a declaration shadowing one in
|
||
an enclosing scope of the same unit (the binder knows).
|
||
- `forbid-negative-array-dim` (off → on): a negative literal in a
|
||
dimension.
|
||
- `void-cast` (on → on): `void'(…)` around anything but a function
|
||
call that has a return value (Verible's rule).
|
||
- `incomplete-assignment` (no Verible equivalent; Warning): in an
|
||
`always_comb`, a variable assigned in the `then` branch of an `if`
|
||
with no `else` (or in some `case` items, not `default`) and not
|
||
assigned unconditionally earlier in the block — latch inference.
|
||
Conservative by construction: only flag when the block has no
|
||
unconditional assignment to that variable before the `if`/`case`;
|
||
measured on opentitan.
|
||
|
||
**33.4 Docs and measurement.** README.md "Linting" (severities, the
|
||
toggles, select/ignore with severity names), `editors/vscode/README.md`
|
||
settings table, the docs-site rules page (hand-written prose today —
|
||
add the new rules with their severity and a note that `--rules-doc` is
|
||
the generated truth), CHANGELOG untouched (the lead writes it). For
|
||
every new rule: findings on the corpus and on opentitan `hw/`
|
||
(read-only `lucisv check`), with ten findings read and classified per
|
||
rule (true / false positive / needs judgment); opentitan is lint-clean
|
||
under Verible, so a Verible-equivalent rule that fires there needs an
|
||
explanation (their config disables it, or our reading differs — say
|
||
which). Timing: `lucisv check` over opentitan before/after (the
|
||
semantic rules already dominate; the new ones must not add more than a
|
||
few percent).
|
||
|
||
Files: crates/vlog_linter/src/{registry.rs, rule_docs.rs, violation.rs,
|
||
lib.rs, rules/mod.rs, rules/<new>.rs, context.rs (if a semantics query
|
||
is needed), visit.rs (new walkers)} + tests/cases/*.lint,
|
||
crates/vlog_linter/examples/vscode_lint_settings.rs (new),
|
||
crates/vlog_semantic (only if `duplicates()`/shadowing needs a query —
|
||
additive, say so in Handshakes), crates/lucisv/src/{lint.rs, args.rs}
|
||
+ tests, crates/lucisv_server/src/{settings.rs, lint.rs} + tests,
|
||
editors/vscode/{package.json, README.md}, README.md "Linting",
|
||
docs/site/src/content/docs/reference/rules.md, docs/features/
|
||
linter-expansion-1/README.md (new), TODO §33. Worktree `lint-1`.
|
||
- [x] 33.0 `Severity` on every rule; select/ignore by severity; CLI
|
||
text/JSON; editor severities; `--rules-doc` grouped
|
||
- [x] 33.1 package.json toggles generated + drift test; `enabled_rules`
|
||
precedence pinned; republish on change
|
||
- [x] 33.2 Error rules: mismatched-labels, duplicate-declaration,
|
||
undeclared-identifier (measured; default decided by the count),
|
||
unknown-port, unknown-parameter
|
||
- [x] 33.3 Warning rules: the thirteen listed, each with tests and an
|
||
opentitan count
|
||
- [x] 33.4 docs; measurements table in the README
|
||
- [x] Gates: fmt/clippy/`cargo test --workspace`; corpus 814/820
|
||
byte-identical (formatter untouched); opentitan read-only
|
||
`lucisv check` census + timing
|
||
- [x] QA: every new rule attacked with hand-written true positives and
|
||
near-misses; the false-positive census re-read; toggles exercised
|
||
through the real server (`workspace/didChangeConfiguration`)
|
||
|
||
## 34. Linter expansion, wave 2 (planned 2026-09-03) — per-rule options, and the first eighteen Style rules
|
||
|
||
After §33 (36 rules, severities, toggles). Two things this wave adds:
|
||
the **option plumbing** every configurable rule needs, and the Style
|
||
rules from Verible's list that carry the most weight in a style guide
|
||
(naming, file layout, generate labels, typedefs, line length). Dev
|
||
Opus 5, QA Sonnet 5. Feature README: `docs/features/linter-expansion-2/
|
||
README.md`. Mapped: `lucisv_core::config` parses one table, `[lint]`,
|
||
with `select`/`ignore`, and rejects `[lint.<rule>]` by name
|
||
(`config.rs::parse_entry`: "per-rule lint settings … are not supported
|
||
yet"); the editor has `lucisv.lint.select/ignore/severity.*/rules.*`;
|
||
`Rule` has no notion of options; `LintContext` carries source, tokens,
|
||
tree, semantics slot and the oracle; `line-length` already lives in
|
||
`FileConfig` for the formatter.
|
||
|
||
**34.0 Options, end to end.**
|
||
(a) `vlog_linter`: `pub struct OptionSpec { name: &'static str, kind:
|
||
OptionKind (Bool | Int { min, max } | Str | Regex | List), default:
|
||
OptionValue, doc: &'static str }` and `Rule::options(&self) ->
|
||
&'static [OptionSpec]` (default empty); `RuleOptions` — a validated
|
||
map `rule → key → OptionValue` built by `RuleOptions::parse(rule, key,
|
||
raw)` that rejects an unknown key ("rule `x` has no option `y`; it has:
|
||
…"), a wrong kind, an out-of-range int or an invalid regex, each with
|
||
the message the two front ends print with file and line. `LintContext`
|
||
carries `&RuleOptions`; a rule reads `ctx.option_str(NAME, "pattern")`
|
||
etc. with the spec's default as the fallback, so a rule never sees
|
||
"unset". (b) `lucisv_core::config`: `[lint.<rule>]` tables accepted —
|
||
`key = value` for bool/int/string, `key = ["a", "b"]` for lists —
|
||
stored raw in `FileConfig::lint_options: Vec<(rule, key, raw, line)>`
|
||
(the core crate does not know the rules); the CLI resolves them
|
||
against the registry per file the way `[lint] select` names are
|
||
checked, failing the run with file:line on the first bad entry. (c)
|
||
Editor: `lucisv.lint.options` (object; `{"<rule>": {"<key>": value}}`,
|
||
`additionalProperties`), parsed in `settings.rs`, validated the same
|
||
way — a bad entry is a `window/logMessage` warning and is ignored, so
|
||
one typo cannot switch the linter off; republish on change. (d)
|
||
Precedence: editor options over `lucisv.toml` options over the spec
|
||
default, key by key (the same ladder `lucisv.lineLength` uses — cite
|
||
`format::settings_for`). (e) `--rules-doc` lists each rule's options
|
||
with kind, default and doc; the VS Code generator emits nothing per
|
||
option (the object setting covers them) but its description names the
|
||
options each rule takes. (f) Pins: parse/validate table tests; a
|
||
`lucisv.toml` with `[lint.line-length] length = 120` changes the
|
||
verdict; the editor object does the same over the wire; a bad key
|
||
fails the CLI naming file:line and only logs in the editor.
|
||
|
||
**34.1 Options on the existing naming rules** (so the family is
|
||
consistent before the new members arrive): `enum-name-style`,
|
||
`struct-union-name-style`, `module-name-style`, `parameter-name-style`
|
||
gain the option Verible gives them (`style_regex`; `parameter-name-
|
||
style` gets `localparam_style`/`parameter_style` with Verible's
|
||
`CamelCase|ALL_CAPS` vocabulary plus the `_regex` overrides); defaults
|
||
reproduce today's behaviour exactly (pin: the corpus and opentitan
|
||
finding lists are byte-identical with no options set).
|
||
|
||
**34.2 New Style rules** (Verible name; default there → here; options):
|
||
- `line-length` (on; `length`, default = the formatter's configured
|
||
`line-length`, else 100) — a token-aware check that ignores a line
|
||
that is one unbreakable token (a long string or macro invocation),
|
||
as Verible does.
|
||
- `posix-eof` (on; safe fix appends the newline).
|
||
- `forbid-consecutive-null-statements` (on; safe fix) — `;;` at
|
||
statement level, the statement twin of `empty-item`.
|
||
- `generate-label` (on) and `generate-label-prefix` (on; `prefix`
|
||
list, default `g_`/`gen_`).
|
||
- `package-filename` (on; `allow-dash-for-underscore`, same as
|
||
`module-filename`).
|
||
- `one-module-per-file` (off).
|
||
- `signal-name-style` (off; `style_regex`, default `[a-z_0-9]+`).
|
||
- `interface-name-style` (on; `style_regex`, default `[a-z_0-9]+(_if)`).
|
||
- `macro-name-style` (on; `style_regex`, default `[A-Z_0-9]+`; the
|
||
macro's own name from the `` `define`` table).
|
||
- `constraint-name-style` (on; `pattern`, default `([a-z0-9]+_)+c`).
|
||
- `parameter-type-name-style` (off; lower_snake + `_t`).
|
||
- `port-name-suffix` (off; `_i`/`_o`/`_io`/`_ni`/`_no`/`_nio` per
|
||
Verible; option `suffixes` list).
|
||
- `banned-declared-name-patterns` (off; `patterns` list of regexes).
|
||
- `typedef-enums` (on) and `typedef-structs-unions` (on;
|
||
`allow_anonymous_nested`).
|
||
- `always-comb` (on; **unsafe** fix rewriting `always @*`/`@(*)` to
|
||
`always_comb` — the two are not identical at time zero, so the fix is
|
||
offered but not applied by default).
|
||
- `explicit-begin` (off; the eleven `*_enable` bool options Verible
|
||
has; safe fix wraps the body in `begin`/`end`).
|
||
Each: its own file, true positives and near-misses, a `.lint` case,
|
||
corpus + opentitan counts with ten findings read and classified;
|
||
opentitan is Verible-clean for its `dvsim` filesets, so a
|
||
Verible-default rule that fires inside them needs an explanation.
|
||
|
||
**34.3 Docs and toggles.** The VS Code generator regenerates the 18 new
|
||
`lucisv.lint.rules.*` entries (the drift test enforces it); README.md
|
||
"Linting" gains the options section and the rows; `editors/vscode/
|
||
README.md` documents `lucisv.lint.options`; the docs-site rules page
|
||
gains the sections; CHANGELOG untouched (the lead writes it).
|
||
Remaining Verible rules — `module-begin-block`, `legacy-generate-
|
||
region`, `legacy-genvar-declaration`, `v2001-generate-begin`,
|
||
`explicit-function-lifetime`/`explicit-task-lifetime`,
|
||
`positive-meaning-parameter-name`, `suggest-parentheses`,
|
||
`unpacked-dimensions-range-ordering`, `uvm-macro-semicolon`,
|
||
`create-object-name-match`, `numeric-format-string-style`,
|
||
`macro-string-concatenation`, `disable-statement`, `forbidden-macro`/
|
||
`forbidden-symbol`, `endif-comment`, `forbid-line-continuations`,
|
||
`dff-name-style`, `proper-parameter-declaration` — are §35, wave 3.
|
||
|
||
Files: crates/vlog_linter/src/{registry.rs (OptionSpec, options()),
|
||
options.rs (new: OptionKind/OptionValue/RuleOptions), context.rs,
|
||
rule_docs.rs, vscode.rs, lib.rs, rules/<new>.rs, rules/<naming>.rs}
|
||
+ tests/cases/*.lint, crates/lucisv_core/src/config.rs (+ tests),
|
||
crates/lucisv/src/{lint.rs, args.rs?} + tests, crates/lucisv_server/
|
||
src/{settings.rs, lint.rs} + tests, editors/vscode/{package.json,
|
||
README.md}, README.md "Linting", docs/site/.../reference/rules.md,
|
||
docs/features/linter-expansion-2/README.md (new), TODO §34. Worktree
|
||
`lint-2`; disjoint from §32 (parser) so the two may run in parallel.
|
||
Every suite and sweep under `tools/guard.sh`.
|
||
- [x] 34.0 options end to end (spec, validation, toml table, editor
|
||
object, precedence, --rules-doc); pins
|
||
- [x] 34.1 options on the four existing naming rules; defaults
|
||
byte-identical
|
||
- [x] 34.2 the eighteen Style rules, each with tests, counts and ten
|
||
classified findings
|
||
- [x] 34.3 docs + regenerated toggles
|
||
- [x] Gates (guarded): fmt/clippy/`cargo test --workspace`; corpus
|
||
814/820 byte-identical; vsix smoke; opentitan read-only census +
|
||
timing vs 0.36.0
|
||
- [x] QA: options attacked (bad key/kind/range/regex on both front
|
||
ends), every rule with near-misses, the census re-read
|
||
|
||
## 35. Linter expansion, wave 3 (planned 2026-09-04) — the remaining Verible rules
|
||
|
||
After §34 (54 rules, options end to end). The twenty Verible rules not
|
||
yet in lucisv, each a small file on the §33/§34 pattern (severity,
|
||
Verible name and default cited, options through `OptionSpec`, true
|
||
positives and near-misses, a `.lint` case, corpus + opentitan counts
|
||
with ten findings classified; every new gap between tokens a rule reads
|
||
is the parser's, not the rule's). Dev Opus 5, QA Sonnet 5, worktree
|
||
`lint-3`, every suite and sweep under `tools/guard.sh`. Feature README:
|
||
`docs/features/linter-expansion-3/README.md`.
|
||
|
||
Rules (Verible default → lucisv default; severity; options):
|
||
- `module-begin-block` (on → on; Style): a `begin`/`end` at module scope.
|
||
- `legacy-generate-region` (off → off; Style): `generate … endgenerate`.
|
||
- `legacy-genvar-declaration` (off → off; Style): a `genvar` declared
|
||
outside the `for` header.
|
||
- `v2001-generate-begin` (on → on; Style): a bare `begin` in a generate
|
||
region.
|
||
- `explicit-function-lifetime` / `explicit-task-lifetime` (on → on;
|
||
Style): `automatic`/`static` stated outside classes.
|
||
- `positive-meaning-parameter-name` (on → on; Style): no `disable_`
|
||
prefixed parameters.
|
||
- `suggest-parentheses` (on → on; Style): `a ? b : c` inside another
|
||
ternary or a mixed-precedence expression without parentheses (Verible's
|
||
shape, cited).
|
||
- `unpacked-dimensions-range-ordering` (on → on; Style): `[N-1:0]`
|
||
unpacked.
|
||
- `uvm-macro-semicolon` (off → off; Warning): `` `uvm_* `` macros ending
|
||
in `;`.
|
||
- `create-object-name-match` (on → on; Warning): `type_id::create("x")`
|
||
whose string differs from the variable.
|
||
- `numeric-format-string-style` (off → off; Style): `%d`/`%h` prefixes
|
||
in format strings.
|
||
- `macro-string-concatenation` (off → off; Warning): `` `"…`" `` misuse.
|
||
- `disable-statement` (off → off; Warning): `disable` outside a
|
||
`fork`/sequential block.
|
||
- `forbidden-macro` (on → on; Warning; option `macros` list, default
|
||
Verible's `uvm_warning`) and `forbidden-symbol` (on → on; Warning;
|
||
option `symbols` list, default `$psprintf`, `$random`, `$dist_*` per
|
||
Verible — folding `invalid-system-task-function`'s list into an
|
||
option if the two overlap; say which).
|
||
- `endif-comment` (off → off; Style; safe fix appends `// name`).
|
||
- `forbid-line-continuations` (on → on; Style): a `\` continuation
|
||
inside a string literal.
|
||
- `dff-name-style` (off → off; Style; options `input`, `output`,
|
||
`waive_ifs_with_conditions`, `waive_lhs_regex` as Verible).
|
||
- `proper-parameter-declaration` (off → off; Style; options
|
||
`package_allow_parameter`, `package_allow_localparam`).
|
||
- `void-cast`'s named-call half (Verible's forbidden-call list) as an
|
||
option on the existing rule.
|
||
Plus the LOW from §34's QA: a checked-in `tests/e2e.rs` case for
|
||
`lucisv.lint.options` over the wire. Docs: the toggles regenerated,
|
||
README.md rows, docs-site sections, coverage_gaps "linter" addendum.
|
||
- [x] the twenty rules, each with tests and counts
|
||
- [x] `void-cast` option; `forbidden-*` lists; `invalid-system-task-
|
||
function` reconciled
|
||
- [x] e2e case for `lucisv.lint.options`
|
||
- [x] docs + regenerated toggles
|
||
- [x] Gates (guarded): fmt/clippy/`cargo test --workspace`; corpus
|
||
814/820 byte-identical; vsix smoke; opentitan census + timing
|
||
- [x] QA: every rule attacked; census re-read; options attacked
|
||
|
||
|
||
## 36. Small items, round 3 (planned 2026-09-04) — topo §2.9-24, §2.9-25, atomic writes
|
||
|
||
One lane, in the main tree (owner's call: no worktree, no parallel lane; QA
|
||
reads the same tree). Dev: Opus 5. QA: Sonnet 5. Feature README:
|
||
`docs/features/small-items-3/README.md`. Ships as 0.40.0.
|
||
|
||
**File ownership** (the whole tree is free, but this is the expected touch
|
||
set — anything outside it is named in the work log):
|
||
`crates/vlog_parser/src/parser/{item.rs,instance.rs,recover_list.rs}`,
|
||
`crates/vlog_parser/src/ast/{mod.rs,module.rs}`,
|
||
`crates/vlog_parser/tests/error_recovery.rs`,
|
||
`crates/vlog_formatter/src/format/item.rs` (one arm),
|
||
`crates/vlog_linter/src/rules/{module_begin_block,v2001_generate_begin}.rs`
|
||
and every exhaustive `ItemKind` match the new variant reaches
|
||
(`vlog_semantic`, `vlog_refactor`, `lucisv_server`, `vlog_linter/visit.rs`),
|
||
`crates/lucisv_core/src/{atomic.rs (new),cache.rs,lib.rs}`,
|
||
`crates/lucisv/src/{main.rs,lint.rs}`, the two rules' rows in `README.md`
|
||
and `docs/site/src/content/docs/reference/rules.md`, `docs/topo.md` §2.9
|
||
(strike 24 and 25 — lead does this at review), this section.
|
||
|
||
### 36.1 A bare `begin … end` at module scope or in a generate region is recovered as a block (topo §2.9-25)
|
||
|
||
Today `parse_keyword_item` has no `begin` arm, so the item fails with
|
||
"expected item", `item_or_recover` skips to a sync point and the rest of the
|
||
unit is lost. Wanted: in **tolerant mode only**, the block is parsed and kept.
|
||
|
||
- New `ItemKind::GenBlock(Box<GenBlock>)` — the existing generate-block node
|
||
(`is_block: true`, label optional). No new node type.
|
||
- `parse_keyword_item`: a `"begin"` arm. Strict mode: the same "expected
|
||
item" error as today (byte-identity of every corpus file depends on the
|
||
strict parser refusing this; nothing about strict mode changes).
|
||
Tolerant mode: `self.record("`begin`/`end` block is not a module item")`
|
||
*at the `begin` keyword*, then `parse_gen_block()` and wrap it. The
|
||
diagnostic is not optional: the file must still be reported as not
|
||
parsing cleanly, so the formatter's "zero errors or nothing" contract
|
||
keeps refusing it exactly as before.
|
||
- Consumers, each the boring choice: the formatter prints it the way
|
||
`gen_block` prints an `if` arm's block (indent the items, `end`, the end
|
||
label if any) — it never reaches output today (a diagnostic is always
|
||
recorded) but the arm exists so a future range/tolerant printer has
|
||
nothing to invent; the semantic binder walks its items as one unnamed
|
||
generate block scope, the same scope shape an unlabeled `if` arm's block
|
||
gets (find how `GenIf` arms are bound and reuse that path — do not invent
|
||
a scope kind); `visit.rs`/outline/refactor walkers descend into
|
||
`items` and nothing else.
|
||
- The two rules stop reading an error leaf: `begin_block(item)` returns the
|
||
`begin` keyword's range (`span.start .. +5`) of an `ItemKind::GenBlock`
|
||
and `None` for everything else; delete `first_word_is_begin`. Doc strings
|
||
of both rules: replace the "parser rejects … rest of the module is lost"
|
||
paragraph with the truth (the parser recovers the block in tolerant mode
|
||
and records a diagnostic; the block's items are visible to every other
|
||
rule). Same paragraph in `README.md`'s rule rows and `rules.md`.
|
||
- Tests (in `tests/error_recovery.rs` and the two rules' modules):
|
||
`a_module_scope_begin_block_keeps_its_items_and_the_items_after_it`
|
||
(block with a `wire` inside, an `assign` after it, `endmodule` consumed,
|
||
exactly one diagnostic at `begin`); the generate-region twin; strict mode
|
||
still refuses both (an `Err`, not a node); an `end : label` on the block
|
||
round-trips into `end_label`; a nested `begin` inside the block recovers
|
||
the same way (two diagnostics, both blocks kept); the two rules each fire
|
||
once, at the keyword, and a *different* rule sees a violation written
|
||
inside the block (proof the items survive); the size pins in
|
||
`ast::size_pins` unchanged (the variant is boxed).
|
||
|
||
### 36.2 A half-typed `#(` override whose value could read as a call (topo §2.9-24)
|
||
|
||
Source (the QA finding in the header-recovery README, verbatim):
|
||
```
|
||
module m;
|
||
sub #(.WIDTH(8), .DEPTH(
|
||
u0 (.a(x), .b(y));
|
||
endmodule
|
||
```
|
||
The value of `.DEPTH(` is parsed greedily; `u0 (.a(x), .b(y))` is a legal
|
||
call with named arguments, so no error fires inside the list and the whole
|
||
instantiation collapses to an item-level `Error`. Wanted: the element
|
||
`.DEPTH(` is an error element, `.WIDTH(8)` survives, `u0` is an instance
|
||
with two connections, one diagnostic.
|
||
|
||
- One lookahead in `parse_connection`, tolerant mode only, before the value
|
||
is parsed (`parse_expr_or_type`): `fn value_runs_into_next_instance(&self)
|
||
-> bool`. Walk tokens from the cursor with a bracket depth starting at 0.
|
||
A closer that would take the depth below 0 is the value's own `)`: return
|
||
`false` — the value closes and is parsed normally. At depth 0, an
|
||
identifier that is the first token of its line and whose next token is
|
||
`(` is *remembered* as the candidate next instance. A `;` at depth 0, a
|
||
sync keyword (`endmodule`, `endinterface`, … — reuse the predicate
|
||
`at_sync_stop` is built on) or EOF ends the walk: return whether a
|
||
candidate was seen. That is: the value's `(` is never closed **and**
|
||
something that looks like the next instance sits inside it. On a valid
|
||
file the walk ends at the value's `)` after a handful of tokens, so cost
|
||
is nothing; only an unclosed value walks to the next `;`.
|
||
- When it returns `true`, fail the element with an error whose span is the
|
||
unclosed `(` (`paren_start`), message "unclosed `(` in a port or parameter
|
||
connection". `element_or_recover` turns it into the error element and the
|
||
existing skip (bracket-seeded, stops at the first token of a new line)
|
||
must leave the cursor on `u0`; `list_ends` then ends the override list
|
||
(recovered, no comma), `close_list` forgives the missing `)`, and the
|
||
instance loop reads `u0`. Verify that tree exactly; if the skip lands
|
||
elsewhere, fix the skip's start, not the lookahead.
|
||
- The same helper covers the connection list: `sub u0 (.a(` ⏎ `u1 (.b(y));`
|
||
costs one connection and keeps `u1` as a second instance.
|
||
- The ambiguous shape stays ambiguous: with the parens balancing
|
||
(`.D(` ⏎ `u0 (.a(x)));`) the value closes, the walk returns `false`, the
|
||
greedy parse wins — pin that as a test so nobody "fixes" it later.
|
||
- Tests: the README shape above (params `[Ok, Error]`, one instance, two
|
||
connections, one diagnostic at the `(`, `endmodule` consumed); the
|
||
connection-list twin; the balanced-parens control; a legal multi-line
|
||
value `.DEPTH(` ⏎ `f(1)` ⏎ `)` parses identically in strict and tolerant
|
||
mode (the parity test `tolerant_parse_equals_strict_parse_on_valid_sources`
|
||
plus a direct case); the header-recovery README's finding gets a work-log
|
||
line pointing here.
|
||
|
||
### 36.3 Atomic in-place writes (§1 backlog item, QA find of 2026-08-25)
|
||
|
||
`process_file` (`lucisv/src/main.rs`) and `--fix` (`lucisv/src/lint.rs`)
|
||
write with `fs::write`, which truncates then writes; `cache.rs` already does
|
||
tempfile + rename by hand. One shared helper, three users.
|
||
|
||
- `crates/lucisv_core/src/atomic.rs`: `pub fn write_atomic(path: &Path,
|
||
bytes: &[u8]) -> io::Result<()>`. Resolve symlinks first
|
||
(`fs::canonicalize` when the path exists — `fs::write` writes *through* a
|
||
symlink and a rename onto the link would replace it with a file; the
|
||
canonical target is what gets replaced). Temp file in the target's
|
||
directory, `.{file_name}.{pid}.lucisv-tmp`; write; copy the target's
|
||
permissions onto it when the target exists (`set_permissions`, so a
|
||
0600 or 0755 file stays that way); `rename` onto the target; on any
|
||
failure after the temp exists, remove it and return the error. No new
|
||
dependency.
|
||
- `cache.rs` uses the helper instead of its inline copy (behaviour
|
||
identical; its `no_temporary_file_is_left_behind` test keeps passing).
|
||
`main.rs:309` and `lint.rs:315` call it.
|
||
- Tests in `atomic.rs`: bytes land; no temp file left in the directory
|
||
after success; after a failed rename (target path is a directory) no
|
||
temp file is left and `Err` comes back; permissions preserved
|
||
(`#[cfg(unix)]`); writing through a symlink replaces the *target* and the
|
||
link still points at it; a new file (no prior target) is created.
|
||
|
||
### Gates (dev runs, all guarded)
|
||
|
||
`cargo fmt -p` per touched crate; `cargo clippy --all-targets` clean;
|
||
`tools/guard.sh -- cargo test --workspace`; `tools/guard.sh --
|
||
tools/corpus_check.sh` still 814/820 with the same six failures; the
|
||
`tests/error_recovery.rs` truncation and single-character-deletion fuzz
|
||
tests green (they are the termination guard for 36.1/36.2). Lead at review:
|
||
byte-identity of every corpus file against the cached 0.39.0 binary,
|
||
opentitan read-only sweep, vsix smoke, 0.40.0.
|
||
|
||
- [x] 36.1 `ItemKind::GenBlock`, the `begin` arm, consumers, the two rules
|
||
- [x] 36.2 the lookahead, the four tests
|
||
- [x] 36.3 `write_atomic`, three users, tests
|
||
- [x] docs: feature README, rule rows, header-recovery work-log line
|
||
- [x] Gates (guarded)
|
||
- [x] QA: every shape above typed against the tolerant parser and the two
|
||
rules; the ambiguous control; strict/tolerant parity re-run; the
|
||
truncation fuzzers re-run; atomic writes attacked (symlink, mode,
|
||
directory target, concurrent writers on one inode) — REWORK (small):
|
||
`mismatched-labels` had no arm for the block; fixed by the lead at
|
||
review with a test, plus the LOW doc comment and a read-only-target
|
||
refusal in `write_atomic` (parity with the old `fs::write`)
|
||
|
||
## 37. Server residue from §10 (planned 2026-09-04) — lazy codeAction resolve, the inlayHint zero, `locate` onto `DeclPositions`
|
||
|
||
One lane in the main tree, dev Opus 5 then QA Sonnet 5, same protocol as
|
||
§36 (lead snapshots the diff before QA; QA never runs a git command that
|
||
rewrites the tree). Feature README: `docs/features/lazy-code-action/README.md`
|
||
(one README for the three, sections per item). Ships as 0.41.0.
|
||
|
||
**Expected touch set:** `crates/lucisv_server/src/{ports.rs,code_action.rs,
|
||
locate.rs,nav.rs,symbols.rs,inlay.rs,main.rs,state.rs,perf.rs}`,
|
||
`crates/lucisv_server/src/server/{dispatch.rs,mod.rs}`,
|
||
`crates/lucisv_server/tests/e2e.rs`, `crates/vlog_refactor/src/ports/mod.rs`
|
||
(only if the offer needs a new one-file question), the §10 lines this closes
|
||
(1236–1249 and 1293), `docs/features/server-lint/README.md`'s resolve note,
|
||
this section. Anything else is named in the work log.
|
||
|
||
### 37.1 `codeAction/resolve` for the port refactorings (§10, owner-approved)
|
||
|
||
`ports::code_actions` costs ~1.4 ms per instantiating file plus a 13 ms
|
||
floor on every cursor move (`docs/performance_take2.md` §6a: 185 ms at a
|
||
128-file fan-out, to offer zero actions), because the *offer* already
|
||
computes the full edit over `Workspace::module_sources` — the module's
|
||
fan-out **plus every open buffer**, each read as text. The quick fixes in
|
||
`code_action.rs` are cheap and stay eager; only the port actions change.
|
||
|
||
- **The offer is local.** Whether an action exists at the cursor is a
|
||
one-file question plus, for a cursor on an instantiation, the instantiated
|
||
module's own declaration (`vlog_refactor::module_definition` through the
|
||
index — one file, the way `inlay.rs`'s `Plans::read` does it). Run the
|
||
engine's `port_actions` over exactly those sources to learn which actions
|
||
exist; throw the edits away. No fan-out is read. The title's count
|
||
("updates N instantiations") comes from the index
|
||
(`instantiations_of(name)` — say in the doc whether that is instances or
|
||
files, and word the title to match); the unsaved-buffer case in
|
||
`an_unsaved_buffer_contributes_the_instantiation_the_index_has_not_seen`
|
||
is answered by the *resolved* edit, which is still exact — move that pin
|
||
to resolve.
|
||
- **Resolve computes the edit.** Each offered action carries `data`
|
||
(`{uri, position, title}`) and no `edit`. `codeAction/resolve` re-runs
|
||
today's eager path at that position and returns the action whose title
|
||
matches, with its `edit`. No match (the buffer changed under the
|
||
lightbulb) is an error response, `"the action is no longer available"`,
|
||
not a silent empty edit. Advertise `resolve_provider: Some(true)`.
|
||
- **A client that cannot resolve gets today's answer.** Read
|
||
`textDocument.codeAction.resolveSupport.properties` at `initialize`; only
|
||
when it lists `"edit"` is the offer lazy. Keep the flag in the server
|
||
state beside whatever `main.rs` already reads from the client
|
||
capabilities (the range-formatting registration is the precedent).
|
||
- Tests: the lazy offer's titles and kinds equal the eager offer's, over
|
||
the `crowded` tree; the resolved `WorkspaceEdit` is byte-equal to the
|
||
eager one (both cursor shapes: a port declaration, an instantiation with
|
||
missing connections); the no-resolveSupport client gets the eager shape;
|
||
a resolve after the document changed errors; the offer over
|
||
`crowded(40)` reads none of the noise files and none of the fan-out
|
||
(pin it the way `the_files_a_code_action_reads_are_the_modules_own_fan_out`
|
||
pins the eager path — through what the offer asks the workspace for);
|
||
an e2e case over the wire (`tests/e2e.rs`): initialize with
|
||
resolveSupport → `codeAction` returns `data` and no `edit` →
|
||
`codeAction/resolve` returns the edit; initialize without → the edit is
|
||
inline. `perf.rs`'s `a_code_action_at_an_instantiation_before_and_after`
|
||
gains an "offer" column; report the three numbers in the work log.
|
||
|
||
### 37.2 `inlayHint` returns 0 at the default scope where workspace scope returns 4 (§10 / take-2 §8)
|
||
|
||
Investigate before fixing: `Plans::read` asks `module_definition` of the
|
||
index, and at folder or default scope the instantiated module's file may
|
||
not be in the index even though §4b says the default scope now answers
|
||
cross-file questions (the `didOpen` widen). Find which lookup the
|
||
neighbours (hover, signature help, completion) use that inlay does not,
|
||
and make inlay use it. Deliverable is one of: a fix with a test at the
|
||
default scope (a `sub.sv` outside the opened folder, `top.sv` inside it,
|
||
hints appear after the widen), or — if the zero is correct — a paragraph
|
||
in the README saying exactly why, for the lead to rule on. Not a gate.
|
||
|
||
### 37.3 `locate::location` onto `DeclPositions` (§10, filed)
|
||
|
||
`Def::lines.positions` (`DeclPositions { name, decl }`, `Some` for every
|
||
file-scope declaration) already holds the client-side ranges, so
|
||
`textDocument/definition`, references, the lens and both hierarchies need
|
||
not read a file to convert an indexed span. Add the index-only path in
|
||
`locate.rs` for a `Def` whose positions are recorded (members keep the
|
||
file-read path — they have none) and route `nav.rs`/`symbols.rs`'s
|
||
file-scope answers through it. Pins: the index-only `Location` equals the
|
||
file-read one over files with multi-byte and astral characters (UTF-16
|
||
surrogates), CRLF and a BOM; a file-scope definition answers without a
|
||
`file_view` being created (assert through whatever the view cache exposes,
|
||
or add a test-only counter — say which); a definition request over an
|
||
opentitan file timed before/after, read-only, in the work log.
|
||
|
||
### Gates (dev, guarded)
|
||
|
||
`cargo fmt -p` per touched crate; clippy clean; `tools/guard.sh -- cargo
|
||
test --workspace`; `tools/guard.sh -- tools/corpus_check.sh` unchanged
|
||
(814/820, same six); the e2e suite green; vsix smoke. Lead at review:
|
||
byte-identity vs 0.40.0, opentitan read-only sweep, 0.41.0.
|
||
|
||
- [x] 37.1 lazy offer + resolve + capability gate + e2e + perf column
|
||
- [x] 37.2 inlayHint: fix with test, or the written finding — the written
|
||
finding (the zero is correct), plus two default-scope tests
|
||
- [x] 37.3 `locate` index-only path + pins + timing
|
||
- [x] docs: feature README; §10 lines ticked; server-lint note
|
||
- [x] Gates (guarded)
|
||
- [x] QA: resolve attacked (stale document, wrong data, missing data,
|
||
client without resolveSupport, both cursor shapes, unsaved buffer);
|
||
inlay at the default scope against a real two-folder tree; locate
|
||
equality over the encoding shapes; opentitan timing re-derived —
|
||
PASS, no findings above LOW; offer ~4.5 ms vs eager ~77 ms over the
|
||
wire at the 128-file fan-out
|
||
|
||
|
||
## 38. The two §11 parser skips (planned 2026-09-04) — rival headers in a conditional region, a net delay after the type
|
||
|
||
One lane in the main tree, dev Opus 5 then QA Sonnet 5, §36's protocol.
|
||
Feature README: `docs/features/parser-skips/README.md`. Ships as 0.42.0
|
||
together with §39.
|
||
|
||
**Expected touch set:** `crates/vlog_parser/src/parser/{module.rs,split.rs,
|
||
decl.rs}`, `crates/vlog_parser/src/ast/decl.rs`,
|
||
`crates/vlog_formatter/src/format/decl.rs`, `crates/vlog_formatter/tests/cases/*`
|
||
(new cases), `crates/vlog_parser/src/parser/tests/{module.rs,decl.rs,split.rs}`,
|
||
`crates/vlog_parser/tests/error_recovery.rs`, the two §11 lines (1453, 1459),
|
||
this section.
|
||
|
||
### 38.1 Two rival, bracket-balanced module/interface headers in an `ifdef`/`else` region (`jtag_if.sv`)
|
||
|
||
The real file: `/Users/guoliangchen/repo/opentitan/hw/dv/sv/jtag_agent/jtag_if.sv`
|
||
(read-only; copy it into a test case). Shape:
|
||
```
|
||
`ifdef GATE_LEVEL
|
||
interface jtag_if #(parameter int unsigned P = 41_664) ();
|
||
`else
|
||
interface jtag_if #(parameter int unsigned P = 20_000) ();
|
||
`endif
|
||
wire tck;
|
||
…
|
||
endinterface
|
||
```
|
||
Today the first header parses in full, the `` `else `` is a directive item
|
||
of its body, the second `interface jtag_if` becomes a *nested* interface,
|
||
and the outer one reaches EOF without its `endinterface`: "163:1: expected
|
||
`endinterface`". `at_split_conditional` (split.rs) never fires because
|
||
nothing errors until EOF and the headers are bracket-balanced.
|
||
|
||
- **Detect the rival in `parse_module`'s body loop**, before the item is
|
||
parsed: the cursor is on an `` `else ``/`` `elsif `` that continues a
|
||
region opened *before this item's own first token* (`open_conds` at the
|
||
item's mark is above zero and no region has been opened since), and the
|
||
tokens after it are the same keyword (`module`/`interface`/`program`) and
|
||
the same name as the header just parsed. That is a header written twice
|
||
across the arms, not a nested unit. Raise a `ParseError` there ("rival
|
||
header for `jtag_if` in a conditional region").
|
||
- **Route it into the existing split.** `split_conditional_item` already
|
||
turns an item that errored inside a region into `ItemKind::Verbatim`
|
||
over the whole item (`capture_split`) — extend `at_split_conditional`'s
|
||
trigger so this error qualifies with the brackets balanced (a flag on
|
||
the error, or a dedicated check beside the bracket one; say which and
|
||
why), and make sure `scan_split_extent` runs to the unit's real closer
|
||
(`endinterface`) so the whole unit is the verbatim item, the way a
|
||
bracket-unbalanced header is today. Strict and tolerant modes get the
|
||
same tree. The formatter prints a `Verbatim` item byte-for-byte, so the
|
||
file formats (its body is not formatted; that is the standing trade for
|
||
a split header, recorded in the directive-split README — cite it).
|
||
- Not a rival: a second `module x` written in the `` `else `` arm of a
|
||
region opened *inside* the body (that is two nested units, illegal, and
|
||
stays the error it is); a different name after the `` `else ``; a region
|
||
closed before the item began. Pin each as a negative.
|
||
- Tests: the jtag_if shape (`module` and `interface` spellings, with and
|
||
without `#(...)`, with `()` and with a real port list); the three
|
||
negatives; the real file as a cases entry (idempotent, comments kept,
|
||
the body verbatim); `tolerant_parse_equals_strict_parse_on_valid_sources`
|
||
still green; the fuzzers.
|
||
|
||
### 38.2 A net delay written after the type (`SimDTM.sv`)
|
||
|
||
`wire [31:0] #0.1 x = y;` is where IEEE 1800 §6.7 puts a net delay
|
||
(`net_type [drive_strength] [vectored|scalared] data_type_or_implicit
|
||
[delay3] list_of_net_decl_assignments`); lucisv parses the delay only
|
||
between the net keyword and the type. Real file:
|
||
`/Users/guoliangchen/repo/opentitan/hw/vendor/pulp_riscv_dbg/tb/unused/SimDTM.sv`
|
||
lines 38–40 (read-only).
|
||
|
||
- `DataDecl` gains the position: replace `delay: Option<Expr>` with
|
||
`delay: Option<NetDelay>` where `NetDelay { expr: Expr, after_type: bool }`
|
||
(or two fields — pick the one that keeps every existing consumer a
|
||
one-line change, and say). The parser accepts the delay in either
|
||
position, never both (both is an error), and records which. The
|
||
formatter prints it where it was written: `wire #5 w;` stays, `wire
|
||
[31:0] #0.1 x = y;` stays. No normalisation — the safety net compares
|
||
token order, and the LRM position is the one the vendor file uses.
|
||
- Consumers: every `d.delay` reader across the workspace (`grep -rn
|
||
'\.delay' crates`), each a mechanical change; `ast::size_pins`
|
||
unchanged or explained.
|
||
- Tests: both positions round-trip byte-identical; both written is a
|
||
parse error; a delay after a *packed* dimension and after a plain
|
||
`logic`-typed net; the SimDTM lines as a cases entry; snapshot suite
|
||
green; the corpus check unchanged.
|
||
|
||
### Gates (dev, guarded)
|
||
|
||
`cargo fmt -p` per touched crate; clippy clean; `tools/guard.sh -- cargo
|
||
test --workspace`; `tools/guard.sh -- tools/corpus_check.sh` — **814/820
|
||
still**, since neither file is in the corpus (say so); `lucisv format
|
||
--check` on the two opentitan files now parses both (read-only; report the
|
||
outcome — `jtag_if.sv` should now be "would reformat" or "unchanged", not
|
||
an error). Lead at review: byte-identity vs 0.41.0 over the corpus and the
|
||
opentitan sweep — the *only* files whose result may change are these two;
|
||
any other difference is a REWORK.
|
||
|
||
- [x] 38.1 the rival-header detection, the split routing, tests — the
|
||
routing is a **dedicated check** (`rival_end_kw`) beside the bracket
|
||
one, not a flag on `ParseError`; `scan_split_extent` takes the unit's
|
||
closing keyword
|
||
- [x] 38.2 `NetDelay` position, both spellings, tests — `NetDelay { expr,
|
||
after_type }` as a struct, since both consumers were one-line either
|
||
way and the struct cannot represent a position without a delay
|
||
- [x] docs: feature README; §11 lines ticked; directive-split README
|
||
cross-reference
|
||
- [x] Gates (guarded) — workspace 3 744 passed / 0 failed; corpus 814/820,
|
||
the same six; both opentitan files "would reformat" (neither is a
|
||
parse error any more), opentitan tree untouched
|
||
- [x] QA: rival shapes and the three negatives attacked; the two real
|
||
files through `--check` and `--stdout` (read-only); delay positions
|
||
attacked with comments and attributes around them; opentitan sweep
|
||
re-derived with exactly two files changing. Verdict PASS — see
|
||
`docs/features/parser-skips/README.md` QA log (2026-09-04).
|
||
|
||
## 39. External waiver files (planned 2026-09-04) — §4's last waiver item
|
||
|
||
One lane after §38 merges, same protocol. Feature README:
|
||
`docs/features/waiver-files/README.md`. Ships as 0.42.0 with §38.
|
||
|
||
**Decisions taken by the lead** (the "file format, discovery rule and
|
||
precedence story" §4 asked for):
|
||
|
||
- **Format: Verible's**, so an existing `.waiver` file carries over
|
||
unchanged. One directive per line:
|
||
`waive --rule=<rule> [--line=<N>|--line=<N>-<M>] [--location=<pattern>]`;
|
||
`#` comments and blank lines ignored. `--rule` is required and must name
|
||
a lucisv rule (`rules_named` validates it, severity words not accepted);
|
||
`--line` is 1-based, a range inclusive; `--location` is matched the way
|
||
`--exclude` patterns are (`lucisv_core`'s matcher: a pattern with `/`
|
||
matches a path suffix, otherwise the file name) — a regex is not accepted
|
||
and a `--location` that looks like one (`.*`, `\.`) is an error naming
|
||
the difference. No `--location` means every file; no `--line` means the
|
||
whole file.
|
||
- **Discovery:** `[lint] waivers = ["path", …]` in `lucisv.toml`, paths
|
||
relative to that toml; `lucisv check --waiver-file <path>` (repeatable,
|
||
relative to the cwd) adds to them; the editor setting
|
||
`lucisv.lint.waivers` (a list, relative to the workspace root) adds to
|
||
them for the server. A file that does not exist or has a bad line is a
|
||
configuration error, reported as `<file>:<line>: message` exactly like a
|
||
bad `[lint.<rule>]` entry (CLI exit 2; the server logs it through
|
||
`notification.rs` and drops that line, never the file).
|
||
- **Precedence: union.** A violation is suppressed when an inline waiver
|
||
*or* an external one covers it; nothing overrides anything. Unused
|
||
external waivers are reported under the existing `unused-waiver` rule
|
||
with the *waiver file* as the path and the directive's line — by the
|
||
CLI only, after the whole run (a `--location` may match a file not yet
|
||
seen); the server does not report unused external waivers (documented:
|
||
it never sees a whole run). An external waiver whose `--location` names
|
||
no file in the run is unused.
|
||
|
||
**Expected touch set:** `crates/vlog_linter/src/waiver_file.rs` (new: parse
|
||
+ match; `waiver.rs` stays the inline story and is near 250 lines),
|
||
`crates/vlog_linter/src/lib.rs` (apply both), `crates/lucisv_core/src/config.rs`
|
||
(`[lint] waivers`), `crates/lucisv/src/{args.rs,lint.rs}`,
|
||
`crates/lucisv_server/src/{lint.rs,settings.rs}` + `server/notification.rs`,
|
||
`editors/vscode/package.json` (the setting, plus `vlog_linter::vscode`'s
|
||
drift test if it generates lint settings), `README.md` and
|
||
`docs/site/src/content/docs/reference/` (a "Waivers" section), the §4
|
||
lines (221, 229), this section.
|
||
|
||
- Tests: parse every directive shape and every error (unknown rule,
|
||
missing `--rule`, bad line range, regex-looking location); matching by
|
||
file name and by path suffix; line and range; union with an inline
|
||
waiver on the same violation (one suppression, neither reported unused);
|
||
unused external waiver reported at the waiver file's line; server: the
|
||
setting adds a file, a bad line is logged once and the rest applies; an
|
||
e2e case over the wire; CLI: `--waiver-file` twice, toml + CLI combined,
|
||
exit codes.
|
||
|
||
- [x] 39.1 `waiver_file.rs` + application in `lib.rs` — the union lives in
|
||
`lib.rs::waive`, which asks both waiver kinds about every violation and
|
||
never short-circuits, so a finding two waivers cover marks both used;
|
||
`waiver.rs`'s `filter` became `covers`
|
||
- [x] 39.2 discovery: toml (`[lint] waivers`, resolved against that toml),
|
||
CLI flag (`--waiver-file`, repeatable, adds to it), editor setting
|
||
(`lucisv.lint.waivers`, hand-written in `package.json` — the generator
|
||
and its drift test cover only `severity.*` and `rules.*`)
|
||
- [x] 39.3 unused reporting (CLI, after the whole run, at the waiver file's
|
||
own line); errors `<file>:<line>: message` — exit 2 on the CLI, dropped
|
||
line by line and logged once on the server
|
||
- [x] docs: feature README; §4 lines ticked. The README/site "Waivers"
|
||
section is ready to paste in the feature README under "Docs to apply at
|
||
merge (lead)" — those files were being edited by another process
|
||
- [x] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged; smoke
|
||
- [x] QA: every directive shape and error attacked on both front ends;
|
||
precedence attacked; an opentitan run with a waiver file that waives
|
||
one real finding, read-only, counts re-derived — verdict REWORK, one
|
||
HIGH finding (code-action/fixAll does not honor external waivers); see
|
||
the feature README's QA log
|
||
|
||
## 40. Performance take 3 on opentitan (owner request 2026-09-04) — after §38 and §39 merge
|
||
|
||
Read-only measurement, no code changes unless a regression is found (then
|
||
it is filed, not fixed in this lane). Output: `docs/performance_take3.md`,
|
||
same table shapes as `docs/performance_take2.md` so every row is a
|
||
before/after, plus a `docs/perf/README.md` entry. Tree:
|
||
`/Users/guoliangchen/repo/opentitan` (never written; the three
|
||
pre-existing modified files stay as they are). Every run under
|
||
`tools/guard.sh`.
|
||
|
||
- **Server, the take-2 request table** (§2 of take 2): startup and scan
|
||
per scope config and cache state (cold / warm), the `didOpen` widen at
|
||
the default scope, `codeAction` at the five cursors of §6a (now the
|
||
lazy offer *and* a `codeAction/resolve` at each), `prepareRename` /
|
||
`rename`, `completion` at the worst prefix, `definition` (index-only
|
||
path), `hover`, `inlayHint` (workspace scope and default scope, with
|
||
§37.2's ruling restated), `references`, `documentSymbol`,
|
||
`workspaceSymbol`, `semanticTokens/full`, diagnostics publish. Driven
|
||
over the wire against `target/release/lucisv-server` at 0.43.0 and,
|
||
for the rows that exist there, the 0.39.0 baseline
|
||
(`~/.cache/lucisv-baselines/` holds CLI binaries only — build the
|
||
0.39.0 server from the tag in a scratch worktree under the scratchpad,
|
||
removed after).
|
||
- **CLI sweeps** over `hw/ip`, `hw/top_earlgrey/ip`, `hw/top_darjeeling/ip`,
|
||
`hw/dv`, `hw/vendor`: `format --check` (cold cache and warm), `check`
|
||
(all rules on; default rules), wall time and peak RSS (`/usr/bin/time
|
||
-l`), 0.43.0 vs 0.39.0 vs 0.41.0; the failure counts per tree and the
|
||
list of files whose outcome changed since 0.39.0 (expected: exactly
|
||
jtag_if.sv and SimDTM.sv from §38).
|
||
- **Method** as take 2 §9: three tries per row, first try and repeat
|
||
range both reported, machine state noted; no server-side
|
||
instrumentation added.
|
||
- Findings: any row slower than take 2 by more than noise is a filed
|
||
item with a reproduction; anything faster is credited to the section
|
||
that did it.
|
||
|
||
- [x] server table re-measured, 0.43.0 vs take 2 vs 0.39.0 — `performance_take3.md`
|
||
§2; 0.39.0 server built from the tag in a scratch worktree, removed after
|
||
- [x] CLI sweeps, three binaries, RSS included — take 3 §7, five trees ×
|
||
{`format --check` cold/warm, `check`, `check --select error,warning,style`}
|
||
- [x] `docs/performance_take3.md` + perf README entry (2026-09-05)
|
||
- [x] opentitan status unchanged after every run — only the three pre-existing
|
||
modified files, checked after every phase; no guard kill (peak 249 MB of 8 GB)
|
||
|
||
## 41. Repository-analysis fix 1 (planned 2026-09-04) — same-target atomic writers (topo §2.9-26)
|
||
|
||
From `docs/repository-analysis.md` finding 1 and topo handshake 26. One
|
||
lane after §39 merges, §36's protocol. Feature README:
|
||
`docs/features/atomic-write-coordination/README.md`. Ships in 0.43.0 with
|
||
§42 and §43.
|
||
|
||
The audit's probe: two threads writing 1 MiB each through `write_atomic` to
|
||
one target collided on the temp name (canonical target + pid — the *same*
|
||
process, so the same name) — 100 write errors in 200 calls, no mixed bytes.
|
||
Two ways in: the CLI's `dedup` (`lucisv/src/main.rs`) folds `.`/`..` but
|
||
leaves symlinks unresolved, so two spellings of one file reach two rayon
|
||
workers; and any two threads in one process writing one path.
|
||
|
||
- **Exclusive, unique temp files.** `atomic::temp_path` gains a per-process
|
||
counter (`AtomicU64`) beside the pid: `.{name}.{pid}.{n}.lucisv-tmp`; the
|
||
temp is opened with `OpenOptions::new().write(true).create_new(true)`
|
||
(O_EXCL) so a collision is an `AlreadyExists` error that retries with the
|
||
next counter value, never a shared file. The temp's mode is set before
|
||
the bytes are written (a 0600 target must not spend a moment world-
|
||
readable).
|
||
- **Dedup by target identity.** `dedup` keys on the canonical path when the
|
||
file exists (`fs::canonicalize`), falling back to today's lexical key
|
||
when it does not; the *reported* path stays the user's spelling (the
|
||
first seen). That closes the symlink alias without changing any output.
|
||
- **Last-writer semantics stated.** Two processes writing one target still
|
||
race (rename is atomic, the later rename wins); both write formatted
|
||
bytes of the same input, and the formatter is idempotent, so the result
|
||
is whole and correct either way. Say so in the README and the atomic.rs
|
||
module doc; do not build a lock.
|
||
- Tests: the audit's probe as a real test (two barrier-started threads ×
|
||
100 rounds, 1 MiB each, **0 write errors**, final bytes always one
|
||
writer's whole buffer); a symlink alias through the real CLI (`lucisv
|
||
format dir/` where `dir/b.sv -> a.sv`: one write, one report line);
|
||
`dedup` with a symlink and with a missing file; the counter's
|
||
uniqueness; the 0600 window (the temp is never readable by others —
|
||
assert its mode right after creation in the test's own thread).
|
||
|
||
- [x] 41.1 exclusive unique temps, mode before bytes
|
||
- [x] 41.2 dedup by canonical identity, reported path unchanged
|
||
- [x] docs: feature README; topo §2.9-26 struck (lead); analysis finding
|
||
1 annotated "fixed by §41" (lead)
|
||
- [x] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged;
|
||
byte-identity vs 0.42.0
|
||
- [x] QA: the probe re-run under the guard at 4 threads; alias attacks
|
||
through the CLI (relative/absolute/`..` spellings + symlink); a
|
||
target that is itself a symlink into another directory; RSS of the
|
||
100-round probe — PASS, see QA log in the feature README
|
||
(2026-09-05)
|
||
|
||
## 42. Repository-analysis fix 2 (planned 2026-09-04) — one lint-configuration contract for project and editor (topo §2.9-28)
|
||
|
||
Finding 2 / handshake 28. One lane after §41. Feature README:
|
||
`docs/features/lint-config-contract/README.md`. Ships in 0.43.0.
|
||
|
||
**Contract (lead's ruling), which is the CLI's today applied to the
|
||
editor:** the editor's settings play the role the CLI's flags play.
|
||
`lucisv/src/lint.rs` already does `pick(--select, toml select)` — the flag
|
||
when given, else the project file. The server does the same, key by key:
|
||
|
||
- rung 2 of `enabled_rules`'s ladder becomes: `lucisv.lint.select` when
|
||
non-empty, else `[lint] select` from the buffer's `lucisv.toml`, else
|
||
the base set;
|
||
- rung 5: `lucisv.lint.ignore` when non-empty, else `[lint] ignore`;
|
||
- rungs 3 and 4 (class switches, per-rule tri-states) are editor-only and
|
||
unchanged — the project file has no such keys;
|
||
- rule options: unchanged (project options, editor overlay key by key).
|
||
- **Rejected project rule options are surfaced**, not dropped: a
|
||
`[lint.<rule>]` entry `set_raw` refuses — and, from §39's QA, a bad
|
||
directive line in a file named by `[lint] waivers`, which the server
|
||
today drops silently where the editor-setting path logs it — is logged
|
||
once per
|
||
(config file, entry) through `notification.rs` as
|
||
`<toml>:<line>: <message>`, exactly the wording `lucisv check` prints
|
||
before failing the run. The server keeps linting with the entry
|
||
dropped (an editor cannot "fail the run"); say so.
|
||
- `enabled_rules` therefore takes the project's selection as an argument
|
||
(a small struct `ProjectLint { select, ignore }` read by `configured`
|
||
from the discovered file) — no second discovery, one read per buffer
|
||
per settings generation, cached the way `configured` already caches or
|
||
not at all if it does not (measure: it must not add a file read per
|
||
diagnostic pass — the `Discovery` result is already computed there).
|
||
- Docs: the README/site sentence the audit wrote ("project selection
|
||
controls CLI runs; editor selection requires `lucisv.lint.*`") becomes
|
||
the new contract in both places (lead applies to README/site at merge;
|
||
the dev writes the text in the feature README).
|
||
- Tests: unit — every combination of {toml select, editor select} ×
|
||
{toml ignore, editor ignore} against the ladder; severity words in the
|
||
toml's lists; a rejected project option logged once and the lint still
|
||
running; wire-level e2e — a workspace with `[lint] select = ["no-tabs"]`
|
||
and no editor settings publishes only `no-tabs` diagnostics; adding
|
||
`lucisv.lint.select` over the wire replaces it; `didChangeConfiguration`
|
||
back to empty restores the project's; the CLI's and the server's rule
|
||
lists for the same buffer are asserted **equal** for three configs.
|
||
|
||
- [x] 42.1 project selection into the ladder, editor-when-set-else-project
|
||
- [x] 42.2 rejected project options logged with file:line
|
||
- [x] docs + tests above; topo §2.9-28 struck (lead); finding 2 annotated
|
||
- [x] Gates (guarded); e2e green
|
||
- [x] QA: the four-way matrix over the wire; the CLI/server equality on
|
||
an opentitan IP (read-only) with its real `lucisv.toml` if one
|
||
exists, else a scratch one
|
||
|
||
## 43. Repository-analysis fix 3 (planned 2026-09-04) — a cycle policy for the walker (topo §2.9-8), and the net-delay comment slot (§2.9-27)
|
||
|
||
Finding 3 / handshakes 8 and 27. One lane after §42. Feature README:
|
||
`docs/features/walk-cycles/README.md`. Ships in 0.43.0.
|
||
|
||
### 43.1 Walker cycle policy
|
||
|
||
`lucisv_core/src/walk.rs` recurses on `Path::is_dir()` with no visited set;
|
||
a symlink cycle (`a/loop -> ..`) runs until the OS refuses. Policy (lead's
|
||
ruling): **each directory is entered once by identity**, and a symlink to a
|
||
directory already on the current path is skipped silently. Identity is
|
||
`(dev, ino)` from `fs::metadata` on unix and the canonical path elsewhere.
|
||
A symlinked directory that is *not* an ancestor is still followed once
|
||
(today's behaviour for `rtl -> ../shared/rtl` stays). No traversal budget:
|
||
identity is the policy, and a budget would be a second, weaker rule.
|
||
|
||
- `Walker` gains `visited: HashSet<Identity>`; `dir()` checks-and-inserts
|
||
before reading. The same file reached twice through two symlinked
|
||
directories is reported once (the first spelling), which also removes
|
||
the dedup case §41.2 would otherwise catch late.
|
||
- Tests: `a/loop -> a` terminates and yields `a`'s files once; `a/up -> ..`
|
||
from a nested start; two symlinked dirs to one target yield its files
|
||
once; a symlink to a *sibling* directory is still followed; a dangling
|
||
symlink is skipped; the gitignore interplay is unchanged (a cycle inside
|
||
an ignored dir never runs). Both front ends: the CLI walks it, the
|
||
server's index scan (`lucisv_server` uses the same walk — confirm with
|
||
grep) opens a cyclic workspace and finishes.
|
||
|
||
### 43.2 Comment before a net delay's `#`
|
||
|
||
`wire /* c */ #5 w;` and `wire [7:0] /* c */ #5 w;` are refused by the
|
||
verifier because `NetDelay` has no comment slot. Add `before_hash:
|
||
Vec<Comment>` on `NetDelay` (parser takes the gap before `#` the way other
|
||
slots do — see `docs/features/comment-slots/README.md` for the house
|
||
mechanism and its gap fuzzer), the formatter prints it inline before `#`,
|
||
the `#SKIP` in `net_delay_position.cases` goes live, the gap fuzzer covers
|
||
the new slot.
|
||
|
||
- [x] 43.1 visited-by-identity walker, both front ends, tests
|
||
- [x] 43.2 `NetDelay::before_hash`, the `#SKIP` retired
|
||
- [x] docs; topo §2.9-8 and §2.9-27 struck (lead); finding 3 annotated
|
||
— done at review 2026-09-05; §2.9-30 filed (unreadable directory
|
||
aborts the walk)
|
||
- [x] Gates (guarded): fmt/clippy/workspace tests; corpus unchanged;
|
||
byte-identity vs 0.42.0; a cyclic scratch tree through both binaries
|
||
- [x] QA: cycles of depth 1–3 through the CLI and the server (guarded,
|
||
time-limited); the comment slot attacked with every comment shape
|
||
and position; the gap fuzzer re-run
|
||
|
||
## Loop order (2026-09-04, owner: "follow the repository analysis")
|
||
|
||
§39 (in flight) → 0.42.0 → §41 → §42 → §43 → 0.43.0 → §40 performance
|
||
take 3 on opentitan. The audit's own doc edits (README, topo, site) are
|
||
committed by the lead as one "docs: repository analysis" commit once that
|
||
process is finished, before §41 starts.
|
||
|
||
## 44. Candidates from performance take 3 (filed 2026-09-05, not planned)
|
||
|
||
`docs/performance_take3.md` re-measured 0.43.0 against take 2 and 0.39.0.
|
||
The lazy code action is worth 11.8× on the cursor-move path and the
|
||
default-scope `didOpen` is 1 731 → 1 082 ms cold; nothing else moved
|
||
since 0.39.0. Two findings are real work and wait for the owner's call:
|
||
|
||
- [x] **Eager `codeAction` (a client without `resolveSupport`) is
|
||
1.35–1.40× slower than take 2 at every fan-out** — **ruled a
|
||
non-hot path by the owner, 2026-09-05**: VS Code, Neovim's client
|
||
and Helix all resolve; documented, not bisected. — already so at
|
||
0.39.0, so it landed in the §29–§35 window; not bisected. Bisect
|
||
over `~/.cache/lucisv-baselines/` (0.35.0–0.39.0 CLI binaries exist;
|
||
the server needs building per tag) and fix the regression, or rule
|
||
that non-resolving clients are not a hot path (VS Code, Neovim's
|
||
built-in client and Helix all resolve).
|
||
- [x] **A `didOpen` of a file already in scope delays the next request by
|
||
21–51 ms**, scaling with file size (take 2: 2–4 ms). The open, not
|
||
the request. Find what the open now does synchronously that it did
|
||
not (the §33+ diagnostics pass? the §37 lint run construction?) and
|
||
move it off the request path or measure it as the price of the
|
||
diagnostics the file gets. — done by §46 (0.44.0), and it was
|
||
neither: the lint pass is 75–95 % of the open and the rule
|
||
`undriven-net` is 90–97 % of the lint pass, because it asked the
|
||
workspace census once per declaration in the buffer before its own
|
||
local guards could silence it. Asked last now, as its twin rule
|
||
`unused-signal` always has. 51/70/95 → 4.6/7.3/7.8 ms on the three
|
||
files of take 3 §8.4; 1 742 → 117 ms on opentitan's 42 192-line
|
||
`pinmux_reg_top.sv`. Not a regression — 0.39.0 measures the same.
|
||
`docs/features/didopen-cost/README.md`.
|
||
- Noted, not actioned: `lucisv check` 6–10 % slower than 0.39.0 on
|
||
`hw/ip` (73 rules vs 54; per-rule cost flat), `workspace/symbol`
|
||
drifting 6.6 → 7.9 ms over three takes, `rename` 115 → 152 ms with two
|
||
more files edited (per-file flat).
|
||
|
||
## Loop 2 order (owner's rulings, 2026-09-05)
|
||
|
||
Asked as twelve questions and answered. Ruled out: the eager codeAction
|
||
regression (non-hot path), the lossless-CST tree round trip (the verifier
|
||
is the invariant). The owner runs the manual acceptance checklist. Everything
|
||
else runs, one lane at a time in the main tree, dev Opus 5 → QA Sonnet 5 →
|
||
lead, a release every two or three sections:
|
||
|
||
§45 small items round 4 (topo 29, 30, 17, 22) → §46 the didOpen delay →
|
||
0.44.0 → §47 `DataType` spans, retire `scan.rs` (topo 2) → §48 package
|
||
re-exports (topo 16) → §49 cross-file instance-member tail in rename
|
||
(topo 23) → 0.45.0 → §50 `.*` expansion → §51 non-ANSI → ANSI ports →
|
||
0.46.0 → §52 organize imports → §53.1 extract module → 0.47.0 →
|
||
**§56 DUT-centred hierarchy view (owner request 2026-09-06) → 0.48.0** →
|
||
§53.2 inline module (its own lane; 53.1 consumed the round, as planned)
|
||
→ §54 coverage gaps L3/L6/L10 → 0.49.0.
|
||
|
||
**Closed 2026-09-07.** Every section above shipped in the release named:
|
||
0.44.0 (§45, §46), 0.45.0 (§47–§49), 0.46.0 (§50, §51), 0.47.0 (§52,
|
||
§53.1), 0.48.0/0.48.2 (§56; 0.48.0's first packages were built a commit
|
||
early and 0.48.1 never built — see the changelog), 0.49.0 (§53.2, §54).
|
||
Loop 2's dev/QA/lead protocol ran in the main tree with no worktrees;
|
||
its two release slips are recorded in CLAUDE.md's rules of thumb below
|
||
(§57) and in the lead's memory.
|
||
|
||
**Coda (2026-09-07, after the close).** Two owner-requested lanes ran
|
||
after §57 and shipped together as **0.50.0**: §58 performance take 4
|
||
(0.49.0 vs 0.43.0; harness committed in `tools/perf/`) and §59 the
|
||
format-cache key fix for topo §2.9-34, which the owner's doc audit found
|
||
in 0.49.0. Take 4's findings are in the loop-3 list above.
|
||
|
||
**Open items for loop 3** (owner decides; nothing here is in flight):
|
||
- §44 second finding ruled non-hot; §55 `state.rs` decomposition (958
|
||
lines, three sentences) — a Fable refactor lane;
|
||
- topo §2.9-31 DPI-export name binding (dpi-export request (b));
|
||
- topo §2.9-32 the refactoring verifier and a same-file relocation of a
|
||
never-dropped piece written as two edits (eq. 3 unreachable);
|
||
- topo §2.9-33 `module_sources` lacks a transitive-instantiators rung
|
||
(inline-module's hierarchical scan sees only the handed files);
|
||
- inline module's deliberate refusals worth their own rounds: same-file
|
||
`S`, unconnected outputs, any `generate`, prefixing past end labels;
|
||
extract module's: attributes on absorbed declarations (§51 too), an
|
||
`interface`'s non-ANSI header (§51), a `.*` inside a `bind` (§50);
|
||
- `uvm-utils-indent` default (off; 21 corpus files change when on) —
|
||
revisit after use;
|
||
- organize imports on files with `` `include``s (refused by design —
|
||
the preprocessor question, TODO §7's standing non-goal);
|
||
- **perf take 4 (§58, 2026-09-07) filed:** the lazy `codeAction` offer
|
||
costs 2–3 ms more at every cursor because `inline_site`/`extract_site`
|
||
each re-parse the buffer the server already holds (take 4 §8.2 — the
|
||
fix is §37.1's shape: gate on the document's own tree); §49's tail
|
||
rename at 751 ms for two files vs 66 ms for one (§8.3 — look at
|
||
rename's reference walk first, completion on the same surface is
|
||
free); `check --select error,warning,style` 1.27× on `hw/ip` after
|
||
`unused-import` (§8.4); two instance-head tails that do not resolve
|
||
(`pwrmgr.sv` 178:10 in a macro argument, `pinmux.sv` 687:40; §8.5 —
|
||
a ruling, not a fix); the index +14% at codec 19 (§8.6, watch).
|
||
- **perf take 5 P1 (§60.1) deferred:** lint-result reuse for the
|
||
code-action path — a memo of `fixable`'s violations keyed by document
|
||
revision + tab width + rule set + merged options + waiver contents +
|
||
index generation (each attacked); worth 24 ms per cursor move on
|
||
opentitan's largest file, 1–3 ms on ordinary RTL.
|
||
- **perf take 5 P2d (§60.2) deferred:** the target-scoped rename
|
||
selector — fan out from the one declaration the open buffer resolves
|
||
the cursor to, instead of every declaration of the name; the lever
|
||
left on the tail rename (233 of 388 ms is one parse per selected
|
||
file, 133 of 238 files being container files a multi-level tail folds
|
||
through). Needs the whole-scope oracle over the shape list in
|
||
`docs/features/perf5-p2/README.md` (multi-path references, wildcard
|
||
imports, package members, `extends`/alias chains, `bind`, `defparam`,
|
||
`$root`, `` `include``, generate shadows, class members, unsaved
|
||
buffers) before any file is dropped.
|
||
- **perf take 5 P3 (§60.3) filed:** the CLI's third parse (the lint
|
||
pass re-parses every file the census parsed) — retaining the census
|
||
ASTs was refused as a memory trade (1 805 trees against a 200 MiB
|
||
peak); and a test pinning `harvest_one`'s lex-only path when neither
|
||
census half is wanted (needs a `Job` constructor for tests).
|
||
- **perf take 5 P4b (§60.4) filed:** the first useful answer after a
|
||
staged startup is ~250 ms cold / ~275 warm (correct in every session)
|
||
against the old race's 84 / 208 — the gap is the workspace walk in
|
||
front of the open buffer's folder (`discovery` 158 ms warm: the walk
|
||
plus one `fs::metadata` per file, which `lucisv_core::walk::collect_files`
|
||
already stat'd and could hand on), then `cache_open` 89 ms; warm settle
|
||
~1.04–1.10 s against the plan's < 1 s, the rest being the store open
|
||
the refused reuse would remove.
|
||
- **review round §61.2 filed:** a `format::indent_width` form taking an
|
||
already-read `FileConfig`, so the code-action path's run and the
|
||
publish path do one `Discovery` walk, not two (+0.1 ms today).
|
||
- **review round §61.3 filed:** a bounded local-record load of the index
|
||
store for the open folder's head (measured ~26 ms vs the 89 ms whole
|
||
open, but the 61 ms checksum verification is owed either way and it
|
||
breaks `Load::canonical`) — its own experiment if the first answer
|
||
needs the 89 ms; and a walk that can skip an already-walked subtree so
|
||
the two-phase discovery stops walking the open folder twice (+2.5–5 %
|
||
on the 1/10-buffer settle).
|
||
- **review round §61.5 filed (QA, pre-existing):** a `bind` file's own
|
||
occurrence of a renamed name (`aes_bind.sv` for a bound name or a
|
||
two-level hierarchical tail) is neither edited nor warned about,
|
||
identically before and after the reuse — the whole-scope engine's
|
||
answer, so a missing warning at least (QA task `task_834abda3`); the
|
||
scope reuse's collateral for the other refactorings (`_with` doors for
|
||
extract/inline/imports/ports/references — the resolves and the extract
|
||
edit are the candidates, the 805 ms refusal is after the build); the
|
||
31 ms store decode the one-place tie costs.
|
||
- **§63.1 QA (2026-09-12, pre-existing, `task_d8afe80f`):** cross-file
|
||
`references` cannot see a hierarchical-surface-only declaration (a
|
||
module's net, variable or instance), bind or not — `nav.rs`'s
|
||
`leaves_this_file` and `indexed_def_in_file` (shared with hover) ask
|
||
`WorkspaceIndex::member`, the connection surface; the fix is the
|
||
hierarchical-surface lookup in both call sites plus a fixture sweep
|
||
across definition/references/hover/documentHighlight.
|
||
- **§63.2 filed (2026-09-12):** the rest of the first-after-edit flush —
|
||
the token clone into `parse_tolerant` (3.9 ms; the parser mutates the
|
||
stream it is given, and `Document::tokens` is read for comments by
|
||
semantic tokens and the linter), `analyze` (9.4 ms), `resolve_external`
|
||
(4.7 ms against the 3 975-file index), and ~6 ms dropping the previous
|
||
revision's products on the request path (drop it after answering).
|
||
Sections after §46 are planned when reached.
|
||
|
||
## 45. Small items, round 4 (planned 2026-09-05) — topo §2.9-29, 30, 17, 22
|
||
|
||
One lane, §36's protocol. Feature README:
|
||
`docs/features/small-items-4/README.md`. Ships in 0.44.0 with §46.
|
||
|
||
### 45.1 The editor's unknown rule name is said once (topo 29)
|
||
|
||
`lucisv.lint.select`/`ignore` naming a rule the registry does not know is
|
||
dropped silently (`named()` skips it); the same typo in `[lint] select` is
|
||
now logged once (§42). Log the editor's the same way — through
|
||
`server/notification.rs`, once per (setting, name), re-armed when the
|
||
setting changes — with the message `lucisv.lint.select: unknown rule: <name>`
|
||
(the shape `lucisv.lint.options` already uses for its bad entries). A
|
||
`select` emptied by the dropping falls back to the project's list, then the
|
||
base set — the §42 ladder unchanged. Tests: unit on the settings decode;
|
||
wire-level: one log line across four diagnostics passes, re-armed by a
|
||
`didChangeConfiguration` that changes the list.
|
||
|
||
### 45.2 A warning channel for the walk (topo 30)
|
||
|
||
`lucisv_core::walk::collect_files` returns `Vec<PathBuf>`; an unreadable
|
||
directory propagates `read_dir`'s error and fails the run, and a dangling
|
||
source link is handed on to fail later. Give the walk a channel:
|
||
`collect_files` returns `Walked { files, warnings: Vec<Warning> }` where
|
||
`Warning { path, message }` — or keeps its signature and takes a
|
||
`&mut dyn FnMut(Warning)`; pick the one that keeps both callers a one-line
|
||
change and say why. An unreadable directory is skipped with a warning and
|
||
the walk continues; a dangling source-file link is warned about here and
|
||
NOT handed on (that reverses §43's review ruling deliberately, because the
|
||
warning is now the error's home). CLI: warnings go to stderr as
|
||
`warning: <path>: <message>` before the report, exit code unchanged (a
|
||
warning is not a failure; `--check` still returns 1/0 on formatting alone).
|
||
Server: each warning logged once per scan through `notification.rs`.
|
||
Tests: a read-only directory (0o000) under the start — the run finishes,
|
||
the other files are reported, one warning names the directory; a dangling
|
||
link; the CLI's stderr and exit code pinned in `tests/cli.rs`; the server's
|
||
scan over the same tree logs once and indexes the rest. Byte-identity of
|
||
every corpus file unchanged; the opentitan sweep outcome unchanged.
|
||
|
||
### 45.3 An inline aggregate as a parameter-override argument (topo 17)
|
||
|
||
`m #(.T(struct packed { logic a; })) u ();` is rejected in expression
|
||
position. `parse_connection`'s value already goes through
|
||
`parse_expr_or_type`; find why an aggregate type is not accepted there (a
|
||
`struct`/`union`/`enum` keyword at the head of the value) and accept it as
|
||
a type argument, printed by the existing type printer. Then M4's
|
||
`instantiation_plan` no longer drops such a `parameter type` default — emit
|
||
the type text. Tests: parse + format round-trip (struct, union, enum, with
|
||
packed dims and a comment inside), the plan emits it, strict/tolerant
|
||
parity, byte-identity.
|
||
|
||
### 45.4 Comment gaps inside a delay list (topo 22)
|
||
|
||
`#(1:2:3)` and gate delays `#(a, b)` go through `parse_delay_values`
|
||
(`parser/instance.rs`); the gaps around the `(`, the `:`s and the `,`s have
|
||
no comment slots, so the verifier refuses them. Add the slots the way §43.2
|
||
added `NetDelay`'s (read `docs/features/comment-slots/README.md`), print
|
||
them inline, and extend the RTL gap fuzzer fixture so its zero-failure bar
|
||
covers the construct. Tests: every gap with a comment, idempotent,
|
||
comments kept; the `EXPECTED_RTL_GAPS` count updated with the reason.
|
||
|
||
### Gates (dev, guarded)
|
||
|
||
fmt/clippy/`cargo test --workspace`; corpus 814/820 same six; byte-identity
|
||
vs 0.43.0 (lead); the opentitan sweep unchanged (lead); smoke.
|
||
|
||
- [x] 45.1 editor unknown-name log
|
||
- [x] 45.2 walk warning channel, both front ends
|
||
- [x] 45.3 inline aggregate override argument + plan emission
|
||
- [x] 45.4 delay-list comment slots + fuzzer coverage
|
||
- [x] docs: feature README; topo 29/30/17/22 struck (lead)
|
||
- [x] Gates (guarded)
|
||
- [x] QA: each item attacked on both front ends; the walker warnings on a
|
||
cyclic + unreadable tree; the aggregate shapes with comments; the
|
||
delay gaps through the fuzzer — REWORK, one MEDIUM finding (a line
|
||
comment trailing a gate instance separator, `format/instance.rs`;
|
||
see `docs/features/small-items-4/README.md` QA log)
|
||
|
||
## 46. The didOpen delay (planned 2026-09-05) — take-3 finding §44b
|
||
|
||
One lane after §45. Feature README: `docs/features/didopen-cost/README.md`.
|
||
Ships in 0.44.0.
|
||
|
||
Take 3 (`docs/performance_take3.md`): a `didOpen` of a file already in
|
||
scope delays the NEXT request by 21–51 ms, scaling with file size, where
|
||
take 2 measured 2–4 ms; a second request at the same position costs
|
||
0.07–0.21 ms, so the open is what costs. The server is a synchronous loop:
|
||
whatever `didOpen` does before returning to the loop is what the next
|
||
request waits for.
|
||
|
||
- **Measure first.** Write a scratch driver (framed JSON-RPC; take 3's
|
||
method, §9 of that doc) and time `didOpen` → first `hover` on opentitan's
|
||
`aes.sv`, `aes_core.sv` and the 42k-line `tl_peri_pkg.sv`-class file, at
|
||
0.43.0 and at 0.39.0 (server built from the tag in a scratch worktree,
|
||
removed after). Then profile the open path with the shipped `--verbose`
|
||
timings (no instrumentation added) or with temporary `eprintln!` timings
|
||
removed before finishing: what runs synchronously — the tolerant parse,
|
||
the diagnostics pass (lint run construction from §42: discovery, waiver
|
||
files, the once-only memo), semantic tokens, the index update of the
|
||
buffer, the completion word table patch?
|
||
- **Fix the largest item, not all of them.** Likely shapes: publish the
|
||
open's diagnostics from the same debounce `didChange` uses instead of
|
||
synchronously; skip re-indexing a buffer whose text equals the disk facts
|
||
the index already holds (content hash); build the `LintRun` lazily.
|
||
Whatever it is, the contract is: `didOpen` returns to the loop in
|
||
≤ 5 ms for a 1k-line file, and the first request after it is answered
|
||
from up-to-date state (diagnostics may arrive a debounce later — say
|
||
which and pin it).
|
||
- Tests: a wire-level test timing `didOpen` → next response on a generated
|
||
2k-line file (an upper bound, generous enough for CI: ≤ 25 ms where
|
||
today is ~50); correctness pins that the first hover/definition after an
|
||
open of an edited-on-disk file sees the buffer's text; the take-3 rows
|
||
re-measured in the README.
|
||
|
||
- [x] measurement + profile, in the README — and the finding understated it:
|
||
`pinmux_reg_top.sv` (42 192 lines) delayed the next request by **1 742
|
||
ms**, of which 1 608 was the one rule `undriven-net` asking the
|
||
workspace census once per declaration ahead of its own local guards
|
||
- [x] the fix, with the ≤ 5 ms return contract pinned — the census question
|
||
moved behind the guards, where `unused-signal` has always asked. Met
|
||
for a generated 1 000-line buffer (<2 ms); 5.9–6.9 ms for
|
||
`aes_core.sv`, 1 145 lines of dense RTL whose 3.0–4.4 ms of parse
|
||
cannot be deferred without answering the next request from stale
|
||
state. Recorded as the limit in the README, not redefined
|
||
- [x] docs; §44b ticked; take-3 finding 2 annotated — the annotation text and
|
||
a `docs/perf/README.md` entry are in the feature README under "Docs to
|
||
apply at merge (lead)"
|
||
- [x] Gates (guarded); the take-3 rows re-measured — 3 814 tests (was 3 810),
|
||
corpus 814/820 same six, clippy and fmt clean, smoke OK; §8.4's three
|
||
files 51/70/95 ms → 4.6/7.3/7.8 ms
|
||
- [x] QA: the driver re-run on the three files at three sizes; the
|
||
diagnostics still arrive; no request answered from stale state —
|
||
PASS, independently re-derived on a new driver: 0.43.0 vs fixed
|
||
3.4×/11×/17× on aes.sv/aes_core.sv/pinmux_reg_top.sv; opentitan
|
||
`hw/ip/{aes,hmac,spi_device}` and
|
||
`hw/top_darjeeling/ip_autogen/pinmux` byte-identical; counting-oracle
|
||
test confirmed to fail on a hand-reverted scratch copy; gates
|
||
reproduced (3814/0/44, corpus 814/820, clippy/smoke clean); QA log
|
||
in `docs/features/didopen-cost/README.md`
|
||
|
||
## 47. Type-name spans on the AST; retire `vlog_semantic/src/scan.rs` (planned 2026-09-05) — topo §2.9-2
|
||
|
||
One lane after 0.44.0, §36's protocol. Feature README:
|
||
`docs/features/type-name-spans/README.md`. Ships in 0.45.0 with §48/§49.
|
||
|
||
`vlog_semantic/src/scan.rs` (193 lines) recovers the byte range of a name
|
||
the AST kept only as a `String` by scanning the construct's source text.
|
||
Its two remaining users, both in `bind/`: `bind/decl.rs` (the type name of
|
||
a declaration — `DataType::name`, split as `pkg::item` into unit and item
|
||
spans by `NameScanner`, or as `iface.modport` into head and tail) and
|
||
`bind/stmt.rs` (`disable <label>`). Every other name already has
|
||
`name_span` on its node (`src[name_span] == name` is pinned over the corpus
|
||
census, 21 485 symbols).
|
||
|
||
- **`DataType::name_span: TextRange`** — the range of the name exactly as
|
||
written, so `src[name_span]` is `pkg::item` (with an escaped segment's
|
||
trailing space, §29) or `iface.mp`. Set by every site that builds a
|
||
`DataType` (`parse_type_ref`, the implicit/`logic` cases — for an
|
||
implicit type with no written name, the empty range at the position the
|
||
name would have had, the convention `name_span` already uses for the
|
||
unnamed-DPI-formal case, decl.rs:436). Segment spans are derived from
|
||
`name_span` alone — split the *span's own text* on `::`/`.`, never
|
||
rescan the construct — in one helper `DataType::segments() ->
|
||
impl Iterator<Item = (&str, TextRange)>`.
|
||
- **Size.** `DataType` rides in every `Expr` through `ExprKind::Type`;
|
||
`size_pins` holds `Expr ≤ 96`. Measure before and after; if the 8 bytes
|
||
push `Expr` over, move `name_span` into the already-boxed `TypeExtra`
|
||
(making `extra` `Some` whenever a name is written) or box — say which
|
||
and why; the pin does not move.
|
||
- **`StmtKind::Disable`** (and any other statement that names a label or
|
||
identifier as a bare `String` — grep `scan::` and `String` names in
|
||
`ast/stmt.rs`) gains `name_span` the same way.
|
||
- **Delete `scan.rs`**, its `mod`, and the `src` parameter the README's
|
||
Handshakes say goes with it if nothing else reads it; the binder reads
|
||
the spans. `vlog_semantic/README.md` and `docs/features/vlog-semantic/README.md`
|
||
Handshakes updated (delivered).
|
||
- **Consumers that benefit:** hover/definition/references on a type name
|
||
(`nav.rs`, `hover.rs`) — nothing to change if they already go through
|
||
`Reference::name_span`; confirm, and add a test that definition on
|
||
`pkg::t` in a declaration lands on `t`'s declaration with the *item*
|
||
range selected, and on `bus_if.mp` on the interface with the head range.
|
||
- Pins: the corpus census assertion `src[name_span] == name` now covers
|
||
type-name references too (extend `tests/census.rs` or the semantic
|
||
corpus test that holds the 21 485 number — report the new count);
|
||
strict/tolerant parity; byte-identity of every corpus file (the
|
||
formatter does not print spans); `cargo test --workspace`; opentitan
|
||
sweep unchanged; a before/after of `definition` on 200 type-name
|
||
positions over opentitan (read-only) to show nothing regressed.
|
||
|
||
- [x] 47.1 `DataType::name_span` + `segments()`, size ruled
|
||
- [x] 47.2 `StmtKind::Disable` name span
|
||
- [x] 47.3 `scan.rs` deleted; binder reads spans; census pin extended
|
||
- [x] docs: feature README; topo §2.9-2 struck (lead); semantic READMEs
|
||
- [x] Gates (guarded): 3 814 tests / 0 failed / 44 ignored (the 0.44.0 count
|
||
exactly — six `scan.rs` unit tests out, six new ones in); corpus 814/820,
|
||
the per-file TSV byte-identical to the committed one; `format --stdout`
|
||
of all 860 corpus files identical to `lucisv-0.44.0`; clippy and fmt
|
||
clean; release server smoke OK; census 27 486 symbols / 103 870
|
||
references / 0 unplaced, identical to a `v0.44.0` scratch worktree; 200
|
||
`definition` positions over opentitan identical old vs new
|
||
- [x] QA: census re-derived; escaped and scoped type names; `iface.mp`
|
||
ports; implicit types; definition/hover on type names over
|
||
opentitan (read-only)
|
||
|
||
## 48. Package re-exports as real references (planned 2026-09-05) — topo §2.9-16
|
||
|
||
One lane after §47 merges, §36's protocol. Feature README:
|
||
`docs/features/package-reexports/README.md`. Ships in 0.45.0.
|
||
|
||
`ItemKind::Export(paths)` is bound as an opaque leaf (`bind/item.rs`, the
|
||
dpi-export handshake). Two halves, both here:
|
||
|
||
- **The binding half.** `export pkg::item;` and `export pkg::*;` record
|
||
`pkg` as a `Target::Unit` reference and `item` as a
|
||
`Target::UnitMember(pkg)` reference — exactly the halves
|
||
`bind_import_path` records — **without** pushing a scope import: a
|
||
re-export brings nothing into the exporting scope (IEEE 1800 §26.6). One
|
||
new binder function beside `bind_import_path`, sharing its path walk.
|
||
`export *::*;` records no references (there is no name to resolve) and
|
||
is documented as "everything this package imports is re-exported".
|
||
- **The resolution half.** A file that does `import a_pkg::*` (or names
|
||
`a_pkg::x`) must resolve `x` when `a_pkg` re-exports it from `b_pkg`.
|
||
The index records each package's re-exports as facts (`FACTS_FORMAT`
|
||
17 → 18: an `RX` group — `(pkg, item|*)` pairs plus the `*::*` flag;
|
||
`index_cache` drops older stores by format as it already does), and the
|
||
member walk in `workspace/external.rs` that lists a unit's members
|
||
follows re-exports: `a_pkg`'s members += `b_pkg`'s exported `item`, or
|
||
all of `b_pkg`'s exports for `b_pkg::*`, or all of every package
|
||
`a_pkg` imports for `*::*` — with a visited set so a re-export cycle
|
||
terminates. Completion after `a_pkg::` lists them; hover/definition on
|
||
`x` lands on `b_pkg`'s declaration; references of `b_pkg::x` include the
|
||
uses through `a_pkg`; rename of `x` edits the re-export line's `item`
|
||
too (the rename engine reads references, so this should follow — pin
|
||
it).
|
||
- Tests: binding — the two halves recorded with exact spans; no scope
|
||
import (a name re-exported is NOT visible bare inside the exporting
|
||
package unless also imported — pin the negative); resolution — a
|
||
three-file workspace (b_pkg declares, a_pkg re-exports one/`*`/`*::*`,
|
||
top imports a_pkg::*) for definition, hover, completion, references and
|
||
rename over the wire; a re-export cycle; a re-export of a name b_pkg
|
||
does not declare (unresolved, no panic); the census numbers re-derived
|
||
and the delta explained (new references only); FACTS_FORMAT bump test
|
||
(an older store is dropped whole).
|
||
|
||
- [x] 48.1 binding of `export` halves, no scope import
|
||
- [x] 48.2 `RX` facts, FACTS_FORMAT 18, member walk through re-exports
|
||
- [x] docs: feature README; topo §2.9-16 struck (lead); dpi-export
|
||
handshake (a) answered
|
||
- [x] Gates (guarded); census delta explained — references 103 870 → 103 875
|
||
(+5: the corpus's two package `export` lines, five name halves in all),
|
||
every other number flat
|
||
- [x] QA: the three-file workspace over the wire; cycles; unknown items;
|
||
an opentitan UVM package tree read-only (definition through a
|
||
re-export, before/after)
|
||
|
||
## 49. Cross-file instance-member tail in rename (planned 2026-09-05) — topo §2.9-23
|
||
|
||
One lane after §48 merges, §36's protocol. Feature README:
|
||
`docs/features/hierarchical-tail/README.md`. Ships in 0.45.0.
|
||
|
||
With `module sub` in `sub.sv` and `assign w = u_x.sig;` in `top.sv`,
|
||
renaming `sub`'s internal `wire sig` edits `sub.sv` only and warns (item
|
||
20's warning); the same shape in one file resolves and is edited. The
|
||
cause is the export rule in `workspace/record.rs::is_exported`: a module
|
||
exports ports and parameters only, so the cross-file member walk cannot see
|
||
`sig` through `u_x`.
|
||
|
||
**Ruling (lead): a module gains a second, distinct surface.** Its
|
||
*connection* surface stays ports + parameters (what a connection list may
|
||
name; completion in a connection list and the `propagate-ports` engine keep
|
||
reading exactly this). Its *hierarchical* surface is its nets, variables
|
||
and (for nested reach) instances, which a hierarchical path may name from
|
||
anywhere (IEEE 1800 §23.6). The index records both, tagged
|
||
(`FACTS_FORMAT` 18 → 19 if §48 already bumped to 18, else 17 → 18: the
|
||
member record carries a `surface` bit), and only the tail walk behind an
|
||
*instance* (`Target::MemberOf { head: an instance … }`) reads the
|
||
hierarchical surface. Nothing else changes what it sees.
|
||
|
||
- `resolve_external`: a `MemberOf` whose head resolves to an instance of
|
||
module `M` looks `tail` up in `M`'s hierarchical surface (then nested
|
||
instances for `u_a.u_b.sig`); the answer is a `Def` in `M`'s file, so
|
||
rename's reference set now includes the cross-file tail and the edit
|
||
lands on it; the §2.9-20 warning is no longer raised for a tail that
|
||
resolved (it stays for one that did not).
|
||
- Not widened: completion after `u_x.` in an expression MAY list the
|
||
hierarchical surface (it is what the user is typing) — say whether it
|
||
does and pin it either way; a connection list's completion must not.
|
||
- Tests: `a_hierarchical_tail_that_resolves_is_renamed_with_its_declaration`
|
||
gets its cross-file twin (two files, the edit lands in both; the warning
|
||
gone); nested `u_a.u_b.sig`; a tail naming a port (both surfaces — one
|
||
answer); a tail naming a parameter; a generate-block-scoped net
|
||
(`u_x.gen[0].sig` — refuse honestly, pin); an interface instance tail
|
||
(already resolves — unchanged); the `--check` of rename's verifier still
|
||
refuses when a tail is ambiguous (two `sub` declarations); the census
|
||
delta explained; opentitan (read-only): rename of an internal net used
|
||
hierarchically from a DV bench, timing before/after, and the count of
|
||
newly resolved references over `hw/ip/aes`.
|
||
|
||
- [x] 49.1 surface bit in facts, FACTS_FORMAT bump (18 → 19), index member
|
||
walk — `workspace/hierarchy.rs`, a second `hier_members` table
|
||
- [x] 49.2 `MemberOf` behind an instance reads the hierarchical surface;
|
||
rename edits the tail; the warning retired for resolved tails
|
||
- [x] docs: feature README (`docs/features/hierarchical-tail/README.md`);
|
||
topo §2.9-23 struck (lead — strike text in the README); record.rs's
|
||
export doc rewritten (the ruling moved to `hierarchy::surface_of`)
|
||
- [x] Gates (guarded): 3 839 tests / 0 failed / 44 ignored (baseline 3 829,
|
||
+10 new); corpus 814/820, the same six; `format --stdout` of all 860
|
||
corpus files byte-identical to `lucisv-0.44.0`, 0 differing; clippy and
|
||
fmt clean; release server smoke OK. Census: single-file corpus census
|
||
unmoved (860 / 27 486 / 103 875 / 1 197 / 0), index gains 5 239
|
||
hierarchical-only members beside an unchanged 12 939, and 335 corpus
|
||
references resolve that could not before. opentitan (read-only,
|
||
requests never applied): `lc_ctrl`'s `fsm_state_q` rename now names
|
||
`dv/tb.sv` as well as `rtl/lc_ctrl_fsm.sv` (10 → 22 ms; prepareRename
|
||
unmoved); over `hw/ip/aes` the newly resolved count is **0** (every
|
||
`aes` hierarchical path goes through a generate block or a `bind`) and
|
||
rename is 41 → 55 ms for the same answer; over all of `hw/` 514
|
||
references newly resolve; store +10.7 % on `aes`, +6.2 % on `lc_ctrl`
|
||
- [x] QA: the shapes above over the wire; the connection-list completion
|
||
unchanged; rename verifier refusals unchanged; opentitan before/after
|
||
|
||
## 55. Filed 2026-09-05 — `lucisv_server/src/state.rs` over the size threshold
|
||
|
||
The §49 dev measured `crates/lucisv_server/src/state.rs` at 957 production
|
||
lines outside tests, over the 800 "consider splitting" mark and past the
|
||
§28 decomposition note in CLAUDE.md (which is stale for it). A pure-move
|
||
decomposition round (Fable refactor-dev, per the refactor policy): the
|
||
scope/widen logic, the document store, and the source selectors
|
||
(`module_sources`, `rename_sources`) are three sentences. Not planned; the
|
||
owner decides where it goes in loop 2.
|
||
|
||
- [x] `state.rs` decomposition (pure move, byte-identical output, test
|
||
count unchanged); CLAUDE.md's measurement line refreshed —
|
||
**deferred to loop 3 by the lead, 2026-09-07** (958 lines at 0.49.0;
|
||
the measurement line already says so); a Fable refactor lane when
|
||
the owner schedules it — **done 2026-10-14**
|
||
(`docs/features/decomposition-state/README.md`: `state/` is ten
|
||
modules, largest 412 production lines; the CLAUDE.md measurement
|
||
line is the lead's, requested in that README's Handshakes)
|
||
|
||
## 50. `.*` expansion (planned 2026-09-05) — the first §8 refactoring
|
||
|
||
One lane after 0.45.0, §36's protocol. Feature README:
|
||
`docs/features/expand-wildcard/README.md`. Ships in 0.46.0 with §51.
|
||
|
||
A wildcard connection `sub u_x (.clk(clk), .*);` binds every remaining
|
||
port to the same-named signal in scope (IEEE 1800 §23.3.2.4). Expanding it
|
||
writes those bindings out — the refactoring people reach for before a
|
||
port list diverges, and the one the ports engine already refuses to edit
|
||
around (`add`/`remove` warn and leave `.*` sites alone; `propagate`
|
||
declines a wildcard site).
|
||
|
||
- **Engine** (`vlog_refactor::ports`, new `expand.rs` beside
|
||
`propagate.rs` — the closest sibling: it already computes "the ports the
|
||
instantiation does not name" from the instantiated module's declaration):
|
||
`expand_wildcard(files, file, offset) -> Result<RefactorEdit, String>`.
|
||
At the cursor's instantiation: refuse unless the connection list holds a
|
||
`.*`; take the instantiated module's port list (through `Scope`, the
|
||
fan-out reader `propagate` uses); for every port not explicitly
|
||
connected, emit `.name(name)` when a signal `name` is declared in the
|
||
instantiating scope (the wildcard's own rule: same name, in scope, any
|
||
kind — net, var, port, parameter is *not* a signal); a port with no
|
||
same-named signal in scope is what the wildcard would have left
|
||
unconnected → emit `.name()` and a warning naming it (the compiler
|
||
would have errored; saying so is the point of the expansion). Replace the
|
||
`.*` token with the generated connections in the port's declaration
|
||
order, one per line when the list is already multi-line, inline
|
||
otherwise — then let the formatter's verified splice do the layout
|
||
(the ports engine's lexical splice + "the file still parses" rule,
|
||
README §"How an edit is made"). The `.*` element's comments (before/after
|
||
slots) go on the first generated connection.
|
||
- **Refusals** (the verifier's whole-edit rule): the instantiated module
|
||
unknown or declared twice; a parse diagnostic in either file; a port
|
||
list carrying compiler directives (`ListDirective` — the same refusal
|
||
`instantiation_plan` makes); an instance with more than one `.*` (illegal);
|
||
a `.*` inside a `bind` directive (out of scope, say so).
|
||
- **Server:** a code action `lucisv: expand .* (N connections)` offered at
|
||
a `.*` under the cursor, through the lazy offer path (§37.1: the offer
|
||
reads the buffer + the declaration, `resolve` computes the edit); a
|
||
command `lucisv.expandWildcard [uri, position]` for clients without
|
||
code actions; the VS Code extension needs nothing new (commands are
|
||
discovered). Title count from the plan.
|
||
- Tests: engine — a three-port module with one explicit and `.*`; all
|
||
ports present in scope; one missing (`.name()` + warning); a port whose
|
||
same-named signal is a *parameter* (not bound — pin per the LRM);
|
||
nested/generate instantiation; multi-line vs inline lists; comments on
|
||
the `.*`; the five refusals; idempotency of the result (formatting the
|
||
edited file changes nothing further); the formatter's byte contract on
|
||
three corpus files edited in a scratch copy. Server — offer + resolve
|
||
over the wire; the command; opentitan read-only: count the `.*` sites
|
||
under `hw/ip` and expand ten of them into scratch copies, each result
|
||
formatting cleanly and parsing with the same instance count.
|
||
|
||
- [x] 50.1 `expand_wildcard` engine + refusals
|
||
- [x] 50.2 code action (lazy) + command
|
||
- [x] docs: feature README; README/site rows (lead applies); §8 line
|
||
annotated
|
||
- [x] Gates (guarded); byte-identity vs 0.45.0
|
||
- [x] QA: the LRM rule attacked (kinds, scopes, generate, parameters);
|
||
refusals; ten opentitan sites in scratch copies
|
||
|
||
## 51. Non-ANSI → ANSI port conversion (planned 2026-09-05) — the second §8 refactoring
|
||
|
||
One lane after §50 merges, §36's protocol. Feature README:
|
||
`docs/features/ansi-conversion/README.md`. Ships in 0.46.0.
|
||
|
||
A Verilog-2001 header `module m (a, b, c);` with body declarations
|
||
`input a; output [7:0] b; inout c;` (and optionally `reg b;` beside the
|
||
`output`) becomes `module m (input a, output reg [7:0] b, inout c);` with
|
||
the body declarations removed. The ports engine already edits headers of
|
||
both shapes (`ports/add.rs::header_edits`: the ANSI list, the non-ANSI
|
||
list plus the body declaration) and its lexical splice + "the file still
|
||
parses" verifier is the safety net; this is the whole-header version.
|
||
|
||
- **Engine** (`vlog_refactor::ports`, new `ansi.rs`):
|
||
`convert_to_ansi(files, file, offset) -> Result<RefactorEdit, String>` on
|
||
a module whose header is `PortList::NonAnsi`. For each header name in
|
||
header order: find its body `PortDecl` (direction, net type or `reg`/
|
||
`logic`, signing, packed dims — from the port declaration and, when a
|
||
separate `reg`/`wire`/`logic` declaration of the same name exists, its
|
||
type merged per IEEE 1800 §23.2.2.2: `output [7:0] b; reg [7:0] b;` →
|
||
`output reg [7:0] b`); emit the ANSI port; delete the body declarations
|
||
it absorbed (whole items, with their trailing comments moved onto the
|
||
ANSI port's slot — comments are never dropped). Leading comments of a
|
||
body declaration go before the ANSI port on its own line if the list is
|
||
multi-line, else are the reason to refuse (say so).
|
||
- **Refusals:** a header name with no body declaration (an implicit port —
|
||
illegal); a body declaration for a name not in the header; a port
|
||
declared twice; a non-ANSI port whose header entry is an expression or
|
||
concatenation (`.a({x,y})`, `{x,y}` — §23.2.2.1 port expressions: refuse
|
||
with the reason); a `PortDecl` with an unpacked dimension differing from
|
||
its variable declaration; any compiler directive in the header or in an
|
||
absorbed declaration; a body declaration inside a generate or
|
||
conditional region; an `interface`/`program` (out of scope in this
|
||
round, say so); the module declared twice in the workspace (the port
|
||
engine's own rule); a parse diagnostic in the file.
|
||
- **Server:** code action `lucisv: convert ports to ANSI (N ports)` offered
|
||
with the cursor anywhere in a non-ANSI module's header, lazy per §37.1;
|
||
command `lucisv.convertToAnsi [uri, position]`.
|
||
- Tests: engine — the LRM examples of §23.2.2.2 (each merge rule), a
|
||
header with 20 ports and mixed declarations, comments on every absorbed
|
||
declaration (all kept, positions pinned), `reg` and `logic` and `wire`
|
||
variants, signed, packed dims, a `parameter` between the declarations
|
||
(untouched), every refusal, idempotency (the result formats unchanged;
|
||
re-running the action refuses because the header is ANSI); the corpus:
|
||
count non-ANSI modules (`PortList::NonAnsi`) and convert every one in a
|
||
scratch copy — each result parses, formats, and has the same port names
|
||
in the same order (a census assertion, not a byte one). Server — offer +
|
||
resolve over the wire; the command; opentitan read-only: the count of
|
||
non-ANSI modules under `hw/vendor` and ten conversions into scratch
|
||
copies.
|
||
|
||
- [x] 51.1 `convert_to_ansi` engine + refusals — `ports/ansi.rs` (the planner)
|
||
plus `ports/merge.rs` (IEEE 1800 §23.2.2.2), 23 refusals, each a sentence
|
||
- [x] 51.2 code action (lazy) + command — the fourth `port_actions` offer, so
|
||
both offer paths get it; `lucisv.convertToAnsi` is the fifth command
|
||
- [x] docs: feature README; README/site rows (lead applies); §8 line
|
||
annotated
|
||
- [x] Gates (guarded); byte-identity vs 0.45.0; the corpus conversion census
|
||
— **zero non-ANSI headers in corpus/ and in all of OpenTitan**, so the
|
||
acceptance material is real ANSI headers made non-ANSI and converted
|
||
back: 5 in the shipped suite, 290 verified under `hw/ip`
|
||
- [x] QA: every §23.2.2.2 merge rule attacked; comments; refusals; the
|
||
corpus census re-derived; opentitan scratch conversions — verdict
|
||
REWORK, two findings in `docs/features/ansi-conversion/README.md`'s
|
||
QA log (V-1: `comments_kept` forgives a duplicated *untouched*
|
||
comment, no attack test; V-2: an attribute on an absorbed
|
||
declaration is silently dropped)
|
||
|
||
## 52. Organize imports (planned 2026-09-05) — the third §8 refactoring
|
||
|
||
One lane after 0.46.0, §36's protocol. Feature README:
|
||
`docs/features/organize-imports/README.md`. Ships in 0.47.0 with §53.
|
||
|
||
`import pkg::*;` / `import pkg::item;` items accumulate at the top of a
|
||
module, package, class or compilation unit. "Organize" does what Pylance's
|
||
does: remove the imports nothing uses, merge exact duplicates, and sort the
|
||
contiguous run at the scope's top — package name, then item, `*` first
|
||
within one package — keeping every comment. The same computation is a
|
||
lint rule, `unused-import` (Style, default off; safe fix = the removal),
|
||
so the editor squiggles what the action would delete.
|
||
|
||
- **What "used" means (the whole risk).** An import `p::*` in scope S is
|
||
used when some reference in S or a scope nested in S resolves to a
|
||
member of `p` *through that import* — i.e. the name is not declared
|
||
locally between the reference and S, and `p` exports it (same-file
|
||
package: the binder's own tables; cross-file: the index's member table
|
||
for `p`, including §48's re-exports). `p::x` is used when `x` is
|
||
referenced that way. A qualified use `p::y` does NOT use the import.
|
||
**Refuse to judge — never remove — when `p` is unknown to the index
|
||
(not indexed, or in an unindexed scope), when `p` is declared twice,
|
||
when S or any nested scope contains a macro call or a conditional
|
||
directive (a name may live in text lucisv did not read), when S is a
|
||
class with a base class outside the file (an inherited member could be
|
||
the use), or when the file has a parse diagnostic.** The verifier's
|
||
resolution check is the second net: after the edit every reference in
|
||
the file must resolve to what it resolved to before (that is what the
|
||
ports engine's `verify_splice` already asserts — reuse it).
|
||
- **Engine** (`vlog_refactor`, new `imports.rs` + `imports/` if it grows):
|
||
`organize_imports(files, file, offset) -> Result<RefactorEdit, String>`
|
||
for the scope at the cursor (the innermost module/package/class/unit),
|
||
and `unused_imports(files, file) -> Vec<(TextRange, reason)>` for the
|
||
rule. Edits: deletions of whole `import` items (with their line) and
|
||
one replacement for the sorted run; an import that carries a comment
|
||
is never deleted (refuse with a sentence: "delete the comment first")
|
||
and is sorted with its comment attached (the `pieces` rule of §51's
|
||
verifier). Exact duplicates keep the first.
|
||
- **Rule** `unused-import` in `vlog_linter` (Style, default off; option
|
||
none), reading the same engine function through the project-facts
|
||
oracle the semantic rules use (`ctx.mentioned_elsewhere`-style —
|
||
whatever gives the index's member table; if the linter cannot reach it
|
||
in single-file mode, the rule is silent there, as `unused-signal` is).
|
||
Safe fix: delete the item. Docs row + toggle regenerated.
|
||
- **Server:** code action `lucisv: organize imports (removes N, sorts M)`
|
||
on a cursor in an import run or the scope header (lazy per §37.1),
|
||
`source.organizeImports` kind so editors' organize-on-save wires it;
|
||
command `lucisv.organizeImports [uri, position]`.
|
||
- Tests: engine — used/unused for `*` and item forms, same-file and
|
||
cross-file packages, a re-export chain (§48), a name shadowed locally
|
||
(import unused), a nested class using the outer scope's import (used),
|
||
duplicates, sort order with mixed `*`/items, comments on imports (kept,
|
||
moved with their line, deletion refused), every refusal; the verifier's
|
||
resolution check catches a wrong removal (an attack pair: remove an
|
||
import a reference needs → must be refused); idempotency; corpus census
|
||
over every scope with ≥ 2 imports: organize in a scratch copy, result
|
||
parses/formats/converges, resolution counts unchanged, counts of
|
||
removed/sorted/refused reported. Rule — true positives, near-misses,
|
||
the census over the corpus with counts. Server — offer/resolve, the
|
||
`source.organizeImports` kind honoured on `codeAction` with `only`,
|
||
the command; opentitan read-only: UVM env packages (`hw/ip/*/dv/env/*_pkg.sv`)
|
||
organized into scratch copies, counts, and every "unused" claim
|
||
checked by grep for the package's members in the file.
|
||
|
||
- [x] 52.1 engine: used/unused, sort, dedup, refusals
|
||
- [x] 52.2 `unused-import` rule + safe fix + toggle
|
||
- [x] 52.3 code action (`source.organizeImports`, lazy) + command
|
||
- [x] docs; §8 line annotated; README/site rows (lead)
|
||
- [x] Gates (guarded); byte-identity vs 0.46.0; corpus census
|
||
- [x] QA: every "unused" claim attacked (shadowing, nested scopes,
|
||
re-exports, macros, directives, unknown packages); the verifier
|
||
attack pair; opentitan UVM packages
|
||
|
||
## 53. Extract module and inline module (planned 2026-09-05) — the dearest §8 refactorings
|
||
|
||
One lane after §52 merges (two sub-lanes in sequence if the first alone
|
||
takes a round), §36's protocol. Feature README:
|
||
`docs/features/extract-inline-module/README.md`. Ships in 0.47.0 with §52.
|
||
Both are lexical refactorings over a verified whole edit, like §50/§51:
|
||
one plan through `vlog_refactor`'s splice and `check.rs` (`pieces_match`,
|
||
`never_dropped`, the resolution check), with a refusal sentence for every
|
||
shape lucisv cannot judge.
|
||
|
||
### 53.1 Extract module
|
||
|
||
Input: a selection covering **whole module items** (one or more
|
||
contiguous `always`/`assign`/instantiation/declaration/generate items)
|
||
inside module `M`, and a name `N` for the new module. Output: a new
|
||
module `N` holding the items, with ports and parameters inferred, and the
|
||
selection replaced by an instantiation `N u_N (...)` rendered by
|
||
`instantiation_plan` over the new module's text (so the skeleton and the
|
||
instantiation can never disagree).
|
||
|
||
- **Ports, from dataflow across the region boundary**, using the file's
|
||
`Semantics` (symbols and references with spans): a name declared
|
||
*outside* the region (in `M`, including its ports) and referenced
|
||
*inside* becomes a port — `input` when only read inside, `output` when
|
||
written inside (assign LHS, always LHS, an instantiation's output
|
||
connection is unknown without the instantiated module's declaration —
|
||
look it up through the index; refuse when unknown) and read or written
|
||
outside, both → refuse ("`x` is driven on both sides of the selection").
|
||
A name declared *inside* and referenced outside → refuse ("move the
|
||
declaration of `x` out of the selection first"). The port's type is the
|
||
declaration's own text in `M` (net/var kind, signing, packed dims —
|
||
the §51 merge machinery renders it); an unpacked dim → refuse this
|
||
round. A parameter of `M` referenced inside becomes a parameter of `N`
|
||
with `M`'s default, passed through `#(.P(P))`. Imports of `M` used
|
||
inside are copied into `N` (§52's judgement says which are used).
|
||
- **The new module's home:** a new file `N.sv` beside `M`'s file when the
|
||
client advertises `workspace.workspaceEdit.documentChanges` with
|
||
`CreateFile` support (VS Code does); otherwise `N` is written below `M`
|
||
in the same file. Say which happened in the action's warning list.
|
||
- **Refusals** (each a sentence): the selection does not cover whole
|
||
items; it contains a port declaration, a `parameter`/`localparam`
|
||
declaration, a `genvar`, a `bind`, a macro call or conditional
|
||
directive, a task/function used on both sides, a hierarchical
|
||
reference crossing the boundary (`u_x.sig` in either direction — the
|
||
§49 surface says whether the head is inside), an interface-typed name
|
||
crossing, a name with an unpacked dimension crossing, an
|
||
`initial`/`final` block (testbench code; refuse this round, say so), a
|
||
`timescale`/`default_nettype` in force that `N.sv` would not inherit
|
||
(a new file: copy the directive or refuse — refuse), `N` already
|
||
declared in the workspace, `M` declared twice.
|
||
- **Server:** code action `lucisv: extract selection into module…` under
|
||
`refactor.extract` (lazy), whose resolve asks the client for the name
|
||
through a command with a `showInputBox`-style flow: since LSP has no
|
||
input prompt, the action carries a default name (`M_extracted`) and the
|
||
VS Code extension wraps the command `lucisv.extractModule [uri, range,
|
||
name]` with an input box (one function in `editors/vscode/extension.js`;
|
||
other clients pass the name themselves). Say so in the docs.
|
||
- Tests: a combinational region (inputs + one output); a sequential
|
||
region (clk/rst become inputs, the register an output); a region using
|
||
a parameter and an import; every refusal; the round trip `extract →
|
||
inline` (53.2) returns the original file modulo layout (formats to
|
||
the same text — pin as byte-equal after formatting both); corpus: five
|
||
hand-picked regions in scratch copies, each result (both files) parses,
|
||
formats, converges, and the whole design's reference counts match
|
||
before/after (the census over the two files together).
|
||
|
||
### 53.2 Inline module
|
||
|
||
Input: the cursor on an instantiation `S u_S (...)` of a module `S`
|
||
declared exactly once in the workspace. Output: the instantiation
|
||
replaced by `S`'s items with `S`'s port names replaced by the connected
|
||
names, `S`'s parameters by their override or default values as
|
||
`localparam`s, and every internal name prefixed `u_S_` unless no name in
|
||
`M` collides (then unprefixed — say which in the warning list); `S`'s
|
||
imports copied into `M` if `M` lacks them.
|
||
|
||
- **Refusals:** a connection that is an expression rather than a plain
|
||
name or literal ("connect `.a(x+1)` to a named wire first"); a `.*`
|
||
("expand `.*` first" — §50); positional connections ("convert to named
|
||
first"); an unconnected input; any hierarchical reference to `u_S` from
|
||
anywhere in the workspace (the §49 hierarchical surface: `u_S.x` in any
|
||
file → refuse, naming the file); `S` with a `generate` that declares
|
||
names reachable hierarchically (`u_S.gen.x` — same rule); `S`
|
||
declared twice or unknown; `S` with ports of interface type, with
|
||
`inout` ports, with unpacked-array ports, or with an `initial`/`final`
|
||
(refuse this round); a macro call or conditional directive in `S`;
|
||
`S`'s `timescale` differing from `M`'s file; a name collision that
|
||
prefixing cannot resolve (an escaped name).
|
||
- **Server:** code action `lucisv: inline `S` here` under `refactor.inline`
|
||
(lazy), command `lucisv.inlineModule [uri, position]`.
|
||
- Tests: a two-port module inlined into its instantiator (round trip
|
||
with 53.1); a parameterized module with an override; a name collision
|
||
(prefixed); every refusal; the verifier's resolution check on the
|
||
result; corpus: five instantiations of small `common_cells` modules
|
||
inlined in scratch copies, each result parses, formats, converges, and
|
||
a `lucisv check --select unused-signal,undriven-net` census over the
|
||
result is unchanged in count from the original two files.
|
||
|
||
- [x] 53.1 extract: dataflow ports, parameters, imports, the new file,
|
||
refusals, action + command + extension input box
|
||
- [x] 53.2 inline: substitution, prefixing, refusals, action + command
|
||
- [x] the extract → inline round trip pinned
|
||
- [x] docs; §8 line annotated (extract only); site rows (lead — see the
|
||
feature README's "Docs to apply at merge")
|
||
- [x] Gates (guarded); byte-identity vs 0.46.0; corpus scratch checks
|
||
- [x] QA: dataflow direction attacked (every statement kind that writes
|
||
a name), boundary-crossing shapes, collisions, the round trip, the
|
||
client-capability fallback, opentitan scratch trials
|
||
- [x] 53.2 QA: the substitution attacked (every position a port name can
|
||
appear in), the `.name` shorthand and `.*` inside `S`, the
|
||
prefixing rule and its collisions, every refusal, the copy
|
||
allowance's attack table re-attacked, the round trip, corpus and
|
||
opentitan scratch trials — PASS, two MEDIUM findings (QA-2, QA-3),
|
||
see the feature README's QA log
|
||
|
||
## 54. Coverage gaps L3, L6, L10 (planned 2026-09-06) — the owner's "do all three"
|
||
|
||
One lane after 0.47.0, §36's protocol. Feature README:
|
||
`docs/features/coverage-gaps-l/README.md`. Ships in 0.48.0. Every item is
|
||
a grammar arm with its formatter twin, the snapshot + idempotency suite,
|
||
strict/tolerant parity, and the byte-identity gates; none of these shapes
|
||
occur in the corpus or opentitan (say so per item with the grep), so the
|
||
acceptance is hand-written cases plus the fuzzers.
|
||
|
||
### 54.1 L6 — the language shapes
|
||
|
||
- `->>` non-blocking event trigger (`->> e;`, `->> #5 e;`, `->> @(posedge clk) e;`).
|
||
- Stream operator `with [range]` (`{<< {a with [0:3]}}`, `[i+:4]`, `[i-:4]`).
|
||
- Cast bases other than a name or system call: a parenthesised width
|
||
`(W+1)'(x)`, a sized literal `4'(x)`, a type with dims `logic [3:0]'(x)`
|
||
— the LRM's `casting_type` (§6.24.1).
|
||
- Drive strength on a net declaration: `wire (strong0, weak1) w = a;`,
|
||
`wire (supply0, supply1) [7:0] v;` — `DataDecl` gains the strength the way
|
||
`ContAssign` already carries one (`parse_opt_drive_strength` exists).
|
||
- `let` at statement position (a `let` declared inside a sequential block
|
||
/ procedural scope, IEEE 1800 §11.13).
|
||
- `#(min:typ:max)` clocking skew: `default input #(1:2:3) output #(2:3:4);`
|
||
and per-signal skews.
|
||
Each: parser arm, AST field with comment slots where a gap opens (the
|
||
comment-slots gap fuzzer's zero-failure bar), formatter arm, cases file,
|
||
strict/tolerant parity, `size_pins` unmoved.
|
||
|
||
### 54.2 L3 — `randsequence` bodies
|
||
|
||
`randsequence (main) main : first second; first : { $display("a"); };
|
||
second : third | fourth := 2; …; endsequence` — a production grammar (IEEE
|
||
1800 §18.17): productions with optional return types and arguments,
|
||
weighted alternatives `:=`, `rand join`, `repeat`, `if`/`case`, code
|
||
blocks, `break`/`return`. Today an opaque `Verbatim` leaf? Check
|
||
(`grep -rn randsequence crates/vlog_parser/src`). Ruling: model the
|
||
production list and alternatives as real nodes (a `RandSequence` statement
|
||
with `Production { name, ret_type, args, alternatives: Vec<Alternative {
|
||
weight, items }> }`, items being production references or a code block
|
||
parsed as a statement block); the formatter prints one production per
|
||
line, alternatives aligned after `:` / `|`; comment slots per production.
|
||
Zero corpus occurrences — a pure-LRM feature; the LRM's own examples are
|
||
the cases.
|
||
|
||
### 54.3 L10 — cosmetics
|
||
|
||
- An enum body one-lined when short: `typedef enum {A, B, C} e_t;` stays on
|
||
one line when it fits the width and has no comments — today it always
|
||
breaks? Confirm with a case; make the group breakable the way a port list
|
||
is (`Doc::Group`), so long bodies still break one per line. **Byte
|
||
identity WILL change** for corpus files with short enums: measure the
|
||
count, list them, and the lead rules at review whether the change is
|
||
wanted (the corpus has ibex/opentitan enums — likely dozens of files).
|
||
- `` `uvm_field_* `` lines dedented to the `` `uvm_object_utils_begin ``
|
||
column: macro statements between `_begin`/`_end` are plain macro items
|
||
with no block for the formatter to see; a targeted rule — a macro
|
||
statement whose name matches `uvm_object_utils_begin`/`uvm_component_utils_begin`
|
||
opens an indent level closed by `uvm_object_utils_end`/`uvm_component_utils_end`
|
||
— in the item/statement sequence printer, gated on exactly those names.
|
||
Byte identity changes for UVM files that already indent them — measure
|
||
and list.
|
||
Both cosmetics are **off by default behind a config key** if the corpus
|
||
count is large: `[format] enum-one-line = true|false`, `[format]
|
||
uvm-utils-indent = true|false`, default false, so 0.48.0 changes no
|
||
byte for anyone who does not opt in; the lead decides the defaults at
|
||
review from the counts.
|
||
|
||
- [x] 54.1 the six L6 shapes, each with cases + parity + fuzzers
|
||
- [x] 54.2 `randsequence` as real nodes
|
||
- [x] 54.3 the two cosmetics behind config keys, corpus impact measured
|
||
— **one key, not two**: `[format] uvm-utils-indent` (21 corpus files
|
||
when on); the enum one-lining was measured already-default and no
|
||
key was shipped for it. Ruling in the feature README's work log.
|
||
- [x] docs; coverage_gaps L3/L6/L10 struck; README/site config keys (lead)
|
||
— strike text and the config-key rows are in the feature README
|
||
under "Docs to apply at merge (lead)"
|
||
- [x] Gates (guarded); byte-identity vs 0.47.0 (0 differing with the keys
|
||
off); opentitan sweep unchanged — 4 143 tests green; corpus 814/820,
|
||
the same six; byte-identity vs 0.48.1 0/860 differing; opentitan
|
||
2 553 files, per-file outcomes identical
|
||
- [x] QA: every shape with comments in every gap; the fuzzers; the keys on
|
||
over the corpus in a scratch copy (idempotent, comments kept)
|
||
|
||
## 56. DUT-centred hierarchy view (owner request 2026-09-06)
|
||
|
||
The next lane after 0.47.0 ships — ahead of §53.2 and §54, at the owner's
|
||
request. One lane, §36's protocol; dev Opus 5, QA Sonnet 5. Feature README:
|
||
`docs/features/dut-hierarchy/README.md`. Ships in 0.48.0.
|
||
|
||
**What the owner asked for, verbatim in substance.** A design holds many
|
||
modules and one (or a few) is the DUT — the module that matters most. It
|
||
usually has DV above it (a testbench that instantiates it). The hierarchy
|
||
pane should let the user right-click any module and **star it as DUT**.
|
||
With one DUT starred the pane shows three sections: **the DUT with its
|
||
children** (its instance subtree, the DUT at the very top), **the DUT's
|
||
parents** (every module that instantiates it, transitively — typically the
|
||
DV — as a tree explored upward from the DUT), and **all other modules**
|
||
(everything that is neither below nor above any DUT), each section
|
||
collapsible. Two DUTs starred → five sections: DUT1 + children, DUT1
|
||
parents, DUT2 + children, DUT2 parents, all other modules. Unstar from the
|
||
same menu.
|
||
|
||
**Where it lives.** Entirely in the extension over the existing flat
|
||
snapshot (`lucisv/moduleHierarchy`: `files`, `modules`, `instances`;
|
||
`hierarchyModel.js::buildHierarchy` already builds the forward tree and
|
||
chooses roots) — the server changes nothing. The reverse map (module →
|
||
instantiating modules, via each instance's owning module) is one pass over
|
||
the same snapshot in the model. DUT choices persist per workspace in
|
||
`workspaceState` (a list of module names, in the order starred), the way
|
||
the existing bookmark does (`hierarchyView.js` `BOOKMARK_KEY`).
|
||
|
||
- **Model** (`hierarchyModel.js`): `sections(model, duts)` returning, in
|
||
order, for each starred DUT `{ kind: 'dut', name, root }` (the DUT's
|
||
forward subtree, exactly the node the plain view would show for it) and
|
||
`{ kind: 'parents', name, root }` (an upward tree: the DUT as the root,
|
||
each child a module that instantiates the parent node — with the
|
||
instance name that does it — recursing up until a module nothing
|
||
instantiates; cycles cut with a visited set), then
|
||
`{ kind: 'others', roots }` = today's roots minus every module that is in
|
||
any DUT's subtree or ancestor chain (a module both below DUT1 and above
|
||
DUT2 appears in both DUT sections and not in others). A starred name the
|
||
snapshot no longer holds (renamed/deleted) keeps its section with an
|
||
empty "not in the index" row rather than vanishing silently.
|
||
- **View** (`hierarchyView.js`): section nodes as collapsible tree items
|
||
with icons (`debug-start`-style for a DUT, an upward arrow for parents,
|
||
a folder for others), the DUT section expanded by default, others
|
||
collapsed; DUT rows carry a `contextValue` so the menu shows
|
||
"Unstar DUT" on a starred module and "Star as DUT" on any other; the
|
||
existing search, reveal-on-open and bookmark behaviour work inside every
|
||
section; when no DUT is starred the pane looks exactly as today (pin it
|
||
— the snapshot-to-tree output byte-identical to the current tests).
|
||
- **Commands + menus** (`package.json`): `lucisv.hierarchy.starDut`,
|
||
`lucisv.hierarchy.unstarDut`, `lucisv.hierarchy.clearDuts`; `view/item/context`
|
||
entries gated on `viewItem`; a `view/title` "Clear DUTs". Also a setting
|
||
`lucisv.hierarchy.duts` (string array) as the second way to set them
|
||
(a checked-in `.vscode/settings.json` for a team) — the union with the
|
||
starred list, the setting's entries shown with a lock icon and not
|
||
unstar-able from the menu (say so in a tooltip).
|
||
- **Tests** (`node --test editors/vscode/*_test.js`, the existing model
|
||
tests' harness): sections for zero, one and two DUTs on a fixture with a
|
||
DV bench above a DUT above three leaves plus two unrelated modules; a
|
||
module both below one DUT and above another; a cycle (`a` instantiates
|
||
`b` instantiates `a`) in the parents walk; a starred name absent from the
|
||
snapshot; the others section excludes exactly the right set; the plain
|
||
view unchanged with no DUT; persistence round trip through a fake
|
||
`workspaceState`; the setting union and lock; the menu `when` clauses.
|
||
Manual: a checklist entry in `docs/manual-acceptance.md` (star aes in
|
||
opentitan → three sections; star aes and hmac → five; unstar).
|
||
- Docs: the extension README's hierarchy section, the site's editors page
|
||
(lead applies), the feature README.
|
||
|
||
- [x] 56.1 model: reverse map, `sections()`, others-exclusion, cycle cut
|
||
- [x] 56.2 view: section nodes, icons, context values, persistence,
|
||
setting union
|
||
- [x] 56.3 commands, menus, package.json, tests, acceptance checklist row
|
||
- [x] docs (lead applies README/site) — applied 2026-09-06 (site editors
|
||
paragraph, topo node; the extension README rows were the dev's)
|
||
- [x] Gates: `node --test editors/vscode/*_test.js`; vsix smoke; the plain
|
||
view pinned unchanged
|
||
- [x] QA: every section shape attacked on the fixture and on opentitan
|
||
(real snapshot, read-only); persistence; the setting; menus
|
||
|
||
## 57. Final cleanup and closing release (owner's end goal, 2026-09-06)
|
||
|
||
After §53.2 and §54 merge and 0.49.0 ships, the last lane of loop 2 is the
|
||
lead's own, no dev/QA:
|
||
|
||
- [x] **Tree:** `git status --porcelain` empty; `git worktree list` shows
|
||
the main tree only; `git branch` shows `master` only; no local tag
|
||
that is not on the server; no stray files in the tree
|
||
(`corpus-check-results.tsv` is ignored — fine); the scratchpad and
|
||
`~/.cache/lucisv-baselines/wip-*` snapshots deleted. — done
|
||
2026-09-07 at 4c2dae3 (main tree only, `master` only, every local
|
||
tag on the server, snapshots and scratch leftovers removed).
|
||
- [x] **Remote:** `master` pushed and equal to local; every release tag
|
||
on the server; every release with 8 assets; the published vsix of
|
||
the final release unzipped and checked for the feature files of
|
||
loop 2 (`hierarchySections.js`, `extract.js`, no `*_test.js`).
|
||
— done 2026-09-07: v0.49.0 has 8 assets (run 270); the darwin-arm64
|
||
vsix carries `hierarchySections.js` and `extract.js`, no `*_test.js`,
|
||
version 0.49.0.
|
||
- [x] **TODO.md:** every checkbox either ticked or annotated with a
|
||
dated ruling (deferred to whom, or dropped why); the "Loop 2 order"
|
||
section closed with what shipped in which release; §44/§55 and the
|
||
topo §2.9 open rows (23 done; 29/30 done; 31 DPI export, 32 the
|
||
verifier same-file relocation) restated in one "open items" list
|
||
for loop 3. — done 2026-09-07: the only unticked lines left are
|
||
§55 (deferred, annotated) and the §57 items that wait on the
|
||
0.49.0 assets.
|
||
- [x] **Docs:** `docs/topo.md` rows for every loop-2 lane present;
|
||
`docs/coverage_gaps.md` struck where delivered; CLAUDE.md's
|
||
measurement line refreshed (`state.rs` 957 lines → whatever §55
|
||
leaves it; if §55 does not run, the number and the reason);
|
||
`docs/manual-acceptance.md` rows through §56; the site rebuilt and
|
||
committed. — done 2026-09-07 (CLAUDE.md re-measured at 0.49.0:
|
||
state.rs 958 with §55 filed; topo rows for §36–§56; L3/L6/L9/L10
|
||
struck; acceptance rows 15–17; site rebuilt in the §54 commit).
|
||
- [x] **Memory:** the paused-state memory rewritten as a short current
|
||
state (not a running log), with the release list and the open items.
|
||
— done 2026-09-07.
|
||
- [x] **Closing release:** if anything above changed a shipped file
|
||
(docs count), a final release `0.49.x`/`0.50.0` cut from the clean
|
||
tree, its assets verified, and the install line given to the owner.
|
||
— **ruled 2026-09-07: 0.49.0 is the closing release.** The commits
|
||
after it are TODO/CLAUDE.md/memory bookkeeping only — nothing that
|
||
reaches a binary, the extension or the site — so no further tag.
|
||
|
||
## 58. Performance take 4 on opentitan (owner request 2026-09-07) — 0.49.0 vs 0.43.0 vs take 3
|
||
|
||
§40's protocol, one release later. Read-only measurement; a regression is
|
||
filed with a reproduction, not fixed in this lane. Output:
|
||
`docs/performance_take4.md`, the same table shapes as
|
||
`docs/performance_take3.md` so every row is a before/after (take 3's
|
||
0.43.0 column carried beside the new 0.49.0 column; 0.39.0 where take 3
|
||
had it), plus a `docs/perf/README.md` entry. Tree:
|
||
`/Users/guoliangchen/repo/opentitan` (never written; the three
|
||
pre-existing modified files stay as they are, `git status --porcelain`
|
||
checked after every phase). Every run under `tools/guard.sh -m 8 -t 1800`.
|
||
No `cargo` command in any tree during a timed measurement.
|
||
|
||
Binaries: the 0.49.0 CLI is `~/.cache/lucisv-baselines/lucisv-0.49.0`
|
||
(0.43.0 and 0.39.0 beside it); the 0.49.0 server is
|
||
`target/release/lucisv-server` in the main tree (the tree's code is
|
||
4c2dae3 = v0.49.0 — verify by sha or `--version` before use, rebuild
|
||
once with `cargo build --release -p lucisv_server` only if it is stale,
|
||
before any timing); the 0.43.0 server is built from the `v0.43.0` tag in a
|
||
scratch `git worktree` under the scratchpad and the worktree removed after.
|
||
|
||
- **The harness is committed this time.** Take 2's client was lost and
|
||
take 3's was reimplemented from prose; take 3's is gone too (the
|
||
scratchpad is volatile). Take 4's client and drivers live in
|
||
`tools/perf/` (`lspclient.py`, `bench.py`, `sweep.sh`,
|
||
`sweeptable.py`, `outcomes.sh`; Python 3 standard library only, a
|
||
short README saying how to run each phase). Take 5 reuses them.
|
||
- **Server, the take-3 request table** (take 3 §2, every row): startup
|
||
and scan per scope config and cache state (cold / warm), the `didOpen`
|
||
widen at the default scope, `codeAction` at the take-3 cursors (lazy
|
||
offer and eager, plus `codeAction/resolve` where an action is offered),
|
||
`prepareRename` / `rename`, `completion`, `definition`, `hover`,
|
||
`inlayHint`, `references`, `documentSymbol`, `workspaceSymbol`,
|
||
`semanticTokens/full`, diagnostics publish, the queue-blocking analysis
|
||
(take 3 §3), the transport baseline and the `--verbose` cross-check
|
||
(take 3 §0).
|
||
- **New rows for what 0.44–0.49 added**, each with the 0.43.0 column
|
||
beside it where the request exists there:
|
||
- the `didOpen` delay (§46) confirmed on the wire in the release build:
|
||
`didOpen` → the request behind it for `aes.sv`, `aes_core.sv`,
|
||
`spi_device.sv`, `pinmux_reg_top.sv` (the perf README's 2026-09-05
|
||
table was taken with temporary timings — this is the release
|
||
number);
|
||
- `codeAction` at the new offer sites: a `.*` instance (expand
|
||
wildcard), a non-ANSI module header (convert to ANSI), an `import`
|
||
line (organize imports), a selection of a few module items (extract
|
||
module), a separate-file instance with named connections (inline
|
||
module) — the lazy offer and one `resolve` each; how many actions
|
||
each cursor offers, so the reader knows what was paid for;
|
||
- `rename` of a net reached through an instance tail (§49's
|
||
hierarchical surface) and `completion` after `u_x.` on an instance
|
||
head — pick real opentitan sites and name them;
|
||
- `lucisv/moduleHierarchy` (the snapshot the DUT view consumes; the
|
||
sections themselves are client-side and not measured here);
|
||
- index store size on disk and the server's peak RSS after the
|
||
workspace scan, 0.43.0 vs 0.49.0 (`FACTS_FORMAT` 18 → 19 added the
|
||
hierarchical member table and the re-export group).
|
||
- **CLI sweeps** as take 3 §7 over the same five trees: `format --check`
|
||
(cold cache and warm), `check` (default rules; `--select
|
||
error,warning,style`), wall time and peak RSS, 0.49.0 vs 0.43.0 vs
|
||
0.39.0; failure counts per tree and every per-file outcome that changed
|
||
since 0.43.0 (expected candidates: §54's grammar — `randsequence`,
|
||
`->>`, casts, drive strengths, `let`, clocking skews — and §38's
|
||
outcomes staying fixed; anything else is a finding). The formatter cache
|
||
goes to a scratch `--cache-dir`; the index cache to a scratch
|
||
`storagePath`.
|
||
- **Method** as take 3 §9: three tries per row, first try and repeat
|
||
range reported, machine state noted (load average before and after
|
||
each phase; the machine runs a desktop session — say so).
|
||
- **Findings:** any row slower than take 3 by more than noise is a filed
|
||
item with a reproduction; anything faster is credited to the section
|
||
that did it. The eager `codeAction` path is ruled a non-hot path
|
||
(owner, 2026-09-05) — report it, do not re-file it.
|
||
- Feature README: `docs/features/performance-take4/README.md` (Goal,
|
||
Assumptions, Handshakes, Status, Work log, QA log, Review).
|
||
|
||
- [x] harness in `tools/perf/` with its README; runs from a clean checkout
|
||
- [x] server table re-measured, 0.49.0 vs 0.43.0 vs take 3 — take 4 §2
|
||
- [x] new rows: didOpen release numbers, the five refactoring offer sites,
|
||
tail rename and instance-head completion, moduleHierarchy, index
|
||
size and RSS
|
||
- [x] CLI sweeps, three binaries, RSS included; outcome diff since 0.43.0
|
||
- [x] `docs/performance_take4.md` + perf README entry
|
||
- [x] opentitan status unchanged after every phase; no guard kill
|
||
- [x] QA: a sample of at least eight rows re-run with the committed
|
||
harness (both binaries) and checked against the document within its
|
||
stated tolerance; the outcome diff re-derived; opentitan status;
|
||
every number quoted in the document found in the raw logs
|
||
|
||
## 59. The format cache key omits `uvm-utils-indent` (topo §2.9-34, owner's audit 2026-09-07)
|
||
|
||
Filed by the repository analysis: `lucisv_core::cache::Entry` and
|
||
`lucisv/src/main.rs::entry_for` key a verdict on content, `line-length`
|
||
and `indent` (and the lucisv version), so toggling `[format]
|
||
uvm-utils-indent` after a clean `--check` keeps the stale clean verdict
|
||
(`--check` exits 0 while `--no-cache --check` exits 1). Runs after §58
|
||
(no build during a timed measurement). Feature README:
|
||
`docs/features/format-cache/README.md` (work log entry, Handshakes
|
||
amended: the key now names the option).
|
||
|
||
- **The key.** `Entry` gains `uvm_utils_indent: bool`; `entry_for`
|
||
fills it from `Config`; the store line carries it as a fifth field and
|
||
a line without it (an older store) is dropped individually, like
|
||
another version's entry. Equality and the codec round-trip tested in
|
||
`cache.rs`.
|
||
- **Regression** as the audit's probe, through the real CLI: a UVM class
|
||
with `uvm_field_int`, cache a clean verdict with the option false,
|
||
flip to true → `--check` exits 1; and the other direction.
|
||
- README: the `--no-cache` workaround paragraph in `README.md` and the
|
||
topo row 34 struck at merge (lead).
|
||
|
||
- [x] `Entry`/`entry_for`/store codec, tests
|
||
- [x] CLI regression, both toggle directions
|
||
- [x] format-cache README work log + Handshakes
|
||
- [x] QA: attack the key (another option, another version, a store line
|
||
with four fields); confirm the audit's probe passes on the fix and
|
||
fails on 0.49.0
|
||
|
||
## 60. Performance take 5 — the implementation plan (owner request 2026-09-07)
|
||
|
||
`docs/performance_take5.md` is the spec; `docs/perf/take5-tracking.md`
|
||
is the ledger every stage fills (baseline columns are the owner's, at
|
||
0.50.0 / bbdbfe9 — never overwritten); `docs/perf/take5-baseline/` is
|
||
the evidence. This section only sequences the plan into lanes and names
|
||
the gates. **Serial, one lane at a time in the main tree** (the plan
|
||
forbids parallel lanes: P1–P4 share `state.rs`, the selectors and open
|
||
handshake 33), dev (Opus) → QA (Sonnet) → lead review → commit, the
|
||
§36 protocol. Every stage: its own feature README
|
||
(`docs/features/perf5-<stage>/README.md`), the tracker's candidate
|
||
columns and an experiment entry filled at the exact candidate commit,
|
||
measured with `tools/perf/` under `tools/guard.sh -m 8 -t 1800`, no
|
||
build during a timed session, opentitan read-only. A stage's numbers
|
||
are taken by its dev and re-taken by its QA on the same binary; the
|
||
lead accepts a number only when both agree within the tracker's
|
||
tolerance. Targets are the plan's provisional goals: missing one is
|
||
reported with the measured remaining stage, never hidden.
|
||
|
||
### 60.0 P0 — the harness tells the truth (tools/perf only)
|
||
|
||
Plan §P0. Files: `tools/perf/*` and its README; no production change.
|
||
Done 2026-09-07; `docs/features/perf5-p0/README.md`, experiment
|
||
`P0-2026-09-07` in the tracker.
|
||
- [x] units and status on every new record (`ms` is latency only; RSS
|
||
and store size in their own fields with units; `status`
|
||
ok/error/refused; result counts; a normalized fingerprint of
|
||
edits/warnings); the schema versioned, the take-4 rows still
|
||
readable
|
||
— `tools/perf/schema.py` (new); `record()` validates, `samples()`
|
||
replaces `Session.ms` so a failed request is never a fast success
|
||
- [x] edit-bearing offers → `codeAction/resolve`; command-bearing
|
||
offers (extract, inline) → a separate execute-command scenario
|
||
that captures the server's `workspace/applyEdit` payload and
|
||
replies `applied: false` (reason recorded as a client capture,
|
||
distinct from an engine refusal or an error); created files,
|
||
edits, refusals, warnings counted
|
||
— phase `execute`: extraction 257 / 245–247 ms, 2 edits / 2 files
|
||
/ 1 created, status `capture`; both `aes_wrap.sv` 66:2 offers
|
||
`refused` with the engine's own sentence
|
||
- [x] the owner's two supplemental probes become phases
|
||
(`offerkinds`: the `context.only` families at the five cursors;
|
||
`offerqueue`: leader/follower); scan completion vs first useful
|
||
answer separated; fresh-process rows distinguished from repeats
|
||
- [x] `sweep.sh`: the scratch format cache reset before *each* cold
|
||
try, warm rows explicitly primed; cold rows show zero hits
|
||
— verified on `hw/ip` at 0.50.0: cold `0 / 0 / 0`, warm `30 / 30 / 30`
|
||
- [x] the baseline reproduced on the unchanged binary with the
|
||
corrected harness — the tracker's "Reference" cells for every
|
||
row P1/P2 will touch (pinmux comment all-family and `only: []`,
|
||
`aes`/`aes_reg_top`/`tb.sv` offers, tail rename, `aes` rename,
|
||
blockers, refactor resolves, the CLI cells) — and a
|
||
`docs/perf/README.md` note if any baseline row changes meaning
|
||
— 114 rows, zero guard kills, corpus unchanged after all 16 runs;
|
||
every CLI stdout hash byte-identical to the baseline's; three rows
|
||
disagree beyond tolerance and are named, not adjusted
|
||
- [x] QA: a deliberately rejected request lands as an error; the
|
||
inline/extract rows show a command and an applyEdit payload or a
|
||
refusal; cold sweep rows have zero hits; a sample of reference
|
||
cells re-taken
|
||
— PASS, 2026-09-07: `docs/features/perf5-p0/README.md` QA log; ten
|
||
REF cells re-taken (two fingerprints byte-identical), all four
|
||
acceptance experiments and the schema/`resolve_rows` attacks verified
|
||
independently, the three named disagreements reproduce and are real
|
||
|
||
### 60.1 P1 — code-action discovery stops repeating work
|
||
|
||
Plan §P1a then §P1b, one lane, then measured; §P1c only if the ports /
|
||
import offers still dominate after that measurement (a lead ruling).
|
||
Files: `lucisv_server/src/{server/dispatch.rs,code_action.rs,lint.rs,
|
||
ports.rs,imports.rs,extract.rs,inline_module.rs}` plus a *new small
|
||
module* for any per-revision memo (`state.rs` is over size — §55);
|
||
`vlog_refactor/src/{ports/,imports.rs,extract/,inline/,lib.rs}` for
|
||
additive parsed-input selectors beside the text ones. `fence.rs` is
|
||
NOT touched: the text-only fence authority stays and is memoized per
|
||
document revision, computed only when a fix needs it
|
||
(shared-fence-filter's contract).
|
||
- [x] P1a: the `only` filter checked before config discovery, lint and
|
||
fence work; `only: []` returns at once; fence regions computed
|
||
only when a candidate fix exists; kind-prefix semantics,
|
||
fixes spanning the cursor, fix-all, action order, and a cursor
|
||
(empty range) still offering extract — all pinned
|
||
— `only: []` 82.80 → **0.064 ms**; quickfix 84.13 → 23.53; the
|
||
base separated at last: lint+config 23.5, fence parse 59.3 ms
|
||
- [x] P1b: selectors over the document's existing parse + diagnostics
|
||
(large-file mode and parse-diagnostic checks exactly as before);
|
||
text wrappers retained for standalone consumers and parity
|
||
tests; fence memo keyed by exact source revision; any lint-result
|
||
reuse keyed by revision + effective lint/format settings +
|
||
waivers + workspace generation, or not done
|
||
— four additive `*_in` selectors; `fences.rs` memo on the
|
||
`Document`; **lint-result reuse deliberately not done**, reason
|
||
and number in `P1b-2026-09-07`
|
||
- [x] work counters (parses per request) prove "no additional parse on
|
||
a repeated offer" — asserted in tests by count, not by stopwatch
|
||
— `vlog_parser::stats::parses()`; a repeated no-offer all-family
|
||
request performs **0** parses, `only: []` **0**, the first
|
||
request after a `didChange` **≤2**
|
||
- [x] parity pinned at every sampled cursor/range: no-offer comments,
|
||
parse errors, CRLF, UTF-16 positions, unsaved edits, untitled and
|
||
large buffers, action filters, fence insertions, waivers, config
|
||
change, index refresh
|
||
— 7 engine tests comparing old against new at *every byte offset*
|
||
of five fixtures, 12 server tests through the real dispatch
|
||
- [x] measured: repeated lazy offers < 5 ms; `aes_reg_top` < 10 ms;
|
||
the pinmux no-offer comment < 16 ms on an unchanged buffer;
|
||
first-after-edit tracked separately; the pipelined definition
|
||
re-measured; tracker + experiment entry filled
|
||
— pinmux 309.60 → **24.02 ms** (−92.2%), queued definition
|
||
309.40 → **24.61** (−92.0%), `tb.sv` 4.46 → 3.65, `aes_reg_top`
|
||
23.31 → 21.83. **Two of three targets missed, both residues
|
||
measured**: the pinmux row is 100% lint, the `aes_reg_top` row is
|
||
21.15 of 21.83 ms of discarded ports plan. New `offeredit` phase
|
||
for first-after-edit
|
||
- [x] lead ruling on P1c from the measurement — **go** (2026-09-07: the
|
||
`aes_reg_top` offer is 21.8 ms after P1b, 21.2 of it the ports
|
||
family's discarded plan); lint-result reuse **deferred** to the
|
||
loop-3 list (24 ms on the largest file; six-surface key; a stale
|
||
fix offer is the failure mode; the first request after a keystroke
|
||
pays the pass regardless)
|
||
— the measurement is in: `aes_reg_top` ports-only 21.15 ms of a
|
||
21.83 ms row; every other family under 0.15 ms
|
||
- [x] P1c: engine-owned offer predicates — `vlog_refactor::{port_offers,
|
||
port_offers_in}` (new `ports/offer.rs`) and `{organize_offer,
|
||
organize_offer_in}`, each asking only the *plan-time* questions over
|
||
the buffer's own parse/analysis and at most one parse of the
|
||
declaring file; no `Scope` for the ports, no `check::verify_splice`
|
||
for either; `ports::offers` / `imports::offers` on them,
|
||
`resolve` and `execute` untouched and still verifying
|
||
— `aes_reg_top` lazy **21.83 → 5.46 ms** (−75.0%), its ports family
|
||
**21.15 → 3.27** (−84.6%), `aes` **7.76 → 1.74** (−77.6%), the
|
||
organize-imports offer **15.39 (REF) → 4.88**; **all three targets
|
||
met**; the eager guardrail unmoved at 492.5 ms
|
||
- [x] P1c parity: offer ⇔ the eager menu, titles included, at **every byte
|
||
offset** of eight port fixtures and seven import fixtures (two new
|
||
engine test files); 50 harness rows field-identical to P1b and 65 to
|
||
the REF; the three resolve fingerprints byte-identical; a repeated
|
||
ports offer parses **1** file and a repeated organize-imports offer
|
||
**3**, asserted by counter against a `resolveSupport` client
|
||
— residues named, not hidden: the declaring file's parse (2.2–2.4 ms
|
||
of the ports offer's 3.27) and the buffer's own share of the imports
|
||
index (~0.8 ms), the second a `vlog_semantic` handshake request
|
||
- [x] lead ruling on a lint-result reuse item (new, from P1b's number:
|
||
24.0 ms, the whole of the pinmux row, for a client that sends no
|
||
`only`) — a keyed cache in §59's shape, not this lane's to add
|
||
— **closed by §61.2 (0.52.0): `lint_snapshot.rs`**
|
||
- [x] QA (P1c): the every-offset parity suites re-attacked, the two
|
||
counters sabotaged, the numbers re-taken on the same binary
|
||
— 2026-09-07: ports side clean (three refusal fixtures old vs new
|
||
vs resolve, counters load-bearing, 13 cells within tolerance, the
|
||
resolve fingerprints equal to REF); one REWORK finding — the
|
||
organize-imports offer no longer runs `verify_splice` while its
|
||
README still called the offer exact — **ruled by the lead**: the
|
||
narrowing is of the offer's promise only (resolve verifies the same
|
||
file set before any edit leaves the engine); the organize-imports
|
||
README amended; the ports/imports offer contract is now the same
|
||
sentence everywhere.
|
||
- [x] QA (P1a/P1b): parity attacks as above, the counters, the numbers re-taken
|
||
— PASS, 2026-09-07: `docs/features/perf5-p1/README.md` QA log; 17
|
||
cursors byte-identical vs a real v0.50.0 baseline server, counter
|
||
sabotage caught in 3 places, parity suite verified exhaustive plus
|
||
one adversarial fixture, a genuine >4 MiB buffer confirmed, all
|
||
re-measured cells agree within tolerance, gates green
|
||
|
||
### 60.2 P2 — rename reuses its analysis, verification untouched
|
||
|
||
Plan §P2a → §P2b/§P2c → §P2d only with proof. Handshake 33 (transitive
|
||
`wrap.u_S.x` users missed by `module_sources`) is resolved and tested
|
||
*before* any narrower selector is shared with inline/ports. Files:
|
||
`lucisv_server/src/{rename.rs,state.rs}`, `vlog_refactor/src/{scope.rs,
|
||
rename/,check/,lib.rs}`, `vlog_semantic/src/workspace/{record.rs,
|
||
index.rs,update.rs,mod.rs}` as the plan lists — the dev inspects the
|
||
real paths first and names them in the README.
|
||
- [x] P2a: stage timings and work counts for the tail rename, `aes`,
|
||
a unique internal name, `clk`/`rst_n`, an existing/conflicting
|
||
new name, an unresolved new-name use, the all-sources fallback:
|
||
selector time, selected paths + bytes with the reason each was
|
||
included, parses/analyses, occurrence collection, before/after
|
||
verification, serialization, peak RSS — behind a flag or the
|
||
`--verbose` channel, never in the default output
|
||
- [x] P2b: one parse/analysis per file inside the request-local scope
|
||
(`FileFacts::from_analysis` the starting point); additive
|
||
prepared-input API, the text API and its answers/refusals
|
||
unchanged; no workspace-wide AST cache
|
||
- [x] P2c: the after-index from unchanged facts plus the edited files'
|
||
one new analysis; untouched watched files keep local semantics
|
||
and re-resolve externally; token identity, parse-diagnostic
|
||
preservation, comments/attributes, before/after resolution all
|
||
still checked; clone/merge/remap cost measured
|
||
- [x] QA (P2a/P2b/P2c only): PASS — gates, hunk-by-hunk verifier review,
|
||
sabotage/re-attack (dev's three pairs plus two of QA's own), wire
|
||
parity (8 `renametrace` rows + 5 QA-chosen renames, old binary vs.
|
||
candidate), parse-formula sabotage, RSS re-take, traceability; see
|
||
the QA log in `docs/features/perf5-p2/README.md` (2026-09-07).
|
||
Handshake 33 and P2d are **not** covered by this QA pass.
|
||
- [x] handshake 33 closed with tests (multi-level hierarchy, generated
|
||
scopes, interface/package/class names, macros, duplicate modules,
|
||
unsaved references) before P2d — an opt-in **fifth rung** on
|
||
`module_sources`, asked for by inline-module alone: every file whose
|
||
token census (`files_mentioning`, i.e. `FileFacts::words`) writes
|
||
the dissolved instance's name. That census is exactly what
|
||
`no_hierarchy` can refuse from, so the selected set now answers that
|
||
refusal **as `sources()` does**, asserted by a six-shape
|
||
whole-workspace equivalence test. Sixteen tests, twelve through the
|
||
real dispatch; +1.2 ms at the measured site (8 files added); extract
|
||
and the port actions unchanged in answer and in cost. The
|
||
transitive-instantiator walk the topology row names was written and
|
||
**discarded**: it cannot reach a `bind` from a file that
|
||
instantiates nothing in the chain. Experiment `H33-2026-09-07`
|
||
- [x] P2d (only with proof): exact-name postings; the selected set
|
||
unchanged; every edit, warning, ambiguous-use refusal,
|
||
unresolved new-name capture and unsaved-buffer contribution
|
||
compared against the whole-scope engine on adversarial cases —
|
||
**measured; no narrowing shipped, and the proof is why.** The new
|
||
by-rung census says **133 of the tail rename's 238 selected files
|
||
(56 %, 58 % of the bytes, ~130 ms) write neither name down**, all of
|
||
them on the container rungs — and those are what `fold_path` hops
|
||
through for a multi-level hierarchical tail and what `base_chain`
|
||
climbs, so dropping them makes a resolved tail `StillUnresolved` (a
|
||
**missed edit**, §49's own feature) and, where a reference has two
|
||
paths, lets it fall through onto the target (an **extra edit**).
|
||
Exact-name postings not implemented: selection is 13.6 ms of 420
|
||
(3.2 %), below the plan's own materiality gate. The target-scoped
|
||
selector — fan out from the one declaration the cursor resolves to
|
||
— is filed with its full shape list and the oracle it needs, as a
|
||
lane of its own. Experiment `P2d-2026-09-07`
|
||
- [x] measured: tail rename ≥ 2× faster (stretch < 200 ms), `aes`
|
||
rename not slower, edit/warning parity exact; queued definition
|
||
follows; tracker + experiment entries — **1.86×** (780.45 →
|
||
419.86 ms), so the 2× target is **missed by 29.7 ms**; the
|
||
measured remaining stage is `Scope::build`'s one parse of each of
|
||
the 238 *selected* files (225 ms of 420), which only §P2d can
|
||
reach. `aes` rename −24.8 % (not slower), every edit / warning /
|
||
refusal fingerprint byte-identical, queued definition −24.5 %,
|
||
whole-file parses 717 → **240 = K + E**. Experiments
|
||
`P2a-2026-09-07`, `P2b-2026-09-07`, `P2c-2026-09-07`.
|
||
**Second lane, 2026-09-07:** still **1.85×** (420.90 ms), because
|
||
§P2d ships no narrowing; `aes` 106.75 (not slower), queued
|
||
definition 121.2, every fingerprint still byte-identical, peak RSS
|
||
not higher (tail 606 MiB, fallback 1 802). The two stages left are
|
||
`Scope::build` **226 ms (54 %)** and `warnings` **83 ms (20 %)**.
|
||
`warnings` is **not** dominant, so it was reported rather than
|
||
fixed: it tokenizes each spelling file up to twice and builds up to
|
||
four `LineIndex`es, none shared and none of them the parse the scope
|
||
already made. Two pure dedupes (one tokenize + one index per call;
|
||
gate `macro_argument_sites` on `files_naming_in_macros`, which is
|
||
`FileFacts::macro_words`) should take the tail rename to ~375 ms and
|
||
**over the 2× line**. Filed for the lead.
|
||
**Third round, 2026-09-07 — the dedupe, and the target met.** One
|
||
lex and one `LineIndex` per file per `warnings()` call, the five
|
||
scans sharing them and their sentences concatenated in the order
|
||
the five loops emitted them: `warnings` **82.2 → 51.4 ms** on the
|
||
tail rename, 22.9 → 8.3 on `aes`, 848.5 → 437.9 on the `clk_i`
|
||
fallback. Tail rename **387.95 ms = 2.01× the REF (780.45)**, so
|
||
the **≥2× target is MET**; `aes` 91.79 (−35.0 %, not slower),
|
||
queued definition 115.91, every fingerprint byte-identical and the
|
||
warning **lists** compared as lists across 13 renames against a
|
||
pre-change binary — identical, order included. Peak RSS tail 596
|
||
MiB / fallback 1 795. The second gate the finding proposed
|
||
(`files_naming_in_macros`) is **not shipped**: `macro_words` skips
|
||
double-quoted runs, so `` `uvm_info("state_q", …) `` is a site the
|
||
scan reports and the census cannot see. What is left is
|
||
`Scope::build`, **233 ms of 388 (60 %)**. Experiment
|
||
`P2d-warnings-2026-09-07`
|
||
- [x] QA: whole-scope parity suite, the verifier invariant (a faster
|
||
partial edit is a failure), handshake-33 attacks, numbers re-taken
|
||
— PASS, 2026-09-07 (Sonnet). Seven handshake-33 attack cases
|
||
(macro-defined-elsewhere, `$root`, macro-built `bind` target,
|
||
string/comment negative control, escaped identifier, generate-label
|
||
path, and a sabotage disabling the rung that proved it load-bearing
|
||
on the three-level `bind` fixture); the topology row's transitive-
|
||
instantiator walk independently confirmed structurally unable to
|
||
reach a `bind` from a non-instantiating file; §P2d's "cannot be
|
||
dropped" census argument reproduced by experiment (dropping the
|
||
indirect container file from the dev's own two-level-tail fixture
|
||
silently loses the tail edit); the `warnings` dedupe re-attacked
|
||
with two new equality fixtures, a concatenation-order sabotage, and
|
||
a direct construction of the macro-words-gate non-equivalence; wire
|
||
parity confirmed over all 13 renames; every fingerprint
|
||
byte-identical on re-measurement. See the QA log in
|
||
`docs/features/perf5-p2/README.md`.
|
||
|
||
### 60.3 P3 — one parse for the CLI package census
|
||
|
||
Plan §P3. Files: `lucisv/src/lint.rs`, `vlog_linter/src/{interfaces.rs,
|
||
lib.rs}`; a semantic fact-extraction API only if needed, additive; the
|
||
CLI keeps no direct semantic dependency.
|
||
- [x] package exports from the census's existing parse; files without a
|
||
package declaration skip the index work by AST, never by text
|
||
search; duplicate/unknown packages, nested declarations, malformed
|
||
source, re-export chains handled exactly as before — additive
|
||
`vlog_linter::package_exports_in(path, file, tokens, src)`, the gate
|
||
`walk_items` looking for `ItemKind::Package` (1 624 of `hw/ip`'s
|
||
1 805 files never build an index), the index itself built from the
|
||
census's own parse through `FileFacts::from_analysis`; **no
|
||
`vlog_semantic` change was needed**. Pinned by a 15-fixture equality
|
||
test against the pre-P3 `WorkspaceIndex::build` body, kept verbatim
|
||
- [x] default `check` output byte-identical; all-style retains every
|
||
`unused-import` finding; fixes, waivers, exit codes stable — all
|
||
five corpus cells' stdout `diff` clean against the reference
|
||
binary's (`hw/ip` 445 / 7 751 / 7 734, `hw/vendor` 1 666, `hw/dv`
|
||
1 158), plus six new end-to-end CLI tests
|
||
- [x] measured: ≥ half of the 123 ms all-style increment removed on
|
||
`hw/ip`, default time and peak RSS not materially worse; the
|
||
paired three-configuration experiment; tracker filled — the paired
|
||
increment **141.7 → 5.0 ms (96 % removed)**, all-style
|
||
**0.6333 → 0.4817 s (−23.9 %)**, default unchanged (all three
|
||
binaries median 0.420 s), all-style peak RSS **219.1 → 202.0 MiB**.
|
||
Experiment `P3-2026-09-07`
|
||
- [x] QA: full findings/fixes/waivers diffed, not counts; RSS re-taken
|
||
|
||
### 60.4 P4 — startup and memory, only after P1–P3
|
||
|
||
Plan §P4a (instrument: discovery/config wait, read/hash, decode, merge,
|
||
completion/include tables, overlay refresh, cache write/compaction,
|
||
first useful answer; 1/10/100 open buffers; requests during a scan)
|
||
then §P4b (the dominant measured stage only). Files: `server/index.rs`,
|
||
`state.rs`, `index_cache.rs`, `candidates.rs`, `includes.rs` and the
|
||
semantic build/facts owners. Serialized after 60.1–60.3.
|
||
- [x] P4a instrumentation and the measured breakdown in the tracker
|
||
(2026-09-07; `docs/features/perf5-p4/README.md`, experiment
|
||
`P4a-2026-09-07`). Three `timing: scan <n> …` lines per scan on
|
||
the `--verbose` channel; `tools/perf/phases_p4.py` reads them.
|
||
**A workspace session pays three scans and the first indexes
|
||
zero files** — warm it still costs 183.7 ms opening and
|
||
compacting a 44.3 MiB store it never uses, which is also the
|
||
whole of §P0's cold-84 / warm-209 first-answer puzzle. Warm
|
||
settle 1 332.7 ms has no dominant stage but 27.5 % of it is the
|
||
store's own I/O; cold settle 2 893.6 ms is 58.9 % parse. The
|
||
encoded-facts retention §P4 hypothesised is real: 44.20 MiB,
|
||
7.7 % of warm idle RSS. Requests queued behind the configured
|
||
rescan wait 2.56 s cold / 0.90 s warm, with zero mismatched
|
||
tables in 18 mid-scan answers
|
||
- [x] lead ruling: which stage, or none — **2026-09-08: go** on (a) skip
|
||
`compact` when the store is unchanged and was loaded canonical,
|
||
(b1) no store open/compact for an empty work list (open deferred to
|
||
the first file); **refused** (b2) store reuse across rescans (the
|
||
reopen guards a mid-session cache-path change and a second session's
|
||
compaction); plus: why the configured rescan does not interleave
|
||
navigation (fix if routing, file if not), and the trace helpers
|
||
moved out of `state.rs`
|
||
- [x] P4b if ruled: warm < 1 s / cold < 2.3 s / idle RSS −15% as
|
||
investigation goals; interrupted-store recovery, coherent
|
||
index/candidate/include prefix, content-based freshness, the
|
||
16 MiB parser stack on any new thread, §46's open path — all
|
||
preserved and pinned
|
||
(2026-09-08; `docs/features/perf5-p4/README.md` §P4b, experiment
|
||
`P4b-2026-09-08`). **(a) + (b1) shipped, (b2) refused, the
|
||
interleaving question answered and filed.** Measured against a
|
||
same-window control built from HEAD: **warm settle 1 326.85 →
|
||
1 137.66 ms, −14.3 %**; cold −1.1 % (unchanged, as predicted);
|
||
**warm idle RSS −15.3 %**, the one goal §P4a had ruled out — it is
|
||
the two 44.3 MiB render buffers, not the encoded-facts retention.
|
||
The store is left byte- **and mtime-**identical across two warm
|
||
sessions where HEAD rewrote the same 46 486 433 bytes each time.
|
||
`mismatched_answers` 0, the scope ladder answers identically in all
|
||
eight cells, §46's `didOpen` path −3.3 %. **Warm < 1 s missed** and
|
||
needs the refused (b2): `cache_open` is still paid twice, 181.7 ms.
|
||
**One deviation reported**: `IndexCache::record` now skips a record
|
||
the store already holds, without which (a) fires in no session that
|
||
has a buffer open. **One regression named**: the warm first useful
|
||
answer is bimodal, 117 ms or the whole configured rescan, because
|
||
removing the empty scan's 181 ms removed the head start the
|
||
`didOpen` used to win its race with the configuration answer — the
|
||
`must_wait` order contract, filed for the lead with the narrow fix.
|
||
**Closed 2026-09-08 by the P4b2 line below**, and not by that narrow
|
||
fix: the lead ruled the plan's own sentence instead
|
||
- [x] P4b2 (the lead's ruling on that regression, 2026-09-08): **stage the
|
||
initial scan until configuration arrives**, with a bounded fallback
|
||
for clients that never answer, rootless and scope precedence intact
|
||
(`docs/features/perf5-p4/README.md` §P4b2, experiment
|
||
`P4b-staged-2026-09-08`; new `server/startup.rs`).
|
||
`Server::started` sends `workspace/configuration` first and waits up
|
||
to `CONFIGURATION_WAIT` (2 s) on `recv_timeout` — no poll, no
|
||
busy-wait — then runs **one** startup scan at the answered scope.
|
||
The empty default-scope scan and the widen behind it are gone; a
|
||
`didOpen` in the window is folded into that scan (its file first in
|
||
the work list) and a request is held and answered *inside* it.
|
||
Paired against the previous P4b release: **warm settled 1 181.34 →
|
||
1 097.98 ms, −7.1 %**, and on the shipped binary re-run **1 190.48 →
|
||
1 037.31 ms, −12.9 %** (the two runs bracket the ≤ ~1.06 s target);
|
||
cold −4.0 % / −2.5 %; `scopeDepth 0` −89.2 % cold /
|
||
−72.6 % warm; 1/10/100 open buffers −28.4 / −26.8 / −21.0 %; warm
|
||
`cache_open` **183.70 → 91.91 ms** — the refused (b2)'s saving,
|
||
arriving without store reuse; warm idle RSS −5.8 %; store byte- and
|
||
mtime-identical; all 24 scope answers identical; `didOpen` pinmux
|
||
−6.3 %; `mismatched_answers` 0. **The `scanserve` "queued behind the
|
||
configured rescan" mode is gone for the startup case.** **One
|
||
regression, filed:** the first useful answer is now unimodal but
|
||
**empty** — 293–411 ms with result count 0, because `begin_scan`'s
|
||
discovery (292.74 ms warm) is the floor and the first drain
|
||
publishes the open buffer alone; the fix is an `open_first` ordering
|
||
change in `state.rs`, which this lane holds calls-only (Handshake
|
||
11). **One defect found by measuring and fixed**: a settings answer
|
||
stranded in `held` behind a request cost the whole bound
|
||
- [x] P4b3 (P4b2's empty first useful answer, closed — Handshake 11
|
||
granted, 2026-09-08): **the read is lazy and the order is the
|
||
user's** (`docs/features/perf5-p4/README.md` §P4b3, experiment
|
||
`P4b-lazy-2026-09-08`; new `crate::scan_order`, `state.rs` split
|
||
into `state/mod.rs` + `state/scan.rs` as a pure move).
|
||
`collect_sources` resolves the scope and reads **nothing** off
|
||
disk; `scan_step` reads a file's text when it indexes it, takes the
|
||
hash, the parse, the words and the `` `include`` lines out of that
|
||
one read, and drops it — proved read-once by a thread-local counter
|
||
in the shape of `vlog_parser::stats::parses`. The work list leads
|
||
with the open buffers and the folders they raise to, and a held
|
||
request — or one behind a mid-scan `didOpen` — waits for that
|
||
folder (`Server::head_owed`, a fifth `must_wait` clause) before it
|
||
is answered. **The first useful answer is result count 1 in twelve
|
||
sessions of twelve**, where P4b2 was 0 in twelve of twelve, and
|
||
faster: cold 287.40 → **249.00 ms (−13.4 %)**, warm 332.68 →
|
||
**277.37 (−16.6 %)**. `work_kib` **34 973 → 0–16**; idle RSS
|
||
**−7.0 % cold / −7.2 % warm**, peak still equal to idle;
|
||
`discovery` **227 → 158 ms** warm with a new `read` stage at 86;
|
||
`includes` **42 → 8.6 ms**. Settled unchanged within noise
|
||
(−5.2 % / −3.0 % in `scan`, +0.9 % / +1.9 % in `scanprofile`, both
|
||
quoted); all 24 scope answers identical; the persistent store
|
||
**byte-identical** from both binaries; `mismatched_answers` 0;
|
||
§46's `didOpen` untouched. **The latency target is missed and now
|
||
explained: the first useful answer is walk-bound** — `discovery` is
|
||
158 ms of pure scope walk, 58 % of the warm answer, and
|
||
`cache_open` is another 89 (the refused (b2)). The §P0 REF's
|
||
84/208 ms was answered off a 124-file *folder* scan that never
|
||
walked the workspace. **One defect found by measuring**: the
|
||
ordering alone left five sessions of six empty, because the client
|
||
answers the settings pull from its own reader thread and beats the
|
||
editor's `didOpen` — hence the drain rule
|
||
- [x] QA (P4b2): re-take the paired numbers; attack the bound (an answer
|
||
at the deadline, twice, an error, a `null`), the window
|
||
(`shutdown`, `didClose`, a folder change, a filelist push, a burst
|
||
putting a request in front of the answer),
|
||
`take_the_answer_out_of_held`'s reordering and the rootless path;
|
||
rule on the empty first useful answer — **answered by P4b3 above**
|
||
- [x] QA (P4b3): re-take the paired numbers, in particular the
|
||
twelve-of-twelve result count and the walk-bound floor; attack the
|
||
lazy read (a file deleted, truncated or replaced between the walk
|
||
and its own step — the `unread` path, the skip count, and whether
|
||
the file really leaves the index), the read-once counter (does any
|
||
path read a file twice), the ordering (rootless, `untitled:`, a
|
||
filelist scope, a capped buffer, 100 buffers, and
|
||
`worth_waiting`'s edges), the drain rule (a `didClose` mid-scan, a
|
||
`shutdown` behind a `didOpen`, two `didOpen`s in one burst, a
|
||
cancel behind a held request, and whether `head_owed` can be left
|
||
true with no scan running), and the include graph and completion
|
||
tables against a text-built pair on a tree with duplicate
|
||
spellings and `+incdir+`s
|
||
- [x] the walk, filed by P4b3 for the next lane: `discovery` is 158 ms of
|
||
scope walk plus one `fs::metadata` per file for the size cap, and
|
||
it is the floor under every first useful answer. Two things to
|
||
measure before building anything — the cap taking its size from the
|
||
walk's own metadata (`lucisv_core::walk::collect_files` is not
|
||
P4b3's file: a handshake request) and handing the first folder to
|
||
`scan_step` before the walk has finished the workspace
|
||
— **closed by §61.3 (0.52.0): two-phase discovery and the walk
|
||
metadata hand-off (per-file `stat`s 3 979 → 0, cap 6.92 → 0.10 ms)**
|
||
- [x] QA (P4a only, 2026-09-08: gates green, 4272/4272, no behaviour
|
||
change verified by hunk review and by running both binaries —
|
||
44/44 identical result_counts and identical scan file-counts;
|
||
instrument cost and every table number reproduced independently;
|
||
docs/features/perf5-p4/README.md QA log. P4b still needs the
|
||
lead's ruling and is unimplemented)
|
||
- [x] QA (P4b): re-take the paired numbers on the same binary against the
|
||
same-window HEAD control; re-attack the six clauses of the
|
||
compaction skip and the deferred open (the dev's own attacks are in
|
||
the work log); rule on the one deviation
|
||
(`IndexCache::record`'s early return) and on whether the bimodal
|
||
warm first answer is acceptable while the interleaving finding is
|
||
open
|
||
|
||
### 60.5 Closing
|
||
|
||
- [x] P5 stays deferred unless a stage's measurement reopens it (lead)
|
||
— 2026-09-08: nothing reopened it; the first-after-edit row after
|
||
P1 is inside the frame, and no user command still blocks navigation
|
||
for a whole scan on the startup path
|
||
- [x] `docs/perf/README.md` entry with the accepted numbers; topo
|
||
edges/handshakes for every contract amended; the plan's status
|
||
line updated; a release cut from the clean tree with its assets
|
||
verified — done 2026-09-08: **0.51.0** (bc59336, v0.51.0), 8
|
||
assets, the darwin-arm64 vsix at 0.51.0 with both binaries,
|
||
`hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||
|
||
## 61. Performance take 5 — the review round (owner request 2026-09-08)
|
||
|
||
`docs/performance_take5_review.md` (Codex, 2026-09-08, at 0.51.0) is the
|
||
spec; its "Follow-up experiment queue" in `docs/perf/take5-tracking.md`
|
||
(R1a–R4) is the ledger every lane fills; `docs/perf/take5-review-20260908/`
|
||
is the baseline evidence (0.51.0 review cells are fixed). Same protocol as
|
||
§60: serial lanes in the main tree, dev (Opus) → QA (Sonnet) → lead
|
||
review → commit; a feature README per lane under
|
||
`docs/features/perf5r-<lane>/`; every number by `tools/perf/` under
|
||
`tools/guard.sh -m 8 -t 1800`, opentitan read-only, no build during a
|
||
timed session, paired against the 0.51.0 review baseline cells;
|
||
no `sleep` over 60 s, waits bounded and keyed on a PID or a file, never
|
||
`pgrep -f`. Order chosen by cost-of-entry and what each measurement
|
||
unlocks: the preflights first (cheap, large), then the action path, then
|
||
the first answer, then the scan, then rename reuse if its measurement
|
||
justifies it.
|
||
|
||
### 61.1 R3a + the refusal preflights (engine-owned)
|
||
|
||
Review §3 items 5–6. A `textDocument/rename` on a cursor with no symbol
|
||
materializes the whole workspace (`server/rename.rs`: `rename_name_at`
|
||
→ `None` → `ws.sources()`, 3 976 files) and the engine builds the scope
|
||
(3 975 parses, 1.9 s) before `locate` refuses in 0.1 ms; the duplicate-
|
||
module refusal and the "meaning would change" refusal take the same
|
||
road; the extract at the `aes_wrap.sv` inline-site selection spends
|
||
805 ms building a scope before its safety checks refuse. Files:
|
||
`vlog_refactor/src/{rename/mod.rs,extract/mod.rs,lib.rs}`,
|
||
`lucisv_server/src/{rename.rs,extract.rs}`, tests.
|
||
- [x] engine-owned rename preflight over the request file alone (its
|
||
parse + analysis; `prepare_rename_here` is the existing one-file
|
||
shape — reuse it): `check_new_name`, then the cursor refusal, with
|
||
today's error precedence (invalid new name → out-of-scope /
|
||
unavailable file → no symbol here) and the exact sentences; the
|
||
server calls it before selecting sources and materializes nothing
|
||
when it refuses; a symbol found → today's path unchanged
|
||
— `vlog_refactor::rename_preflight` (`rename/preflight.rs`), additive,
|
||
**without** the `external`/`index` parameters the brief proposed: every
|
||
refusal they could answer is one the staleness argument forbids taking,
|
||
so they would have been unused. Takes rules 1, 4, 5, 6, 11a and — only
|
||
for a non-file-scope declaration in the buffer — rule 2
|
||
- [x] duplicate-declaration refusal moved ahead of materialization ONLY
|
||
with the evidence the review asks for (the index is current and
|
||
authoritative for that name — the workspace's `declared_twice`
|
||
already gates the ports offer on it; state the argument or leave
|
||
it on the slow road)
|
||
— **left on the slow road, with the argument.** `state/mod.rs::set_document`
|
||
reads the index and never writes it, so an unsaved edit that adds or
|
||
removes a file-scope declaration is not in it; `rename` is the authority
|
||
that re-derives the count. A wrong *offer* costs a lightbulb, a wrong
|
||
*refusal* costs the work. `rstmgr_por` keeps its ~2.0 s, asserted by
|
||
`a_name_declared_in_two_files_stays_on_the_slow_road`
|
||
- [x] extract preflight: the selection's own checks that read only the
|
||
request file's parse (the region, the item kinds, the refusal
|
||
shapes `extract_site`/`Region::read` already know) run before
|
||
`Scope::build`; exact refusal sentence preserved, no optimistic edit
|
||
— **they already do, by two mechanisms**, which the new `extractrefuse`
|
||
phase measures: `execute`'s `site_at` gate *is* `extract_site_in`, whose
|
||
first two statements are the parse-diagnostic check and `Region::read`;
|
||
and `plain_identifier`/occupied are `extract_module`'s own first
|
||
statements, ahead of `Extraction::plan`. A preflight was written, wired,
|
||
measured and **removed** as redundant
|
||
- [x] measured: no-symbol rename ≤ 16 ms with zero closed-workspace
|
||
parses; the `aes_wrap.sv` extract refusal with its parse count;
|
||
the successful renames and the extract capture unchanged
|
||
(fingerprints); R3a/R3c cells + experiment entries
|
||
— no-symbol **2 012.3 → 0.34 ms**, `trace_parses` **3 975 → 0**,
|
||
peak RSS 909 → 429 MiB, sentence identical. `aes_wrap.sv` extract
|
||
refusal **761.1 → 767.8 ms (unchanged)**; its stage is
|
||
`boundary::Crossing::read`, scope-dependent at depth — deferred to §61.5.
|
||
All fingerprints identical (`b39defb21265…`, `fa7e31c78382…`,
|
||
`090e92e7736e…`). R3a/R3c cells and both experiment records filed
|
||
- [x] QA: refusal-precedence matrix old vs new (13 shapes: invalid name,
|
||
keyword, unsaved/closed file, untitled, no symbol, comment, string,
|
||
macro, duplicate module, existing name, same name, large-file
|
||
buffer, cursor on a reference vs a declaration); parse counts;
|
||
fingerprints; numbers re-taken
|
||
— **PASS.** Rule table rebuilt independently from `renaming`/`Scope::
|
||
locate`/`declaration` vs `rename_preflight`/`declared_here`, agrees
|
||
with the dev's; oracle sabotaged twice (an invented refusal, a
|
||
reworded sentence) and caught both; gates clean (fmt/clippy/4 322-test
|
||
guarded run, matching a same-tree baseline + the 17 added tests
|
||
exactly — the README's "4 328" was a slip, corrected); fresh guarded
|
||
wire re-runs against the sha256-matched candidate binary over
|
||
OpenTitan reproduce no-symbol 0/0 parses and ≤1 ms, the duplicate-
|
||
module and common-port rows unchanged (3 975 parses, same sentence),
|
||
the `aes_wrap.sv` extract refusal unchanged with its `Crossing::read`
|
||
sentence, and the `aes.sv` capture fingerprint identical; all 12
|
||
tracker R3a/R3c-x numbers and 5 fingerprints traced verbatim in
|
||
`~/.cache/lucisv-perf/take5r-1/`. QA log in
|
||
`docs/features/perf5r-preflight/README.md`
|
||
|
||
### 61.2 R1a + R1b — the code-action path on a large file
|
||
|
||
Review §1. `lint.rs::fixable` still runs `lint_with` on every request:
|
||
23 of the 25 ms all-family menu on the pinmux comment; the first action
|
||
after an edit is 136 ms. Files: `lucisv_server/src/{lint.rs,
|
||
code_action.rs,fences.rs,server/dispatch.rs}` + a new small module for
|
||
the snapshot; `state/` for one field at most; tests.
|
||
- [x] R1b first: a `--verbose` stage trace for one `codeAction` on the
|
||
pinmux comment — config/waiver load, dirty-buffer flush (the
|
||
`Document` rebuild), lint, fence, serialization — for the first
|
||
request, an unchanged repeat, the first after a one-character
|
||
edit, and the definition queued behind each; harness rows
|
||
— `lint_trace.rs`, one `timing: codeaction …` line per request that
|
||
linted anything, two groups (`flush{…} action{…}`) divided by the
|
||
flush; phases `actionprofile` and `ruleablation` in
|
||
`tools/perf/phases_r1.py`. **The 23 ms is `lint_with`** (20.9 of 22.0;
|
||
config I/O 0.04, run build 0.01, serialization 0.03, fence skipped) and
|
||
**three semantic rules are the whole of it** — `unused-signal` +8.2,
|
||
`multiply-driven` +7.5, `undriven-net` +7.4 ms over a 1.3 ms floor, the
|
||
other 55 default rules ≤ +2.2 each. **The 136 ms is 78% the flush**:
|
||
99.7 of 127.5 ms, of which 21.1 is the diagnostics pass, leaving
|
||
~78.6 ms of `Document::new` on 1.3 MB; the handler then lints the same
|
||
revision a **second** time for 20.2 ms. Deviation: the flush is one
|
||
traced stage plus its parse count, not split into parse/analysis/overlay
|
||
— those live in `state/mod.rs`, outside this lane's ownership, and
|
||
flush-minus-diagnostics answers the question asked
|
||
- [x] the dependency/invalidation table written BEFORE any cache:
|
||
document content/revision, effective rules and options, tab width,
|
||
external waiver contents, project/index inputs the workspace rules
|
||
read (index generation); each row names the test that flips it
|
||
— 14 rows in `docs/features/perf5r-lint-snapshot/README.md`, derived from
|
||
the arguments of the `lint_with(ctx, rules, external)` call it guards, so
|
||
the list is complete by construction. Three mechanisms only: **identity**
|
||
(the buffer, `doc.large`, close/reopen — `set_document` builds a new
|
||
`Document`), the **key by value** (rules, options, width, indent, waiver
|
||
*contents*), and **one explicit drop** (`Document::refresh_overlay`, which
|
||
every index mutation in `state/` already ends in). Row 12 is the one that
|
||
decides the config question: the `lucisv.toml` and the waiver files are
|
||
**not watched** (`watch::SOURCE_GLOB` is sources plus the filelist), so
|
||
the per-request read is the only thing that ever notices them changing
|
||
- [x] R1a: a lint-result snapshot keyed by that table, consumed by the
|
||
diagnostics pass and the quick-fix discovery alike; recomputed on
|
||
any mismatch; bounded (one per open document); the fence authority
|
||
and execute-time validation untouched
|
||
— `lint_snapshot.rs`: `Key` compared **by value, never hashed**, and
|
||
`Slot`, one `Mutex<Option<…>>` field on the `Document`. One `found(doc,
|
||
run)` in `lint.rs` that both doors call; the tab width moved onto the
|
||
`LintRun` (read through `format::indent_width`, whose call the dispatcher
|
||
no longer makes) so the two doors build the same context and share one
|
||
slot. `fence.rs` and the shared-fence contract untouched; `vlog_linter`
|
||
untouched
|
||
- [x] measured: unchanged pinmux menu and queued definition ≤ 16 ms;
|
||
first-after-edit improved and reported separately with its stage
|
||
split; no stale diagnostic or fix under any invalidation; R1a/R1b
|
||
cells + experiments
|
||
— paired against trunk `51cbfd2`: **all families 22.61 → 0.98 ms
|
||
(−95.6%)**, **quickfix only 24.51 → 0.11 (−99.5%)**, **queued definition
|
||
22.39/22.38 → 0.78/0.76 (−96.5%)** — both gates met with two orders of
|
||
magnitude of margin. **First-after-edit 125.65 → 106.89 ms (−14.9%)**,
|
||
and its split names the remaining stage: ~84 ms `Document::new` plus the
|
||
21.9 ms diagnostics pass, with the code-action lint at **0.00 ms**.
|
||
Diagnostics publish +0.3%, idle RSS at 100 open buffers each holding a
|
||
snapshot 574.0 → 574.6 MiB (+0.1%), take-3 `codeaction` cells within
|
||
1.5%. Config-discovery memo **not taken**: the trace measures that I/O at
|
||
0.04–0.16 ms and its failure mode would be a stale rule selection.
|
||
R1a/R1b cells and both experiment records filed
|
||
- [x] QA: every invalidation row forces a fresh result (change the
|
||
buffer, the config, a waiver file, a dependency file the workspace
|
||
rules read, close/reopen, a UTF-16 range); stale-fix attack; memory
|
||
bound; numbers re-taken
|
||
— PASS. All 14 rows attacked over real stdio JSON-RPC against the
|
||
release binary on an independent fixture workspace (two standalone
|
||
scripts, not the dev's own tests); three targeted sabotage cuts
|
||
(waiver text, the `refresh_overlay` drop, `tab_width` in the key)
|
||
each caught by exactly the predicted test and reverted clean; gates
|
||
cross-checked against a from-scratch clone of `51cbfd2` with
|
||
matching binary sha256es and a name-level test diff (+21/-0);
|
||
100-buffer RSS and the stage trace reproduced independently within
|
||
noise; 12 tracker numbers traced verbatim (some as documented
|
||
medians) in `~/.cache/lucisv-perf/take5r-2/`; opentitan clean and
|
||
zero guard kills throughout. QA log in
|
||
`docs/features/perf5r-lint-snapshot/README.md`
|
||
|
||
### 61.3 R2a + R2b — the first useful answer
|
||
|
||
Review §2. Warm first answer 325 ms = 205 ms workspace discovery +
|
||
92 ms store open before the open buffer's folder is even stepped.
|
||
Files: `lucisv_core/src/walk.rs` (an additive handshake: hand on the
|
||
metadata the walk already stat'd), `lucisv_server/src/{state/,
|
||
scan_order.rs,server/startup.rs,server/index.rs,index_cache.rs}`, tests.
|
||
- [x] R2a: measure the walk's stages (gitignore/config handling, the
|
||
size-cap `metadata` per file, path sorting) and the store open;
|
||
then the walk metadata hand-off (one `stat` per file, not two) —
|
||
the handshake recorded in `lucisv_core`'s README and topo before
|
||
the interface changes — **the split says the cap's second `stat` is
|
||
6.9 ms of a 165 ms discovery, not the ~45 §P4b3 guessed, and the
|
||
walk is 95 % of it; the hand-off (`collect_files_with`, additive)
|
||
takes `stats` 3 979 → 0 and `cap` 6.92 → 0.10 ms, and the first
|
||
answer does not move. Kept as a tidy-up; R2b is the lever.** The
|
||
handshake went into the code's doc comments as the interface
|
||
changed and into the feature README after, not before — recorded
|
||
as a deviation; the topo edge is a request for the lead
|
||
- [x] R2b: the raised-folder work begins before the remaining discovery
|
||
finishes — one coherent scan (the folder walked, stepped and
|
||
published first; the rest of the workspace discovered and stepped
|
||
after; paths and facts deduplicated; configured scope, exclusions,
|
||
filelists, size cap, unsaved-buffer precedence preserved; never two
|
||
complete scans, never an answer from only the open file); if the
|
||
store open remains the barrier, a measured design for bounded
|
||
local-record loading before any format change — **shipped, bounded
|
||
twice (rung 2 only, strict descendants of a root only,
|
||
`HEAD_WALK_MAX` 512) and `collect_files_below` carries the root's
|
||
`.gitignore` down so the two halves of one scan cannot disagree
|
||
about which files exist. `OPENING_FILE_WAIT` (25 ms, inside the
|
||
staging window) closes the didOpen-vs-configuration race that left
|
||
2 sessions in 8 paying the old cost. The store open is 61 ms of
|
||
checksum: the bounded local load was designed and measured (~26 ms,
|
||
~50 ms first answer) and NOT shipped — it moves cost rather than
|
||
removing it and changes `Load::canonical`, which the compaction
|
||
skip and the byte-identical store rest on. Filed as its own
|
||
experiment.**
|
||
- [x] measured: first definition ≤ 200 ms warm and cold, equal to the
|
||
settled target (not merely non-empty); warm quiet scan ≤ 1.0 s if
|
||
reachable, reported honestly; RSS reduction kept; startup ordering
|
||
cases (config before/after didOpen, late/no reply, unsaved buffer,
|
||
multiple folders, root-level file, a dependency outside the first
|
||
folder) pinned; R2a/R2b cells + experiments — **first definition
|
||
265.9 → 77.9 ms cold (−70.7 %) and 301.3 → 115.1 warm (−61.8 %),
|
||
result count 1 in 12 of 12; warm quiet settle 1 033.9 → 997.4 ms
|
||
(≤ 1 s, first time, by less than the spread); idle RSS −8.6 % cold;
|
||
store byte-identical (three sha256s over 28 stores); 24 of 24 scope
|
||
cells; `mismatched_answers` 0 AND the new stricter
|
||
`unsettled_answers` 0. Named costs: settled +2.5 % / +4.8 % at 1/10
|
||
open buffers (the neighbourhood subtree walked twice), and the
|
||
"equal to the settled target" gate is met on the measured cursor
|
||
and all 54 probe requests but is NOT true by construction for a
|
||
cross-folder cursor — pinned by a test and filed as a
|
||
`server/dispatch.rs` handshake.** Feature README
|
||
`docs/features/perf5r-first-answer/`; 4 343 → 4 360 tests
|
||
- [x] QA: the ordering matrix; coherence (`mismatched_answers` 0 with the
|
||
settled-equality check, not the non-empty one); persistence
|
||
attacks re-run; numbers re-taken
|
||
— PASS. Gates green (4 360 tests, +17/−0 vs `a1c77c0`, fmt/clippy
|
||
clean); walk hand-off sabotage caught by exactly the predicted 12
|
||
tests; `collect_files_below` attacked with 5 fixtures beyond the
|
||
dev's own 4 (nested exclusion, intermediate `.gitignore`, symlink
|
||
outside root — pinned, agrees with the plain walk, not a
|
||
regression — missing folder, `gitignore:false`), all correct;
|
||
`HEAD_WALK_MAX` fallback has **no shipped test** but independently
|
||
verified correct via a constructed fixture (filed for the lead);
|
||
ordering matrix (a–h) read and sampled across 17 wire tests, `f`
|
||
pinned (`open_next` finishes the *whole* pending discovery before
|
||
reordering, never a targeted walk); `unsettled_answers` confirmed
|
||
to count empty mid-scan answers against a non-empty settled one;
|
||
cross-folder `[]` exception reported, not failed; `index_cache.rs`
|
||
diff confirmed empty; opentitan clean, zero guard kills. QA log in
|
||
`docs/features/perf5r-first-answer/README.md`
|
||
|
||
### 61.4 R4 — publication cost under load
|
||
|
||
Review §4. Files: `tools/perf/` (a fixed-arrival-rate probe), then
|
||
`lucisv_server/src/{server/index.rs,state/,candidates.rs,includes.rs}`.
|
||
- [x] the probe: a definition every N ms of wall clock (not after the
|
||
previous response), recording queue latency, publications, per-
|
||
publication cost (index absorb / candidates / includes / overlays)
|
||
and scan completion under the same offered load, 1 / 10 / many
|
||
buffers — **`tools/perf/phases_r4.py`: `scanload` (warm),
|
||
`scanloadcold`, `scanloadcross`, plus a quiet control in the same
|
||
series. A fixed request *count* over a fixed window, because the
|
||
first draft stopped sending when the server went quiet, which made
|
||
the offered load a function of the server — `scanserve`'s own
|
||
confound in a new place. The split at `eb54042`, warm, one open
|
||
buffer, a definition every 100 ms: 34 publishes, `absorb` 2 433 ms
|
||
(78 %), `candidates` 623 (20 %), `includes` 47, `overlay` 2.4
|
||
(0.08 %) — 3 105 ms of publication in a 4 206 ms scan whose quiet
|
||
form takes 1 005. Cold: 88 publishes, 7 973 of 10 675 against a
|
||
2 766 ms quiet scan. `absorb` is the cost because it ends in a
|
||
whole-index merge; the overlay refresh, which this item expected to
|
||
matter, is 0.08 % at one buffer and 9.6 % at 101**
|
||
- [x] then reduce duplicate publication work (incremental candidates and
|
||
includes tables, or a bounded publish cadence) preserving the
|
||
coherent-prefix contract; quiet-scan decode/merge only after an
|
||
allocation profile shows duplication — **the cadence
|
||
(`Scan::publish_is_due`, `PUBLISH_EVERY` 512): one merge per 512
|
||
staged records instead of one per burst of requests, with the drain
|
||
that has something *waiting* — the session's first useful answer —
|
||
exempt. A quiet scan still publishes nothing. The candidates
|
||
rebuild and the overlay refresh were **measured and not rebuilt**:
|
||
the cadence takes both down with it, and the overlay is noise at
|
||
every buffer count an editor has. `WorkspaceIndex::absorb`'s
|
||
whole-index merge is named as a finding for a later lane —
|
||
`update_facts` has a targeted merge beside it and `absorb` does
|
||
not, but that is a `vlog_semantic` change this lane may not make**
|
||
- [x] measured: same offered load, better queue latency AND completion;
|
||
never fewer served requests reported as a speedup; R4 cells —
|
||
**same offered load, requests answered equal in every cell:
|
||
publication −78 to −88 %, the traced scan −48 to −65 %, the median
|
||
request wait −98 to −99.5 % (warm 112.3 → 1.9 ms at one buffer,
|
||
1 960 → 10.4 at 101; cold 137.7 → 1.5, and 4 706 → 2.1 at two).
|
||
Across the sixteen loaded cells the tail improved in ten, was level
|
||
in two and rose in four — three of them single-open-buffer cells,
|
||
worst warm 168 → 422 ms, against cold 9 308 → 1 583 at 101 buffers.
|
||
Quiet warm scan 1 005 → 985 ms (≤ 1 s kept), quiet cold 2 724 →
|
||
2 694, first useful answer 78.2 → 80.8 cold / 115.1 → 115.8 warm,
|
||
idle RSS −0.2 %, store size identical, 24 of 24 scope cells equal,
|
||
`scanserve` cold median 122.2 → 45.6 with the same 13 requests
|
||
served. `mismatched_answers` 0 and `unsettled_answers` 0
|
||
everywhere — and on a new cross-folder cursor the reference is
|
||
unsettled 12 of 270 with one buffer and 270 of 270 with eleven
|
||
where the candidate is 0. Feature README
|
||
`docs/features/perf5r-publication/`; 4 360 → 4 365 tests**
|
||
- [x] the lead's §61.3 rulings, both on this drain path: **an empty
|
||
navigation answer computed mid-startup-scan is not answered — the
|
||
request is asked again at the next publish and at the latest when
|
||
the scan ends, where `[]` is honest. Three methods
|
||
(definition / typeDefinition / references), a hover untouched and
|
||
pinned. The `HEAD_WALK_MAX` fixture QA asked for is in
|
||
`server/tests/startup.rs` and was sabotage-checked**
|
||
- [x] QA: coherence under load; the probe's arrival discipline verified;
|
||
numbers re-taken — **PASS. Coherence sabotage-tested (a direct
|
||
index/candidates-agreement test, failed when `publish_scan`'s
|
||
candidates absorb is disabled). The "never re-ask" sabotage produces
|
||
the lost-request failure this task guards against; the shipped rule
|
||
does not. `HEAD_WALK_MAX` sabotage reproduces "515 files (the folder
|
||
first)". `scanload`/`scanloadcross` re-run independently on the dev's
|
||
own binaries: `mismatched_answers` 0 and `unsettled_answers` 0 for the
|
||
candidate in every cell, matching the archived record. Quiet
|
||
scan/RSS controls re-run within ±10% (widest +6.9%). Tail
|
||
characterized: the CAND max attributed to cadence spacing, not
|
||
deferral; a T=100 ms secondary bound estimated to give back most of
|
||
this cell's publication win since the reference's own pre-cadence
|
||
publish spacing (~123 ms) is already close to 100 ms. One
|
||
non-blocking gap found and pinned by a new test: a `$/cancelRequest`
|
||
against a request sitting in `Server::deferred`, arriving outside a
|
||
batch that reunites it with a publish, is silently ineffective
|
||
(exactly-one-response held; `cancel-request`'s README needs a dated
|
||
amendment, filed as a handshake). QA log in
|
||
`docs/features/perf5r-publication/README.md`**
|
||
|
||
### 61.5 R3b + R3c — rename scope reuse (conditional)
|
||
|
||
Review §3 items 1–4, after 61.1's measurement of the 229 ms scope stage
|
||
(parse / analysis / index assembly / allocation split). Request-local
|
||
reuse of open documents' analyses and closed files' cached facts, tied
|
||
to the selected source bytes, unsaved-buffer precedence kept, cross-file
|
||
resolution rebuilt for the candidate workspace, a memory budget stated;
|
||
the 51 ms warning pass profiled and tightened without changing a
|
||
sentence; the selection set stays the correctness reference (P2d).
|
||
- [x] lead ruling from 61.1's split: go / defer — **go — 34.3 %.** The
|
||
tail rename's 242.4 ms scope stage is `lead` 0.4 + `kept` 133.5 +
|
||
**`other` 83.1** + `merge` 23.4, where `other` is the 103 container
|
||
files analysed for their index record and never read again; 83.1 /
|
||
242.4 = 34.3 %, against a 30 % condition. Agreed by every other
|
||
multi-file row (25.0 / 33.0 / 35.8 / 36.0 %, and **87.8 %** on the
|
||
duplicate-module refusal); 0 % on the two rows where every selected
|
||
file spells the name, which is the case the reuse is not for. The
|
||
split is now shipped in the engine's trace (`IndexTrace`,
|
||
`WarnTrace`), and a trace-only build put the inside of one analysis
|
||
at **lex 34 %, parse 32 %, analyse 20 %, read-off 13 %** — the
|
||
review's "parser versus index" question answered as *parser*. The
|
||
49.7 ms warning pass is **84 % the macro-argument scan**, which is
|
||
one per-file lex already shared by all five scans (§P2d): no
|
||
duplicated work left in it, and retaining tokens instead is refused
|
||
on the `clk_i` row's 1.9 GiB peak
|
||
- [x] if go: the reuse, ≥ 20 % wire-time on the large rename at bounded
|
||
peak RSS, ordinary / common-port / collision / macro-bind /
|
||
hierarchical-tail / fallback cases compared, verifier untouched —
|
||
**shipped as an engine door (`vlog_refactor::KnownFacts`) with one
|
||
server implementation: a caller may hand back the index record it
|
||
holds for exactly the bytes it is handing over, and the engine skips
|
||
that file's parse. The tie is `IndexCache`'s own store entry —
|
||
record and FNV-1a written by one read and compared in one function —
|
||
never the workspace index's record, which carries no hash. No
|
||
persistent decoded-analysis cache; nothing retained past the
|
||
request; unsaved-buffer precedence falls out of the content key.
|
||
Paired against `07ef771` with the order alternated per phase: tail
|
||
**380.2 → 314.0 ms (−17.4 %)**, parses **240 → 137** = `(K − 103) +
|
||
E`; fallback `clk_i` −17.4 %, conflict −18.8 %, new-name-many-uses
|
||
−18.5 %, duplicate-module refusal **2 053 → 695 ms (−66.1 %, 3 975
|
||
→ 14 parses)**; `aes` −0.5 %, extract refusal −0.7 %, resolves
|
||
within ±1.4 %; peak RSS lower or level everywhere. Parity: 36 rows
|
||
equal on fingerprint/message/status/counts/titles and **1 750
|
||
warning sentences compared line by line** by a new `renamewarn`
|
||
phase — identical. `check/` no diff. **The ≥ 20 % gate is missed at
|
||
−17.4 %** against the paired reference (−21.2 % against the review's
|
||
own 398.3 baseline; the absolute ≤ 318 ms form met at 314.0), and
|
||
the remaining stage is named: the reuse's own **31.1 ms of store
|
||
decode**, the price of the one-place tie. Collateral for the other
|
||
refactorings **not taken** — measured nil, and reaching them needs a
|
||
`_with` entry point in five files this lane does not own. Feature
|
||
README `docs/features/perf5r-scope-reuse/`; 4 366 → 4 374 tests**
|
||
- [x] QA — **PASS** (2026-09-09). The tie verified as one comparison
|
||
(`entry_for`) fed by one store entry, never the workspace index;
|
||
stale-disk, unsaved-buffer, misfiled-record and identical-content
|
||
cross-path attacks all forgiven correctly; two sabotage variants
|
||
(hash check removed; workspace-index record substituted) both caught
|
||
by existing tests. Index equality re-checked at the query level
|
||
(`defines`, `member`, `references_to`, `members_of_chain`,
|
||
`hierarchical_declarations`) over a macro-table + re-export fixture.
|
||
`check/` no diff; `(K-reused)+E` formula sabotage-verified. 36-row and
|
||
1 750-sentence parity, and the 34.3 % go arithmetic, re-derived from
|
||
raw evidence, not just read. Three QA-chosen renames (wildcard
|
||
import, bind-visible name, two-level hierarchical tail) run directly
|
||
against the real opentitan tree: byte-identical outcomes across
|
||
no-reuse/full-reuse/half-reuse. One out-of-scope observation flagged
|
||
separately (a bind-file's own occurrence going unedited/unwarned,
|
||
reproducible at HEAD, unrelated to the reuse door). Full log:
|
||
`docs/features/perf5r-scope-reuse/README.md`'s QA log.
|
||
|
||
### 61.6 Closing
|
||
|
||
- [x] `docs/perf/README.md` entry; topo for every contract amended; the
|
||
review's status line; release 0.52.0 with assets verified — entry,
|
||
topo and status lines done 2026-09-09; **0.52.0** released
|
||
(b12e0cc, v0.52.0): 8 assets, the darwin-arm64 vsix at 0.52.0 with
|
||
both binaries, `hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||
|
||
## 62. The 0.52.0 review (Codex, 2026-09-09) — F1/F2/F3 and the next lanes
|
||
|
||
`docs/performance_052_review.md` (findings F1–F3, next actions 3–5) and
|
||
`docs/052_implementation_plan.md` (the other agent's plan; its Phase 1
|
||
was implemented in the tree before the lead saw it) are the spec; the
|
||
tracker's "Follow-up findings" and N1–N3 rows are the ledger; evidence in
|
||
`docs/perf/review-052-20260909/`. Same protocol as §60/§61.
|
||
|
||
### 62.1 F1 — directory aliases in the split startup scan (correctness)
|
||
|
||
The neighbourhood walk and the rest walk had separate visited sets, so a
|
||
directory reachable by two spellings (`a_alias -> z_real`) was indexed
|
||
twice at startup: two definition targets, a false "declared in more than
|
||
one file" rename refusal, healed only by a rescan. Fix (the other agent +
|
||
the lead's finishing lane): one `DirectoryTracker` shared across both
|
||
walks; a pre-check that falls back to the single canonical walk when an
|
||
alias sorts before the open folder or an ancestor; the `HEAD_WALK_MAX`
|
||
fallback discards the head instead of unioning it; an alias found only
|
||
by the rest walk requests an ordinary rescan so path spellings converge;
|
||
the open-buffer alias check stats only same-named files.
|
||
- [x] tracker shared, pre-check, fallback, conflict → rescan; `stats` 0
|
||
on opentitan again; discovery and the 100-buffer cell unchanged
|
||
- [x] fixtures: alias before / after / multiple / ancestor / sibling
|
||
(outside the chain) / cycle / ignore rules / unsaved buffer /
|
||
genuine duplicate declarations (still refused) — startup, rescan
|
||
and restart agree on index paths, definitions and prepareRename
|
||
- [x] QA: the matrix re-attacked, stat counts, numbers re-taken
|
||
|
||
### 62.2 F2 + F3 — the load probe (harness)
|
||
|
||
- [x] F2: a warm `scanload` cell primes an empty store untimed; per-trial
|
||
cache hits/misses in the row; a warm trial with 0 hits is an error
|
||
- [x] F3: scan completion stamped from the scan's own end event, not the
|
||
request window; responses partitioned by it; arrival stamps kept
|
||
- [x] QA: a brand-new store, a window longer than the scan
|
||
|
||
### 62.3 N1–N3 — deferred to loop 3 unless the owner asks
|
||
|
||
N1 the dirty-buffer parse (114 ms first-after-edit), N2 the retained-
|
||
analysis parse work and the 31 ms facts decode, N3 the whole-index merge
|
||
per publication. Filed with the review's baselines; not started.
|
||
|
||
### 62.4 Closing
|
||
|
||
- [x] `docs/perf/README.md` note; topo (the walk tracker); release 0.53.0
|
||
with assets verified — done 2026-09-09: **0.53.0** (b4a0668,
|
||
v0.53.0), 8 assets, the darwin-arm64 vsix at 0.53.0 with both
|
||
binaries, `hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||
|
||
## 63. Loop 3, round 1 (planned 2026-09-11) — the `bind` rename gap, then N1
|
||
|
||
Two lanes, serial, in the main tree (§36's protocol: one dev (Opus), then
|
||
one QA (Sonnet), then the lead's review; dev and QA both through
|
||
`tools/guard.sh`; no `sleep` over 60 s; no `pgrep -f`). Ships as 0.54.0.
|
||
|
||
### 63.1 A `bind` file's own occurrence of a renamed name (QA `task_834abda3`)
|
||
|
||
Found by §61.5's QA on the real opentitan tree, reproducible at HEAD and
|
||
unrelated to facts reuse. Renaming `entropy_masking_req` (a net declared in
|
||
`hw/ip/aes/rtl/aes.sv`) edits `aes.sv` but leaves `hw/ip/aes/dv/aes_bind.sv`'s
|
||
`.entropy_masking_req(entropy_masking_req)` — the expression half of a
|
||
connection inside `bind aes aes_reseed_if u_aes_reseed_if (…)`, which the
|
||
binder resolves in the bind target's scope (`Target::BindScope { target:
|
||
"aes" }`, `vlog_semantic/src/resolve.rs`) — neither edited nor warned about.
|
||
Renaming `seed_en` (declared in `aes_prng_clearing.sv`) leaves the same file's
|
||
two-level tail `u_aes_core.u_aes_prng_clearing.seed_en` neither edited nor
|
||
warned about, while §49's hierarchical tail from an ordinary instantiating
|
||
file (`u_entropy_src_main_sm.state_q` in `entropy_src_core.sv`) is edited.
|
||
The whole-scope engine is the refusal authority, so a silent miss is a
|
||
wrong answer: after the rename the design no longer elaborates.
|
||
|
||
The contract to reach: an occurrence in a `bind` directive's connection is
|
||
**edited** when the engine resolves it to the renamed declaration — a bare
|
||
name in the bind target's scope, or a hierarchical path whose root is the
|
||
bind target (the target module, a `: u_x` instance list, or a hierarchical
|
||
target path) — through the same rungs an instantiating file's occurrences
|
||
use; **warned about** (file:line, the sentence shape `rename/warnings.rs`
|
||
already uses) when the name occurs in a `bind` connection the engine cannot
|
||
resolve; never silent. Source selection (`rename_sources_traced`'s rungs,
|
||
`module_select::hierarchical_users`, `files_mentioning`) must bring the
|
||
`bind` file in — find out which rung drops it before adding one. Refusal
|
||
parity with `rename_preflight` stays one-directional (the preflight may
|
||
refuse only what the engine refuses); `check/after.rs`'s rebinding check
|
||
runs over the edited `bind` file like any other.
|
||
|
||
Feature README: `docs/features/rename-bind-occurrences/README.md`. Files:
|
||
`crates/vlog_refactor/src/{rename/,references.rs,scope.rs,check/}`,
|
||
`crates/vlog_semantic/src/{resolve.rs,workspace/}` only if a resolver rung is
|
||
missing (a Handshake entry in the README either way),
|
||
`crates/lucisv_server/src/{rename.rs,rename_trace.rs,module_select.rs,state/}`
|
||
for selection, `tools/perf/` only to add a fixture row. Nothing else.
|
||
|
||
- [x] the reproduction pinned first: engine-level fixtures in
|
||
`vlog_refactor` (a `bind` file beside the declaring file) for the
|
||
bare-name connection, the positional connection, the two-level tail,
|
||
a `: u_x` instance-list target, a hierarchical target path, a `bind`
|
||
inside a generate block (`if (…) begin : gen … end`), and one the
|
||
engine must *not* resolve (a bind whose target module is not in the
|
||
workspace) — each asserting today's silent miss, then flipped
|
||
- [x] the fix: occurrences resolved through `Target::BindScope` and tails
|
||
rooted at the bind target edited; unresolvable ones warned about;
|
||
the rung that dropped `aes_bind.sv` named in the README
|
||
- [x] parity: `renamewarn`'s 1 750 sentences and the 36-row `paired`
|
||
fingerprints re-taken against 0.53.0 — every difference is a `bind`
|
||
file's new edit or warning and is listed in the README, nothing else
|
||
moves; the eight rename shapes' timings within noise (the tail rename
|
||
≤ 330 ms median)
|
||
- [x] the three QA renames (`WidthPRDSBox`, `entropy_masking_req`,
|
||
`seed_en`) run against the real opentitan tree through
|
||
`rename_traced_with` under all three reuse modes: identical answers,
|
||
and `aes_bind.sv` now edited
|
||
- [x] QA: fixtures re-attacked (a `bind` whose connection names a
|
||
*different* declaration of the same name; the new name colliding in
|
||
the bind target's scope — refused; an escaped-name target; a
|
||
`defparam`-only bind file), parity re-derived, opentitan sweep
|
||
|
||
### 63.2 N1 — the first request after an edit (the 0.52.0 review, item 3)
|
||
|
||
The review's cell: `pinmux_reg_top.sv` (40 267 lines), one-character
|
||
`didChange`, then the all-family `codeAction` menu — **113.6 ms**, against
|
||
0.23 ms for the unchanged repeat. The lint snapshot cannot help a fresh
|
||
revision; what remains is the debounced `Document::new` the request wrapper
|
||
performs before any handler runs (`tokenize`, `parse_tolerant` over a clone
|
||
of the token stream, `collect_defines`, `analyze`, `resolve_external`,
|
||
`LineIndex::new`), the diagnostics publish that lints the new revision, and
|
||
the menu's own stages. `crate::lint_trace` already splits the request into
|
||
flush / config / build / lint / fence / serialize under `--verbose`; the
|
||
flush's inner stages are not yet split.
|
||
|
||
Target: ≥ 15 % off the first-after-edit cell (stretch < 95 ms) with the
|
||
AST, the diagnostics and the menu byte-identical; the unchanged-repeat cell
|
||
and every other `offeredit`/`offerkinds` row within noise; peak RSS not up.
|
||
Measure before building: split the flush in `lint_trace` (lex / parse /
|
||
defines / analyze / external / lines / publish-lint), take the numbers on
|
||
0.53.0, and go after the largest stage. Candidates, in the order the review
|
||
named them: the token-stream clone into `parse_tolerant` (borrow or hand
|
||
over, keeping `Document::tokens`), allocation in `tokenize`/`parse_tolerant`
|
||
for a 40 k-line generated file, `analyze`'s tables, `resolve_external`
|
||
against a 3 975-file index, a second lint of the same revision anywhere on
|
||
the path (the snapshot must serve both the publish and the menu — verify it
|
||
does). A change in `vlog_parser`'s public signatures is a Handshake in the
|
||
README and a topo row. No stopwatch assertions in tests.
|
||
|
||
Feature README: `docs/features/perf-first-after-edit/README.md`. Files:
|
||
`crates/lucisv_server/src/{lint_trace.rs,state/mod.rs,server/,diagnostics.rs,
|
||
code_action.rs}`, `crates/vlog_parser/src/{lexer.rs,parser/,lib.rs}`,
|
||
`crates/vlog_semantic/src/{analyze*,bind/}` only for a measured stage,
|
||
`tools/perf/` for the flush split rows. Nothing else.
|
||
|
||
- [x] the flush split in `lint_trace` and a harness row per stage; the
|
||
0.53.0 numbers in the README before any change — `Rebuild`'s seven
|
||
stages (`lex parse defines analyze external lines publish`) plus
|
||
`documents`, printed as a **third sibling group** `rebuild{…}` on
|
||
the `timing: codeaction` line, which `phases_r1.actionprofile`
|
||
picks up as `trace_rebuild_*` with no harness code change
|
||
(`phases_p2.parse_trace` flattens one level). **The 100 ms flush on
|
||
0.53.0: lex 29.1, parse 25.6, publish 22.2 (lint 22.0), analyze
|
||
10.1, external 4.8, lines 0.6, defines 0.5, ~7 dropping the old
|
||
revision.** Two of the review's candidates were answered by the
|
||
split: `action` reads `snapshot=hit`/`lint=0.00ms` (no second lint
|
||
of the revision) and `lint::context` already lends `doc.semantics`
|
||
(no second analysis)
|
||
- [x] the fix, one stage at a time, each with its before/after cell;
|
||
parser snapshot and idempotency suites green; corpus and opentitan
|
||
byte-identity gates — three changes, all in `vlog_parser`: the
|
||
lexer's two phases **fused** (the intermediate `Vec<RawTok>` gone;
|
||
`tokenize` 27.8 → 24.7 ms), **`Parser::skip`** for the 178
|
||
`bump()` sites that threw the token away (`parse_tolerant` 17.5 →
|
||
16.0 ms), and a **first-byte test in front of the 44-entry
|
||
operator table** (24.7 → **11.6 ms**, the largest single win).
|
||
Parity: token stream + parse diagnostics + whole AST + symbol
|
||
table digested per file over **4 807 files** (corpus + opentitan),
|
||
0 differ; `format --stdout` byte-identical over corpus (860) and
|
||
over opentitan (one tree digest, identical stderr); diagnostics
|
||
and the all-family + seven-family menus identical on the pinmux,
|
||
aes and tb buffers before and after an edit, including a revision
|
||
edited to *have* lint findings. 4 403 → **4 406 tests**
|
||
- [x] `offeredit`, `offerkinds`, `flush`, `diagnostics` phases paired
|
||
against 0.53.0 with the order alternated; RSS cell — the cell
|
||
**110.95 / 107.54 → 88.31 / 88.36 ms, −19.2 %**: the ≥ 15 % gate
|
||
met and the < 95 ms stretch met. The unchanged-repeat cell
|
||
(0.27/0.32 → 0.22/0.19) and every `offeredit`/`offerkinds`/
|
||
`flush`/`diagnostics` row are inside their own version's a/b
|
||
spread. RSS **not up**: warm flat (≈428 MiB both), cold scan
|
||
~25 MiB *lower* (506 → 480 MiB) — the `Vec<RawTok>` that is no
|
||
longer built; index store byte-identical at 45 468 KiB. Feature
|
||
README `docs/features/perf-first-after-edit/`; evidence and
|
||
runners in `~/.cache/lucisv-perf/63-2/`
|
||
- [x] QA: the trace's arithmetic re-derived, the parity attacked (a buffer
|
||
that fails to lex; a `` `define`` edit that changes the macro table;
|
||
an edit that moves a fence), the numbers re-taken
|
||
|
||
### 63.3 Closing
|
||
|
||
- [x] `docs/perf/README.md` entry; topo rows for every contract amended;
|
||
release 0.54.0 with assets verified — done 2026-09-12: **0.54.0**
|
||
(da32237, v0.54.0), 8 assets, the darwin-arm64 vsix at 0.54.0 with
|
||
both binaries, `hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||
|
||
## 64. Loop 3, round 2 (planned 2026-09-12) — cross-file references for hierarchical-surface-only declarations
|
||
|
||
One lane. The dev half runs in the owner's spawned session
|
||
(`task_d8afe80f`, its own worktree); QA (Sonnet) and the lead's review run
|
||
on that result in the main tree after it lands. Same rules as §63: guard
|
||
every suite and sweep, no `sleep` over 60 s, no `pgrep -f`, opentitan
|
||
read-only. Ships as 0.55.0.
|
||
|
||
### 64.1 `references` stops at the connection surface (QA §63.1, `task_d8afe80f`)
|
||
|
||
`crates/lucisv_server/src/nav.rs`: `leaves_this_file` (~148) and
|
||
`indexed_def_in_file` (~235; `indexed_def_for_symbol` is shared with
|
||
`hover.rs`) decide whether a declaration can be referenced from another file
|
||
by `WorkspaceIndex::member(unit, name)` — the **connection** surface, ports
|
||
and parameters. A module's net, variable or instance lives on the
|
||
**hierarchical** surface only (`workspace/hierarchy.rs`, since 2026-09-05), so
|
||
both functions treat such a declaration as unable to leave its file. Two
|
||
symptoms, pinned by
|
||
`nav.rs::a_binds_connection_expression_is_reachable_by_definition_not_yet_by_references`:
|
||
`references` from the *declaration* of a hierarchically reached net falls to
|
||
the single-file fallback and never sees a cross-file use (a `bind`
|
||
connection or an ordinary `u_x.sig` tail alike); `references` from a *use*
|
||
that does resolve cross-file cannot re-identify the open buffer's own
|
||
in-file use of the same declaration, because `indexed_def_in_file` maps the
|
||
live symbol back the same wrong way. Not `bind`-specific; reproduced with a
|
||
plain `assign w = u_leaf.sig;`.
|
||
|
||
The contract to reach: a declaration's cross-file reachability is judged on
|
||
the surface a use can actually reach it by — `member_in(unit, name,
|
||
Surface::Hierarchical)` in both call sites (the connection answer is a prefix
|
||
of the hierarchical one, so package/class/struct members and ports keep
|
||
their answers byte-for-byte). `references_are_ambiguous` and the
|
||
single-record rule (`defs.len() != 1`) keep their meaning over the wider
|
||
answer — a name declared both as a port and as an internal net of the same
|
||
unit is ambiguous, not silently the port. Hover and definition, which share
|
||
`indexed_def_for_symbol`, must not change what they say for anything they
|
||
already answered. No new index field, so no `FACTS_FORMAT` bump; if one
|
||
turns out to be needed, say why in the README.
|
||
|
||
Feature README: `docs/features/references-hierarchical-surface/README.md`.
|
||
Files: `crates/lucisv_server/src/{nav.rs,hover.rs}` and the server's wire
|
||
tests (`server/tests/`), `crates/vlog_semantic/src/workspace/hierarchy.rs`
|
||
only if `member_in` needs a case it lacks (a Handshake entry either way).
|
||
Nothing else.
|
||
|
||
- [x] the fixture sweep first, asserting today's answers, then flipped:
|
||
`definition`, `references` (from the declaration and from each use,
|
||
`includeDeclaration` both ways), `hover`, `documentHighlight` over
|
||
(a) a `bind` connection's bare name, (b) a `u_x.sig` tail from an
|
||
instantiating file, (c) a two-level tail, (d) a port of the same
|
||
unit (unchanged answers), (e) a package member (unchanged), (f) a
|
||
name that is both a port and an internal net of one unit (ambiguous
|
||
— the single-file fallback, as today), (g) an unsaved buffer
|
||
(`untitled:`), (h) the open buffer's own in-file use seen from a
|
||
cross-file use
|
||
- [x] the fix in both call sites; the §63.1 QA test renamed to say what it
|
||
now asserts
|
||
- [x] on the real opentitan tree (read-only): `references` on
|
||
`entropy_masking_req` from `aes.sv` lists `aes_bind.sv`; on
|
||
`state_q` from `entropy_src_main_sm.sv` lists `entropy_src_core.sv`;
|
||
the `nav`/`navqueue` harness rows within noise (the hierarchical
|
||
lookup is one more map probe)
|
||
- [x] QA: fixtures re-attacked (a generate-scoped net; a net shadowed by a
|
||
port of the same name in a *different* unit; a class member — must
|
||
stay on the connection answer), opentitan census, gates. Verdict:
|
||
rework needed — three findings in the closed-declaring-file repair's
|
||
handling of a stale-on-disk file (one new to this lane, two
|
||
pre-existing and general); see the feature README's QA log.
|
||
- [x] rework (dev, per the lead's ruling on QA findings 1–3): one fresh read
|
||
per closed file per request, threaded to the rendering step
|
||
(`file_view`'s cache is no longer on this path); a re-analysed closed
|
||
file's declaration reported at its live span; every index-time
|
||
closed-file span guarded with `hover::spells_exactly` (now `pub(crate)`)
|
||
and dropped rather than misrendered. `qa_finding_1/2/3` flipped to the
|
||
fixed answers and renamed, plus one attack on the guard itself. QA's
|
||
+25 % on a local-net request in a 40 000-line file accepted as-is, for
|
||
§64.2 to note in `docs/perf/README.md`.
|
||
- [x] QA re-check (same worktree): findings 1–3 re-derived by hand and
|
||
confirmed fixed (a use-only shift, a deleted declaring file, a UTF-8
|
||
boundary, two independent closed files, an escaped port and an
|
||
escaped hierarchical net all attacked and held). **Finding 4, new**:
|
||
the `include_declaration` fallback's index-time span is rendered with
|
||
**no guard** when the file is *open* (only the closed path calls
|
||
`spells_exactly`) — reproduced with a renamed live buffer, a stale
|
||
3-byte span lands on the first three characters of the live token
|
||
`sig2`. Verdict: rework needed again; see the feature README's QA log
|
||
for the fix suggestion. Gates green (4453 passed), opentitan
|
||
re-confirmed byte-identical, size 423 lines.
|
||
- [x] rework 2 (dev, finding 4): the `include_declaration` chain lifted into
|
||
`nav::declaration_site`; an open buffer's index-time fallback span is
|
||
emitted only if `hover::spells_exactly` holds against the live text,
|
||
else the declaration is omitted (the closed path keeps its single guard
|
||
in `closed_locations`). QA's finding-4 test flipped and renamed, plus a
|
||
control (an unsaved edit above the declaration still reports the live
|
||
line). Gates green through `tools/guard.sh`.
|
||
- [x] QA final (escalated, same worktree): the finding-4 test re-derived
|
||
by hand (a real unsaved rename; honest omission, tails unchanged) and
|
||
the control shown to come from the live path; the declaration-site
|
||
ladder attacked rung by rung — five `qa_final_*` tests (a failed live
|
||
lookup with the name still in place → emitted; a suffix of a longer
|
||
live name → dropped; off a UTF-8 boundary → dropped, no panic;
|
||
`includeDeclaration: false` on the closed rungs; one observation, a
|
||
different exact `sig` at the old bytes is reported, for the lead).
|
||
`nav.rs` 433 production lines, no unwrap/expect/panic,
|
||
`indexed_references` 71 lines (reported). Gates green (4459 passed),
|
||
opentitan rows re-confirmed read-only, checkout status identical.
|
||
Verdict: **pass**.
|
||
|
||
### 64.2 Closing
|
||
|
||
- [x] `docs/perf/README.md` note if any harness number moved; topo row
|
||
(`lucisv_server ──▶ vlog_semantic`: nav asks the hierarchical
|
||
surface) — done 2026-09-12 (the perf entry records the +25 % on a
|
||
local-net `references` and the closed-file parse; the
|
||
`references-nav ──▶ workspace-index` row amended)
|
||
- [x] release 0.55.0 with assets verified — done 2026-09-17: **0.55.0**
|
||
(23e2e4b, v0.55.0), CI green on the release commit, 8 assets, the
|
||
darwin-arm64 vsix at 0.55.0 with both binaries,
|
||
`hierarchySections.js`, `extract.js`, no `*_test.js`.
|
||
|
||
## 65. Stabilization round 1 (planned 2026-09-30, owner's order) — two correctness gaps, then the doc-test stall
|
||
|
||
Three lanes, one at a time on trunk, dev (Opus) → QA (Opus) → lead review →
|
||
commit. Rules as §63/§64: every suite and sweep through `tools/guard.sh`,
|
||
never piped (log to a file, check `guard exit` and the suite count); no
|
||
`sleep` over 60 s; never `grep` without a path; opentitan read-only (the
|
||
eval clone `~/.cache/lucisv-eval/ot` may be read and, for an edit test,
|
||
restored with `git -C … checkout -- <file>`). ~~Ships as 0.60.0.~~
|
||
**Release targets (corrected 2026-10-19):** 65.1 shipped in **0.60.0**
|
||
(2026-10-08); 65.2, 65.3 and 65.4 are open and target **0.62.0** (wave
|
||
below, §65.7); 65.6 is unscheduled.
|
||
|
||
### 65.1 Rename and references through a generate block label (topo §2.9-43, MCP-14)
|
||
|
||
`rename` of a generate block label (`for (…) begin : g_lane … end`) rewrites
|
||
the label and nothing else: a hierarchical path through it
|
||
(`g_lane[0].lane_q`, `u_x.g_lane[1].sig` from another file) keeps the old
|
||
name and no longer resolves, with no warning; `find_references` on the label
|
||
reports no use. The MCP layer refuses the rename (any `block`-kind
|
||
declaration); the LSP and the CLI still perform it. Feature README
|
||
`docs/features/generate-label-rename`.
|
||
|
||
The contract to reach, in `vlog_semantic` (resolution) and `vlog_refactor`
|
||
(`find_references`, `rename`, the verifier):
|
||
|
||
- [x] a path segment that names a generate block — bare (`g.x`), indexed
|
||
(`g[0].x`, `g[i].x`), nested (`g_a.g_b[2].x`), and behind an instance
|
||
path from another file (`u_x.g[0].x`) — resolves to the block's label
|
||
and is a reference to it
|
||
- [x] `find_references` on the label lists the declaration, the closing
|
||
`end : label` and every such segment, same-file and cross-file, through
|
||
the same fan-out §64.1 uses for hierarchical-surface declarations
|
||
- [x] `rename` rewrites all of them, all-or-nothing; a closing label is
|
||
rewritten with its opening one; a segment it cannot resolve (macro
|
||
text, a string) is a warning, as for any other declaration; an
|
||
unnamed block (`genblk1`) is not renameable
|
||
- [x] named procedural blocks (`begin : lbl` in `always`/`initial`/
|
||
functions/tasks): the label, its closing label and `disable lbl;` are
|
||
one reference set
|
||
- [x] the verifier accepts exactly these rewrites and nothing more:
|
||
masked-corruption attack tests for any normalization it gains
|
||
(CLAUDE.md invariant 4)
|
||
- [x] the LSP (`textDocument/references`, `rename`, `prepareRename`) and
|
||
the CLI get it through the engine; `lucisv-mcp`'s refusal of a
|
||
`block`-kind rename (`crates/lucisv_mcp/src/tools/edit.rs`) is lifted
|
||
and its tests (`tests/qa_m7.rs`) assert the rename instead
|
||
- [x] opentitan: a generate label with cross-file uses renamed on the eval
|
||
clone — every site rewritten, the files still parse, clone restored
|
||
- [x] rename warnings and mentions are scoped to the renamed declaration
|
||
(lead's inspection 2026-09-30: a module member's bare spelling
|
||
elsewhere is not news; a dotted one and a unit/package name's every
|
||
spelling still are)
|
||
- [x] QA: attack the index forms, nesting, shadowing (a net and a block of
|
||
the same name in different scopes), a label used only in a closing
|
||
label, `disable`, an escaped label, a label inside an `ifdef`
|
||
|
||
### 65.2 LSP `references` omits three `aes` instantiations (topo §2.9-36, MCP-6)
|
||
|
||
On opentitan, `textDocument/references` at the `aes` instantiation in
|
||
`hw/ip/aes/dv/tb/tb.sv` (and at its `.clk_i` connection) answers 11 and 9
|
||
locations; the whole-set engine answers 14 and 12 — the same plus the three
|
||
top-level instantiations in
|
||
`hw/top_{earlgrey,darjeeling,englishbreakfast}/rtl/autogen/*_pd_main.sv`
|
||
(`aes #(` and `.clk_i(clkmgr_clocks_i.clk_main_aes)`). Stable after a 30 s
|
||
settle, so not an indexing race. Feature README
|
||
`docs/features/references-fanout-pd-main`.
|
||
|
||
- [x] root cause named (the fan-out/scope selection in `lucisv_server` —
|
||
`module_select`, `state/` scope widening, or the index's
|
||
instantiation facts for those three files; they are large generated
|
||
files, check the 1 MiB cap and the word census)
|
||
- [x] ~~the LSP answer equals the whole-set engine's for the module name and
|
||
for a port of it, from the declaration and from a use; a regression
|
||
test with a fixture that reproduces the cause (not only opentitan)~~ — **closed by the owner's ruling 2026-10-19: scope-relative by design.** The LSP answer equals the engine over the same file set (pinned for both scopes in `server/tests/references_scope.rs`); the default `folder` scope does not reach the three tops, `workspace` does (14/12).
|
||
- [x] an opentitan test (ignored by default, like `tests/opentitan.rs`)
|
||
pinning the 14 and 12
|
||
- [x] ~~QA: the same comparison for five other modules instantiated from a
|
||
`*_pd_main.sv` top, and for `rename`'s fan-out (does rename see the
|
||
three sites?)~~ — not run: no production code changed under the ruling
|
||
|
||
### 65.3 The combined test command stalls entering the doc-tests
|
||
|
||
`cargo test --workspace` under `tools/guard.sh`: on 2026-09-29 (0.59.0 gate)
|
||
every suite finished in about two minutes and the run then sat 25 minutes
|
||
in `Doc-tests vlog_linter` until the guard cut it; on 2026-09-30 an
|
||
independent session's run hit its 600 s guard "entering the final doc-test
|
||
harness". `cargo test --workspace --doc` alone passes in under a minute.
|
||
|
||
- [x] reproduce (how often, which doc-test, what the stuck process tree
|
||
is — `rustdoc`, `rust_out`, stdin?) and name the cause; `guard.sh`
|
||
runs the command with `0<&3` — check what the doc-test harness
|
||
inherits as stdin when the gate runs in the background
|
||
- [x] fix at the cause (the harness, the doc-test, or the guard), and make
|
||
the release gate a script (`tools/gates.sh`) that runs fmt, clippy,
|
||
the test build, the suites, the doc-tests, the corpus gate and the
|
||
node tests as separate guarded steps with logs kept and a summary
|
||
that shows a kill — `tools/RELEASING.md` and CLAUDE.md point at it
|
||
- [x] ten consecutive green runs of the gate script recorded
|
||
|
||
### 65.4 Resolve a hierarchical path rooted at a top-level module name (lead to schedule; from §65.1 QA F1)
|
||
|
||
A path whose head is a top module declared in another file — `tb.dut.u_x.sig`,
|
||
the shape every opentitan DV `force`/`$deposit`/`uvm_hdl_*` path takes
|
||
(IEEE 1800 §23.6: a top-level module name is the root of a hierarchical
|
||
name) — resolves nothing today: `tb` is bound as a `Target::Lexical` use,
|
||
misses in the writing file, and `resolve::member_site`'s `head_site` stops
|
||
the spine, so no segment after it is a reference and a rename of `dut`'s
|
||
declarations leaves the path behind (since §65.1 with a warning, not
|
||
silently). The root lookup belongs in `vlog_semantic/src/resolve.rs`
|
||
`head_site`: when the lexical walk misses **and** the head is followed by a
|
||
`.`, answer `MemberSite::Unit { path: head, surface: Hierarchical }` so the
|
||
workspace's `fold_path` walks `tb` → `dut`'s type → … exactly as it walks an
|
||
instance path today — with the head itself recorded as a `Target::Module`-like
|
||
use so `tb` stops being `NotFound`. QA's repro: `vlog_refactor/tests/
|
||
qa_generate_label.rs` `a_path_rooted_at_another_files_top_module_is_never_silently_left_behind`
|
||
(`probe.sv`: `assign o = tb.dut.g_sw[0].buf_q;`), and on opentitan
|
||
`hw/ip/keymgr_dpe/dv/env/keymgr_dpe_if.sv:514,515,517` (`force
|
||
tb.dut.gen_sw_assigns[i]…`) under `rename gen_sw_assigns`. Watch: a name
|
||
that is both a local and a top module (the local wins), `$root.tb…`, and the
|
||
index cost of the extra external candidates on every DV path.
|
||
|
||
- [x] root lookup in `head_site`, the head recorded as a module use
|
||
- [x] QA's repro renames the path instead of warning; the §65.1 warning
|
||
still fires for a root the workspace does not declare
|
||
|
||
### 65.6 Rename inside included fragments (lead to schedule; from §65.1 QA final H4)
|
||
|
||
A module that `` `include``s a fragment of its own body (`prim_ram_1p.sv`
|
||
including `prim_util_memload.svh`, every opentitan `*_assert.svh`) has that
|
||
fragment's text pasted into its scope, but lucisv analyses the fragment as a
|
||
file of its own: a bare `mem` there resolves to nothing, so `rename
|
||
prim_ram_1p.mem` edits the module and — since §65.1 — only *warns*
|
||
(`prim_util_memload.svh:12,24,32,43: `mem` is used in a file `prim_ram_1p.sv`
|
||
includes and was left unchanged`). Renaming there means binding a fragment
|
||
in the scope of the file that includes it (the include site's scope chain as
|
||
the fragment's outer scope, as `fragment-mode` does for a bare body) and
|
||
verifying the edit against that binding; a fragment included from two
|
||
modules is two bindings and must agree or be refused. QA's repro:
|
||
`vlog_refactor/tests/qa_warning_scope.rs`
|
||
`a_bare_use_in_plain_included_code_is_renamed_or_said` (`m_body.svh`:
|
||
`assign o = state_q;` included by `m.sv`).
|
||
|
||
- [ ] a fragment included by exactly one unit is bound in that unit's scope
|
||
and renamed with it; one included by several is refused unless every
|
||
binding agrees
|
||
- [ ] QA's repro renames the fragment's use; the §65.1 warning remains for
|
||
what cannot be bound
|
||
|
||
|
||
### 65.7 Wave for 0.62.0 (planned 2026-10-19, owner's order: "fix those that are true")
|
||
|
||
Two parallel lanes first (disjoint files; neither touches `vlog_semantic`),
|
||
then 65.4 serially (it changes `vlog_semantic` resolution, which §65.2's
|
||
lane might also need — run after it merges).
|
||
|
||
**Lane A — §65.2 references fan-out** (Opus dev → QA → lead), files:
|
||
`crates/lucisv_server/src/state/sources.rs`, `crates/lucisv_server/src/nav.rs`,
|
||
new test files under `crates/lucisv_server/src/server/tests/`, a new
|
||
ignored-by-default `crates/lucisv_server/tests/opentitan_references.rs`,
|
||
`docs/features/references-fanout-pd-main/README.md`.
|
||
|
||
- [x] §65.2's checklist above (closed by ruling: scope-relative by design)
|
||
|
||
**Lane B — §65.3 gate script** (Opus dev → QA → lead), files:
|
||
`tools/gates.sh` (new), `tools/guard.sh` (only if the cause is there),
|
||
`tools/RELEASING.md`, `docs/features/release-gates/README.md` (new);
|
||
CLAUDE.md's pointer is the lead's at merge.
|
||
|
||
- [x] §65.3's checklist above
|
||
|
||
**Then — §65.4 top-module-rooted paths** (serial, after lane A merges).
|
||
|
||
- [x] §65.4's checklist above (conservative by the owner's ruling: a head with an import candidate, inside a class, or beside a macro that could declare it is not rooted)
|
||
|
||
|
||
### 65.8 Completion after a top-rooted path head (deferred from §65.4 H2, 2026-10-19)
|
||
|
||
`tb.` offers nothing in completion: the completion walk keeps "an unknown
|
||
head answers nothing" (two `lucisv_server` completion tests pin it), while
|
||
resolution now roots an unknown head at a top module. Decide whether
|
||
completion should offer `tb.`'s hierarchical members, answering `None` when
|
||
the index has no unit of that name. `docs/features/top-rooted-paths`.
|
||
|
||
- [ ] owner/lead decision; if yes, `completion/member.rs` + tests
|
||
|
||
## 66. Format Selection that fits where it stands (planned 2026-11-09, owner's order)
|
||
|
||
Owner's report: *Format Selection* "fails more than half of the time". The
|
||
usual selection is one whole `always` block or one whole `case` statement,
|
||
often nested inside blocks the selection does not cover. Reproduced on trunk
|
||
(`lucisv --lines`, the engine `textDocument/rangeFormatting` shares): selecting
|
||
a `case` re-lays the whole `always` around it; the block is re-indented to the
|
||
formatter's own depth × width, so in a file indented any other way it no
|
||
longer lines up with its neighbours; a selection inside `generate` re-lays the
|
||
whole region; and a file with a parse error anywhere is refused outright.
|
||
Owner's rule: do not worry about the parent — the selected block keeps the
|
||
indentation level it starts at, and stays functionally the same.
|
||
|
||
### 66.1 VS Code language configuration (lead, done 2026-11-09)
|
||
|
||
- [x] `editors/vscode/language-configuration.json` (comment tokens, brackets,
|
||
auto-closing and surrounding pairs) wired to both language ids in
|
||
`editors/vscode/package.json` — Toggle Line/Block Comment (Ctrl+/) works
|
||
without another Verilog extension installed.
|
||
|
||
### 66.2 Selection formatting (one lane: dev, then QA)
|
||
|
||
Feature README: `docs/features/selection-formatting/README.md`. Files:
|
||
`crates/vlog_formatter/src/selection.rs` (+ a `selection/` split if it nears
|
||
600 lines), `crates/vlog_formatter/src/{lib.rs,printer.rs,format/mod.rs}`,
|
||
`crates/vlog_formatter/tests/selection.rs`, `crates/lucisv_server/src/format.rs`,
|
||
`crates/lucisv_server/src/server/tests/formatting.rs`,
|
||
`crates/lucisv_server/tests/e2e.rs`. `verify.rs`, `range.rs`, `fence.rs`, the
|
||
parser and the CLI's `--lines` are not touched.
|
||
|
||
- [x] `format_selection`: the smallest run of sibling items/statements the
|
||
selected lines cover, laid out alone at the indentation it was written
|
||
at, spliced into otherwise untouched bytes.
|
||
- [x] Verified whole-file (`verify_equivalence`, unchanged) and converged by
|
||
replaying the located target, not the line numbers.
|
||
- [x] Fences outrank the selection; a module/package-level target defers to
|
||
`format_range` (header/footer splitting).
|
||
- [x] A file that does not parse: the target is located in the tolerant tree
|
||
and refused when a diagnostic falls inside it.
|
||
- [x] `textDocument/rangeFormatting` / `rangesFormatting` call it.
|
||
- [x] Tests: the owner's shapes (whole `always`, whole `case`, inside
|
||
`generate`, inside a function), off-grid and tab indentation, partial
|
||
selections, comments, fences, broken files, masked-corruption attacks on
|
||
the splice.
|
||
|
||
## 67. Sticky scroll shows every layer (planned 2026-11-11, owner's order)
|
||
|
||
VS Code pinned only the module header, because sticky scroll follows the
|
||
document-symbol outline by default and the outline stops at declarations.
|
||
The server's folding ranges already carry every `begin`/`end`, `case`,
|
||
`fork`, `generate` and function — one fold per layer, starting on its header
|
||
line.
|
||
|
||
- [x] `editors/vscode/package.json` `configurationDefaults` for both language
|
||
ids: `editor.stickyScroll.defaultModel` = `foldingProviderModel` and
|
||
`editor.stickyScroll.maxLineCount` = 10 (VS Code's default of 5 is the
|
||
owner's example exactly, with nothing to spare). A user's own setting
|
||
still wins.
|
||
- [x] `crates/lucisv_server/src/folding.rs`: a test pinning that each layer
|
||
of the owner's example (module, `always`, `case`, case item, `if`)
|
||
starts a fold on its header line.
|
||
- [ ] Seen in a running VS Code (owner).
|
||
- Known limit: a layer with no `begin` (a one-statement `if`, a case item
|
||
without `begin`) has no fold and so no pinned line; a `begin` written on
|
||
its own line pins that `begin` line, not the `always` above it.
|
||
|
||
## 68. Completion that keeps up with typing (planned 2026-11-17, owner's order)
|
||
|
||
Five asks from the owner, about the VS Code extension. Two serial lanes
|
||
(`lucisv_server` depends on `vlog_parser`, so they are not independent):
|
||
68.1 first, then 68.2. Each lane: one dev, then one QA, both Opus 5.5.
|
||
|
||
### 68.1 Lane A — auto-`end`, templates, ranking, keyword ghosts, port items
|
||
|
||
Feature README: `docs/features/completion-ux/README.md`. Files:
|
||
`crates/lucisv_server/src/{on_type.rs,inline.rs,templates.rs,pairs.rs,settings.rs,main.rs}`,
|
||
`crates/lucisv_server/src/completion/*`, new modules beside them where a
|
||
file is near 600 production lines, `crates/lucisv_server/tests/e2e.rs`,
|
||
`editors/vscode/{extension.js,package.json,smoke.js,README.md}` and a new
|
||
`editors/vscode/*_test.js` if the extension logic is factored out. No
|
||
parser, formatter, linter or semantic crate change.
|
||
|
||
- [x] **`begin` + Enter writes the `end`** (owner: "more like begin +
|
||
<return>, the cursor should be the next line of begin, at the correct
|
||
indentation, and ready for the first statement"). The newline on-type
|
||
answer, when the line above ends in `begin` (or `begin : label`) and
|
||
the file has an unclosed `begin`, also inserts `end` on the line after
|
||
the new one, at the indentation of the statement the `begin` belongs
|
||
to; the cursor stays on the new, indented line. No `end` when the
|
||
blocks already balance. Setting `lucisv.autoEnd` (default on). The
|
||
extension sends the request itself when `editor.formatOnType` is off
|
||
and puts the cursor back.
|
||
- [x] **`always_ff @(` / `always @(` expand with clock and reset**:
|
||
`posedge ${1:clk} or negedge ${2:rst_n}`, both tab stops, in the ghost
|
||
and as the first popup template; the clock-only form stays available
|
||
second.
|
||
- [x] **Names from the current file rank first** in the popup: declared
|
||
anywhere in this buffer, then words used in it, ahead of other files'
|
||
names and of keywords.
|
||
- [x] **Keyword ghosts**: a typed prefix of a keyword shows the rest of it
|
||
as grey inline text (Tab accepts), following the popup's selected item
|
||
when the popup is open. Setting `lucisv.inlineKeywords` (default on).
|
||
- [x] **Port items**: unconnected ports first; already-connected ports
|
||
listed after them, marked `connected` in the dimmed detail; accepting
|
||
a port writes `.name($1)` with the cursor inside the parentheses.
|
||
|
||
### 68.2 Lane B — no rushed errors on the connection being typed
|
||
|
||
Feature README: `docs/features/port-entry-grace/README.md`. Files:
|
||
`crates/vlog_parser/src/parser/instance.rs` (+ its tests),
|
||
`crates/lucisv_server/src/{diagnostics.rs,server/diagnostics.rs,state/*}`.
|
||
|
||
- [x] Parser recovery keeps an unfinished connection (`.`, `.name(` open to
|
||
the end of its line, a missing `,` before the next `.name`) inside its
|
||
own entry — still a diagnostic, never silent — so the rest of the file
|
||
parses, colours and lints as if the entry were complete.
|
||
- [x] The server withholds the diagnostics that fall inside the entry the
|
||
last edit touched, and releases them after a quiet period or when the
|
||
next edit lands elsewhere.
|
||
|
||
## 69. Module instantiation syntax highlighting (2026-11-17, owner's order)
|
||
|
||
Feature README: `docs/features/instantiation-highlighting/README.md`. Files:
|
||
`crates/lucisv_server/src/{tokens.rs,tokens/instantiation.rs}`,
|
||
`editors/vscode/{package.json,.vscodeignore,semanticTokens_test.js}`,
|
||
`docs/features/{lucisv-server,large-file-mode}/README.md`.
|
||
|
||
- [x] Distinct semantic highlights across module instantiations (14-type wire
|
||
legend unchanged): module name (`class`), `#` + `.PARAM` overrides +
|
||
parameter values (`parameter`, distinct from `()`), instance name
|
||
(`function`), `.port`/`.*` (`property`), and port connections
|
||
(`variable`), including unfinished entries while typing.
|
||
- [x] `configurationDefaults` enables `editor.semanticHighlighting.enabled` and
|
||
`semanticTokenScopes` maps `verilog`/`systemverilog` roles to distinct,
|
||
non-white TextMate scopes across themes.
|
||
|
||
## 70. The tests pass on Linux, and one cleaning round (2026-11-19, owner's order)
|
||
|
||
Every suite had only ever run on macOS arm64; the Linux and Windows binaries
|
||
ship unexecuted. A `linux-x64` Actions runner now exists (`luhpe-linux-x64`,
|
||
a resource-capped Docker-in-Docker container on the Gitea host), and the
|
||
first trial of the suite in its job image found: clippy red on three unused
|
||
imports in `lucisv_server` test modules (their only users are tests compiled
|
||
on macOS/Windows alone), and 11 distinct failing tests out of ~5 300 — eight
|
||
that set up an unreadable/unwritable path and so cannot fail as root (the
|
||
job image's user), one that assumes a case-insensitive filesystem, two
|
||
`…_in_linear_time` timing assertions. No product failure among them as far
|
||
as the trial shows. One lane, `docs/features/linux-test-portability`;
|
||
`tools/linux_check.sh` runs the working tree in that image without a push.
|
||
|
||
- [x] `cargo clippy --all-targets -- -D warnings` clean on Linux and on
|
||
macOS (`crates/lucisv_server/src/hover.rs`, `includes.rs` test modules,
|
||
and whatever else the Linux build names).
|
||
- [x] The permission-denied tests (`crates/lucisv/tests/cli.rs`,
|
||
`crates/lucisv_core/src/walk.rs`, `crates/lucisv_mcp/src/apply.rs` and
|
||
`tests/cache.rs`, `tests/qa_m6.rs`, `crates/lucisv_server/src/state/tests/filelist.rs`)
|
||
pass both as root and as an unprivileged user: where the platform does
|
||
not enforce the permission the test says so and stops, it does not
|
||
assert the opposite.
|
||
- [x] `crates/lucisv_server/src/file_ops.rs`
|
||
`a_case_mismatched_include_spelling_still_narrows_in_and_rewrites`
|
||
holds on a case-sensitive filesystem or is scoped to the insensitive
|
||
ones, with the reason written at the test.
|
||
- [x] `crates/lucisv_server/src/large.rs` — the two `…_in_linear_time`
|
||
tests pass on the runner **and still fail when the conversion is
|
||
quadratic** (shown, not asserted).
|
||
- [x] The cleaning round: test code only, driven by what the tools report on
|
||
either platform — unused imports and dead helpers, platform assumptions
|
||
left implicit, assertions on wall-clock or environment that the runner
|
||
shows to be fragile. No test is deleted and the test count does not
|
||
drop; no production code and nothing in `verify.rs` changes.
|
||
- [x] `cargo test --workspace` green on Linux as root and with `--user`,
|
||
and `tools/gates.sh` green on macOS.
|
||
- [x] (lead) `.gitea/workflows/ci.yml` gains a `linux` job on `linux-x64`;
|
||
`docs/topo.md` and `tools/RELEASING.md` updated.
|
||
|
||
## 71. The overnight queue (2026-11-19, owner's order) — eight features, one release each
|
||
|
||
Ordered by the owner on 2026-11-19, to be done unattended after §70 lands:
|
||
each item goes through the dev → QA → lead-review loop, is committed, and
|
||
ships as its own release — `0.65.2`, `0.65.3`, … `0.65.n` in the order they
|
||
finish — and once all are done, `0.66.0`. The lead has the owner's standing
|
||
go-ahead to commit, tag and push for this queue. Every feature is tried on
|
||
the OpenTitan tree (not only on unit fixtures) before it is called done.
|
||
The items are the owner's words, lightly condensed; each gets its own
|
||
subsection, plan and `docs/features/<name>/README.md` when its turn comes.
|
||
|
||
- [x] **71.1 An edit does not re-index the whole database.** (0.65.6, `docs/features/localized-reindex`)
|
||
Today every
|
||
file edit re-indexes everything. A change to a `define` may have to;
|
||
a typical, localized edit must not.
|
||
- [x] **71.2 Actions stay fast on a huge, heavily-dependent tree.** (0.65.11, `docs/features/fast-actions`) Do the
|
||
work dynamically: answer first from what is already in the same file
|
||
(hover to a definition in this file), and use the relationship map to
|
||
load completion candidates on demand.
|
||
- [x] **71.3 Highlighting does not wait for the index.** (0.65.10, `docs/features/viewport-highlight`)
|
||
Always run a
|
||
localized, viewport-only highlight; it may be imperfect and be
|
||
corrected later, but basic colours must not wait for the whole
|
||
database.
|
||
- [x] **71.4 `` `ifdef `` / `` `else `` blocks fold** (0.65.4, `docs/features/ifdef-folding`), and take part in the
|
||
sticky-scroll ("floating") bars.
|
||
- [x] **71.5 The formatter adapts to the file's own style** (0.65.5, `docs/features/format-styles`: six named styles and `auto`)
|
||
— where lines
|
||
break, what is grouped, how ports align. If inferring that is too
|
||
ambiguous, a setting with a drop-down of named styles instead (ANSI,
|
||
Google, Microsoft, NXP — educated guesses), with the rules easy to
|
||
read in the source.
|
||
- [x] **71.6 The module view shows where you are.** (0.65.2, `docs/features/hierarchy-current-path`; not yet seen in a running editor.)
|
||
Highlight the open
|
||
file's instance and its parents in different shades — bright light
|
||
orange for the instance, dimmer the further up — or anything in that
|
||
spirit that makes the hierarchy easy to read.
|
||
- [x] **71.7 Find References sometimes answers "not found"** (0.65.8, `docs/features/scan-ordering`: a server bug — the caret just past a name)
|
||
on a
|
||
port/signal, then works after clicking elsewhere and back. VS Code or
|
||
the server? Investigate, then fix what is ours.
|
||
- [x] **71.8 Comments: no code colours inside them** (0.65.3, `docs/features/comment-highlighting`; the bracket colour is VS Code's, explained not changed)
|
||
(the `[]` of
|
||
`signal[]` gets highlighted today), **but do highlight `TODO`,
|
||
`FIXME`, `FIX_ME`, `TBD`**, plus a user setting for custom words that
|
||
are highlighted only in comments.
|
||
- [x] **71.9 Release `0.66.0`** once 71.1–71.8 have each shipped.
|
||
|
||
### 71 — wave 1 (lead, 2026-11-19): 71.6 runs beside §70
|
||
|
||
The owner asked not to wait for §70's Linux runs. §70 is test code in the
|
||
Rust crates and touches no contract; 71.6 is the extension's hierarchy view
|
||
(`editors/vscode/hierarchy*.js`, `package.json`, the extension README and
|
||
changelog). Disjoint file sets, and the one edge between the two areas
|
||
(`editors/vscode ◀──▶ lucisv_server`, the spawn contract) is touched by
|
||
neither — so they run as two lanes: §70 on trunk's tree (already in flight
|
||
there), 71.6 in the worktree `../lucisv-wt/71.6` on `lane/71.6-module-view`,
|
||
branched from `88546c8`. 71.1–71.3 all live in `lucisv_server`'s state and
|
||
indexing, collide with each other and with §70's test files, and wait for
|
||
§70 to merge.
|
||
|
||
- Lane 71.6 owns: `editors/vscode/hierarchyView.js`, `hierarchyModel.js`,
|
||
`hierarchySections.js` and their `_test.js` files, new
|
||
`editors/vscode/*.js` modules it adds, `editors/vscode/package.json`
|
||
(`contributes` only — not `version`), `editors/vscode/.vscodeignore`,
|
||
`tools/release.sh`'s runtime-module checks if a new module needs listing,
|
||
`docs/features/hierarchy-current-path/README.md`.
|
||
|
||
- Wave 2 (lead, 2026-11-19): 71.6 shipped as 0.65.2 (`e9f5090`). §70 is still
|
||
in flight on trunk's tree, so the next lane is again one that stays out of
|
||
the Rust test files: **71.8** (comments), in `../lucisv-wt/71.8` on
|
||
`lane/71.8-comments` from `e9f5090`. It owns
|
||
`editors/vscode/syntaxes/*`, `language-configuration.json`, new
|
||
`editors/vscode/*.js` modules and tests, `extension.js` wiring,
|
||
`package.json` `contributes`, `.vscodeignore`, the extension README, and —
|
||
only if the stray colour turns out to come from the server's semantic
|
||
tokens — `crates/lucisv_server/src/tokens.rs` and `tokens/`, which §70
|
||
does not touch. `docs/features/comment-highlighting/README.md`.
|
||
|
||
- Wave 3 (lead, 2026-11-19): 71.8 shipped as 0.65.3 (`948f8a0`) and 71.4 as
|
||
0.65.4 (`d574969`), each from its own worktree; both tagged locally and
|
||
**not pushed** — the owner's ssh key left the agent at about 05:00 (its
|
||
`AddKeysToAgent 1h`), which also stops `tools/linux_check.sh`. §70 is
|
||
committed on macOS evidence with its Linux line left open. 71.5 (formatter
|
||
styles) runs in `../lucisv-wt/71.5` from `d574969`. Owed once ssh is back,
|
||
in this order: push master and the tags one at a time; re-run §70 on Linux
|
||
(root twice, `--user`); add the `linux` job to `ci.yml`.
|
||
|
||
- Wave 4 (lead, 2026-11-19): 71.5 shipped as 0.65.5 from `../lucisv-wt/71.5`,
|
||
rebased onto §70's commit. 71.1 (localized re-index) is with QA in
|
||
`../lucisv-wt/71.1`. Found on the way by 71.5's QA, all present in 0.65.4
|
||
and filed here, not fixed:
|
||
- [ ] A comment between a generate `end` and `else` (also a trailing `// c`
|
||
after a labelled generate `end` before `else`) is a verification
|
||
error: the file is left unformatted. The safety net works; the
|
||
formatter should not need it.
|
||
- [ ] `` `ifdef `` between `end` and `else` is a parse error.
|
||
- [ ] An attribute on an ANSI port (`(* keep *) input a`) is a parse error.
|
||
- [x] The server's `line-length` lint falls back to 100 columns under the
|
||
`ansi`/`microsoft`/`nxp` styles (`lucisv_server/src/lint.rs`); taken
|
||
when 71.1 merges.
|
||
- [ ] One-per-line styles give multi-instance declarations
|
||
(`p1 u8 (...), u9 (...)`) the hanging layout.
|
||
|
||
- Wave 5 (lead, 2026-11-19): 71.1 shipped as 0.65.6 after a QA FAIL (four
|
||
stale answers), a fix round, a QA pass and a last small round. What the
|
||
QA rounds and a read-only investigation turned up, all present before this
|
||
wave, becomes lane **71.7** (the owner's Find References item, widened):
|
||
- [x] A caret just past an identifier's last letter asks about the next
|
||
character: references, definition, hover and highlight come back
|
||
empty (`server/dispatch.rs` `Server::offset`). This is the owner's
|
||
"not found, then works after clicking back".
|
||
- [x] A `didChange` arriving during a whole rescan can overtake an older
|
||
one still queued (`server/mod.rs` `process_batch`): with incremental
|
||
sync the server's buffer is corrupted until the file is reopened.
|
||
- [x] A burst `[request, didOpen]` during the startup scan is re-held at
|
||
every file (`server/index.rs` `answer_what_is_waiting`): the scan
|
||
takes ~300 s on OpenTitan instead of ~1.7 s.
|
||
- [ ] A watcher event naming only a directory leaves stale state; an
|
||
excluded buffer stays indexed after close; symlinked files are held
|
||
under one or both spellings depending on what was open.
|
||
71.3 (viewport highlighting) passed QA with a gap in the default folder
|
||
scope (colours wait out a widen, ~630 ms); it is rebased after 71.7 and
|
||
closes that in its fix round. Then 71.2.
|
||
|
||
- 0.65.6 never published (lead, 2026-11-19): the release build failed to
|
||
compile `lucisv-server` for Windows — `dir_id` is a `Copy` pair on unix and
|
||
a `PathBuf` elsewhere, and 71.1's new code moved it in a closure
|
||
(`state/incremental.rs`). The gate caught nothing because nothing before
|
||
the release build compiles for another platform. Fixed by the lead (one
|
||
line) and shipped as 0.65.7 with 0.65.6's notes; `tools/gates.sh` gains a
|
||
`cross` step so the next one is caught before the tag. Seven of the eight
|
||
§71 items therefore have releases 0.65.2–0.65.5 and 0.65.7.
|
||
|
||
- Wave 6 (lead, 2026-11-19): 71.7 shipped as 0.65.8. Left open from it and
|
||
from its QA, all older than this series:
|
||
- [ ] A request held during a scan is answered against the newest text; a
|
||
position-based one can resolve a different symbol when an edit moved
|
||
the text under it, and rename edits carry no document version.
|
||
- [ ] An unheld buffer opened while a scan runs is never taken in
|
||
afterwards; closing an unsaved in-scope buffer a rescan had indexed
|
||
leaves its text in the index.
|
||
- [ ] Renaming a port of a module defined twice gives an edit or a refusal
|
||
at random (`qa717/drv/dup.py`).
|
||
- [ ] Directory-only watcher events (needs a broader watcher
|
||
registration — the owner's call), excluded buffers after close (a
|
||
cheap fix belongs in the index layer: adding a file is a wide
|
||
change), symlink spellings.
|
||
|
||
- §70 closed (lead, 2026-11-19), shipped with 0.65.9. Once ssh was back the
|
||
suite proved flaky on Linux (3 of 9 runs): two test helpers that insisted
|
||
a write to a child's stdin succeed, a 200 ms wall-clock bound, an MCP test
|
||
that could hang on an inherited pipe — and one real bug, `lucisv-mcp`
|
||
serving stale contents after a same-tick, same-size rewrite on Linux
|
||
(`project/files.rs`, the racy rule covered the mtime alone). All fixed in
|
||
lane 70b (`docs/features/linux-test-portability`, Round 2); Linux is green
|
||
10/10 as root and as a user (dev) and 6/6 each (QA); `ci.yml` has its
|
||
`linux` job. Left open:
|
||
- [ ] A file with an mtime in the future is re-read by `lucisv-mcp` on
|
||
every call, forever (67 ms against 7 ms per `find` on 4 000 files).
|
||
- [ ] `crates/lucisv/tests/cli.rs:2149` asserts only an empty stdout, no
|
||
exit code.
|
||
- [ ] `crates/lucisv_mcp/tests/qa_m3.rs` uses unix-only APIs with no cfg:
|
||
`cargo check --all-targets` for Windows fails there (tests only).
|
||
- [ ] The release is still gated on macOS alone; Windows is compile-checked
|
||
(`cross`), never executed.
|
||
|
||
- Wave 7 (lead, 2026-11-19): 71.3 shipped as 0.65.10, re-applied onto
|
||
0.65.8's message loop by hand and re-validated by a second QA round. Left
|
||
open from it:
|
||
- [ ] The discovery walk at the start of every scan answers nothing while
|
||
it runs: a late open in workspace scope still waits 62–86 ms for
|
||
colour and a rescan holds colours 70–159 ms. Making the walk
|
||
resumable needs its own identical-result proof (`state/discover.rs`).
|
||
- [ ] A `range` answered during a rescan always counts as a guess and
|
||
costs one refresh at settle even when nothing changed.
|
||
- [ ] An edit in one file that changes how another OPEN file colours sends
|
||
no refresh (as before this lane).
|
||
|
||
- Wave 8 (lead, 2026-11-19): 71.2 shipped as 0.65.11 after four dev rounds
|
||
and four QA rounds — two QA failures, so the last round ran with Fable 5.2
|
||
as dev and QA (`docs/features/fast-actions`, Review). Left open from it:
|
||
- [ ] Inside the startup settings wait, the client's answer to the pull is
|
||
applied ahead of an older settings push held with it
|
||
(`server/startup.rs`, `take_the_answer_out_of_held`; predates the
|
||
lane; needs a client whose push and answer disagree in one burst).
|
||
- [ ] `tests/fast_actions_bursts.rs`'s oracle accepts an answer the
|
||
reference gives after any later message of the round: 2–9 % of
|
||
injected stale answers pass when a later message restores the state.
|
||
- [ ] Whether a large open buffer is in the index depends on when it was
|
||
opened, saved or scanned (predates the lane; 77–98 answers differ
|
||
between a settled session and a fresh server on OpenTitan).
|
||
- [ ] The 40 000-file rescan after a delete takes either 12.3 s or
|
||
14.5–15.5 s, on 0.65.10 and on this tree alike; cause not found.
|
||
|
||
## 72. Sticky scroll pins the module instance (planned 2026-11-19, owner's order)
|
||
|
||
Owner: "only the module definition is floating. I want to extend this a
|
||
little so that the module instance would be floating as well." Folds come
|
||
only from keyword pairs and `` `ifdef `` branches, so nothing delimited by
|
||
`( )` pins. Surveyed on OpenTitan `hw` (4 047 files): 162 instances of 50+
|
||
lines, none pinned; 132 of them write `#(` on the type line, so the instance
|
||
name sits on a later `) u_name (` line. Example:
|
||
`hw/ip/aes/rtl/aes_control_fsm_n.sv:382-594`. One lane (dev, then QA),
|
||
feature README `docs/features/instance-folding/README.md`.
|
||
|
||
- [x] `crates/lucisv_server/src/folding/instances.rs` (new): one fold per
|
||
multi-line module instantiation from its module-type line, and one more
|
||
per instance from the line its name is on when that is a different
|
||
line, so both `aes_control_fsm #(` and `) u_aes_control_fsm (` pin
|
||
while the reader is in the connection list. The closing line stays
|
||
visible, as for every scope fold.
|
||
- [x] `crates/lucisv_server/src/folding.rs`: the third source merged through
|
||
`in_answer_order`; every fold the server answered before is still
|
||
there, unchanged and first on a shared start line.
|
||
- [x] Tests in the same change, and `folding/opentitan_sweep.rs` extended:
|
||
instances counted independently, existing folds proven unchanged.
|
||
- [x] `editors/vscode/README.md`: the sticky-scroll row names the instance.
|
||
- [x] Seen in a running VS Code (owner, 2026-11-19, on the local 0.66.1
|
||
build). Shipped as 0.66.1.
|