Files
Guoliang ChenandClaude Mythos 5.2 71d13b5fbe
ci / checks (push) Successful in 1m0s
ci / corpus (push) Successful in 18s
ci / linux (push) Successful in 6m4s
release / build-and-publish (push) Successful in 5m31s
Release 0.66.2: every source file names its author
Every tracked file that can carry a comment (880 of them) now opens with
"Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with
"Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love,
luciochen.com", in the file's own comment syntax. No behaviour change: the
diff outside the version bump and changelogs is comment lines only.

- tools/stamp_author.py: writes the lines; idempotent, `--check` lists
  what is missing. Headers go under a shebang and under Markdown front
  matter.
- Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON
  and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the
  LICENSE files (already carry the copyright line).
- tools/linux_check.sh: --help reads its header from line 3, now that the
  author line sits under the shebang.
- tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before.

Co-Authored-By: Claude Mythos 5.2 <[email protected]>
2026-11-24 12:11:09 -08:00

554 lines
29 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
# lint-harness
## Goal
Give the linter the testing backbone Verible's rules have: TODO §5's
`LintTestCase`/`RunLintTestCases` port (test cases embed their expected
findings positionally in the source, matched **exactly** in both directions)
and its `RunApplyFixCases` equivalent (every autofix rule gets
`(input, fixed output)` pairs, with the fixed output itself lint-clean for the
fixed rules and never something the formatter would refuse). One file-driven
harness — `crates/vlog_linter/tests/lint_cases.rs` over
`crates/vlog_linter/tests/cases/*.lint` — replaces the per-rule Rust
boilerplate `tests/rules.rs` had accumulated: adding a rule's coverage is now
a data file, zero Rust.
## Assumptions
- **Marker lines are ordinary comments to the linter.** A `//^ <col> <rule>`
line is left in the source when linting, so line numbers in a failure
report are the case's own and the source stays valid Verilog. The linter
never interprets `//^` (verified: no rule or waiver grammar matches it).
- **Markers carry the CLI's coordinates.** `<col>` is the 1-based column
`lucisv check` prints (`LineIndex::line_col` of the violation's span start),
so a marker can be written by copying a diagnostic. A caret positioned
*under* the span was rejected deliberately: tabs in the offending line are
themselves test content, so visual caret alignment lies, and a `//`-prefixed
caret line cannot point at columns 1–2 at all (where `no-tabs` fires most).
- **The default tab width (2) is what fix cases are written against** —
`LintContext::new`'s default, same as the CLI's default `--indent`.
- **A fix case runs the CLI's loop, not one pass**: apply Safe fixes →
re-lint, up to 10 rounds, and the fixpoint must equal the expected text.
One pass would under-describe `--fix` (a line ending in a tab takes two
rounds by design, and one .lint case pins exactly that).
- **"Lint-clean for the fixed rules" means: at the fixpoint, no enabled rule
still offers a Safe fix.** Violations without a fix (or with an Unsafe one)
may survive — they are findings, not failures.
- **Fences are out of the harness's scope.** `--fix` declining to edit inside
`// lucisv: off` is `crates/lucisv/src/lint.rs`'s behavior, not
`vlog_linter`'s; it stays tested by the CLI tests in
`crates/lucisv/tests/cli.rs`.
- **Unsafe fixes are untested here because none exist.** When the first rule
ships one, the fix loop needs an opt-in header (a `#unsafe-fixes` analog of
`--unsafe-fixes`) — noted so it is a case-format extension, not a redesign.
## Handshakes
**Consumed**
- `vlog_linter`'s public API only: `run`, `lint`, `apply_fixes`,
`select_rules`, `rule_by_name`, `ParsedSource`, `Rule`, `Applicability`,
`Violation`. Nothing in `src/` was touched; the API needed no additions.
- `vlog_parser::LineIndex` for marker coordinates (the same conversion the
CLI prints with).
- `vlog_formatter::{format_source, Config}` — **new dev-dependency** of
`vlog_linter`, tests only, for the cross-tool guarantee. The library's
dependency list is unchanged: `cargo tree -p vlog_linter -e normal` is
still `vlog_parser` + std. (A plain `cargo tree -p vlog_linter` now shows
`vlog_formatter` under `[dev-dependencies]` — that is the harness, not the
crate.) No new external dependency; `vlog_formatter` is a workspace crate.
**Promised**
- The `.lint` case format documented below, and the discipline that a marker
naming a rule that no longer exists fails the suite — so a rule rename or
removal must take its markers with it (rule names are stable API; this is
the enforcement on the test side).
- Every rule keeps violating/clean/waived/unused-waiver coverage in the new
format; both fixable rules keep fix round-trips.
## The .lint case format
Files live in `crates/vlog_linter/tests/cases/*.lint`, one per rule (plus
`waivers.lint`, `class_bodies.lint`, `mixed.lint`). The framing is the house
`.cases` pattern: cases separated by `====` lines, `#` header lines naming
the case. Four headers are special:
```
#SKIP <why> known-bad case: must still fail; passing demands the marker's removal
#path rtl/foo.sv lint the source as if read from this path (module-filename, wire-reg-mixup)
#select a,b lucisv check --select semantics: replaces the default rule set
#tolerant fix case whose input the formatter refuses; must be true (see below)
```
The body is Verilog source, linted verbatim. A violation expectation is a
marker line after the offending line:
```
module m;
wire a;
//^ 1 no-tabs
endmodule
```
`//^ <col> <rule-name>` asserts one finding of that rule at that 1-based
column on the nearest preceding non-marker line; markers stack for several
findings on one line. **`//^` is reserved throughout a `.lint` file** — any
trimmed line starting with it is parsed as a marker (block comments
included), and a malformed one fails the file loudly rather than passing
as content (QA finding 2, lead-documented). Likewise a `#word` header with
no space after the `#` must be a known directive (`#path`, `#select`,
`#tolerant`, `#SKIP`) or the file errors — a case *name* needs a space
after the `#` (QA finding 1, lead-fixed with a self-policing test). The
match is exact in both directions — a marked finding that is not reported
fails, and a reported finding that is not marked fails — and the failure
names both:
```
no_tabs.lint:1 [wrong col]: findings do not match the markers
missing (marked, not reported):
2:2 no-tabs
unexpected (reported, not marked):
2:1 no-tabs — tab character; indent with spaces
source:
1 | module m;
2 | wire a;
3 | //^ 2 no-tabs
4 | endmodule
```
(That report is real, captured from the harness; the self-policing test
`a_wrong_column_fails_in_both_directions` pins its shape.)
Case-file errors — distinct from case failures, because they mean the *test*
is wrong: a marker naming a rule that does not exist ("a renamed or removed
rule must take its markers with it"), a marker for a rule the case does not
enable ("add it to #select"), a marker with no column, a marker above all
code, an unknown `#select` name, a case with no source.
### Fix cases
A `----` line splits a case into `(input, expected fixed output)`:
```
# fix: a tab that is also trailing whitespace takes two rounds
module m;
wire a;<TAB>
//^ 1 no-tabs
//^ 9 no-trailing-whitespace
endmodule
----
module m;
wire a;
//^ 1 no-tabs
//^ 9 no-trailing-whitespace
endmodule
```
(`<TAB>` above stands in for the invisible trailing tab byte the real case
file carries — trailing whitespace and tabs in `.lint` files are content.)
The markers still describe the *input* (a fix case is a lint case too), and
marker lines pass through the fix untouched, so they appear verbatim in the
expected output. The harness then asserts three things:
1. **The fixpoint equals the expected text** — Safe fixes applied in the
CLI's fix→re-lint loop (cap 10 rounds), diffed line by line on mismatch.
2. **Clean for the fixed rules** — no enabled rule still offers a Safe fix
on the output.
3. **The cross-tool guarantee** — `vlog_formatter::format_source` must
accept the fixed output and format it to a fixed point
(`format(format(out)) == format(out)`; the formatter's own runtime
verification also runs inside every `format_source` call). The exception
is a fix case whose **input** the formatter already refuses — the
tolerant population only the linter sees. Such a case must say so with
`#tolerant`, which skips the formatter checks; an unmarked refused input
is a case error, and a `#tolerant` marker on an input that formats
demands its own removal, exactly like `#SKIP`. Nothing in the population
is silent.
All 5 shipped fix cases run the full check — every fix input and every fixed
output is formatter-accepted and converges (proven by the `#tolerant`
discipline itself: a silently-skipped case is impossible).
### The harness polices itself
`tests/lint_cases.rs` carries 12 self-policing tests that feed the runner
deliberately wrong scratch cases and pin the failure reports: wrong column
(both directions named), unmarked finding, stale marker (dead rule), marker
for an unselected rule, marker without a column, marker above all code,
unknown `#select`, wrong fixed output (line diff shown), a passing `#SKIP`
case, a refused fix input without `#tolerant`, a `#tolerant` marker on a
formattable input, and one correct case that must pass.
## Status / TODO
- [x] `.lint` format: `====`/`#`/`//^ <col> <rule>`/`----`, `#path`,
`#select`, `#SKIP`, `#tolerant`.
- [x] Exact two-direction matching with the readable report above.
- [x] Stale-marker detection (dead rule = case error), unselected-rule
markers, marker syntax errors.
- [x] Fix cases: CLI fix loop, clean-for-fixed-rules, cross-tool formatter
guarantee with the explicit `#tolerant` population.
- [x] One-parse property (`ParsedSource` products == source) asserted over
every case, absorbed from the old `assert_lint_with`.
- [x] Migration: all 55 `tests/rules.rs` tests → 76 `.lint` cases;
`rules.rs` deleted. Every rule has violating/clean/waived/
unused-waiver coverage in the new format; both fixable rules have fix
round-trips (5 fix cases).
- [x] 12 self-policing tests.
- [x] TODO §5: both harness items checked.
- [ ] `#unsafe-fixes` header — waits for the first rule with an Unsafe fix.
- [ ] Component-level tests, error-case tests, fuzzing — the *other* §5
items, untouched here.
## Migration stats, honestly
| | before | after |
|---|---|---|
| `vlog_linter` integration test fns | 55 (`tests/rules.rs`) | 13 (1 table + 12 self-policing) |
| data-driven cases | 0 | 76 (5 of them fix round-trips) |
| Rust test boilerplate LOC | 523 (`rules.rs`) | 547 (`lint_cases.rs`, the harness itself) |
| case data LOC | 0 (inline in Rust strings) | 501 (`cases/*.lint`, 14 files) |
| `cargo test -p vlog_linter` | 119 + 55 + 1 | 119 + 13 + 1 |
| `cargo test --workspace` | 827 | 785 |
Read fairly: the Rust LOC did not shrink — it moved from per-rule repetition
(four near-identical functions per rule, escaped `\n\t` strings, no columns
checked) into a one-time harness that per-rule coverage no longer touches.
What each *case* costs went from ~8 lines of Rust with escapes to ~5 lines
of plain Verilog; what each case *checks* grew (columns now exact, both
directions, plus the one-parse property everywhere and the fix/cross-tool
checks on fix cases). The 42-test drop in the raw count is 55 functions
replaced by 13, while assertion coverage went up: the old suite checked 55
(line, rule) shapes, the new one checks 76 cases × (line, col, rule) exact
in both directions. The 119 unit tests in `src/` (registry, waiver
derivation, fix-engine internals, naming predicates) are untouched — those
are API tests, not case tests, per the migration rule.
## Work log
### 2026-08-20 — dev
- Read the Verible pattern (TODO §5), the house `.cases` harness
(`crates/vlog_formatter/tests/cases.rs`), and the existing
`tests/rules.rs` style before designing. Kept the `.cases` framing
(`====`, `#` headers, `#SKIP` discipline, collected failures, line
diffs) so there is one house pattern, not two.
- **Marker design decision**: `//^ <col> <rule>` with an explicit 1-based
column, not a positioned caret. Two reasons, both from "the formatter does
not run on these files": tabs in offending lines are content, so a
visually-aligned caret lies under any tab width; and a `//`-prefixed line
can never point at columns 1–2, where `no-tabs` — the highest-volume rule —
fires. The column is the one `lucisv check` prints, so writing a marker is
copying the diagnostic.
- **Columns were verified by the harness, not trusted**: all 76 cases'
hand-computed columns passed on the first full run (the one failure in
that run was a self-policing test's own assertion, fixed), which is also
the first live demonstration that the exact-match reports are usable — the
mismatch report in this README is captured from that run.
- **`#tolerant` discipline added mid-round**: the first cut silently skipped
the formatter checks when the input was refused, which made "the
cross-tool guarantee ran" unverifiable from a green suite. Now the
tolerant population is explicit, checked in both directions (`#SKIP`
semantics), and provably empty today: all 5 fix cases run the full
formatter check.
- One-parse property kept: the old `assert_lint_with` compared
source-parsed and product-parsed lint results on every test; `check_case`
does the same on every case.
- Migration: deleted `tests/rules.rs` (55 tests, 523 LOC) after porting all
of it — quartets for all 12 real rules and `unused-waiver`, waiver range
semantics, class-body reach (including the documented not-legal-SV
always-in-class walk-uniformity case, its caveat carried into the case
name), the mixed-file case, and the off-by-default `module-name-style`
select behavior. Nothing from `src/` unit tests was moved or deleted.
- New dev-dependency `vlog_formatter` (workspace crate, tests only) with the
justification comment in `Cargo.toml`; the library dependency list is
unchanged, which QA can re-verify with `cargo tree -p vlog_linter -e
normal`.
- **Gates**: `cargo test --workspace` 785 passed / 0 failed (baseline 827;
the delta is exactly −55 migrated + 13 new, accounted above);
`cargo test -p vlog_linter` 119 + 13 + 1; `cargo clippy --all-targets
--workspace` silent; `cargo fmt -p vlog_linter --check` clean (fmt scoped
because the tree carries other agents' uncommitted churn). Corpus
untouched — no `src/` change anywhere, so corpus numbers cannot have
moved.
- **TODO.md §5**: checked the inline-marker harness item and the
`RunApplyFixCases` item, with `→` notes pointing here.
- Scope kept: files touched are `crates/vlog_linter/tests/**`,
`crates/vlog_linter/Cargo.toml` (dev-dependencies only), this README, and
`TODO.md` — plus the mechanical one-line `Cargo.lock` consequence of the
dev-dependency (no external crate; the lock line names the workspace's own
`vlog_formatter`).
## QA log
### 2026-08-20 — QA
Verdict: **pass**, no blocking findings. Every claim in the Work log and the
Migration-stats table reproduced. Four minor findings below, one of them a
real (low-severity) hole in header parsing.
**Gates re-run from a clean tree**
| gate | result |
|---|---|
| `cargo test --workspace` | 785 passed / 0 failed |
| `cargo test --workspace` at `HEAD` (54b0ca3, throwaway `git worktree`) | **827** passed / 0 failed — the claimed baseline, measured not assumed |
| `cargo test -p vlog_linter` | 119 (unit) + 13 (lint_cases) + 1 (doc) |
| `cargo clippy --all-targets --workspace` | silent |
| `cargo fmt --all --check` | clean (whole workspace, not just the crate) |
| determinism | two full `cargo test --workspace` runs, 785 test lines each, `diff` identical once timings are stripped |
| `cargo tree -p vlog_linter -e normal` | `vlog_parser` only; the dev-dep chain (`vlog_formatter → vlog_parser`) adds no external crate and no cycle (`vlog_formatter` does not depend on `vlog_linter`) |
| corpus | `git status` over the whole tree shows **no** `crates/*/src/**` change anywhere, so corpus numbers cannot have moved; `corpus/` and `tools/` untouched. (The TSV is generated on demand, not committed, so there is nothing to md5.) |
Counts re-derived from the files, all matching the table: 76 cases across 14
`.lint` files (`====` count + 1 per file), 5 fix cases (`----`), 501 LOC of
case data, 547 LOC of harness, 523 LOC in the deleted `rules.rs` with 55
`#[test]` fns.
**Claim 1 — markers carry `lucisv check`'s coordinates.** Verified by copying
five case bodies to disk and running the real CLI. Every marker column is the
diagnostic's column, verbatim:
- `mixed.lint` as `rtl/top.sv` → `1:8 module-filename`, `1:24
explicit-parameter-storage-type`, `4:1 no-tabs`, `4:14
always-comb-blocking` — the four markers exactly.
- `no_trailing_whitespace.lint:1` → `2:10`; `class_bodies.lint` param case →
`1:21` and `3:14`; `no_tabs.lint` mid-line case → col `7`;
`waivers.lint` malformed-waiver case → `2:3 unused-waiver`.
The copy-the-diagnostic property holds. The caret-rejection reasoning also
holds *empirically*, not just rhetorically — see the attacks below.
**Claim 2 — fix cases.** The loop is CLI-equivalent: `crates/lucisv/src/lint.rs`
has `MAX_FIX_ROUNDS = 10` and the same fix→re-lint shape; the harness allows
rounds 0..=9 (10 applications, same as the CLI) and *errors* on an 11th
instead of silently stopping, which is the right strictness for a test. The
two documented divergences are both in Assumptions and both correct: no fence
filtering (`fixable_outside_fences` is the CLI's job) and `false` for
unsafe fixes (none exist).
The two-round case was traced step by step (temporary scratch test, deleted):
```
round 0: findings=[2:1 no-tabs Safe, 2:9 no-trailing-whitespace Safe] applied=1
-> "module m;\n wire a; \n…"
round 1: findings=[2:10 no-trailing-whitespace Safe] applied=1
-> "module m;\n wire a;\n…"
round 2: findings=[] applied=0
```
Exactly as documented: the two Safe fixes overlap on the trailing tab, so
round 0 lands only `no-tabs` (which expands *both* tabs on the line), and the
now-plain trailing run goes in round 1. The input markers `1` and `9` are the
input's true columns.
`#tolerant` is provably empty — `grep '^#tolerant\|^#SKIP' tests/cases/`
returns nothing — and the cross-tool check is provably *reached* by all five
fix cases, not silently skipped. Proof by sabotage: replacing
`format_source(&fixed, …)` with a call on a formatter-refused literal made
**exactly 5 cases** fail with "accepts the input but refuses the fixed
output", naming all five fix cases. Reverted byte-identical (md5
`9032f79cc6ab6ed834ff8ba5d62bc579`).
**Claim 3 — self-policing is non-vacuous.** Not just read and run; broken on
purpose to check the tests actually catch anything.
- `if want != got` → `if false`: `a_wrong_column_fails_in_both_directions`,
`an_unmarked_finding_is_unexpected` and
`a_skip_case_that_passes_demands_its_marker_removed` all went red at once.
- `(true, Ok(_)) => Err(…)` → `Ok(())`:
`a_tolerant_marker_on_a_formattable_input_demands_its_removal` went red.
- Both reverted and md5-verified back to `9032f79cc6ab6ed834ff8ba5d62bc579`.
The **stale-marker promise was tested for real**, not only through the
scratch test: temporarily renaming `no_tabs.rs`'s `NAME` to `"no-hard-tabs"`
turned 13 cases red, 9 of them with
`marker names a rule that does not exist: 'no-tabs' — a renamed or removed
rule must take its markers with it`. Rule file reverted, md5
`3b2dce6a1a0f3b64395f1ac4a0862697`, workspace back to 785 green.
Sabotaging one *shipped* case instead of the harness (`no_tabs.lint`'s
mid-line marker `7` → `8`) produced the report the README advertises, naming
both directions — `missing 2:8 no-tabs` / `unexpected 2:7 no-tabs — tab
character; indent with spaces` — plus the numbered source. Reverted, md5
verified.
**Claim 4 — migration honesty.** `git diff HEAD -- crates/vlog_linter/src/`
is empty and `git status` lists no `src/` path: the 119 unit tests are
untouched. All 13 rules have the quartet — every rule has ≥1 violating
marker and ≥1 waiver-mention case, and each rule file carries an explicit
"quiet" case (`always_rules` 2, `case_missing_default` 2, `module_filename`
2, `no_tabs` 2, `wire_reg_mixup` 3, one each elsewhere; `unused-waiver`'s
"clean" cases are the two ignored/disabled-waiver cases in `waivers.lint`,
its "waived" case is *an unused waiver can itself be waived*).
I mapped all 55 deleted test fns onto the new cases one by one. **Nothing
asserted before is unasserted now.** Sample of five, in detail:
| deleted test | ported to | anything lost? |
|---|---|---|
| `module_filename_is_quiet_when_it_matches_or_has_no_path` (2 asserts) | `module_filename.lint` cases 2 and 3 | no — both split out |
| `no_tabs_is_waived` (2 asserts) | `no_tabs.lint` "waived on the same line" + "waived from the line above" | no |
| `wire_reg_mixup_is_quiet_on_logic_and_on_verilog_files` (3 asserts) | `wire_reg_mixup.lint` cases 2, 3, 4 | no |
| `a_rule_off_by_default_says_nothing_until_selected` (raw `run` + selecting) | `module_name_style.lint` cases 1 and 2 | no — the off-by-default half survives as the no-`#select` case |
| `the_always_rules_reach_a_class_body_too` (with its not-legal-SV caveat) | `class_bodies.lint` case 4, caveat carried into the case name | no |
Coverage is strictly **up**, not merely preserved: 12 cases are new content
(`no_tabs` multi-tab / mid-line / string-literal, `case_missing_default`'s
`unique case`, and all 9 of `waivers.lint`), plus columns, both-direction
matching, and the fix/cross-tool checks. Note `waivers.lint` *duplicates*
`src/lib.rs`'s waiver unit tests at case level rather than replacing them —
those unit tests are still there, so this is additive.
Small precision on the stats table (not corrected in place, since "55" there
also correctly names the test-function count): the old suite made **58**
assertion sites, not 55 — `grep` counts 60 `assert_lint*(` occurrences, two
of which are the helper bodies calling `assert_lint_with`. 58 old
`(line, rule)` shapes → 76 new `(line, col, rule)` cases. The argument holds
with the corrected number.
**Claim 5 — the dev-dependency. My ruling: compliant, keep it.**
CLAUDE.md's rule is "standard library first; adding a dependency requires a
written justification in the feature README". Both the letter and the spirit
are met. The letter: the justification exists twice, in `Cargo.toml` and in
Handshakes. The spirit — the rule exists to police supply-chain surface,
build weight and the crate's public contract — is untouched: `vlog_formatter`
is a workspace-internal path crate, dev-only, pulling in zero external code
(`vlog_formatter → vlog_parser`, nothing else), with no cycle, and
`cargo tree -e normal` proves the library's contract is byte-for-byte what it
was. A workspace-internal dev-dep is a *test-wiring* decision, not a
dependency decision, and I do not think it should be held to the same bar as
an external runtime dep. The one alternative worth naming for the lead:
the cross-tool assertion could have lived in `crates/lucisv`, which already
depends on both — but that would have split the case format across two
crates to avoid a dependency that costs nothing. The dev chose correctly.
**Claim 6 — gates.** All in the table above.
### Findings
1. *(minor, real)* **A typo'd or unknown `#` header is silently absorbed into
the case name instead of being rejected.** `split_case`
(`tests/lint_cases.rs:100-116`) recognizes `#path `, `#select `,
`#tolerant`, `#SKIP`; everything else becomes name text. Reproduced: a
scratch case headed `#patth rtl/m.v` over `module m;\n reg q;\nendmodule`
passes green — but for the wrong reason (no path at all, rather than a
`.v` path), silently weakening exactly the property
`wire_reg_mixup.lint` case 3 exists to pin. `#unsafe-fixes` and
`#tolerantt` are likewise accepted in silence. Most typo directions fail
loudly (a lost `#SKIP`/`#tolerant`/`#select` makes the case go red), so
this is not a false-green risk in the shipped set — I re-verified all 14
files pass with their real headers. It is a maintenance hazard and it
contradicts the feature's own "nothing in the population is silent"
stance. Cheap discriminator, if the lead wants it fixed: every real
directive is written with no space after `#` and every case name with one,
so `#word` with no following space could be required to be a known
directive. Flagged, not implemented — that is a format decision, not a
QA typo fix.
2. *(minor, documentation)* **`//^` is reserved and the format spec does not
say so.** Any line whose *trimmed* text starts with `//^` is consumed as a
marker and can never be case content — including one inside a `/* */`
block (the harness is line-based, not lexical). Both attacks fail loudly
(`//^ decorative banner` → "`decorative` is not a column number"; the
block-comment one → "missing (marked, not reported)"), so nothing is
silently mis-attributed, but the README's "The .lint case format" section
should state the exclusivity in one line.
3. *(minor, documentation)* **`.lint` files are CRLF-transparent, which means
`\r` can never reach the linter.** A CRLF-encoded case file parses and
passes (verified), because `str::lines()` strips the `\r` before `join()`
rebuilds the source with `\n`. Consequence worth recording in Assumptions:
CRLF behaviour of the text rules (e.g. that `\r` is *not* trailing
whitespace, per `trim_end_matches([' ', '\t'])`) is not expressible as a
case. Not a regression — `rules.rs` could not express it either.
4. *(cosmetic)* Two asymmetries in header enforcement, so the Handshakes
wording is not over-read: `#SKIP` and `#tolerant` are enforced in both
directions (verified), but `#select` only rejects unknown names and
markers for unselected rules — an over-broad `#select` is silent — and
`#path` has no enforcement at all. `class_bodies.lint` case 3's
`#path rtl/m.sv` is in fact inert (no `reg`, and `m` matches `m.sv`); it
is there for realism, which is fine, but nothing would catch it going
stale. Also `#SKIP` is matched with `starts_with("SKIP")`, so a case
*named* "SKIPping blank lines" would be treated as skipped.
Two latent notes, neither reachable today: `diff()` is `.lines()`-based, so a
fixpoint that differed from the expected text *only* in its trailing newline
would be reported with an empty diff body — unreachable because `join()`
normalizes both sides and no fix deletes a line terminator (an expected
output with an extra blank line *is* caught, rendering as a bare `-` line,
verified). And `split_case`'s header loop would eat a case whose first source
line begins with an unindented `#` (a bare delay statement) — no realistic
case starts that way.
### Adversarial cases written and run (all deleted; tree restored)
Six expressibility attacks in a scratch `tests/cases/qa_attack.lint`, **all
passing**, which is the real vindication of the explicit-column marker over a
positioned caret:
- `no-tabs` at **column 1** and at **column 2** (` \twire a;`) — the zone a
`//`-prefixed caret line provably cannot reach.
- `no-trailing-whitespace` at **column 1** (a whitespace-only line).
- Two findings on one line at different columns (`8` + `24`).
- The same two markers written in **reverse order** — the harness sorts both
sides, so ordering is irrelevant and unsorted findings cannot fool it.
- **Two different rules at the identical `line:col`** (a tab-only line fires
`no-tabs` *and* `no-trailing-whitespace` at 2:1). Both matched.
Four failure attacks, all failing loudly with the advertised report: a marker
for a **waived** finding (classified `missing (marked, not reported)` — the
marker is the side with no counterpart, which reads correctly); a **duplicate
marker** with one finding (multiset semantics survive the sort); a
non-marker `//^` comment; a `//^` inside a block comment. Plus the CRLF file,
the trailing-blank-line fix case, and the three typo'd-header cases described
in the findings.
Everything created during QA was removed and verified: `qa_attack.lint` and
the scratch test file deleted, `no_tabs.lint`, `lint_cases.rs` and
`src/rules/no_tabs.rs` restored byte-identical by md5, the baseline
`git worktree` removed, `git status` back to the dev's exact working set, and
`cargo test --workspace` green at 785.
## Review
**2026-08-20 — lead. Verdict: accepted and committed. The owner's final
sequence item lands: writing a lint rule's tests is now copying lucisv's
own diagnostics into a data file, and the harness polices itself.**
Points reviewed and accepted:
1. **Copy-the-diagnostic markers over positioned carets** — the tab
argument is exactly right (a visual caret lies where tabs are
content, and can't reach columns 1-2 where no-tabs lives), and QA
vindicated it by expressing markers at both caret-impossible
columns and at identical positions for two rules.
2. **The cross-tool guarantee on fix cases** (fixed output must be
lint-clean AND formatter-convergent) is the harness's real value:
QA's sabotage of the format_source call turned exactly 5 cases red,
proving all fix cases reach it. The `#tolerant` escape being empty
today but two-way enforced is the #SKIP discipline applied forward.
3. **Migration with a coverage audit, not a coverage claim**: all 55
deleted functions mapped individually onto cases, coverage strictly
up (58 old line-rule shapes → 76 line+col+rule cases; QA's
corrected 58 stands alongside the dev's correct 55-function count),
119 src unit tests untouched.
4. **The dev-dependency ruling adopted**: a workspace-internal,
test-only path dependency moves neither supply-chain surface nor
the library contract (cargo tree -e normal unchanged); the
alternative — splitting the case format across crates to dodge a
free dependency — would have been worse. QA's independent ruling
concurred.
5. **Lead fixes on acceptance**: QA finding 1 (typo'd `#word` headers
silently becoming case names) fixed with the offered discriminator
plus a self-policing test; finding 2 (`//^` reserved) now stated in
the format spec. Findings 3-4 (CRLF transparency, the #select/#path
enforcement asymmetries) stand as recorded, with the `#SKIP`
starts_with quirk inherited knowingly from the .cases precedent.
With this, the owner's 2-3-4-5-7 sequence is complete.
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->