TODO §39 (docs/features/waiver-files). Closes §4's last waiver item. `vlog_linter::waiver_file`: `waive --rule=<rule> [--line=N|N-M] [--location=<pattern>]`, `#` comments, BOM tolerated; `--location` is the `--exclude` matcher (`lucisv_core::walk::is_excluded`, a new vlog_linter → lucisv_core edge), a regex-looking pattern refused by name. `lint_with(ctx, rules, external)` applies inline and external waivers as a union and reports which external directives fired; `lucisv check` reports the dead ones under `unused-waiver` at the waiver file's line after the whole run. Discovery: `[lint] waivers` (relative to the toml), `--waiver-file` (repeatable), `lucisv.lint.waivers` (first workspace root); bad lines fail the CLI run with file:line and are dropped and logged once by the server. Review rework (QA's HIGH): the server's code-action path now lints with the buffer's `LintRun` — its enabled rules and external waivers — so a quick fix is never offered, nor applied by fix-on-save, for a waived finding. Docs: Waivers sections in README and the linter guide, cli and configuration rows, topo edge, site rebuilt. Co-Authored-By: Claude Fable 5.1 <[email protected]>
562 lines
31 KiB
Markdown
562 lines
31 KiB
Markdown
# waiver-files
|
|
|
|
## Goal
|
|
|
|
Findings can be suppressed from *outside* the RTL, in Verible's waiver file
|
|
format, so a project that already has a `.waiver` file carries it over
|
|
unchanged and a team can silence a rule for a legacy directory without
|
|
editing five hundred files. One directive per line —
|
|
`waive --rule=<rule> [--line=N|--line=N-M] [--location=<pattern>]`, with `#`
|
|
comments and blank lines ignored — read from `--waiver-file` on the command
|
|
line, from `waivers` under `[lint]` in a `lucisv.toml`, and from
|
|
`lucisv.lint.waivers` in an editor. External waivers and the inline
|
|
`// lucisv: waive` comments are a **union**: a finding either covers is
|
|
suppressed, and one both cover marks both used. This closes §4's last two
|
|
waiver items (TODO §39).
|
|
|
|
## Assumptions
|
|
|
|
- **`--location` is not a regex.** Verible's is; lucisv has no regex engine
|
|
in the linter's path and deliberately keeps `--exclude`'s glob semantics
|
|
everywhere a pattern names files. A pattern that *looks* like a regex is
|
|
refused with a message saying what the difference is, rather than silently
|
|
matching nothing. The detector is `waiver_file::regex_hint`: `.*`, `.+`,
|
|
or any of `\ ^ $ [ ] ( ) | ? + { }`. A bare `.` is not a metacharacter —
|
|
`foo.sv` is a file name. A pattern that is a valid glob *and* looks like a
|
|
regex (a file with a `+` in its name) is refused; nothing in the corpus or
|
|
in opentitan has one, and the message tells the user what to write.
|
|
- **A directive names one rule.** A severity word (`error`, `warning`,
|
|
`style`) is refused, though `--select`/`--ignore` accept one: a waiver file
|
|
is checked in, and one word in it quietly silencing a whole class is not
|
|
something anyone should be able to write by accident.
|
|
- **`--regex=` is refused by name**, because Verible has it and a user
|
|
carrying a file over deserves to be told which directive lucisv cannot
|
|
honour rather than "unknown option".
|
|
- **Line ranges are `N-M`, inclusive, 1-based**, matching Verible. `N:M` is
|
|
not accepted.
|
|
- **A stdin buffer has no path**, so a directive with a `--location` cannot
|
|
cover it; one without covers it like any other file.
|
|
- The CLI de-duplicates waiver files by their **canonicalized** path, so the
|
|
same file named by `--waiver-file` and by a `lucisv.toml` is read once. If
|
|
canonicalization fails (a path that does not exist) the path as written is
|
|
the key — and a non-existent path fails the run a line later anyway.
|
|
- The server reads its waiver files **on every lint pass**, exactly as it
|
|
already re-reads the buffer's `lucisv.toml` per pass, so a waiver file
|
|
edited while the editor is open takes effect at the next publish with no
|
|
cache to invalidate. The cost is a few `read_to_string`s of small files
|
|
beside a parse and an analysis, and it is zero when nothing is configured.
|
|
- `lint::fixable` (the code-action path) still runs `default_rules()` with no
|
|
waivers at all, inline or external — unchanged from before this round. A
|
|
waived finding was never published, so no lightbulb is offered for it in
|
|
practice; the mismatch is pre-existing and out of scope here.
|
|
|
|
## Handshakes
|
|
|
|
**Consumed**
|
|
|
|
- `lucisv_core::walk::is_excluded` — the `--exclude` matcher, now also the
|
|
`--location` matcher. **This adds `lucisv_core` as a dependency of
|
|
`vlog_linter`** (`crates/vlog_linter/Cargo.toml`, with the reason in a
|
|
comment). `lucisv_core` has no dependencies of its own, so this adds no
|
|
external code and closes no loop; copying the matcher instead would have
|
|
meant the two *look* the same and can drift. **This is a new edge for
|
|
`docs/topo.md`: `vlog_linter ──▶ lucisv_core`.** That file is owned by
|
|
another process this round, so the edge is recorded here for the lead to
|
|
apply.
|
|
- `lucisv_core::config::FileConfig::lint_waivers` — new `Option<Vec<PathBuf>>`
|
|
field, `[lint] waivers`, resolved against the config file's own directory
|
|
by `Discovery` exactly as `filelist` is.
|
|
- `vlog_linter::rule_by_name` / `Severity::from_name` — a directive's `--rule`
|
|
is validated against the registry at parse time.
|
|
|
|
**Promised**
|
|
|
|
- `vlog_linter::lint(ctx, rules)` is **unchanged** in signature and behaviour;
|
|
it now delegates to `lint_with(ctx, rules, &ExternalWaivers::default())`.
|
|
- `vlog_linter::lint_with(ctx, rules, &ExternalWaivers) -> (Vec<Violation>,
|
|
WaiverUse)` is the new entry point. The `WaiverUse` half is the caller's to
|
|
merge across a run and hand back to `ExternalWaivers::unused`.
|
|
- `vlog_linter::{ExternalWaivers, UnusedReport, WaiverUse}` are public.
|
|
`ExternalWaivers::read` returns `(waivers, problems)` — a file that cannot
|
|
be opened is the `Err`, a file with bad *lines* is an `Ok` carrying both —
|
|
so the CLI can fail the run and the server can drop the line and log it,
|
|
from one reader.
|
|
- `vlog_linter::waiver::Waivers::filter` is gone, replaced by
|
|
`Waivers::covers(rule, line)`; the union has to ask both waiver kinds about
|
|
every violation, and a `filter` that dropped violations before the external
|
|
one saw them would have marked only one of a covering pair used. Internal
|
|
to the crate (`pub(crate)`), so nothing outside moves.
|
|
- `lucisv_server::state::Workspace::roots()` is new (`&[PathBuf]`), for
|
|
resolving a relative `lucisv.lint.waivers` entry against the first root the
|
|
way `filelist_path` does inline.
|
|
- `lucisv_server::lint::{waiver_paths, external_waivers}` are public so
|
|
`server/notification.rs` can validate the setting once when it arrives.
|
|
- `settings::LintSelection` gained a sixth element (the waiver list), so a
|
|
changed list republishes every open buffer, as a changed option already did.
|
|
- `lucisv::lint::{plan, check_stdin}`: `check_stdin` takes one more argument
|
|
(`&ExternalWaivers`); `external_waivers(opts, configs)` is public for the
|
|
stdin path in `main.rs`.
|
|
|
|
**Requested of the lead** (files owned by the concurrent docs process): the
|
|
`README.md` / docs-site text under "Docs to apply at merge (lead)" below, and
|
|
the `docs/topo.md` edge above.
|
|
|
|
## Status / TODO
|
|
|
|
- [x] 39.1 `waiver_file.rs` (parse + match) and the union in `lib.rs`
|
|
- [x] 39.2 discovery: `[lint] waivers`, `--waiver-file`, `lucisv.lint.waivers`
|
|
- [x] 39.3 unused reporting on the CLI; errors on both front ends
|
|
- [x] the VS Code setting — **by hand** in `editors/vscode/package.json`:
|
|
`vlog_linter::vscode` generates only `lucisv.lint.severity.*` and
|
|
`lucisv.lint.rules.*`, and the drift test
|
|
(`settings.rs::the_vscode_lint_toggles_match_the_registry`) filters on
|
|
exactly those two prefixes, so `lucisv.lint.select`, `ignore`, `options`
|
|
and now `waivers` are hand-written beside them
|
|
- [x] tests: every directive shape and every error; matching by name, path
|
|
suffix, line and range; union with an inline waiver; unused reporting;
|
|
CLI (`--waiver-file` twice, toml + CLI, exit codes); server unit tests;
|
|
one e2e case over the wire
|
|
- [x] docs: this README; TODO §4's two waiver lines and §39's own boxes
|
|
- [ ] QA
|
|
|
|
## Work log
|
|
|
|
**2026-09-04 (dev).**
|
|
|
|
- `crates/vlog_linter/src/waiver_file.rs` (new, ~330 lines with tests): the
|
|
directive parser, the matcher, `WaiverUse` and the unused report.
|
|
`waiver.rs` is untouched except that `filter` became `covers` — it is still
|
|
only the inline story.
|
|
- The union lives in `lib.rs::waive`, which asks **both** waiver kinds about
|
|
every violation and never short-circuits: `inline.covers(..) || external
|
|
.covers(..)` with `||` would have left the second waiver of a covering pair
|
|
looking dead. There is a test for exactly that in `cli.rs`.
|
|
- Grammar accepted, exactly:
|
|
`waive` then any order of `--rule=<rule>` (required, once),
|
|
`--line=<N>` or `--line=<N>-<M>` (once), `--location=<pattern>` (once).
|
|
Leading and trailing whitespace ignored, `#` comments and blank lines
|
|
ignored, CRLF handled (the span arithmetic uses `split_inclusive('\n')` so a
|
|
`\r` does not shift a directive's reported line). There is no quoting, so a
|
|
pattern cannot contain a space — the same limitation `.f` filelists have.
|
|
- Every error message (each prefixed `<file>:<line>: `):
|
|
- ``expected a `waive` directive, found `<word>` ``
|
|
- ``` `waive` needs a `--rule=<rule-name>` ```
|
|
- ``unknown rule `<name>` ``
|
|
- ``` `--rule=<word>` names a severity class; a waiver names one rule at a time ```
|
|
- ``` `--line=<v>` is not a line or a line range (`--line=5`, `--line=5-9`) ```
|
|
- ``` `--line=<v>` starts at 0; lines are numbered from 1 ```
|
|
- ``` `--line=<v>` counts backwards ```
|
|
- ``` `--location=<v>` looks like a regular expression (`<token>`); lucisv
|
|
matches a location the way `--exclude` does — … ```
|
|
- ``` `--<flag>` is given twice ```
|
|
- ``` `--regex` is not supported; waive by `--line` or `--location` ```
|
|
- ``unknown option `<flag>` (the options are `--rule`, `--line` and
|
|
`--location`)``
|
|
- ``` `--<flag>` takes a value: write `--<flag>=<value>` ```
|
|
- ``` `--<flag>` has an empty value ```
|
|
- and, for a file that cannot be opened at all, `<path>: <io error>`.
|
|
- CLI: `--waiver-file` is repeatable and lint-only; the run's set is the flag's
|
|
files in order, then every `[lint] waivers` entry of a config file governing
|
|
an input, de-duplicated canonically. The first problem fails the run at exit
|
|
2 before anything is linted, matching a bad `[lint.<rule>]` entry.
|
|
- Unused external waivers are computed **after** the whole run
|
|
(`lint::dead_waivers`), from the `WaiverUse` each file's report carries,
|
|
merged. They are reported as ordinary `unused-waiver` violations against the
|
|
waiver file, which means they flow through `--output-format json` and the
|
|
exit code unchanged. A stdin run is a run of one buffer and reports them
|
|
too.
|
|
- `check_one`/`run_rules`/`fix_source` grew a `Pass<'a>` struct rather than a
|
|
seventh and eighth parameter (clippy's `too_many_arguments` was one argument
|
|
away). Pure plumbing; no behaviour moved.
|
|
- Under `--fix`, usage accumulates across the fix rounds: a waiver that
|
|
covered a finding the fix then removed still did its job.
|
|
- Server: `LintRun` carries an `ExternalWaivers`; `violations_in` calls
|
|
`lint_with` and discards the usage half, because the server never sees a
|
|
whole run and must not claim a waiver is dead. The setting's files are read
|
|
a second time in `apply_settings` purely to log what is wrong with them —
|
|
once per settings push instead of once per keystroke.
|
|
- Deviations from the plan, all noted above: the `lucisv_core` dependency in
|
|
`vlog_linter` (Handshakes), the VS Code setting added by hand rather than
|
|
through the generator (which does not cover this family of settings), and
|
|
`editors/vscode/README.md` gaining the setting's row — a file outside the
|
|
plan's expected touch set, listed below.
|
|
|
|
**Gates (all guarded, 2026-09-04)**
|
|
|
|
- `cargo fmt -p` clean for `lucisv`, `lucisv_core`, `lucisv_server`,
|
|
`vlog_linter`; `cargo clippy --all-targets` clean (zero warnings).
|
|
- `tools/guard.sh -- cargo test --workspace`: **3 764 passed, 0 failed, 44
|
|
ignored** (3 744 at 0.41.0, plus this round's 20 new tests).
|
|
- `tools/guard.sh -- tools/corpus_check.sh`: **814/820**, the same six
|
|
failures as 0.41.0.
|
|
- `cargo build --release -p lucisv -p lucisv_server`, then
|
|
`tools/guard.sh -- node editors/vscode/smoke.js target/release/lucisv-server`
|
|
— OK, 20 messages.
|
|
- opentitan demonstration, read-only:
|
|
`target/release/lucisv check --no-cache --select error,warning,style
|
|
hw/ip/aes/rtl` reports **307** violations; with
|
|
`--waiver-file <scratch>/opentitan.waiver` holding
|
|
|
|
```text
|
|
waive --rule=dff-name-style --line=226 --location=aes_key_expand.sv
|
|
```
|
|
|
|
it reports **306**, and the one line that disappears is exactly
|
|
`aes_key_expand.sv:226:12 … [dff-name-style]`. (The *default* rule set finds
|
|
nothing at all in `hw/ip/aes/rtl`, which is why the demonstration selects
|
|
every class.) `git -C ~/repo/opentitan status --porcelain` afterwards shows
|
|
only the three pre-existing modified files.
|
|
|
|
**Files touched outside the plan's expected set**
|
|
|
|
- `crates/vlog_linter/Cargo.toml` — the `lucisv_core` path dependency.
|
|
- `crates/lucisv_server/src/state.rs` — `Workspace::roots()`, an accessor.
|
|
- `crates/lucisv_server/tests/e2e.rs`, `crates/lucisv/tests/cli.rs` — tests
|
|
the plan asked for.
|
|
- `editors/vscode/README.md` — the settings table's row for
|
|
`lucisv.lint.waivers` (`README.md` at the repo root and everything under
|
|
`docs/site/` were owned by another process this round and are left alone;
|
|
their text is below).
|
|
|
|
## Docs to apply at merge (lead)
|
|
|
|
Ready to paste. The first block is for `README.md` (the linter section, after
|
|
the inline-waiver paragraph) and for
|
|
`docs/site/src/content/docs/guides/linter.md`.
|
|
|
|
```markdown
|
|
### Waivers
|
|
|
|
A finding is suppressed by a comment in the RTL:
|
|
|
|
```systemverilog
|
|
wire a; // lucisv: waive no-tabs
|
|
// lucisv: waive-start line-length
|
|
…
|
|
// lucisv: waive-stop line-length
|
|
```
|
|
|
|
`verilog_lint:` is accepted in place of `lucisv:`, so a Verible-annotated
|
|
codebase needs no editing.
|
|
|
|
It can also be suppressed from **outside** the RTL, in Verible's waiver file
|
|
format — one directive per line, `#` comments and blank lines ignored:
|
|
|
|
```text
|
|
# every line of every file
|
|
waive --rule=no-tabs
|
|
# one line, or a range with both ends included
|
|
waive --rule=line-length --line=12
|
|
waive --rule=line-length --line=12-20
|
|
# only the files a pattern names
|
|
waive --rule=no-tabs --location=legacy/top.sv
|
|
```
|
|
|
|
`--rule` is required and names exactly one rule — a severity word is not
|
|
accepted here. `--line` is 1-based. `--location` is matched the way an
|
|
`--exclude` pattern is: `*` stands for any run of characters *within* one path
|
|
component, a pattern containing `/` matches a path suffix, and one without
|
|
matches the file name at any depth. Unlike Verible's, it is **not** a regular
|
|
expression, and a pattern that looks like one (`.*`, `\.`, `[…]`) is an error
|
|
naming the difference rather than a pattern that silently matches nothing.
|
|
|
|
lucisv reads waiver files from three places, and they **add up**:
|
|
|
|
| Where | Paths relative to | Applies to |
|
|
| --- | --- | --- |
|
|
| `lucisv check --waiver-file <path>` (repeatable) | the working directory | that run |
|
|
| `waivers` under `[lint]` in `lucisv.toml` | that `lucisv.toml` | the CLI and the editor |
|
|
| `lucisv.lint.waivers` in an editor | the first workspace folder | the editor |
|
|
|
|
```toml
|
|
[lint]
|
|
waivers = [ "waivers/legacy.waiver" ]
|
|
```
|
|
|
|
External waivers and inline ones are a **union**: a finding either covers is
|
|
suppressed, and a finding both cover leaves neither reported as dead.
|
|
|
|
A waiver file that does not exist, or a directive that does not parse, fails
|
|
`lucisv check` with `<file>:<line>: <message>` and exit 2 — the same treatment
|
|
a bad `[lint.<rule>]` entry gets. In an editor the bad line is dropped, the
|
|
rest of the file still applies, and the problem is written once to the lucisv
|
|
log.
|
|
|
|
A waiver that suppressed nothing is itself reported, under the
|
|
`unused-waiver` rule: an inline one at the comment, an external one at its
|
|
line of the waiver file. **Only `lucisv check` reports unused external
|
|
waivers**, and only after the whole run has been linted — a `--location` may
|
|
name a file the run has not reached yet, and an editor never sees a whole run
|
|
at all.
|
|
```
|
|
|
|
For `docs/site/src/content/docs/reference/cli.md`, in the `lucisv check`
|
|
options table:
|
|
|
|
```markdown
|
|
| `--waiver-file <PATH>` | Read waiver directives from this file; repeatable. Adds to whatever `waivers` under `[lint]` in a `lucisv.toml` already names. Relative to the working directory. A missing file or an unparsable directive is an error (exit 2) |
|
|
```
|
|
|
|
For `docs/site/src/content/docs/start/configuration.md`, in the `lucisv.toml`
|
|
key table and the editor-settings table respectively:
|
|
|
|
```markdown
|
|
| `[lint] waivers` | `[]` | External waiver files, resolved against the `lucisv.toml`'s own directory. Verible's format; see the linter guide's Waivers section |
|
|
```
|
|
|
|
```markdown
|
|
| `lucisv.lint.waivers` | `[]` | External waiver files, absolute or relative to the first workspace folder; added to whatever `[lint] waivers` names. A missing file or an unparsable directive is logged and dropped. Unused external waivers are reported by `lucisv check` only |
|
|
```
|
|
|
|
And the edge for `docs/topo.md`: **`vlog_linter ──▶ lucisv_core`** —
|
|
`waiver_file.rs` matches a `--location` with `walk::is_excluded`, the same
|
|
matcher `--exclude` uses.
|
|
|
|
### 2026-09-05 — lead, at review
|
|
|
|
QA's HIGH closed in the tree: `lucisv_server::lint::fixable` now takes the
|
|
buffer's `LintRun` and lints with `lint_with(ctx, run.rules, run.external)`,
|
|
so a quick fix is never offered — and `source.fixAll.lucisv` never applied —
|
|
for a finding a checked-in waiver file waived; the code-action entry point
|
|
takes the run and the dispatch builds it with `LintRun::for_document`. This
|
|
also stops the code-action path from fixing under `default_rules()` while
|
|
the diagnostics pass runs the enabled set, a second pre-existing drift.
|
|
Pinned by `an_externally_waived_finding_gets_no_quick_fix_and_fix_all_leaves_it`.
|
|
The BOM LOW: a leading U+FEFF is stripped before the first directive is
|
|
read. The other LOW (a bad line in a file named by `[lint] waivers` is
|
|
dropped silently in the editor, the editor-setting path is logged) is
|
|
documented in the applied docs and folded into §42.2, which surfaces every
|
|
rejected project entry with file and line. The docs in "Docs to apply at
|
|
merge" are applied to README.md, the linter guide, cli.md, configuration.md
|
|
and topo.md.
|
|
|
|
## QA log
|
|
|
|
**2026-09-05 (QA).**
|
|
|
|
Read the plan (TODO §39), the feature README in full, and the diffs of
|
|
`crates/vlog_linter/src/{waiver_file.rs,waiver.rs,lib.rs}`,
|
|
`crates/lucisv_core/src/config.rs`,
|
|
`crates/lucisv/src/{args.rs,lint.rs,main.rs}`,
|
|
`crates/lucisv_server/src/{lint.rs,settings.rs,state.rs,server/notification.rs}`,
|
|
`editors/vscode/package.json` and `editors/vscode/README.md`, and the two test
|
|
files. Built `cargo build --release -p lucisv -p lucisv_server`, then attacked
|
|
the grammar, precedence and both front ends by hand, using scratch files under
|
|
the session scratchpad and read-only runs over opentitan. Every experiment
|
|
that needed a real request over the wire (server disk re-read, code-action
|
|
gap) was a temporary `#[test]` appended to `crates/lucisv_server/tests/e2e.rs`,
|
|
run under `tools/guard.sh`, then removed — `git diff --stat` on that file
|
|
after removal matches the dev's own 81-line addition exactly, confirming no
|
|
residue.
|
|
|
|
**CLI grammar — all shapes and errors, verified by direct reproduction.**
|
|
`--rule` alone, `--line=N`, `--line=N-M`, `--location=name.sv`,
|
|
`--location=dir/name.sv` (suffix), all three together in every order (3
|
|
permutations tried) — every shape suppresses exactly the finding(s) it should
|
|
and nothing else. Every error message in the Work Log fires with the
|
|
`<file>:<line>: message` shape and exit 2: bad keyword, missing `--rule`,
|
|
unknown rule, severity-as-rule, `--line=0`, `--line=9-5`, non-numeric
|
|
`--line`, doubled flag, unknown flag, `--regex=`, flag with no value, empty
|
|
value, a regex-looking `--location` (with the reason named). With three bad
|
|
lines in one file (line 1 fine, line 2 and 3 both bad), only line 2 is
|
|
reported — the **first** bad line, confirmed. With two waiver files
|
|
(`goodA.waiver` clean, `badB.waiver` bad), the error correctly names
|
|
`badB.waiver`, not a false-positive stop at the first file.
|
|
|
|
Edge cases: `--line=5-5` behaves as a one-line range; `--line=1-4` spanning
|
|
the whole 4-line file waives every occurrence; `--line=100` past EOF is
|
|
reported `unused-waiver`, never an error; `--location` naming a file absent
|
|
from the run is reported unused; `--location=f*.sv` and `--location=**/foo.sv`
|
|
both match via the `--exclude` glob semantics as documented; CRLF endings
|
|
parse every directive without shifting reported line numbers (multi-line CRLF
|
|
file tested, both directives fired); a UTF-8 BOM before `waive` is rejected
|
|
with a (slightly odd but non-corrupting) "found `\u{feff}waive`" message, exit
|
|
2 — acceptable, not a hazard; tabs between `--rule=`/`--line=`/`--location=`
|
|
words parse fine (`split_whitespace` handles them); `Waive` (capitalized) is
|
|
correctly rejected — the grammar is case-sensitive as specified; an empty
|
|
waiver file contributes nothing and errors nothing; a directory given as
|
|
`--waiver-file` surfaces the OS "Is a directory" error at exit 2; a
|
|
non-UTF-8 waiver file is rejected with "stream did not contain valid UTF-8",
|
|
exit 2. The same waiver file given twice via `--waiver-file` is read once —
|
|
confirmed by only one `unused-waiver` finding, not two, for a dead directive
|
|
in it.
|
|
|
|
Discovery combinations: `[lint] waivers` in a `lucisv.toml` (resolved
|
|
against the toml's directory) plus `--waiver-file` (resolved against the
|
|
cwd) from a **different cwd** than the toml's directory both applied
|
|
together correctly, suppressing both their respective lines. A `lucisv.toml`
|
|
pointing at a missing waiver file fails the run with the resolved absolute
|
|
path and exit 2.
|
|
|
|
**Precedence — union, exactly as specified.** A finding covered by both an
|
|
inline `// lucisv: waive` and a matching external directive is suppressed
|
|
once, and **neither** is reported unused. An inline waiver covering nothing
|
|
plus an external one covering the actual finding: the inline is reported
|
|
`unused-waiver`, the external (which fired) is not. `--select` excluding the
|
|
waived rule entirely makes the waiver silent (no `unused-waiver`) — consistent
|
|
with existing inline-waiver behavior and documented in the Assumptions.
|
|
`--fix` with a waived fixable violation: reproduced on a scratch copy (never
|
|
opentitan) — the waived line's tab was left untouched while an unwaived tab
|
|
on another line was fixed in the same run. Exit code and `--output-format
|
|
json`: an unused external waiver flows through as an ordinary violation
|
|
(`"filename":"<waiver-file>"`, correct line/column) and contributes to the
|
|
non-zero exit code.
|
|
|
|
**Server, over the wire (temporary e2e tests, removed after).** `[lint]
|
|
waivers` in a checked-in `lucisv.toml` suppresses a published diagnostic
|
|
(confirmed both standalone and combined with `lucisv.lint.waivers`).
|
|
`workspace/didChangeConfiguration` adding, then removing, then re-adding
|
|
`lucisv.lint.waivers` mid-session updates published diagnostics each time
|
|
(`[1,2] → [2] → [1,2] → [2]`, 0-based `no-tabs` lines, across four pushes) —
|
|
no reload needed. A waiver file **edited on disk while the server runs** is
|
|
re-read: verified by hand-driving the JSON-RPC stream (rather than the
|
|
`talk()` helper, which writes the whole session before reading anything, so
|
|
race-free ordering needed manual interleaving) — read the first publish,
|
|
*then* rewrote the waiver file on disk, *then* sent a no-op `didChange`, and
|
|
the second publish reflected the new file content with no restart. This
|
|
matches the Assumptions section's claim exactly. A bad directive in
|
|
`lucisv.lint.waivers` is logged once via `window/logMessage` (not
|
|
`showMessage`) when the setting arrives, not once per keystroke — confirmed
|
|
both by the dev's own e2e test (exactly 2 log lines for one bad rule + one
|
|
missing file) and by code inspection: `lint::violations_in`/`LintRun::for_
|
|
document` discard the read's problem list on every pass, so only
|
|
`notification.rs`'s one-time read at settings-arrival time can log anything.
|
|
The server never publishes `unused-waiver` for an external waiver, in any of
|
|
the above scenarios — confirmed.
|
|
|
|
One clarification volunteered here since it affects how a reader should
|
|
weight the "documented" note in the config.rs precedent: a bad `[lint]
|
|
waivers` entry from a *toml* (as opposed to the `lucisv.lint.waivers`
|
|
*setting*) is silently dropped by the server with **no log line at all** —
|
|
`notification.rs::waiver_problems` only inspects the setting's own paths
|
|
(`FileConfig::default()` is passed, discarding the buffer's real config).
|
|
This is consistent with the server's pre-existing treatment of a bad
|
|
`[lint.<rule>]` entry (`lint.rs::configured`'s comment: "dropped here rather
|
|
than reported... which is where a config error belongs" — i.e. `lucisv
|
|
check`'s job), so it is not a new inconsistency, but it means a typo in a
|
|
checked-in `lucisv.toml`'s `[lint] waivers` is invisible in the editor with no
|
|
log trace at all (only `lucisv check` will ever catch it). Not filing this as
|
|
a defect since it matches standing precedent, but noting it because the plan
|
|
text's single sentence ("the server logs it through notification.rs and
|
|
drops that line, never the file") reads as if it covers all three discovery
|
|
paths, and it does not — it covers only the editor setting.
|
|
|
|
**Opentitan (read-only).** Reproduced exactly: `--select error,warning,style
|
|
hw/ip/aes/rtl` → **307**; with the `dff-name-style --line=226
|
|
--location=aes_key_expand.sv` waiver → **306**, and the missing line is
|
|
confirmed to be `aes_key_expand.sv:226:12 … [dff-name-style]`. Added: the
|
|
`--location` **suffix** form `aes/rtl/aes_key_expand.sv` → also **306**
|
|
(same result as the file-name form). A whole-file waiver
|
|
(`--rule=port-name-suffix --location=aes_wrap.sv`, no `--line`) → **304**
|
|
(three `port-name-suffix` findings in that file, all gone, zero remaining).
|
|
A waiver naming a file outside the run (`--location=nonexistent_file_xyz.sv`)
|
|
produces exactly one `unused-waiver` line. `git -C
|
|
~/repo/opentitan status --porcelain` after every run showed only the three
|
|
pre-existing modified files (`hw/ip/aes/dv/tb/tb.sv`,
|
|
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`).
|
|
|
|
**Gates (all guarded).** `cargo fmt --check`: clean. `cargo clippy
|
|
--all-targets`: clean, zero warnings. `tools/guard.sh -- cargo test
|
|
--workspace`: **3 764 passed, 0 failed, 44 ignored** — matches the dev's
|
|
figure exactly. `tools/guard.sh -- tools/corpus_check.sh`: **814/820
|
|
(99.3%)**, the same six pre-existing failures (one `end`, one identifier, one
|
|
expression, one declaration/instantiation, one `;`, one lex "number base").
|
|
`tools/guard.sh -- node editors/vscode/smoke.js target/release/lucisv-server`:
|
|
OK, 20 messages.
|
|
|
|
### Findings
|
|
|
|
**HIGH — the code-action path does not honor external waivers, and the
|
|
Assumptions section understates it.** `lucisv_server::lint::fixable`
|
|
(`crates/lucisv_server/src/lint.rs:334`, called from
|
|
`code_action::code_actions`, `crates/lucisv_server/src/code_action.rs:37`)
|
|
calls the old `lint(&ctx, &default_rules())` rather than `lint_with`, so it
|
|
never consults `LintRun::external`. **Inline waivers are still respected
|
|
here** — `lint()` internally still runs `Waivers::collect(ctx)` regardless of
|
|
the `external` argument, so an inline-waived finding correctly gets no quick
|
|
fix. **External waivers are not respected at all**, and this is
|
|
reproducible, not merely theoretical:
|
|
|
|
- Reproduction (temporary e2e test, removed after): a buffer with three
|
|
tabbed lines — one inline-waived (`// lucisv: waive no-tabs`), one
|
|
externally waived via a `lucisv.toml`'s `[lint] waivers` pointing at a
|
|
waiver file with `--rule=no-tabs --line=3`, one waived by neither.
|
|
Published diagnostics correctly show only the un-waived line. A
|
|
`textDocument/codeAction` request over the whole buffer returns **two**
|
|
quickfix actions: the un-waived line (expected) **and the externally
|
|
waived line** (not expected — no action should exist for it at all). Worse,
|
|
a `source.fixAll.lucisv` request (what an editor's "format/fix on save"
|
|
sends) **actually rewrites the externally-waived line**, turning its tab
|
|
into spaces — silently overriding the waiver a team member wrote into a
|
|
checked-in `lucisv.toml`.
|
|
- The Assumptions section's claim — "A waived finding was never published,
|
|
so no lightbulb is offered for it in practice; the mismatch is pre-existing
|
|
and out of scope here" — is only half right. It is accurate for a finding
|
|
an *inline* waiver covers (no lightbulb, confirmed). It is **not** accurate
|
|
for a finding only an *external* waiver covers: `code_actions` never
|
|
consults the published diagnostics list or the request's `range` against
|
|
what the client already sees — it recomputes `fixable()` independently and
|
|
offers/applies whatever it finds, waiver or not. The QA brief's own
|
|
framing ("it is pre-existing for inline waivers too") does not hold up
|
|
against this reproduction — the inline case is fine; only the external one
|
|
is broken, and it is broken in a way that actively edits code
|
|
(`fixAll`), not merely in a way that could theoretically surface a
|
|
quickfix nobody clicks.
|
|
- This does not violate the CLAUDE.md corruption invariant (the output is a
|
|
valid, idempotent formatting change, just one the team asked to suppress
|
|
for that line) but it does defeat the stated purpose of an external
|
|
waiver for anyone with fix-on-save enabled, which is a common editor
|
|
default. Recommend `fixable` take the buffer's `ExternalWaivers` (already
|
|
computed once per `LintRun`) the same way `violations_in` does, or, if a
|
|
fix for 0.42.0 is out of scope, correcting the Assumptions section to state
|
|
the real risk plainly (external waivers are not honored by the editor's
|
|
quick-fix or fix-on-save code path) rather than describing it as
|
|
no-observable-difference.
|
|
|
|
**LOW — BOM message is unusual but not a hazard.** A waiver file with a
|
|
leading UTF-8 BOM produces `` expected a `waive` directive, found
|
|
`\u{feff}waive` `` (the BOM character embedded verbatim in the error text)
|
|
rather than a message about the BOM specifically. Exit 2, no corruption, and
|
|
BOM'd waiver files are not mentioned as a requirement anywhere in the plan —
|
|
recording this only because the QA brief asked for a BOM to be tried. Not
|
|
blocking.
|
|
|
|
**LOW — documentation precision.** The plan's discovery-rule bullet describes
|
|
the server logging behavior for a bad waiver line as if it applied uniformly
|
|
across all three discovery paths; in the implementation it applies only to
|
|
the `lucisv.lint.waivers` editor setting, and a bad `[lint] waivers` entry
|
|
from a `lucisv.toml` is silently dropped with no log at all on the server
|
|
side. This matches the server's existing, unrelated precedent for
|
|
`[lint.<rule>]` entries, so it is not a code defect, just worth a line in the
|
|
feature README's Assumptions (or the merge docs) so a future reader is not
|
|
surprised that only the editor-setting path logs.
|
|
|
|
Everything else asked for in the QA brief — every directive shape and error,
|
|
every precedence combination, `--select`/`--ignore` interaction, `--fix`
|
|
interaction, server settings roundtrip, disk re-read, toml-via-server,
|
|
opentitan counts — checked out exactly as designed and documented.
|
|
|
|
**Verdict: REWORK** — one HIGH finding (the code-action/fixAll gap for
|
|
external waivers, and the inaccurate risk description of it in the
|
|
Assumptions section). Everything else in the feature — the CLI grammar, the
|
|
CLI's own `--fix`, precedence, discovery, the diagnostics-publishing half of
|
|
the server, and the opentitan demonstration — is solid and matches the plan
|
|
precisely. The lead's call on whether the HIGH finding blocks 0.42.0 or ships
|
|
with corrected documentation and a follow-up item; either way the
|
|
Assumptions section as written should not stand unchanged, since it asserts
|
|
something this QA pass showed to be false in the `fixAll` case specifically.
|
|
|
|
## Review
|
|
|
|
**2026-09-05 — lead.** Accepted with the rework above; ships in 0.42.0 with
|
|
§38. The format, discovery and precedence are the ruled ones, and the dev's
|
|
deviations hold: the `vlog_linter ──▶ lucisv_core` edge is the right price
|
|
for one pattern language across `--exclude` and `--location` (copying the
|
|
matcher would have made two), the `Pass` struct is plain plumbing, and the
|
|
setting joins the hand-written `select`/`ignore`/`options` rather than the
|
|
generator's per-rule toggles. QA's HIGH was real and is the kind of gap a
|
|
union has to be checked for at every consumer — the fix routes the last
|
|
consumer through the run. Unused-waiver reporting on the CLI only, after the
|
|
whole run, stays as ruled. The opentitan demonstration (307 → 306 by one
|
|
directive, 304 with a whole-file rule waiver) is the behaviour asked for.
|