TODO §68.2: an unfinished port connection stays in its own entry, and its errors wait until you pause

Parser (tolerant mode only, parser/recover_list.rs): a lone '.', a
'.name(' left open at its line end and a trailing ',' in a named list are
recovered inside their entry — always a diagnostic, never silent; strict
mode and valid code are unchanged (1 026 inputs old vs new: identical
strict results and trees, byte-identical CLI output; corpus 814/6).
Server (state/port_grace.rs): diagnostics that start inside the entry the
last edit touched, in a named-connection list of an instance, are withheld
for 1.5 s and released by the loop's timeout, an edit elsewhere or a save;
a pulling client that supports it gets workspace/diagnostic/refresh.
A trailing ',' in a named list is now reported in tolerant mode too.
Dev + QA (Opus 5.5); QA failed one gate (lucisv_mcp qa_f1), one fix
round, re-check passed: parser 521, server 1954, mcp 383, formatter 352.
Not yet seen in a running VS Code. docs/features/port-entry-grace; topo
rows for §68.1 and §68.2.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
This commit is contained in:
lucioandClaude Mythos 5.2 committed 2026-11-17 15:40:58 -08:00
1 parent c1076f9405
commit 14213f6a93
19 files changed
+2396 -25

No files matched your search

+4
View File
@@ -282,6 +282,10 @@ signatures.
costs 1 and 1. `docs/features/header-recovery/README.md` is the feature;
the mechanism in *this* README — item and statement lists — is
unchanged and still handles everything outside a header.
- [x] **2026-11-17, `docs/features/port-entry-grace/README.md`:** an
unfinished connection (`.`, a `.name(` left open at the end of its line,
a trailing `,`) costs one diagnostic inside its own entry and the list
reads on to the entries after it.
## Work log
+538
View File
@@ -0,0 +1,538 @@
# port-entry-grace
## Goal
The owner (TODO §68.2): "don't rush to show the syntax error when the user is
editing the port, help auto complete the port syntax, like `.po...()`, and use
the auto-completed, syntax correct version to run syntax highlighting and
lint." Lane A (§68.1) makes accepting a port write `.name()`. This lane makes
the editor calm while a named connection is being typed inside an instance's
port list or `#(` parameter list. Two halves:
1. **Parser recovery** (`vlog_parser`, tolerant mode only): an unfinished
entry — a lone `.`, a `.name(` left open at the end of its line, a missing
`,`, a trailing `,` — stays inside its own entry. It still costs exactly one
diagnostic, whose span lies inside the entry (or on the one token that
proves it), and the rest of the list, the instance and the file parse,
colour and lint as if the entry were complete.
2. **The server withholds the entry being typed** (`lucisv_server`): while the
last edit of a buffer sits inside a connection list, the diagnostics
(parse *and* lint) whose range starts inside the entry around it are left
out of what is published or pulled, and said again when the next edit lands
outside the entry, when `PORT_ENTRY_GRACE` (1500 ms) passes with no edit, or
when the buffer is saved, closed or reopened.
## Assumptions
- **Tolerant mode only.** The whole-file formatter parses strictly, so every
shape here is refused by `format_source` exactly as before
(`crates/vlog_formatter/tests/port_entry_refusal.rs`), and no file the
strict parser accepts reads differently in tolerant mode
(`valid_lists_read_the_same_in_both_modes`,
`tolerant_parse_equals_strict_parse_on_valid_sources`; QA: 911 repo files
identical). **Corrected after QA:** the formatter *does* read the tolerant
tree in two places — Format Selection (`vlog_formatter/src/selection/mod.rs`,
`Tree::parse` falls back to it) and fences (`fence.rs`) — and the tolerant
diagnostic count is compared before/after by `vlog_refactor`'s check
(`check/mod.rs`) and the MCP placement check (`place/verify.rs`). The one
rule that changes what they see is (d), the trailing `,` now being
reported. QA measured the consequence (accepted by the lead): Format
Selection over 673 single-line selections in 113 files — 55
refused→formatted (selections clear of the instance in files whose only
fault is a trailing `,`, which used to be "not a tree to trust"), 0
formatted→refused, 0 changed outputs; the refactor check and the MCP
placement check now catch an edit that leaves `.a(x),)`; corpus
`picorv32/scripts/smtbmc/mulcmp.v` (two named lists ending in `,`, which
yosys accepts) is now flagged in the editor.
- **The unfinished entry is an error element, not a fabricated connection.**
`ListElem::Error` with the entry's raw text — the marker header recovery
already has. A synthesized `.po()` would make the tolerant tree claim a `)`
the source never wrote, and the MCP placement check compares tolerant trees
of two texts (`lucisv_mcp/src/tools/place/verify.rs`): `.po(` and `.po()`
must not compare equal. No new AST variant.
- **"The entry being typed" is where the last edit ended.** Incremental sync
only: the byte offset just past the last change's inserted text, in the new
text. A full-document sync (rangeless change) remembers nothing and
withholds nothing.
- **One buffer is being typed in at a time.** An edit in buffer B releases
whatever buffer A was withholding at once, rather than after A's grace.
- **1500 ms is a constant**, not a setting (same reasoning as
`CHANGE_DEBOUNCE`): long enough to finish a port name and its connection,
short enough that a real mistake left behind shows before attention moves.
- **The withheld window rides the generation.** Every change of what
`diagnostics_of` answers moves `generation` (the pull `resultId`): the edit
itself (flush), the release (grace or edit elsewhere), the save. A pull
answered while withholding can never be "unchanged" against a later full
list.
- **During a running scan the loop is the scan's**, so a grace that ends mid
scan is released when the scan hands the loop back (the same holds for the
change debounce today).
## The exact rules
### Half 1 — parser (`parser/recover_list.rs`, call sites in `parser/instance.rs`)
Applied in both the `#(` override list and a named connection list.
- **(a) lone `.`** — a `.` followed by `,` `)` `;` EOF, a construct
keyword (`endmodule`…), or — on a later line — a keyword or a `.`. A `.`
or keyword on the same line (`..z (p)`, `.input(x)`) keeps the generic
recovery: one error element holding the whole of it. It becomes an error
element holding just the `.`; diagnostic `expected a name after \`.\`` on
the `.`. (A same-line keyword, `.input(x)`, keeps the generic recovery,
whose skip takes the whole `.input(x)`.)
- **(b) open value** — at a `.name(`'s `(`, the value is abandoned when all
three hold: (1) the `(` is still open at the end of its line; (2) the next
line begins with `.`, `)`, `;`, a keyword, or EOF; (3) the bracket is not
closed the way a value's is — no matching `)` before a `;`/construct
keyword/EOF, or the matching `)` is followed by `;`, EOF, a construct
keyword, `.`, or a plain (non-macro) identifier. Valid lists always follow a
value's `)` with `,`, `)` or a directive/macro, so (3) is false on every
valid file — `.po(top` ⏎ `.sig), .q(r)` reads as written. The existing
error `unclosed \`(\` in a port or parameter connection` is raised at the
`(`, and the existing element recovery takes the `(` and skips to the end of
its line — at the value's own level. A bracket opened *inside* the
abandoned value (`.c(f(`, `.c(z[`, `.c({`, `.c((`) is skipped
bracket-balanced, so the element swallows the entries below it and the
list's `)` (`.c(f(\n .b(y))`). Same at c1076f9; a known limit. Condition (2) keeps the pinned ambiguous shape `.D(` ⏎
`u0 (.a(x)));` exactly as it was (an identifier opening the next line is
`value_runs_into_next_instance`'s question).
- **List continuation after a recovered entry** — `connection_list_ends`: in
tolerant mode, after an error element with no `,` behind it, a `.` at the
cursor is the next connection and the list reads on, silently (the
recovered entry already has its diagnostic). Any other token still ends the
list as `list_ends` always did.
- **(c) missing `,`** — unchanged from header recovery: both entries are
`Ok`, one `expected \`,\`` on the `.` of the second entry — the token that
proves the comma missing. After a recovered entry, (b) above applies
instead (no second diagnostic).
- **(d) trailing `,`** — a `,` that only the list's `)` follows, in a named
list or an override list: `expected a connection after \`,\`` on the `,`.
Tolerant mode used to end the list there *silently* while strict mode
refused — a gap this closes. A positional list's trailing `,` is an omitted
connection and stays legal.
- `.name(z);` on one line (both `)` already typed, list unclosed) is
unchanged: `Ok(.name(z))` plus `expected \`)\`` on the `;`.
### Half 2 — entry bounds (`state/port_grace.rs`, `entry_around`)
The list is `signature::enclosing_list`'s, but only believed when (1) no `;`
stands between its `(` and the edit (the bracket count takes a value left open
for the list never closing; a connection list never holds a `;`); (2) it is
a **named** list — it holds an entry at its own level that starts with `.`
(the one being typed counts; a `.` opening its own line counts at any depth);
and (3) it is not a declaration header's — no `module`, `macromodule`,
`interface`, `program`, `class`, `package`, `primitive`, `function`, `task`
or `checker` keyword between it and the `;` before. So positional instance
lists, call arguments, a function declaration with a user return type, a call
after `begin : label` and every header `#(` withhold nothing. Then:
- **start** — walking from the list's `(` to the edit: the last `,` at the
list's level (included), else the list's `(` (excluded); a `.` that opens
its own line always starts an entry (depth reset) — where the parser ends a
value left open on the line above.
- **end** — walking on from the edit at the depth the edit is at: the first
`,` at that level or any `;` (excluded, its start), the first closing
bracket that would go below that level, or the end of the edit's line —
reaching on to the next line's first token when that is a `.` (the token
that proves a `,` missing).
- A diagnostic is withheld iff its range **starts** in `[start, end]`, both
ends included.
Agreement with Half 1: (a) on the `.` — inside; (b) on the `(` — inside;
(c) on the next entry's `.` — inside whether the user typed the entry below
(the entry starts at its line's `.`) or above (the entry reaches the next
line's `.`), and on one line (no `,` between); (d) on the `,` — inside the
entry after it (start includes the `,`).
### Half 2 — when (`state/port_grace.rs` `PortGrace`, `server/*`)
- `didChange` → `sync::apply_changes_at` gives the edit end →
`PortGrace::edited` (pending; other buffers marked released).
- flush (`flush_dirty`) → after `set_document`, `locate_port_entry` looks the
edit up in the fresh tokens; outside any list it is forgotten.
- `diagnostics_of` (push and both pulls) → `PortGrace::withhold`.
- The loop (`Server::run`) waits `min(CHANGE_DEBOUNCE if dirty, time to the
earliest grace deadline)`; on the timeout, and at the top of every
iteration, `release_port_entries` bumps the generation and republishes each
due buffer. No thread, no new wake-up mechanism.
- `didSave` / `didClose` / `didOpen` forget the buffer's entry before the
flush; a save of a non-dirty buffer that was withholding republishes it.
- Formatting, semantic tokens, completion: untouched. The formatter refuses
on the real parse; the tokens after an unfinished entry equal those with
the entry completed (`after_an_unfinished_entry_the_file_reads_as_with_the_entry_completed`).
### Known limits (accepted by the lead, 2026-11-17)
- On a list that never closes, the entry runs on to the `;`, so a
diagnostic on the same line after it (`sub u0 (.a(x), .b(y) assign q = ;`)
waits out the grace too. The inclusive end also holds back an existing
diagnostic on the next line's `.` while the line above is typed.
- `.b(y)` ⏎ `.,` costs two diagnostics on one `.` (missing `,` and lone
dot).
- `.po(` before an `` `ifdef `` reports on the list's `;`, outside the
entry.
- A release republishes even when the entry held nothing back (one extra,
identical publish ~1.5 s after a keystroke in a complete entry).
- A nested bracket opened in an abandoned value swallows the rest of the
list (above).
## Handshakes
- **Consumes** `signature::enclosing_list` (unchanged) and
`vlog_parser`'s tolerant tree. **Promises** to everything reading the
tolerant tree: an unfinished connection is a `ListElem::Error` whose raw
text is the entry's own source; the entries after it are ordinary `Ok`
elements. `vlog_semantic`/`vlog_linter` already filter error elements
(`filter_map(ListElem::ok)`); verified no panic and no cascade
(`an_unfinished_entry_costs_one_error_and_no_cascade`).
- **New parser diagnostics** (tolerant only): `expected a name after \`.\``,
`expected a connection after \`,\``; the unclosed-`(` message is reused.
- **`sync::apply_changes` is `#[cfg(test)]` now**; the server calls
`apply_changes_at`, which also returns the edit end.
- **GRANTED by the lead, 2026-11-17: `workspace/diagnostic/refresh`.**
`ClientAbilities.diagnostic_refresh` (server/mod.rs), read in main.rs by
`diagnostic_refresh_support` from the **raw** params at
`capabilities.workspace.diagnostics.refreshSupport` — `lsp-types` 0.97
names its typed field `diagnostic` (singular, no rename), so the typed
decode never sees what VS Code sends. `release_port_entries` sends the
request once per release (not per buffer) when the client pulls and
accepts it; the answer is ignored (`response`'s fall-through).
`vscode-languageclient` 9 advertises the capability and re-pulls visible
documents on the request, so in VS Code the entry shows after the 1.5 s
pause. A pulling client without it still sees the release at its own next
pull, under a new generation.
## Status / TODO
- [x] Half 1: (a) lone `.`, (b) open value, list continuation, (d) trailing
`,`; (c) already held. Unit tests + valid-unchanged + formatter-refuses.
- [x] Half 2: edit end from incremental sync, entry bounds, withhold in push
and pull, release on edit elsewhere / grace / save / close / reopen,
generation bump on release.
- [x] Server unit tests (bounds, state machine with injected time, tokens and
findings after the entry) and e2e over stdio (grace, edit elsewhere,
save, pull).
- [x] Perf: didChange→publish before/after, two runs each.
- [x] `workspace/diagnostic/refresh` for pulling clients that accept it —
Handshake granted, main.rs read, e2e both ways.
## Work log
### 2026-11-17 — dev agent (Opus 5.5)
- Surveyed today's tolerant parse of every shape with a scratch probe:
`.` ⏎ `.b(y)` and `.po(` ⏎ `.b(y)` cost the rest of the list (the recovered
entry with no `,` ended it; `.b(y));` became an error item, two
diagnostics, the second on the next entry); `.po(z` ⏎ `.b(y))` read as
`.po(z.b(y))` with the diagnostic on the `;`; `.b(y),)` was **silent** in
tolerant mode though strict refuses it; the missing `,` already kept both
entries.
- Half 1 lives in `recover_list.rs` (the list-recovery module) rather than in
`instance.rs`: `instance.rs` is at 564 production lines and CLAUDE.md sends
new code near 600 to another module. `instance.rs` only changes its two
list loops' calls (`connection_or_recover`, `note_trailing_comma`,
`connection_list_ends`) and ORs `value_left_open` into the existing
unclosed-`(` test. `at_open_bracket` became a wrapper over a free
`is_open_bracket` shared with the new lookahead.
- Half 2: the state lives in the `Workspace` (`state/port_grace.rs`, field
`grace`), not in `Server`: `Server` is built by a struct literal in
`startup.rs` and `ClientAbilities` by one in `main.rs`, neither this lane's
file; `Workspace` is `Default`-built, so a field costs nothing outside
`state/`. Same reason the new module is `state/port_grace.rs` and not a
crate-root module (that would need a `mod` line in `main.rs`).
- Found and fixed: `enclosing_list`'s naive bracket count reads a list as
still open after an abandoned `.po(`, so an edit three items down was
"inside" it and its `wire ;` error was withheld. A `;` between the list's
`(` and the edit now rules the list out (unit-tested).
- Pull mode: no refresh path exists (`docs/features/pull-diagnostics/README.md`
says so explicitly), so per the brief nothing was invented; the generation
bump makes the next pull full. Handshake request filed above.
- Perf, `didChange` → `publishDiagnostics` over stdio, release build, two runs
each (ms; "alone" includes the 150 ms debounce timer, "+request" is a
keystroke a request follows, mean of ten):
| probe | before run 1 | before run 2 | after run 1 | after run 2 |
|---|---|---|---|---|
| ibex_core.sv (2 026 lines), keystroke in a `.clk_i` connection, alone | 170.5 | 158.8 | 165.2 | 157.6 |
| same, + request | 4.87 | 4.25 | 5.05 | 4.26 |
| generated 1 000 lines, alone | 168.5 | 165.9 | 164.6 | 164.7 |
| generated 1 000 lines, + request | 3.85 | 4.14 | 3.97 | 3.71 |
| generated 10 000 lines, alone | 200.0 | 202.3 | 204.8 | 198.7 |
| generated 10 000 lines, + request | 37.5 | 38.1 | 37.9 | 37.1 |
Probe: `cargo test --release -p lucisv_server --test e2e a_keystroke --
--ignored --nocapture --test-threads=1` (the new
`a_keystroke_in_a_port_list_round_trip_over_the_wire` plus the existing
`a_keystroke_round_trip_over_the_wire`). Flat within run-to-run noise:
the entry lookup is one token walk per flush, no extra parse.
- Gates: `cargo fmt`, clippy `--all-targets` (vlog_parser, lucisv_server)
clean; suites green (vlog_parser 518, vlog_semantic 418, vlog_linter 673,
vlog_formatter 352, vlog_refactor 743, lucisv_server 1 950, every guard
exit 0); corpus gate 814/820 pass; release build + `smoke.js` OK.
- Handshake granted (lead): main.rs reads `refreshSupport` from the raw
params (the typed field is misnamed in `lsp-types` 0.97 — found while
wiring it); `release_port_entries` asks a capable pulling client to pull
again, once per release. Tests: a unit test of the capability read
(plural key only, literal `true` only), e2e
`a_pulling_client_that_can_refresh_is_asked_to_after_the_grace`, and the
no-capability pull test now proves no refresh is sent. VS Code README line
restored to "after a short pause, or once you edit elsewhere or save".
### 2026-11-17 — fix round (dev agent, Opus 5.5)
- MUST-FIX 1: rule (a)'s `.` follower now counts only on a later line;
`..z (p)` is one error element again, so `lucisv_mcp`'s `qa_f1`
(unmodified) passes. Test `two_dots_on_one_line_stay_one_error_element`.
- SHOULD-FIX 2: `entry_around` requires a named list
(`holds_a_named_entry`) and rejects declaration headers
(`in_a_declaration_header`). Tests for QA's cases (header `#(parameter W =
|)`, interface and class headers, positional list, function declaration,
call after a labelled begin, a fresh empty instance list) and the positive
ones (`.po`, `.`, a fresh entry after `,`, `#(.W(|` on an instance).
- README: the tolerant-tree claim rewritten with QA's measured consequence;
the nested-bracket skip described as it is; known limits listed.
## QA log
### 2026-11-17 — QA agent (Opus 5.5)
Verdict: **fail on one gate (MUST-FIX 1), otherwise pass with findings.**
Experiments ran in throwaway copies under the session scratchpad (`base/` =
`git archive c1076f9`, `copy/` = this working tree, each with its own target
dir); nothing in the working tree was rewritten. Only added file:
`crates/vlog_parser/tests/qa_port_entry_grace.rs`.
**A. Gates (re-run by QA, every suite through `tools/guard.sh -m 6 -t 1200`).**
`cargo fmt --all --check` 0; clippy `--all-targets -p vlog_parser -p
lucisv_server` 0, no warnings. Suites (passed/failed/ignored, guard exit):
vlog_parser 518/0/2 (0), vlog_semantic 418/0/4 (0), vlog_linter 673/0/0 (0),
vlog_formatter 352/0/0 (0), vlog_refactor 743/0/6 (0), lucisv_server
1 952/0/41 (0), lucisv 143/0/0 (0), **lucisv_mcp 124/1/3 (101)**.
`tools/gates.sh --only corpus`: PASS, 814/6. Release build 0;
`smoke.js target/release/lucisv-server`: OK (67 messages). With the QA file:
vlog_parser +2 tests, green.
**B. Scope / size.** verify.rs, formatter source, AST, semantic, linter
untouched. Edited beyond TODO §68.2's file list: `parser/recover_list.rs`
(reasoned in the work log), `server/notification.rs`, `sync.rs`,
`tests/e2e.rs` (plus the granted main.rs / server/mod.rs). Production lines
(non-blank, non-comment, before `mod tests`): recover_list.rs 169 → 287,
instance.rs 564 → 569, port_grace.rs 162 (new), notification.rs 206 → 230,
server/diagnostics.rs 158 → 183. No `unwrap`/`expect`/`panic!`/`unsafe` in
new non-test code; slice indexing in `entry_start`/`entry_end` is bounded.
**C. Parser.** (1) 1 023 inputs — all 911 `.sv/.v/.svh/.vh` files in the repo
(corpus + fixtures) + 60 QA legal shapes + 52 QA broken shapes — dumped as
strict result + tolerant diagnostics + tolerant tree (`{:#?}`) by both
binaries: **every strict result identical; every file the strict parser
accepts reads identically**. The 43 differences are all strict-refused
inputs (41 QA broken shapes, QA `v57`, and corpus
`picorv32/scripts/smtbmc/mulcmp.v`, whose two named lists end in `,` — see
C4). `lucisv --stdout` over all 1 023: byte-identical outputs and exit codes;
`lucisv check`: identical except QA `b09` (a generate label lint now reached
past the recovered entry — intended). (2) Legal multi-line connections
(next-line operand, `signed'(…)`, `this.`, `super.`, `null`, `new`, `$bits`,
`` `MACRO(x) ``, comment line, `intf.sig`, `.a(intf` ⏎ `.sig)`, `#(.W(` ⏎
`8))`, `.*`, `(* *)`, generate-for, instance arrays, gates, `bind`, program /
interface / checker instances, UDP, `` `ifdef `` arms, `{n{…}}`, `inside`,
`tagged`, `pkg::`, `std::randomize`, two instances per item, …): zero
diagnostics, tree == strict tree; pinned in `qa_port_entry_grace.rs`. A
mutation dropping condition (3) (`starts_new && !self.value_closes(open)` →
`starts_new`) is caught by `tolerant_parse_equals_strict_parse_on_valid_sources`
and `valid_lists_read_the_same_in_both_modes`. (3) 50 unfinished shapes
(first / last / only / repeated / at EOF / in `#(` / in generate / in
`` `ifdef `` / nested open bracket / `.po(a,` / `.` ⏎ `);` / trailing `,` +
EOF / keyword after `(` / ten lone dots): never silent, strict refuses all, no
panic, no hang, at most one diagnostic per line; pinned in the same file
(fails on c1076f9: the silent trailing comma). (4) Consumers of the new
trailing-`,` diagnostic: see SHOULD-FIX 3. (5) `format_selection`, every
single line of 113 files (the QA shapes + mulcmp.v), 673 selections, base vs
new: 0 OK→refused, 0 OK with a different output, 55 refused→OK (all on
files whose new tolerant parse now has a diagnostic: b17 b22 b33 b39 b41 b46
mulcmp.v), every OK output keeps every non-whitespace character of the input;
whole-file `format_source` refusal set identical.
**D. Server** (python stdio client against the release binary; scripts in
the scratchpad `qaB/d2.py`). (1) A pre-existing lone `.` in another entry of
the same list, an `assign q = ;` elsewhere and lints elsewhere publish while
`.po(` is held. (2) Release: push +1 501–1 516 ms after the keystroke;
pull + `refreshSupport`: one `workspace/diagnostic/refresh` at +1 501 ms,
next pull full under a new resultId, no repeat refresh in 2 s; pull without
it: no server message, next pull full (resultId 3 → 4); `workspace/diagnostic`
likewise; edit elsewhere +162 ms (the debounce); edit in another buffer +1 ms;
save +1 ms (also when sent before the debounce flush); close clears, reopen
says everything. (3) No permanent hide found: hover + completion every 200 ms
for 5 s → released at +1 507 ms; two changes in one notification (last one
decides, both orders); full-document sync withholds nothing; undo; deleting
the whole instance; lines inserted above (edit elsewhere → release).
(5) `.b` → `.bx(y)` in a project: `unknown-port` withheld, shown at +1 507 ms;
`.a(undef…)` likewise. (6) ibex_core.sv keystroke in `.clk_i`, two runs per
arm: base 167.6 / 167.6 ms alone, 5.64 / 5.50 ms + request; new 168.5 /
168.3, 5.64 / 5.64 — flat. CPU over 5 idle s after a release: 0.000 s.
(7) Semantic tokens after the entry (`.po`, `.po(`, `.`, `.po(x`, `.po,` vs
`.po(),`): identical (also on c1076f9 — tokens are lexical there).
**MUST-FIX**
1. **`lucisv_mcp` suite red**:
`crates/lucisv_mcp/tests/qa_f1.rs:447`
`qa_r_only_an_affected_instances_unreadable_connection_refuses` fails
(passes on c1076f9). `..z (p)` is now a lone-`.` error element `.` plus an
`Ok` connection `.z (p)` (rule (a) takes any `.` followed by `.`, same line
included), so `add_port` still refuses and writes nothing, but says "holds
`.`" instead of "holds `..z (p)`". Repro: `cargo test -p lucisv_mcp --test
qa_f1`. The lane's gate list omitted lucisv_mcp. Either restrict (a)'s
`.` follower to a later line, or (lead's ruling, file outside the lane)
update the expectation.
**SHOULD-FIX**
2. **Module/class header `#(` lists are treated as instance lists.**
`signature::list_at` reads `name #(` as an override list, so typing in
`module hm #(parameter W = |) (input logic a);` withholds the header's
diagnostics for 1.5 s (over the wire: `expected expression` at 0:26 shown
only at +1 503 ms). The brief says a header must withhold nothing.
`port_grace.rs:192` (`entry_around` takes `enclosing_list` as is).
3. **README Assumption "the formatter … never reads the tolerant tree" is
false.** `vlog_formatter/src/selection/mod.rs:87` (`Tree::parse`) falls
back to the tolerant tree, and `fence.rs:110` reads it. Consequence of (d):
a file whose only fault is a trailing `,` (corpus `mulcmp.v`) used to be
refused whole by Format Selection (tolerant parse had no diagnostic → "not
a tree to trust"); now selections clear of the instance format (verified
output, text preserved — C5) and the instance itself is refused. Also
new: the editor flags `mulcmp.v` (yosys accepts the trailing comma). Other
consumers: `vlog_refactor` `check/mod.rs:324` and MCP `place/verify.rs:62`
compare tolerant diagnostic *counts* before/after — an engine edit that
leaves `.a(x),)` is now caught (tighter, no test changed); `lucisv check`
does not print parse diagnostics (unchanged output). Correct behaviour as
far as QA can tell; the README should say so.
4. **Nested open bracket in the abandoned value swallows the rest of the
list.** `.c(f(` / `.c(z[` / `.c({` / `.c((` ⏎ `.b(y));`: the error element
is `.c(f(\n .b(y))` — the next entry and the list's `)` go with it (rule
(b) fires, but the element recovery's skip is bracket-balanced, not "to
the end of its line" as the README says). Over the wire a lint outside the
entry (`` `y` is read but never driven `` at 1:11) appears at once while
typing `.c(f(`, and not while typing `.c(`. Same as c1076f9, so not a
regression, but the README's promise doesn't hold for it.
**NOTE**
5. Other lists `enclosing_list` accepts, withheld for 1.5 s: positional
instance lists (`sub u0 (x, y|, z)` → `, y`); function declarations with a
user-type return (`function automatic my_t f(input a|` → `input a`); a
call right after a block label (`begin : blk` ⏎ `my_task(a, b|)` → `, b`).
Not covered (nothing withheld): instance arrays `sub u0 [1:0] (…)`, gates.
6. On an unclosed list, `entry_end` runs to the `;`: `sub u0 (.a(x), .b(y) |
assign q = ;` withholds both `assign` diagnostics (1.5 s). The inclusive
end also withholds a pre-existing diagnostic on the next line's `.` when
typing on the line above it.
7. "Exactly one diagnostic" has exceptions: `.b(y)` ⏎ `.,` costs two on one
`.` (missing `,` + lone dot). `.po(` ⏎ `.b(y)), .c(z));` now loses the
whole instance to an error item (c1076f9 kept it) — contrived, not a typing
shape. `.po(` ⏎ `` `ifdef `` … → diagnostic on the list's `;`, outside the
entry.
8. Pre-existing, not this lane: a positional list's trailing omitted
connection (`u0 (x, y,)`) is an empty `Ok` entry strictly and absent
tolerantly — strict ≠ tolerant on valid input (same at c1076f9).
9. A release republishes even when the entry held nothing back (one extra
identical publish ~1.5 s after a keystroke in a complete entry). Harmless.
10. Only a running VS Code confirms: the squiggle actually disappears and
reappears with `vscode-languageclient` 9.0.1 pull + refresh (the
capability is advertised: `diagnostic.js:784`), and how it feels.
### 2026-11-17 — QA re-check of the fix round (Opus 5.5)
Verdict: **pass.** MUST-FIX 1 and SHOULD-FIX 2 are fixed; nothing new found
that blocks. Fresh scratch snapshot of the working tree; the old-vs-new
comparison is against the same c1076f9 baseline.
- **Gates** (QA's own runs, each suite guarded, exit 0): `cargo fmt --check`
clean; clippy `--all-targets -p vlog_parser -p lucisv_server` clean, 0
warnings; vlog_parser 521/0/2 (includes `qa_port_entry_grace.rs`, 2/2),
lucisv_server 1 954/0/41, **lucisv_mcp 383/0/4** (full suite;
`git status crates/lucisv_mcp` empty), vlog_formatter 352/0/0;
`gates.sh --only corpus` PASS 814/6.
- **MUST-FIX 1.** `sub u0 (.a(x), ..z (p));` and `sub u0 (.a(x), . .b(y));`:
one error element (`..z (p)`, `. .b(y)`) and one `expected identifier`
diagnostic, the same tree and diagnostics as c1076f9. `.` ⏎ `.b(y)` still
recovers: error `.`, one `expected a name after \`.\``, the list reads on.
- **SHOULD-FIX 2, over the wire** (release binary, error typed, first
publish vs ~1.5 s later). Withholding nothing; the error arrives with
the debounce: the module `#(parameter W = |)` and interface headers, the
class `#(type T = …)` header, a positional instance list, a function
declaration with a user return type, and `my_task(a, |b)` after
`begin : blk`. Still withheld, released at +1 502–1 512 ms: `.po(`, `.`,
`.p(` after a `,`, `#(.W(|` on an instance, and `.` in a fresh empty
`sub u0 (|)`. Attacks on `in_a_declaration_header`. Every instance below
is still withheld, so none is wrongly taken for a header: after
`function void f(); endfunction`, after `task t; endtask`, after
`endclass` and after `endpackage`; after `always_comb begin end` and after
`function int f(int a); return a; endfunction`; inside
`generate if (X) begin`; after `else` and after `` `ifdef ``; after
`(* keep *)`; in a `bind`; in interface and program bodies; as the first
item after `module m (input a);`; on the header's own line
(`module m; sub u0 (…`); and for checker and interface instances. Lists
that might be wrongly included: none are withheld for
`extern function my_t f(`, `import "DPI-C" function my_t f(`,
`virtual intf vif(`, `new(.x(…))`, a modport or a clocking block. Two are
withheld, both instance-shaped and both accepted per the brief:
`t(.a(|=1))` after `begin : blk`, and `my_t v (.a(…))`, which is an
instance.
- **Valid-code identity** (1 026 inputs: the 1 023 from before plus the
three two-dot shapes). Every strict result is identical. The tolerant
trees differ only on strict-refused inputs: 41 QA broken shapes, `v57`
and `mulcmp.v`. `lucisv --stdout` outputs and exit codes are
byte-identical. `lucisv check` output is identical except QA `b09`, as
before.
- **README.** The tolerant-tree readers, the nested-bracket limit, the
named-list and header rules and the known limits all match the code.
NOTE (new, minor):
11. In README rule (a), the sentence "It becomes an error element holding
just the `.`…" now follows the same-line exception, so it reads as if
it described the exception. The `.input(x)` parenthetical is repeated,
and one line of rule (b) is not wrapped. Wording only.
12. `holds_a_named_entry` counts a `.` that opens a line at any depth. A
positional list that continues a hierarchical name on the next line
(`sub u0 (top` ⏎ `.sig, b)`) therefore counts as named and is withheld
for 1.5 s. Rare and harmless.
## Review
### 2026-11-17 — lead (after dev, QA fail on one gate, one fix round, QA re-check pass)
Accepted. The first QA verdict was a fail on one gate: `lucisv_mcp`'s
`qa_f1` — rule (a) read `..z (p)` on one line as a lone dot. The lead's
dev brief had left `lucisv_mcp` and `lucisv` out of the gate list; that
omission is the lead's, and both crates are in every later list. One Opus
fix round; the re-check passed (parser 521, server 1 954, mcp 383,
formatter 352, corpus 814/6).
Rulings recorded:
- **A following `.` makes a lone dot only on a later line.** Two dots on
one line keep the generic recovery, so the MCP refusal message is the one
it was.
- **Only a named-connection list of an instance withholds.** The list holds
an entry at its own level that starts with `.`, and no declaration keyword
stands between it and the `;` before it. Headers, positional lists, call
arguments withhold nothing. A named-argument call and `my_t v (.a(…))`
still do; accepted (same syntax as an instance).
- **A trailing `,` in a named list is now a tolerant-mode diagnostic**, as it
always was in strict mode. Consequences measured by QA and accepted:
Format Selection away from that instance now formats (55 refused →
formatted, none the other way, no output changed); the refactor check and
the MCP placement check catch an edit that leaves one; one yosys-style
corpus file is flagged in the editor.
- **`workspace/diagnostic/refresh`** on release for a pulling client that
advertises it (handshake granted to the dev: `main.rs`).
- Valid code: 1 026 inputs old vs new, every strict result and every
strictly-accepted tree identical, CLI output byte-identical.
Open, minor: QA notes 11 (rule (a) wording in this README) and 12 (a
positional list continuing a hierarchical name on the next line counts as
named). **Not verified by anyone:** the squiggle's timing in a running VS
Code with the pull + refresh client, and whether 1.5 s feels right.
+2
View File
@@ -430,6 +430,8 @@ graph LR
| `range-formatting ──▶ format-fences` | depends | A range is "an inverted fence": reuses `Doc::Verbatim`, `fence::collect`/`region_at`, and two helpers widened to `pub(crate)` (`line_start`, `with_trailing_comments`) — the only fence.rs change. |
| `range-formatting ──▶ spans` | depends | The planner selects items by span/line. |
| `selection-formatting ──▶ range-formatting / format-fences / lucisv-server` | depends | (2026-11-09, TODO §66.2) `format_selection` lays out the smallest run of sibling items/statements a line span covers at its written indentation and splices it in; defers to `format_range` for a module/package-level target; consumes `fence::collect`/`with_trailing_comments` and `Fmt::item_seq`/`stmt_seq`; adds `Printer::print_at` and `FormatError::Selection`. `verify.rs`, `range.rs`, `fence.rs` untouched. The server's range, ranges and on-type `;` requests all go through it. |
| `completion-ux ──▶ on-type-formatting / inline-templates / completion-core / member-completion` | depends | (2026-11-17, TODO §68.1) the newline on-type answer writes an owed `end` (`on_type/auto_end.rs`, `begin_owes_an_end` shared with the `begin` ghost); keyword ghosts after the template triggers (`inline/keywords.rs`, follows `selectedCompletionInfo`); sortText tiers 2/3 are this buffer's declared names and used words (`completion/buffer.rs`); connection items keep connected ports and insert `name($1)` (`completion/connection.rs`). Extension `typing.js` sends the on-type request when `editor.formatOnType` is off. Server crate only. |
| `port-entry-grace ──▶ header-recovery / pull-diagnostics / change-debounce` | depends | (2026-11-17, TODO §68.2) tolerant-mode recovery of an unfinished named connection in `parser/recover_list.rs` (lone `.`, value left open at its line end, trailing `,` — always a diagnostic inside the entry; strict mode and valid code unchanged); `state/port_grace.rs` withholds the diagnostics of the entry the last edit touched for `PORT_ENTRY_GRACE` (1.5 s) in a named-connection list of an instance, released by the main loop's timeout, an edit elsewhere, or a save; `workspace/diagnostic/refresh` for pulling clients. A trailing `,` in a named list is now a tolerant diagnostic — read by Format Selection, the refactor check and the MCP placement check. |
| `alignment ──▶ spans` (+ name-spans) | depends | Anchor columns are derived from `name_span` byte offsets + the source text; deliberately **no** token-level representation of spacing. `doc.rs`/`printer.rs`/`verify.rs` untouched. |
| `alignment ──▶ format-fences` | depends | `fence::region_at` (via `Fmt::is_fenced`) keeps fenced items out of alignment groups. |
| `shared-fence-filter ◀──▶ linter-core / server-lint` | handshake | Closes server-lint Handshake 3: `fence::protected_regions` + `is_protected` become the **one** answer to "what may an automatic fix not touch"; CLI `--fix` and server quick fixes both call it; `vlog_linter` itself deliberately stays fence-blind. |