# formatter-bug-fixes ## Goal Fix the five confirmed formatter/parser bugs the case-tables and safety-net features found and parked. All five made `lucisv` refuse to write output (exit 2) because the runtime safety net caught them as token loss, comment motion or non-convergence — so every one of them was a file the formatter could not format at all. Each fix lands with its parked `#SKIP` case turned into a live regression case plus new cases around it. The five: 1. Continuation lines of a multi-line block comment gain the current indent on every pass (unbounded; breaks hard invariant #2, idempotency). 2. A comment inside an expression group is lifted out of the group instead of forcing it to break, contrary to `README.md`'s "a comment inside a group forces it to break". 3. Closing block labels (`end : x`, `join* : x`, `endfunction : x`, `endtask : x`, `endpackage : x`, generate `end : x`) are dropped; only `endmodule : x` survived. 4. A multi-instance declaration (`sub u0 (.a(x)), u1 (.a(y));`) always breaks and under-indents the continuation instances. 5. `always @( /* c */ * )` loses the comment: `parse_sens_list` discarded comments written inside the parens of an implicit sensitivity list. **Round 2 (2026-08-29, Lane B of the testbench-syntax wave).** The same feature, extended to `syntax_coverage.md`'s bucket 2: the 12 real OpenTitan files that parse with zero errors but whose *formatted output* the safety net refused. Three more bugs, all in `format.rs`'s layout, none needing a `verify.rs` change: 6. A line comment trailing the then-branch's `end` swallowed the `else` that followed it (`end // addr_phase_write` + `else if (...) begin` came back as one comment). 4 of the 12 files. 7. A comment written inside a statement header's parentheses (`if (// why` ⏎ `cond)`, `while (`, `repeat (`, `wait (`, `case (`) printed *after* the `)`, moving it across a token. 7 of the 12 files. 8. `default;` — the case-item colon IEEE 1800 §12.5 makes optional — came back as `default:`, inventing a token the source never wrote. 1 file. ## Assumptions - The four `#SKIP` expected outputs are the spec. None of them was changed. - **Comment re-indentation is relative to the comment's original opening column.** A block comment's continuation lines are dedented by `original_column - 1` (spaces/tabs only, never past the first non-blank character) before the printer re-indents them. That is what makes the transform a fixed point: the second pass sees the column the first pass produced and dedents by exactly what it added. Continuation lines that started *left* of the opening column cannot be preserved as-is — the printer always prepends the current indent — so they land on the new indent; that is stable from the second pass on and is pinned by a case. - The same re-indent rule is applied to multi-line **directives** (`` `define X \``) and **attributes**, which had the identical unbounded drift for the identical reason. See the work log. - Comments are compared by text in stream order by `verify.rs`, so a comment kept on a construct must be printed lexically between the same two tokens it sat between in the input. For the sensitivity list that means comments written before the `*` are printed before it and comments after it are printed after it, rather than all being pushed to one side. - **`verify.rs` needed no new normalization and none was added.** With the comment printed inside the parens (`@(/* c */ *)`), input and output produce the same stream and the existing `@ ( * )` → `@ *` collapse simply does not fire on either side (it requires the four symbols to be adjacent). The only `verify.rs` edit is that comment items now report their *own* line/column instead of the owning token's, which is a diagnostics improvement — positions are never compared. - `(*` immediately followed by anything but `)` lexes as an attribute instance, so `@(*` may only be printed when `)` follows immediately. When there is a comment after the star the formatter prints `@( * /* c */)` with the star off the paren. This is a lexer constraint, not a style choice. - A closing label is always printed in the `endmodule : m` spelling already used for modules (space, colon, space). Labels are preserved verbatim; the formatter never invents or removes one, and never checks that a closing label matches its opening label (that is a linter's job). - A comment inside an expression makes the enclosing `=` **hug**: the value keeps its opening bracket on the assignment's line (`assign y = {`) instead of moving to the next line. Without that, the parked case's expected output is unreachable, because a hard line anywhere inside a group breaks every enclosing group in this printer. The hug only applies when the value already contains a forced break, so no case without comments changed. ### Round 2 (2026-08-29) - **`verify.rs` was not touched at all this round** (`git diff` on it is empty), and no normalization was added or broadened. Every fix is a layout change in `format.rs`; the safety net's judgement of all three shapes is unchanged, and four crafted (input, corrupted output) pairs assert it still rejects exactly the corruptions these bugs used to produce. - **The parser's trivia attachment is taken as given.** Nothing between a statement header's `(` and `)` owns trivia, so a comment written there is queued and lands on the next node that takes meta — the body statement, or a `case`'s first item. The formatter takes it back by *span* rather than asking the parser to change: a leading comment of the body that starts before the header's `)` was written inside the parentheses. This is Lane B's file-set constraint made into a design point, and it is exact, because a comment's byte span says unambiguously which side of the `)` it was on. - **The `)` is found in the source, not in the AST**, by skipping whitespace and comments forward from the end of the condition expression (`skip_trivia`). Only trivia can stand there for `if`/`while`/`repeat`/ `wait`/`case`. If anything else turns up, the header prints its plain parentheses and takes nothing, so an unrecognized shape behaves exactly as it did before. - **A cuddled `else` is a layout decision, not a token.** `end` keeps `else` on its line unless the then-branch's own trailing comments end in a line comment, which would swallow it. A block comment still cuddles (`end /* why */ else`). - `for`, `foreach` and `do ... while` are **not** covered: the first two do not end their header in a single condition expression, and a `do`-`while` has no body after its parentheses to take the comment back from. All three still refuse cleanly and are pinned as refusals by a test. - A comment written *before* a header's `(` (`if /* c */ (a)`) is also not covered — the formatter has no offset for the `(`, so such a comment is treated as if it were inside and the file is still refused, exactly as it was before. No corpus use. - **`default;` is read from the source too.** `CaseItem` records no `colon` flag (the parser does `let _ = self.eat_sym(":")`), so `default_has_colon` looks at the byte after the keyword. With a null body the `;` hugs the keyword — `default;`, not `default ;` — while `default: ;` keeps both the colon and the space it already had. Generate-case `default` reads the same way. ## Handshakes - **`vlog_parser::token::Comment` gained a position** (the handshake request filed by the safety-net feature): `Comment { text, blank_before, line, col }`, 1-based, pointing at the opening `//` or `/*`. `col` is what makes bug 1 fixable. **Consumers**: anything constructing a `Comment` must supply the two fields; in-tree that is only `lexer.rs`. - **`vlog_parser::token::Token::trailing` is now `Option`** instead of `Option`, so a trailing comment carries a position too (it can be re-attached as a leading comment by the parser, and then it is re-indented). `verify.rs` and one lexer unit test were the only readers. - **`ast::RawText { text, col }`** is new and replaces the bare `String` in `ItemKind::Directive`, `StmtKind::Directive` and `Meta::attrs`, for the same re-indent reason. - **AST: closing labels are new fields** — `ItemKind::Package.end_label`, `GenBlock.end_label`, `FunctionDecl.end_label`, `TaskDecl.end_label`, `StmtKind::Block.end_label`, `StmtKind::ForkJoin.end_label`. - **AST: `SensList::Star` is now a struct variant** `Star { before, after }` carrying the comments written inside `@( ... * ... )`. - **AST: expression lists carry comments.** `ast::ExprItem { meta, expr }` is new; `Expr::Concat`, `Expr::Call.args` and `Expr::Inside.ranges` hold `Vec` instead of `Vec`, `PatternItem` gained a `meta`, `Expr::Paren` became `Paren { inner, before, after }`, and `Expr::Binary` gained `comments` (written between the left operand and the operator). `Expr::Repl`'s inner list was left as `Vec` — it is printed with a fixed `", "` join rather than through `delimited`, so it has no break to force; a comment inside a replication is still refused by the safety net. - **`printer::contains_hard_line` is now `pub(crate)`** so `format.rs` can ask "does this value break on its own?" for the `=` hug described above. - `Meta.trailing` is still a bare `String`: several trailing comments merge into one there, and it is printed verbatim on one line, so it needs no position. - Nothing outside `vlog_parser` / `vlog_formatter` was touched. `crates/lucisv` and the top-level `README.md` (another agent's scope) are untouched; `cargo fmt` was run and left those files byte-identical. ### Round 2 (2026-08-29) - **Nothing was changed outside `crates/vlog_formatter`.** Round 2 consumes the AST exactly as it stands: `Comment.span`, `Expr.span`, `CaseItem.span` and `Meta.leading`'s source order are the only new load-bearing surfaces, and all four already existed. `git diff` on `crates/vlog_parser` and `crates/vlog_semantic` is empty. - **Open handshake request to whoever owns `vlog_parser/src/parser.rs` (Lane A's file this wave).** `Parser::take_before_open` (`parser.rs:757`) calls `take_dangling()`, which drains the *whole* pending-comment queue — `pending_trailing`, `pending_leading` and the bracket token's own leading comments — rather than only the comments actually written in front of the bracket. So a comment written just after a statement header's `(` is swallowed by the first call inside the condition and printed between that call's callee and its own `(`: ```systemverilog if (// If keymgr is not enabled in the current LC !cfg.keymgr_vif.get_keymgr_en() || ... ``` comes back as `!cfg.keymgr_vif.get_keymgr_en // If keymgr ...` ⏎ `() ||`. `header_parens` cannot take it back — it never reaches the body's leading comments — and the formatter cannot hoist it out past the `!` without a cutoff threaded through every `expr` call, which is far more machinery than the parser fix. **Requested fix**: in `take_before_open`, keep only the comments whose `span.start >= self.last_end()`, i.e. those written in the gap that ends at the bracket, and leave the rest queued. `last_end()` already exists (`parser.rs:611`). This is the last of the 12 bucket-2 files (`hw/ip/keymgr/dv/env/keymgr_scoreboard.sv`); the shape is pinned as a clean refusal by `verification.rs::a_comment_before_a_call_in_a_condition_is_still_refused`, which is the test that should flip to a `.cases` entry when the parser fix lands. - **Format-cache discipline** (`topo.md` §2.3): this round changes formatter *output* for the shapes above, so the workspace version must be bumped at release or a stale `.lucisv_cache` will skip files that would now format differently. Flagged for the lead; no version was bumped here. ### Round 2's `take_before_open` request — **DELIVERED** (2026-08-29) Filed by round 2 against whoever owns `crates/vlog_parser/src/parser.rs`; answered by the `directive-in-statements` round (see `docs/features/directive-in-statements/README.md`). The requested change and one more site it needed: - `Parser::take_before_open` no longer calls `take_dangling()`. It takes only the comments whose `span.start >= self.last_end()` — the gap that ends at the bracket — through a new narrow sibling, `Parser::take_gap()`. Exactly the fix round 2 specified. - **That alone was not enough.** `CallComments::dangling` (the inside of an *empty* `()`, `parser.rs`'s postfix-call arm) drained the whole queue too, so with `before_open` fixed the comment was swallowed one line later — which is why the pinned shape's condition starts `!en()` and not `!en(x)`. It now uses `take_gap()` as well. Both sites are `CallComments`; nothing else changed. Verified by composing this lane's parser with round 2's worktree in a scratchpad copy (round 2's files read-only, never edited): the whole workspace suite stays green except `verification.rs::a_comment_before_a_call_in_a_condition_is_still_refused`, which flips from pass to fail — i.e. the shape now formats — and the real `hw/ip/keymgr/dv/env/keymgr_scoreboard.sv` formats cleanly, closing the 12th and last bucket-2 file. That test should become a `.cases` entry at merge, as round 2 predicted. Round 2's `expect_divergence` attack pairs all still pass: `verify.rs` is untouched by either lane. Still open, and **not** this handshake: `return // c` ⏎ `g();`, round 2's "second, independent symptom". The parser no longer misplaces that comment into the call, but nothing owns a comment written between `return` and its expression, so it drifts and the safety net still refuses the file — refused before this round and refused after, byte-identical either way. It needs a comment slot on `StmtKind::Return`, which is an AST change with printer arms. ## Status / TODO - [x] Bug 3 — closing block labels preserved (`end`, all `join` kinds, `endfunction`, `endtask`, `endpackage`, generate `end`). - [x] Bug 4 — multi-instance declarations stay on one line when they fit and indent their continuation when they do not. - [x] Bug 5 — comments inside `@( * )` are kept next to the `*`. - [x] Bug 1 — block-comment continuation lines are dedented to their original opening column before re-indenting; idempotent. Same fix applied to multi-line directives and attributes. - [x] Bug 2 — a comment inside an expression forces its group to break, for concatenations, call arguments, `inside` sets, assignment patterns, parenthesized expressions and between the operands of a binary chain. - [x] `#SKIP` markers removed from all four parked cases; 17 new cases added across `comments`, `statements`, `instantiation`, `functions_tasks`, `module_headers` and `generate`. - [x] `cargo test --workspace` green, `cargo clippy --all-targets` silent (including the four pre-existing warnings), `cargo fmt --check` clean. - [ ] Not fixed, still refused by the safety net (documented, not hacked around): a comment inside a **replication** (`{2{a, // c`), a comment inside a compactly-printed bracket expression (`x[a /* c */ + b]`, where `expr_compact` has no line to break), and a comment between a value and the `;` that follows it (`assign y = a /* c */ ;`), which the statement harvests and re-prints after the `;`. All three are pre-existing and each needs its own small design decision. - [x] TODO.md: nothing to check off — none of these bugs had a backlog item. The "re-enable the four `#SKIP` cases" item lives in the case-tables README's TODO and is now satisfied. ### Round 2 (2026-08-29) - [x] Bug 6 — a line comment trailing `end` no longer swallows the `else` that follows it; a block comment still cuddles. - [x] Bug 7 — a comment written inside an `if`/`while`/`repeat`/`wait`/`case` header's parentheses is printed inside them, on the correct side of the condition. - [x] Bug 8 — `default;` keeps IEEE 1800 §12.5's optional colon off, and `default: ;` keeps it on. - [x] 11 of the 12 bucket-2 OpenTitan files format cleanly and are idempotent; the whole checkout is unchanged on disk. Before/after in the work log. - [x] 11 new `.cases` entries (10 in `comments.cases`, 1 in `statements.cases`) — each one asserts the output *and* that re-formatting it is a fixed point, which is what the harness does. - [x] 4 masked-corruption rejection pairs + an explicit comments-never-dropped assertion in `verification.rs`, plus 4 pinned refusals for the shapes deliberately left uncovered. - [x] `cargo fmt --check` clean, `cargo clippy --all-targets` silent, `cargo test --workspace` green, pinned corpus 813/820 (baseline 813, zero verification errors). - [ ] Not fixed, needs a change in `vlog_parser` (see Handshakes): a comment after `if (` when the condition starts with a call — `keymgr_scoreboard.sv`, the 12th file. - [ ] Not fixed, no corpus evidence, pinned as refusals: a comment inside a `for`/`foreach` header or a `do ... while (...)`; a comment written between a header keyword and its `(`. ## Work log ### 2026-08-18 — dev agent **Bug 3 (closing block labels) — fixed.** The parser was parsing `: name` after every closing keyword and throwing the identifier away (`parse_package`, `parse_gen_block`, `parse_tf_body`, and the `begin` / `fork` arms of `parse_keyword_stmt`). Added `Parser::parse_end_label` — one helper, used by all six sites plus `parse_module`, which already kept its label by hand — and an `end_label` field on the six nodes. The formatter grew `Fmt::closing(kw, label)`, exactly the `endmodule : m` rendering generalized, and now uses it for `endmodule` too, so all seven closing keywords share one spelling. Un-skipped the parked `end : main` case and added five more: all three `join` kinds, nested `begin : inner`, `endfunction` + `endtask`, `endpackage`, and a generate-block `end : lane`. **Bug 4 (multi-instance declarations) — fixed.** `Fmt::instantiation` emitted `text(",")` + `HardLine` between instances unconditionally, which both forced the break and left the continuation at the head's indent. Rewrote it in the shape `declarators` already uses: a single instance is emitted directly (no extra indent level, so its connection list still lines up under itself — the first attempt indented every instantiation's broken connection list by two extra columns and three existing cases caught it), several instances go into `group(indent(...))` with `Doc::Line` separators, so they fit on one line when they can and indent one level when they cannot. Per-instance leading and trailing comments are emitted in the multi-instance path, which also makes a comment between two instances break the list. Three cases: fits, does not fit, and comment-forces-break. **Bug 5 (comments in an implicit sensitivity list) — fixed.** `parse_sens_list` now recognizes `@( * )` before consuming the `(` and keeps the comments the lexer attached around the star, in two buckets (`before`, `after`) so their order relative to the `*` survives the round trip. Two new parser helpers, `take_leading_here` / `take_trailing_here`, read the comments straight off the token instead of going through `pending_leading` / `pending_trailing`; that matters because the pending queues can hold older comments from before the `@`, and stealing one of those would move it across a token and trip the equivalence check. The formatter prints `@(/* c */ *)` / `@( * /* c */)`; a line comment inside gets a hard line so it cannot swallow the `*)`. **No `verify.rs` change was needed** — see Assumptions. One lexer constraint surfaced while testing: `@(*` followed by a space lexes as an attribute instance, so the `after` spelling keeps a space after the paren. **Bug 1 (multi-line comment re-indent) — fixed**, using the handshake the safety-net agent asked for: `token::Comment` now carries `line`/`col`, filled in by the lexer (which already had both for every raw token). `Fmt::raw_text` became `raw_lines(text, col)`: continuation lines are dedented by `col - 1` before the printer prepends the current indent, so pass two removes exactly what pass one added and the text is a fixed point. `Token::trailing` had to become `Option` for the same reason — an unharvested trailing comment is re-attached as a *leading* comment by `take_meta`, and from that moment it goes through the re-indenting path. While testing this I found the **same unbounded drift on multi-line directives** (`` `define FOO(a) \`` continued onto the next line, inside a module) and on multi-line attributes: identical root cause, identical refusal from the convergence check. Since the fix was one field away I did it rather than leave a known non-convergent input behind: `ast::RawText` pairs the verbatim text with its starting column, and `Directive` / `Meta::attrs` use it. This is beyond the five bugs as briefed; it is called out here and covered by a case (`a continued \`define inside a module keeps its continuation indent`). **Bug 2 (comment inside an expression group) — fixed**, in three steps. 1. *List-shaped groups.* `ast::ExprItem { meta, expr }` gives concatenation elements, call arguments and `inside` set members the same `Meta` that port and connection lists already had, and `PatternItem` gained one; the parser harvests around the commas exactly the way `parse_declarators` does, and the formatter feeds them to the existing `delimited`, which already emits a hard line per comment and therefore already forces the break. So the fix was plumbing, not new layout code. 2. *Parenthesized expressions.* `Expr::Paren` carries the comments written just inside its parens (`( // why` … / … `// sum )`), mirroring `SensList::Star`. 3. *Between operands.* `Expr::Binary` carries the comments written between the left operand and the operator. When present, `binary_chain` puts the comment last on its line and starts the next line with the operator (`a // hi` ⏎ `+ b`) instead of the usual trailing-operator layout, which would produce `a // hi +` — i.e. an operator swallowed by a comment. The parked case then still failed, on layout: `assign y =` broke before the `{` because a hard line anywhere inside a group breaks every enclosing group in this printer. Rather than redesign the IR, added `Fmt::assign_rhs`: if the right-hand side already contains a forced break, `= {` stays on the head line (the same shape as a broken port list keeping `module m (` on its line); otherwise the previous `Line`-and-indent behavior is unchanged. This is why `printer::contains_hard_line` became `pub(crate)`. Un-skipped the parked concatenation case and added five more (call args, assignment pattern, paren-adjacent, between binary operands, comment before an operator in a chain). **Pre-existing clippy warnings.** All four are in files this change already touches, and all four fixes were trivial, so they are gone: `printer.rs`'s `manual_repeat_n` (`repeat_n`), `parser.rs`'s two `if_same_then_else` (the net-or-`var` test in `parse_ansi_port` / `parse_port_decl`, merged into one condition), and `format.rs`'s dead `ListItem::blank_before` (removed — `delimited` documents that blank lines inside bracketed lists are dropped deliberately, so the field had no future reader). `cargo clippy --all-targets` is now completely silent. **Verification.** Beyond the suite: a hand-written stress file combining all five constructs (labeled package/function/task/fork, a starred sensitivity list with a comment, a commented concatenation, a multi-instance declaration, an indented banner comment) formats cleanly, and `lucisv` on its own output is byte-identical. Every bug's original repro from the two feature READMEs was re-run through the built CLI and now exits 0. ### 2026-08-29 — dev agent (Lane B, testbench-syntax wave) **Scope.** `syntax_coverage.md`'s bucket 2: the 12 OpenTitan files that parse with zero errors but whose formatted output the safety net refused. Measured first, against the real checkout at `/Users/guoliangchen/repo/opentitan` (`--no-cache --check` over all 3,943 `.sv`/`.svh`): **151 failures, 12 of them `verification failed:`** — reproducing the sweep exactly. The 12 are three shapes, not one: | # | shape | files | |---|---|---| | 6 | `end // c` ⏎ `else …` — the trailing line comment swallows the `else` | 4 | | 7 | a comment inside a statement header's `(...)` prints after the `)` | 7 | | 8 | `default;` comes back as `default:` | 1 | **Bug 6 — `end // c` then `else`.** `if_stmt` cuddled `else` onto the `end` line whenever the then-branch was a block. `stmt_as_body` has already printed the block's trailing comments by then, so ` else if (b) begin` landed *inside* a line comment's text and `verify.rs` saw one comment reading `// addr_phase_write else if (addr_phase_read) begin`. The whole fix is one extra condition on `then_is_block`: a free `trailing_ends_line(&then.meta)` that asks whether the last thing `trailing` prints is a `//` comment. A block comment still cuddles, which is what the source wanted anyway. **Bug 7 — comments inside a header's parentheses.** The header's `(` and `)` are printed by `parens()` and belong to no node, so the parser has nowhere to put a comment written between them: it stays in the pending queue and lands on the next node that calls `take_meta` — the body statement (`if`, `while`, `repeat`, `wait`) or the first case item (`case`). Printed there, the comment sits after a `)` it was written before. Fixed entirely on the formatter side, by span. `header_parens(cond, body_meta)` finds the closing `)` with `skip_trivia` (forward from `cond.span.end`; only whitespace and comments can stand there), takes every leading comment of the body that starts before it, splits them at `cond.span.start` into before/after buckets, and hands them to `paren_comments` — which is the existing `ExprKind::Paren { before, after }` layout, factored out and now shared by both callers rather than duplicated. It returns how many comments it consumed; `stmt_as_body_from` / `leading_from` / `case_body` skip exactly that many. `leading`, `stmt_as_body` and `case_body`'s old signature are all preserved as `skip = 0` wrappers, so the twelve other `stmt_as_body` call sites are untouched. When the source is not the expected shape (no `)` where one was expected, or nothing to take) the function returns the plain `parens(cond)` and takes nothing, so every input that formatted before formats identically. `for`, `foreach` and `do ... while` were deliberately left out: the first two do not end their header in one condition expression and the third has no body after its parens. Confirmed they still refuse cleanly and pinned that with a test, so a later round sees them change rather than appear. **Bug 8 — `default;`.** `parse_case_body` does `let _ = self.eat_sym(":")`, so the AST does not record whether the source wrote the colon, and `case_labels` printed `default:` unconditionally — inventing a token. Since `CaseItem.span` starts at the `default` keyword, `default_has_colon` reads the byte after it (through the same `skip_trivia`) and prints what was written. With a null body the `;` hugs the keyword, because `stmt_as_body` would otherwise lay the `;` out as a body and produce `default ;`. `default: ;` is unchanged. **`verify.rs` is untouched** — `git diff` on it is empty. Per `topo.md` §2.1's standing template I added the rejection tests anyway: four crafted (input, corrupted output) pairs asserting the net still refuses the comment merged into `else if`, the comment moved across the `)`, `default;` → `default: ;` and its mirror `default: ;` → `default;`. **Before / after on the real OpenTitan checkout** (3,943 files, `--no-cache --check`, nothing ever written — `git status` in the corpus shows only the pre-existing `hw/ip/aes/dv/tb/tb.sv` modification `syntax_coverage.md` already records): | | before | after | |---|---|---| | total failures (exit 2) | 151 | 140 | | `verification failed:` | 12 | **1** | | `parse error:` / `lex error:` | 139 | 139 | | crashes | 0 | 0 | All 11 fixed files were additionally formatted twice through `--stdout` and the two passes compared byte-for-byte: **idempotent**, and every checkout file's `md5` is unchanged. Pinned 820-file corpus: **813 passing** (baseline 813), zero verification errors, zero crashes — no regression. **The 12th file, and why it is not mine to fix.** `hw/ip/keymgr/dv/env/keymgr_scoreboard.sv` had *two* bucket-2 bugs; fixing the first (the `end // addr_phase_write` / `else if` merge at line 643) uncovered a second at line 1254 that is not a formatter layout bug at all. The comment there is written after `if (` and the condition starts with a call, so `Parser::take_before_open` — which drains the whole pending queue — hands it to `CallComments::before_open`, and the formatter faithfully prints it between the callee and its `(`. `header_parens` never sees it. Hoisting it back out of the expression past the `!` would need a suppression cutoff threaded through every `expr` call; the parser fix is one span check. Filed as an open handshake (above) with the exact patch, out of Lane B's file set, and pinned as a clean refusal by a test. Also confirmed the same parser bug bites `return // c` ⏎ `g();`, which is a second, independent symptom. **Deviation from the brief**: 11 of 12 files, not 12, for the reason above. Nothing was worked around and no corruption ships — the 12th file is still refused and left byte-identical, which is the correct behavior until the parser lands its fix. **Format-cache note for the lead**: formatter output changed, so the workspace version must be bumped at release (`topo.md` §2.3). Not bumped here. ## QA log ### 2026-08-19 — QA agent **Scope**: ran the full tool chain, read every line of the diff (`token.rs`, `lexer.rs`, `parser.rs`, `ast.rs`, `format.rs`, `printer.rs`, `verify.rs`) against the seven claims in the assignment, then went well beyond the committed cases with a hand-built stress corpus (15 constructive `.sv` files plus the 3 known-refusal reproductions) run through a 3-pass fixed-point script, and a second script that re-ran every one of the 200 committed cases and all 4 `tests/fixtures/*.sv` files through 3 passes independently of `cargo test` (which only checks 2). No regression found. Full corpus and scripts left at `/private/tmp/claude-501/-Users-guoliangchen-repo-verilogrustformatter/9ecac3b9-8a0e-4065-85de-23cc2a396bad/scratchpad/{stress,stress3.py,regress3.py}` for reference (outside the repo). **Tool chain** (workspace root): - `cargo test --workspace`: **70/70 pass**, 0 failed (18 `lucisv` unit + 12 `cli.rs` + 3 `vlog_formatter` unit + 1 `cases.rs` (covering all 200 cases internally) + 2 `fixtures.rs` + 19 `verification.rs` + 15 `vlog_parser` unit). Confirmed 200 cases / 0 `#SKIP` two ways: `grep -c '^====' ` per file (14+32+18+26+16+13+20+18+28+15 = 200) and `grep -rn '#SKIP'` across `tests/cases/*.cases` (zero hits). - `cargo clippy --all-targets`: silent — `Finished` with no warning lines at all. Grepped the diff for `#[allow]`: none added anywhere. Independently confirmed the four previously-documented warnings are actually gone at their old sites: `printer.rs:91` now uses `repeat_n` (not `repeat().take()`), `parser.rs`'s `parse_ansi_port` (line 599-607) and `parse_port_decl` (line 741-749) both use the merged `net = { ... }` block instead of the old duplicated if/else-if, and `ListItem.blank_before` is gone from `format.rs` entirely (`grep` for the field name: no hits). - `cargo fmt --check`: exit 0, no output. **Claim verdicts** 1. **Block-comment continuation drift — PASS.** Confirmed via 3 independent probes beyond `comments.cases`: a column-0 banner (`stress/01_comment_col0.sv`), a comment nested four `begin` levels deep (`02_comment_deep_nested.sv`), a comment inside a `case` item (`03_comment_in_case_item.sv`), a tab-indented comment (`05_tab_indented_comment.sv`), and — the sharpest probe — `04_ragged_continuation.sv`, a comment whose five continuation lines have five *different* indents (7, 3, 0, 8, 5 spaces), one of them starting left of the opening column. All five are stable across 3 passes. Hand -verified the ragged case's exact output against the dedent-then-reindent formula in the Assumptions (dedent by `col-1`, reindent by current indent = 2): input indents 7/3/0/8/5 → output indents 7/3/2/8/5, i.e. every line kept its *relative* raggedness except the one that started left of the opening column, which landed on the new indent exactly as the Assumptions predict. This is a materially stronger check than what's in `comments.cases` (whose ragged-indent case only has two continuation lines, both indented the same way). - **Tab/column consistency, audited as requested**: `lexer.rs`'s `RawLexer::bump` (line 72-82) increments `col` by exactly 1 per byte regardless of character, i.e. a tab counts as 1 column, not 8. The dedent side, `format.rs::strip_blanks` (line 1607-1616), strips up to `n` *characters* (space-or-tab, one per iteration), also byte-count based. The two are consistently unit-for-unit. Verified concretely: a comment opening after one leading tab (`col` = 2, so dedent = 1) whose continuation lines are themselves tab-indented dedents by exactly one leading tab per line, confirmed by hand-tracing `05_tab_indented_comment.sv`'s output. 2. **Comment inside expression groups forces a break — PASS.** Built `stress/07_expr_comments_everywhere.sv` stacking every position at once: nested concat-inside-concat, nested call-inside-call, both ternary branches (parenthesized), an assignment pattern, an `inside` set, a binary-chain comment before the operator, and a standalone leading-and-trailing-commented paren. All eight comments survived in their original stream position, all eight groups broke open, 3-pass stable. One layout observation, not a defect (see Findings #3 below). 3. **Closing block labels — PASS.** `stress/08_closing_labels.sv` exercises all three `join` kinds (`join`, `join_any`, `join_none`) plus nested labeled blocks (`begin : outer` › `begin : inner` › `end : inner` › `end : outer`, checking the labels come back in the correct nesting order, not swapped) plus a labeled `function`/`task` inside a labeled `package`. `08c_generate_labeled.sv` adds a labeled generate `if`/`else` and a labeled generate `for`. `08b_end_label_trailing_comment.sv` (a case from the assignment's specific ask: "trailing comment AFTER an end label") — `end : blk // trailing after end label` — round-trips correctly with the comment staying trailing on the label line. All stable across 3 passes; all closing-label cases in the committed `.cases` diff (`statements.cases`, `functions_tasks.cases`, `generate.cases`, `module_headers.cases`) independently re-verified by hand-reading the diff, all four look correct against their stated construct. 4. **Multi-instance declarations — PASS**, including the boundary the assignment specifically asked for. Built a generator (inline, not left in the corpus) that produces a two-instance declaration whose one-line rendering is *exactly* 100 and 101 columns: at 100 it stays on one line, at 101 it breaks with the continuation indented one level (4 spaces) under the 2-space head — distinguishable from a new statement, matching the bug-4 fix description exactly. Also checked instance arrays (`arr0 [3:0] (...)`) and parameter overrides together in one declaration (`09_multi_instance_params_arrays.sv`); all four sub-cases (fits / breaks / arrays / short) render as expected and are 3-pass stable. 5. **`@( /* c */ * )` — PASS**, and more spellings than documented. `10_sens_list_spellings.sv` mixes `@( /* a */ * )`, `@(*)`, `@*`, `@( * /* trailing */ )`, and — not in any existing case — **both a before- and an after-comment on the same sensitivity list**: `@( /* before */ * /* after */ )` → `@(/* before */ * /* after */)`. Comment order relative to `*` preserved on both sides simultaneously, 3-pass stable. Confirmed by direct code read that `verify.rs`'s only change is the two `comment_item(...)` call sites at lines 174 and 187 now reading `comment.line`/`comment.col` (or `trailing.line`/ `trailing.col`) instead of the owning token's — no comparison logic touched, no normalization added or removed. `git diff crates/vlog_formatter/src/verify.rs` is exactly those two one-line changes plus a doc-comment wording update; confirmed line-by-line. 6. **Multi-line directives/attributes — PASS.** `06_define_ifdef.sv` (a 3-continuation-line `` `define`` inside an `` `ifdef``, at top level) and `06b_define_inside_module.sv` (the same, nested inside a module — the specific case the work log calls out) both stable across 3 passes. `11_attribute_multiline.sv` (a 3-line `(* foo = 1, bar = 2, baz = 3 *)` attribute) also stable. Audited `RawText` usage for consistency across the three call sites the Handshakes promise (`ItemKind::Directive`, `StmtKind::Directive`, `Meta::attrs`): all three are populated via the same `Parser::take_raw_text()` (`parser.rs:215-218`, captures `col` before `bump()`) and all three are read via the same `Fmt::raw_text()` → `raw_lines(text, col)` (`format.rs:112-114`). No third code path exists for either type. 7. **200 cases / 0 `#SKIP` / green workspace / silent clippy / clean fmt / self-format-stable — PASS**, all independently reproduced above. Additionally ran lucisv-on-its-own-output beyond the work log's one hand-written file: **every one of the 200 committed cases' expected outputs plus all 4 real fixture files** (204 total) through 3 passes via `regress3.py` — 0 failures, 0 cases where pass1's output differs from the `.cases` file's recorded expected output (an independent cross-check of the harness itself), 0 cases of 3rd-pass drift anywhere in the corpus. **Handshake audit** - `token::Comment{line,col}`: confirmed 1-based, confirmed populated only by `lexer.rs` (`tokenize`, lines 564-580) from `RawTok.line`/`.col`, which come from the raw lexer's running position at the *start* of the comment (`RawLexer::bump`, byte-granular column counting, tab = 1 column, consistent with the dedent side — see claim 1 above). - `Token::trailing: Option`: grepped every `.trailing` site in both crates (`grep -rn '\.trailing'`). No caller still assumes `String`; the one remaining `Option` is the unrelated `Meta.trailing` (several merged trailing comments, printed verbatim, no position needed — matches the Handshakes note that it "needs no position"). The lexer unit test (`lexer.rs:638`) uses `.expect("trailing comment")`, which is fine per CLAUDE.md's test exemption. - `RawText.col`: confirmed all three consumers (`ItemKind::Directive`, `StmtKind::Directive`, `Meta::attrs`) go through one producer (`take_raw_text`) and one consumer (`raw_text`/`raw_lines`) — see claim 6. - `printer::contains_hard_line` now `pub(crate)`: two call sites, both sane — the pre-existing two internal to `printer.rs` (group-fits and hard-line-forces-break checks) plus the one new external use in `format.rs::assign_rhs` (`format.rs:240`), which is exactly the "does this value already break?" check the Assumptions describe. No other new callers. - `CLAUDE.md` no-`unwrap`/`expect`/`panic!`-in-library-paths: grepped the diff's added (`+`) lines for `.unwrap()`/`.expect(`/`panic!`; the only three hits are all inside `#[cfg(test)] mod tests` in `lexer.rs` (`lexer.rs:638,644,653` in the new file), which CLAUDE.md exempts. `format.rs:532`'s pre-existing `unreachable!()` in `binary_chain` is unchanged context, not new. - No new dependencies (`git diff` on all three `Cargo.toml` + `Cargo.lock`: empty). No `#[allow]` added anywhere. `TODO.md`, top-level `README.md`, and `crates/lucisv/` are all byte-identical to `HEAD` (`git diff --stat` empty for all three) — matches the Handshakes claim that nothing outside `vlog_parser`/`vlog_formatter` was touched. **Regression hunting** Specifically tried to break something that used to work. Constructed and fixed (after finding my own test-file bugs, not formatter bugs — `initial` inside a function, `always` inside a function, `fork` at package scope are all illegal Verilog, not lucisv defects) a combined-stress file (`12_combo_stress.sv`: banner comment + labeled package/function/nested begin + `@( /* c */ * )` + commented concatenation + multi-instance, all in one file) — 3-pass stable, matches the work log's own combined-stress claim. Ran the entire `tests/cases/` corpus (all 200 inputs) and all 4 `tests/fixtures/*.sv` through 3 passes independently of `cargo test` (`regress3.py`): **zero regressions, zero drift, zero unexpected refusals.** This is the strongest evidence available that nothing which used to format correctly now breaks. **Findings** *Should-fix* None. No blocking or correctness issue found in the diff itself. *Nit / informational* 1. **A comment in a ternary branch with no enclosing group still refuses cleanly** (exit 2, file untouched) — verified with `assign w = cond ? a : // c\n b;` → `verification failed: token stream diverges at index 10: ...`. This is *not* a broken claim (ternary branches were never listed among the covered constructs — Handshakes names only concat/call-args/`inside`/assignment-pattern/paren/binary), and it is not a regression (ternary carries no comment field before or after this diff). It is simply a fourth refusal location beyond the three the README's "Not fixed" list names. Worth a one-line addition to that list for completeness next time someone touches this area, but not blocking — filed here rather than fixed, since expanding comment support to ternaries is a design decision (does the ternary need to hug like `assign_rhs` does?), not a small unambiguous fix. 2. **Pre-existing lexer limitation, not caused by this diff**: `@(* )` — parens with a bare space between `*` and `)`, *no comment involved* — fails to lex at all (`lex error: unterminated attribute (* ... *)`), because `(*` immediately followed by anything other than `)` is always treated as the start of an attribute instance (`vlog_parser/src/lexer.rs:223`, `peek_at(2) != b')'`), and that line is untouched by this diff (confirmed via `git diff` showing no hunk touching it). So legal input with incidental whitespace inside `@( * )` was already unparseable before this change and still is. Flagging because this feature's Assumptions specifically discuss this exact `(*` ambiguity for the *output* spelling of `after`-comments, so it's a natural thing for whoever reads that section next to wonder about; it's out of scope for a bug-fix feature that (correctly) didn't touch `lexer.rs`'s core tokenizing logic. 3. **Style observation, not a bug**: a comment on its own source line immediately before a closing construct — the closing `)` of a `Paren`, or before a binary operator — gets glued onto the end of the preceding line in the output rather than kept on its own line. Example: input ``` assign s = ( // paren leading comment a + b // paren trailing comment ); ``` formats to `a + b // paren trailing comment` on one line. This is deliberate and consistent — it's the exact same mechanism the committed `comments.cases` case "comment before the operator of a long operator chain" already pins down (`first // wait for the second one too` ⏎ ` && second;`), and it mirrors `SensList::Star`'s `after` handling. Not a correctness issue (order and content both preserved, 3-pass stable), just a readability wrinkle worth knowing about if a future case author is surprised by it. **Overall verdict**: all 7 claims **PASS**. No regression found anywhere in 204 pre-existing inputs re-run through 3 passes, nor in 15 hand-built adversarial stress files targeting the specific corners the assignment named (ragged/tab/column-0 comments, every expression-comment position, every closing-label kind including nested and trailing-comment-after-label, the exact 100/101-column multi-instance boundary, and mixed sensitivity-list spellings). The three documented remaining refusals all still refuse cleanly with an accurate error and leave the file byte-identical. CLAUDE.md compliance (no unwrap/expect/panic in library paths, no new deps, no un-explained `#[allow]`, TODO.md/README.md/`lucisv` untouched) all confirmed by direct inspection, not just by trusting the work log's claims. ### 2026-08-29 — QA agent (Lane B, testbench-syntax wave) **Scope**: round 2 only — the three bucket-2 fixes (bug 6 `end // c` + `else`, bug 7 `header_parens`, bug 8 `default;`) — with the adversarial charter aimed squarely at a dropped/merged comment, an invented/moved token, or a fix that only works on the corpus shapes. Built a `--no-cache --stdout`/`--check` attack harness (pass1 → pass2 byte comparison for idempotency) and ran ~30 hand-crafted `.sv` files beyond the committed cases, then reproduced every number in the work log independently against the real checkouts. **Tool chain** (workspace root, after adding the two regression tests below): `cargo fmt --check` clean; `cargo clippy --all-targets` silent, no new `#[allow]`; `cargo test --workspace` green — `vlog_formatter`'s `verification.rs` at 119/119 (118 + 1 new), `cases.rs` 1/1 (672 total cases across all `.cases` files, `grep -c '#SKIP'` zero everywhere). Confirmed `git diff --stat` on `crates/vlog_parser`, `crates/vlog_semantic`, `crates/vlog_formatter/src/verify.rs` is empty — the "verify.rs untouched" claim holds. **Shape-A attacks (`end // c` / `else`)** — 5 crafted files: nested three-deep if-else-if chain with every `end` individually commented (correct, stable); the comment text containing the literal word "else" (correct, not mistaken for structure); a CRLF-terminated file with the same shape (correct); a pure block comment before `else` (still cuddles, as designed). **One real gap found** (below) with a mixed block+line trailing comment. **Shape-B attacks (`header_parens`)** — 9 crafted files hitting the source scan directly: a `)` inside a string literal in the condition (`s == ")"`), a `)` inside a nested paren sub-expression, a `)` spelled inside a block comment (`/* looks like ) but is not */`), comments on both sides of the `cond.span.start` split simultaneously, a condition that is itself a `Paren` (double parens), `case`/`while`/`repeat`/`wait` each with both-sided comments, and a case with two commented items after the header to attack the skip-count plumbing. **All format correctly, keep every comment in its original stream position, and are idempotent — no corruption, no double-print, no drop.** Also re-confirmed the two documented refusal boundaries directly (not just via `cargo test`): a comment before the statement keyword's `(` (`if /* c */ (a)`) refuses cleanly (`token stream diverges ... input has comment ... output has symbol "("`), and a comment before a call in the condition refuses cleanly, matching the Handshakes description exactly. **Shape-C attacks (`default`)** — 9 crafted files: `default ;` (extra space) normalizes to `default;`; `default: ;` unchanged; `default begin end` / `default: begin end` both correct with the colon exactly as written; `default y = 9;` (no colon, non-null body — a shape not explicitly named in the work log but legal per the same IEEE grammar) correctly keeps the colon off; two `default`s in one `case` (illegal but tolerated) round-trips both correctly; `default /* c */: y = 9;` (comment between keyword and colon) refuses cleanly rather than dropping or moving the comment. **One non-blocking style nit found** (below): a trailing comment on `default;` breaks the hug. `default;` inside a `generate case` without `begin`/`end` hits a **pre-existing parser error** ("expected item"), confirmed unrelated — `default begin : gd end` in the same position parses and formats fine, so this is generate-case's existing null-body restriction, not a regression from this round. **Refusal-pin sabotage check**: confirmed by inspection that `StmtKind::For` and `StmtKind::DoWhile` were not touched by the diff at all (no `header_parens` call added), so their pinned refusal test is exercising the same pre-existing, unmodified comment-position divergence check from round 1 — not a vacuous pass against dead code. **Masked-corruption template**: all four crafted pairs genuinely attack the paths this round changed (else-swallow, comment-across-`)`, colon invented, colon dropped) rather than generic corruptions; re-ran them independently via `cargo test -p vlog_formatter the_bucket_two_corruptions_are_still_rejected`. **Numbers reproduced independently**, all against the live checkouts, all read-only (`--check`/`--stdout` only): - OpenTitan (`/Users/guoliangchen/repo/opentitan` @ `0098135264`, the same pre-existing `hw/ip/aes/dv/tb/tb.sv` local edit `syntax_coverage.md` records, nothing else dirty): `lucisv --no-cache --check .` → **exactly 1** `verification failed:` (`hw/ip/keymgr/dv/env/ keymgr_scoreboard.sv:1254`, byte-identical message to the Handshakes quote). Total failure count differs slightly from the work log's 140 (146 here) — attributable to `.gitignore`/vendor-tree walk differences between sweeps, not to this round; the load-bearing number (verification failures) matches exactly. - Grepped the whole checkout for the three trigger shapes independently of the work log's file list (`end\s*//.*\n\s*else`, `(if|while|repeat|wait| case)\s*\(\s*//`, `^\s*default\s*;`) and got **exactly 12** candidate files. Ran each through format+idempotency: **10 format cleanly and are pass1==pass2 idempotent**, `keymgr_scoreboard.sv` is the documented refusal, and one grep hit (`spi_device_scoreboard.sv`) fails on an unrelated pre-existing macro-expansion parse error (`` `CREATE_TPM_CASE_STMT ``) before the formatter ever reaches the bucket-2 shape — confirms "11 of 12" exactly, with the 12th grep hit being a false positive from the search pattern, not a second bug. - Corpus gate: fetched `tools/corpus_fetch.sh`'s four pinned repos (820 files: 131 + 613 + 35 + 41, matches exactly) and ran `scripts/score.sh`: `{"passing":813,"total":820,...}` — the exact baseline, zero `verification failed:` entries in `.score-results.tsv` (the 7 failures are all pre-existing parse/lex errors, none in the `other` bucket is a verification error). **Findings** *Should-fix*: none. No hard-invariant violation found in either crafted attacks or the real checkouts. *Nit / informational* (both non-blocking — the safety net holds in both cases; regression tests added for both): 1. **`trailing_ends_line` (`format.rs`, the `Some(tr)` arm) checks whether the *merged* trailing text starts with `//`, not whether it ends in a line comment.** `Meta.trailing` merges several trailing comments into one string (see `ast.rs:92-96`); a line comment must physically be last in any such merge (nothing can follow `//` on the same source line), so the correct test is "does the merge end in one", not "does it start with one". For `end /* a */ // b` the merged text is `"/* a */ // b"`, which does not start with `//`, so `trailing_ends_line` returns `false` and `then_is_block` stays `true` — the `else` still tries to cuddle, exactly reproducing the bug this round fixes, on the one merge shape the fix's condition doesn't cover. **Not a corruption**: `verify.rs` catches it on reparse (the output's one merged comment doesn't match the input's two) and the file is refused, byte-identical, same as it was before this round (this exact shape always cuddled unconditionally pre-fix too, so it is not a regression — it is the fix's coverage boundary, undocumented until now). Pinned as a refusal, not fixed — narrowing `is_line_comment` into a "starts vs. ends" split is a real design decision (the merge already lost the individual comments' boundaries) that belongs to whoever next touches this heuristic, not a QA-scope patch. Regression test: `crates/vlog_formatter/tests/verification.rs:: a_block_comment_merged_with_a_trailing_line_comment_before_else_is_still_refused`. 2. **A trailing comment on a colon-less `default;` breaks the hug and inserts a space**: `default; // fallback` formats to `default ; // fallback`. Root cause: `case_item`'s shortcut requires `is_bare(&item. stmt.meta)`, and a comment trailing the null statement lands in `item. stmt.meta.trailing`, which is not bare, so the shortcut is skipped and the general `case_labels` + `stmt_as_body` path inserts its usual `Doc::Line` between the label and the body. **Not a correctness issue**: the comment is kept verbatim in its original stream position, `verify.rs` accepts it (whitespace is not part of the token stream), and it is idempotent. It does contradict the round's stated design point ("`default;`, not `default ;`") for this one sub-case. Pinned with an exact-output case rather than fixed, since teaching the shortcut to also fire with a bare-except-trailing-comment statement (and then print that comment itself) is a small but real behavior change outside a verify-and-report QA pass. Regression case: `crates/vlog_formatter/tests/cases/statements.cases`, "a trailing comment on a colon-less `default;` keeps the comment and the missing colon". **Regression tests added this pass** (2 files, both green): - `crates/vlog_formatter/tests/verification.rs`: `a_block_comment_merged_with_a_trailing_line_comment_before_else_is_still_refused` (finding 1 above, pins the safe refusal). - `crates/vlog_formatter/tests/cases/statements.cases`: one new case (finding 2 above, pins the current — correct but slightly odd — output). **Overall verdict**: **SHIP.** Both bucket-2 fixes claimed (11/12 files, verification failures 12→1) are reproduced exactly against the live OpenTitan checkout and the pinned 813/820 corpus, `verify.rs` is byte-for-byte untouched, and every crafted adversarial input across all three shapes either formats correctly with every comment preserved in place and idempotently, or is safely refused with the file left untouched — never corrupted. The two findings are both informational nits with permanent regression tests now guarding them; neither is a hard-invariant violation and neither blocks merge. ## Review **2026-08-29 — lead, round 2 (bucket-2 round-trip bugs).** Reviewed after QA's SHIP; gates re-run on the worktree (fmt clean, formatter suite green). Three shapes, three root causes, all fixed where the bug lived — format.rs — with verify.rs, the parser and the semantics provably untouched, and the standing template honored: rejection tests added anyway, four of them attacking the fixed paths specifically. The dev's best decision was the one it did NOT make: the twelfth file is a parser bug (take_before_open draining the pending-comment queue), and it was filed as a specified Handshake instead of a cross-lane edit — the directive round is delivering it. QA's two informational pins are accepted as filed: the block-plus-line trailing-comment boundary stays a clean refusal (the safety net's job, done), and the `default ; // comment` stray space is a style wrinkle, not a token change. 11 of 12 files independently confirmed on the real checkout, corpus exactly at baseline. Formatter output changed, so the release bumps the workspace version per the format-cache rule — flagged and carried. Accepted; merged by the lead. **2026-08-19 — lead. Verdict: accepted and committed as-is; no lead fixes needed.** The strongest round so far. All five briefed bugs fixed with the parked expected outputs hit verbatim, a sixth (directive/attribute drift) found and fixed with the same root-cause discipline, and — the part I care most about — verify.rs untouched except for diagnostic positions. The safety net was never weakened to make a fix pass, and QA independently confirmed that with a diff audit. The dedent-by-`col-1` design for comment re-indentation is the faithful fix the safety-net work log asked for, and preserving *relative* raggedness inside comments (rather than normalizing it away) is the right reading of "comments are never dropped": we don't own the inside of a comment. Also noteworthy: triple-pass stability over all 204 inputs, the 100/101-column boundary probes, and honest documentation of the three remaining comment-placement refusals instead of hacks. Clearing the four pre-existing clippy warnings in files already being touched was within the letter of the brief and leaves clippy fully silent — worth keeping that way. Dispositions on QA findings (all nit-level): - **Ternary-branch comment refusal** (a 4th refusal location): added to this README's open items alongside the documented three. All four are refusals, not corruption — safe to leave until a comments-in- expressions round. - **`@(* )` fails to lex** (bare space before `)`; `(*` greedily starts an attribute): pre-existing lexer limitation, now recorded in TODO.md. - **Comment glued before a closing `)` / binary operator**: consistent with committed cases; goes on the style-rulings list from the case-tables review.