Merge branch 'small-1'
This commit is contained in:
commit
ef9ce984b7
20 files changed
+1136
-74
No files matched your search
@@ -420,6 +420,27 @@ a **wrong** answer (a signal reported unused because the file that reads it
|
||||
happened to be cached), not a missing one. See
|
||||
`docs/features/semantic-lints-on/README.md`.
|
||||
|
||||
**`FACTS_FORMAT` 17 (2026-09-02, `macro-word-census`)** adds one more group,
|
||||
**`MW`**, written after `W`: the *raw half* of the same census
|
||||
(`vlog_semantic::words::harvest_raw`) — the words a file writes only inside a
|
||||
macro invocation, a directive line or an attribute, sorted. Two letters
|
||||
because the single letter `M` is already the member group; the framing is
|
||||
untouched, and `Reader::tag` compares a marker whole, so a two-letter tag is a
|
||||
tag like any other. It is written beside `W` rather than carved out of it: the
|
||||
lint rules' mention guard wants the union, and the rename wants the half
|
||||
nothing can edit. What it costs, measured the same way:
|
||||
|
||||
| tree | records | store at format 17 | `MW` bytes | delta |
|
||||
|---|---:|---:|---:|---:|
|
||||
| `corpus/` | 860 | 3 971 684 | 123 402 | **+3.11 %** |
|
||||
| opentitan | 3 979 | 44 858 329 | 743 873 | **+1.66 %** |
|
||||
|
||||
The bump is a correctness bump for the same reason 13 was: a 0.33.0 store
|
||||
holds no `MW` group at all, so a rename over a half-cached workspace would
|
||||
answer "no file names it in a macro" for exactly the files the store had — and
|
||||
silence about a macro argument the rename left behind is the failure the new
|
||||
warning exists to prevent. See `docs/features/macro-word-census/README.md`.
|
||||
|
||||
### Why one line per record
|
||||
|
||||
Because it is what makes the append log crash-safe with no framing of its own.
|
||||
|
||||
@@ -80,10 +80,17 @@ assumed.
|
||||
|
||||
**Requested of others (not done here)**
|
||||
|
||||
- *`crates/lucisv`'s owner (concurrent this round)*: a `lucisv check --rules-doc`
|
||||
flag that prints `vlog_linter::rules_markdown()` to stdout and exits 0.
|
||||
One `println!`; no other wiring. Until then the same output is available as
|
||||
`cargo run -p vlog_linter --example rules_markdown`.
|
||||
- ~~*`crates/lucisv`'s owner (concurrent this round)*: a `lucisv check
|
||||
--rules-doc` flag that prints `vlog_linter::rules_markdown()` to stdout and
|
||||
exits 0. One `println!`; no other wiring. Until then the same output is
|
||||
available as `cargo run -p vlog_linter --example rules_markdown`.~~
|
||||
**Delivered 2026-09-02 (`macro-word-census`, TODO §29.3, topo §2.9-5):**
|
||||
`lucisv check --rules-doc` prints it and exits 0, before rule selection and
|
||||
before any path is gathered; it is lint-only and takes no files. The example
|
||||
binary is removed — the flag is the tool now. Pinned in
|
||||
`crates/lucisv/tests/cli.rs` (`rules_doc_prints_the_generated_reference`
|
||||
asserts every registered rule has exactly one section, and that the output
|
||||
equals `rules_markdown()`).
|
||||
- *config-discovery's owner*: the `lint` key in `lucisv.toml` is what
|
||||
per-rule naming-style configuration waits on — the shape wanted is
|
||||
`[lint.parameter-name-style] style = "CamelCase"` picking one of the named
|
||||
|
||||
@@ -0,0 +1,461 @@
|
||||
# macro-word census (TODO §29)
|
||||
|
||||
## Goal
|
||||
|
||||
Three independent small items, one lane. **29.1** moves
|
||||
`vlog_refactor::rename::scope` to the crate root: the in-scope workspace every
|
||||
refactoring in the crate reads through was never rename-specific, and `ports`,
|
||||
`references` and `instantiate` all reached it through `rename`. A pure move.
|
||||
**29.2** is the substantive one and closes the server half of `docs/topo.md`
|
||||
§2.9-18. A rename says nothing about a file whose *only* relationship to the
|
||||
renamed name is a macro argument, because `Workspace::rename_sources` has no
|
||||
rung that finds such a file and the engine can only warn about files it was
|
||||
handed. The lead's ruling was that the missing rung must not be built — the
|
||||
union census (`FileFacts::words`) is untagged, so a rung on it would re-read
|
||||
every file spelling `clk` and bring back the 2.5–3.0 s `prepareRename` cost —
|
||||
and that a *separate* per-file census of the words a file writes only in
|
||||
unparsed text is the answer instead: something the server can **warn from
|
||||
without reading a byte**. That census is `FileFacts::macro_words`
|
||||
(`FACTS_FORMAT` 16 → 17), harvested by `vlog_semantic::words::harvest_raw`,
|
||||
asked of `WorkspaceIndex::files_naming_in_macros`, and appended as one warning
|
||||
per unread file by `lucisv_server::rename`. **29.3** wires
|
||||
`vlog_linter::rules_markdown()` — which has had only an example binary since
|
||||
lint-rules-2 — to `lucisv check --rules-doc`, closing §2.9-5.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **"Raw text" is exactly three token shapes**, and they are the three
|
||||
`vlog_semantic::words::harvest` already treated as raw: an `Ident` whose text
|
||||
starts with a backtick (a macro invocation, arguments included), a
|
||||
`Directive` and an `Attribute`. `harvest_raw` shares the predicate
|
||||
(`words::raw_text`) and the splitter (`words::raw_words`) with `harvest`, so
|
||||
the two cannot come to disagree about what counts.
|
||||
- **The raw census is therefore a superset of "names it in a macro
|
||||
*argument*"**: `` `ifdef sig ``, `(* keep = sig *)` and the macro's own name
|
||||
are in it too. Erring wide is deliberate — the alternative is silence about
|
||||
text the rename really did leave behind, which is the failure §2.9-18 is
|
||||
about. The engine's own warning, which is precise, still covers every file
|
||||
the engine read; this one only speaks for files it did not.
|
||||
- **`words` is untouched.** The lint rules' mention guard wants the union — a
|
||||
signal read only inside a `` `uvm_info `` argument is mentioned — so the raw
|
||||
half is written *beside* `words`, never carved out of it. Every word in
|
||||
`macro_words` is also in `words`; pinned in both `words.rs` and over a stored
|
||||
record.
|
||||
- **`fingerprint` is unchanged.** The census is derived from the same text by
|
||||
the same lex, so a second count would witness nothing the `words=` count does
|
||||
not already witness (a record lost, duplicated, or attached to the wrong
|
||||
file).
|
||||
- **A file that does not lex contributes no macro words**, the same
|
||||
all-or-nothing answer it already gives for `words` and for the parse.
|
||||
- **Subtracting the handed source set is enough to exclude open buffers.**
|
||||
`Workspace::rename_sources` puts every open buffer in the set it returns, so
|
||||
the server's filter needs no separate open-buffer pass. If that ever stops
|
||||
being true, the pin
|
||||
`a_file_that_only_names_the_symbol_in_a_macro_is_warned_about_unread` still
|
||||
passes but the warning could name a buffer the user has open — worth knowing.
|
||||
- **`--rules-doc` describes the build, not a run.** It is handled before rule
|
||||
selection and before any path is gathered, so it cannot be affected by
|
||||
`--select`, a `lucisv.toml`, or a file that does not lex.
|
||||
|
||||
## Handshakes
|
||||
|
||||
**Consumed**
|
||||
|
||||
- `vlog_parser::token::{Token, TokenKind}` — unchanged; `harvest_raw` reads the
|
||||
same three kinds `harvest` does.
|
||||
- `vlog_refactor::rename_name_at` (server) — already consumed; the server now
|
||||
keeps the name it returns rather than dropping it into the `match`, to ask
|
||||
the index the same question the engine was asked.
|
||||
- `crate::locate::display_name` (server) — how a file is named in a message,
|
||||
the same file-name-only rule the engine's `Scope::display` uses.
|
||||
- `vlog_linter::{rules_markdown, all_rules}` — `rules_markdown` was already
|
||||
public; `all_rules` is read by the new CLI test only.
|
||||
|
||||
**Promised**
|
||||
|
||||
- `vlog_semantic::words::harvest_raw(&[Token]) -> Vec<String>` — sorted,
|
||||
deduplicated, a subset of `harvest`'s answer over the same tokens.
|
||||
- `vlog_semantic::FileFacts::macro_words() -> &[String]` — the same list, per
|
||||
stored record.
|
||||
- `vlog_semantic::WorkspaceIndex::files_naming_in_macros(&str) -> impl
|
||||
Iterator<Item = FileId>` — the twin of `files_mentioning`, same linear walk
|
||||
with a binary search per record, over the shorter list.
|
||||
- **`FACTS_FORMAT` 16 → 17**, recorded in `facts.rs`'s doc comment with its
|
||||
reason: a 0.33.0 store holds no `MW` group and would answer "no file names it
|
||||
in a macro" for every file it cached — silence about a macro argument the
|
||||
rename really did leave behind, which is a wrong answer rather than a missing
|
||||
one. `lucisv_server::index_cache` stamps `FACTS_FORMAT` into its header
|
||||
already, so a store written by 0.33.0 is discarded whole with no change here.
|
||||
- **The record format gains one group, `MW`**, written after `W`. Two letters
|
||||
because the single letter `M` is the member group; the format's tags are
|
||||
arbitrary strings and `Reader::tag` compares them whole, so this is a tag
|
||||
like any other. A record without it does not decode (pinned).
|
||||
- `lucisv check --rules-doc` — prints `vlog_linter::rules_markdown()` on stdout
|
||||
and exits 0. Lint-only; takes no files (a path beside it is a usage error).
|
||||
|
||||
**Requested of others (not done here)**
|
||||
|
||||
- *The lead*: strike `docs/topo.md` §2.9-18 (server half delivered) and §2.9-5
|
||||
(`--rules-doc` delivered). This lane does not edit `topo.md`.
|
||||
- *Nobody*: `crates/lucisv_server/src/perf.rs` has no probe for a rename over a
|
||||
real tree, so the warning pass's cost is measured in this lane's own
|
||||
`#[ignore]`d probe in `vlog_semantic/tests/workspace.rs` instead of beside
|
||||
the other rename measurements. A probe in `perf.rs` would be the better home;
|
||||
`perf.rs` is outside this lane's file ownership, so it is filed, not written.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] 29.1 `Scope` at the crate root, counts identical
|
||||
- [x] 29.2a `words::harvest_raw`, sharing `raw_text`/`raw_words` with `harvest`
|
||||
- [x] 29.2b `FileFacts::macro_words`, `FACTS_FORMAT` 16 → 17, `MW` group
|
||||
- [x] 29.2c `WorkspaceIndex::files_naming_in_macros`
|
||||
- [x] 29.2d the server's warning, appended in `lucisv_server::rename::rename`
|
||||
- [x] 29.2e the pins: `harvest_raw` units, codec round-trip with and without
|
||||
`MW`, the format-16 rejection, the three-file server pin and its control
|
||||
- [x] 29.2f the README amendments (refactor-rename, semantic-lints-on,
|
||||
index-persistence)
|
||||
- [x] 29.3 `--rules-doc`, usage text, tests, example binary removed
|
||||
- [x] Store measurement on corpus and on OpenTitan
|
||||
- [x] Gates: fmt, clippy, `cargo test --workspace`, corpus gate, OpenTitan
|
||||
read-only sweep
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-09-02 — 29.1, `Scope` at the crate root
|
||||
|
||||
`git mv crates/vlog_refactor/src/rename/scope.rs
|
||||
crates/vlog_refactor/src/scope.rs`; `lib.rs` gains `mod scope;`
|
||||
(crate-private). `rename/mod.rs` keeps `pub(crate) use crate::scope::{display,
|
||||
Scope};` so every in-crate path that spells `crate::rename::Scope` — `check.rs`,
|
||||
`references.rs`, all five `ports/` modules — still resolves untouched, which is
|
||||
what keeps this a move rather than a rename of nine files. `warnings.rs`, the
|
||||
one importer that spelled it `super::scope::`, had to change and now says
|
||||
`crate::scope::`. The `//!` loses its "it lives under `rename` because …"
|
||||
sentence and gains the real reason it is at the root.
|
||||
|
||||
Two visibility spellings changed with no semantic effect: `Scope::index` and
|
||||
`Scope::file_id` were `pub(super)`, which at the crate root means the crate.
|
||||
Written as `pub(crate)` so the word says what it does.
|
||||
|
||||
Proof: `cargo test -p vlog_refactor` 86/5/52/63/0 — identical to the counts
|
||||
TODO §29 recorded — and `cargo test --workspace` 3 215 passed over 48 binaries,
|
||||
also identical. No public path changed (`Scope` is `pub(crate)`).
|
||||
|
||||
### 2026-09-02 — 29.3, `lucisv check --rules-doc`
|
||||
|
||||
`Options::rules_doc`, parsed from `--rules-doc`, listed in
|
||||
`check_flag_scopes`'s `lint_only` table (so `lucisv --rules-doc` says "only
|
||||
valid for `lucisv check`") and documented in the usage text under CHECK
|
||||
OPTIONS. The "no input files" check grew one branch: `--rules-doc` is the one
|
||||
invocation that needs no input, and being *given* one is a usage error
|
||||
(`--rules-doc takes no files`) rather than a path silently ignored.
|
||||
`run_check` prints `vlog_linter::rules_markdown()` and returns 0 before
|
||||
`select_rules` and before `gather`, so the answer is a property of the build.
|
||||
|
||||
`crates/vlog_linter/examples/rules_markdown.rs` removed — the flag is the tool
|
||||
now, which is what its own doc comment said it was waiting for.
|
||||
|
||||
No `docs/lint-rules.md` is checked in, so there was nothing to regenerate and
|
||||
no drift test to write. `docs/site/src/content/docs/reference/rules.md` was
|
||||
considered and is **not** generated text — it is a hand-written page with its
|
||||
own "Purpose" column, a badge and prose — so it is not a drift-test candidate
|
||||
either, and it is outside this lane's files.
|
||||
|
||||
Tests: `crates/lucisv/tests/cli.rs`
|
||||
`rules_doc_prints_the_generated_reference` (first line, exactly one `## <name>`
|
||||
section per registered rule, and the whole output equal to
|
||||
`vlog_linter::rules_markdown()`) and
|
||||
`rules_doc_refuses_files_and_belongs_to_check`; `args.rs`
|
||||
`rules_doc_is_the_one_check_that_needs_no_input`.
|
||||
|
||||
### 2026-09-02 — 29.2, the macro-word census and the warning it enables
|
||||
|
||||
**`words::harvest_raw`.** The raw-token match moved into `raw_text(&Token) ->
|
||||
Option<&str>` and both harvests branch on it, which is the whole
|
||||
anti-drift argument: there is one definition of "the parser never looked inside
|
||||
this token". `harvest`'s body is otherwise unchanged (the macro-invocation arm
|
||||
already came before the plain-`Ident` arm, and a backticked `Ident` still never
|
||||
reaches the plain arm), and the shared `sorted()` gives both the same canonical
|
||||
value. Pinned: the raw half holds only words seen as raw text, it is a subset of
|
||||
the whole census over five shapes, and a word written both ways is in both.
|
||||
|
||||
**`FileFacts::macro_words`.** A `Census { words, macro_words }` struct now
|
||||
carries both halves from the one lex through `parse_and_collect` and
|
||||
`facts_from_analysis`, so the two can never be built from different lexes of the
|
||||
same file — which also kept `facts_from_analysis` from growing a second
|
||||
positional `Vec<String>` parameter. `FileFacts::from_analysis` (the server's
|
||||
open-buffer path) builds it with `Census::of(tokens)`, so a buffer and its file
|
||||
on disk answer alike.
|
||||
|
||||
`FACTS_FORMAT` 16 → 17 with the reason in the doc comment. The group is
|
||||
written as **`MW`**, not `M` as §29 sketched: `M` is already the member group,
|
||||
and while a positional format could carry two `M` tags unambiguously, a reader
|
||||
of `facts.rs` could not. Tags are compared whole by `Reader::tag`, so a
|
||||
two-letter tag costs nothing. `update_file` / `absorb` / `remove_file` swap
|
||||
whole records and carry the new field with no change, as expected; `fingerprint`
|
||||
is deliberately untouched.
|
||||
|
||||
**`files_naming_in_macros`.** `files_mentioning`'s twin, same walk, over
|
||||
`macro_words`. Documented as a superset of "names it in a macro argument", with
|
||||
the reason.
|
||||
|
||||
**The server warning.** `lucisv_server::rename::rename` keeps the name
|
||||
`rename_name_at` returned and, after the engine answers, appends
|
||||
`unread_macro_warnings`: every file `files_naming_in_macros(old)` names that is
|
||||
not among the paths `rename_sources` handed the engine. **No new rung and no
|
||||
new `Workspace` method** — `rename_sources` already *returns* the path set it
|
||||
built, so the subtraction reads it directly; `state.rs` is untouched. Open
|
||||
buffers need no separate pass because `rename_sources` puts every one of them in
|
||||
that set. When the cursor is on nothing the whole workspace goes to the engine,
|
||||
so there is nothing outside the handed set and no warning is computed at all.
|
||||
|
||||
Pins (`crates/lucisv_server/src/rename.rs`): the three-file case —
|
||||
`sub.sv` declares `output logic sig`, `top.sv` connects `.sig(w)`, `far.svh`
|
||||
holds one `` `uvm_info(…, sig, …) `` line and nothing else — asserts the
|
||||
premise (`far.svh` is not in `rename_sources`'s result), that the rename edits
|
||||
`sub.sv` and `top.sv` and not `far.svh`, and that exactly one warning names
|
||||
`far.svh` with the census's sentence. The control gives `far.svh` an
|
||||
instantiation of `sub`, asserts it *is* a source, and demands exactly one
|
||||
warning naming it — the engine's "one opaque token" sentence, not the census's.
|
||||
No double warning.
|
||||
|
||||
A deviation from §29's sketch worth naming: the sketch had `top.sv` use
|
||||
`u.sig`, a hierarchical tail. That shape is `docs/topo.md` §2.9-23 — a
|
||||
cross-file instance-member tail does not resolve for rename, so `top.sv` would
|
||||
not be edited and the pin would have asserted the gap rather than the feature.
|
||||
The pin uses a port and a connection instead, which is the same three-file
|
||||
topology with the edit actually happening.
|
||||
|
||||
**Store measurement** (`the_macro_word_group_costs_this_many_store_bytes`, an
|
||||
`#[ignore]`d probe over `LUCISV_STORE_ROOT`, the house shape):
|
||||
|
||||
| tree | records | store bytes | `MW` bytes | share | records with ≥1 macro word |
|
||||
|---|---|---|---|---|---|
|
||||
| `corpus/` | 860 | 3 971 684 | **+123 402** | +3.11 % | 562 |
|
||||
| OpenTitan | 3 979 | 44 858 329 | **+743 873** | +1.66 % | 3 174 |
|
||||
|
||||
Small, as expected: the raw half is a few dozen words per file where the union
|
||||
census is hundreds, and OpenTitan's larger files dilute it further.
|
||||
|
||||
**Cost of the warning pass** (`the_macro_census_walk_costs_this_much_per_rename`,
|
||||
same probe file, release build, mean of 100):
|
||||
|
||||
| tree | name | `files_naming_in_macros` | `files_mentioning` |
|
||||
|---|---|---|---|
|
||||
| OpenTitan `hw/ip` (1 8xx files) | `clk` | 14 files, 69 µs | 77 files, 177 µs |
|
||||
| OpenTitan `hw/ip` | `rst_ni` | 95 files, 53 µs | 648 files, 155 µs |
|
||||
| OpenTitan (3 979 files) | `clk` | 58 files, 186 µs | 253 files, 528 µs |
|
||||
| OpenTitan | `rst_ni` | 172 files, 140 µs | 1 164 files, 466 µs |
|
||||
|
||||
Under 0.2 ms over the whole tree, against a rename that costs hundreds of
|
||||
milliseconds — and it reads no file, which is the property that made this the
|
||||
ruling instead of the rung.
|
||||
|
||||
**Gates.** `cargo fmt -p` for `vlog_refactor`, `vlog_semantic`,
|
||||
`lucisv_server`, `lucisv`; `cargo clippy --all-targets --workspace` 0 warnings;
|
||||
`cargo test --workspace` **3 226 passed, 0 failed, 42 ignored, 48 binaries**
|
||||
(baseline 3 215 / 40 / 48 — eleven new tests and two new `#[ignore]`d
|
||||
measurement probes); `scripts/corpus_gate.sh` **814/820**, the same six
|
||||
failures by the same categories; the OpenTitan `lucisv check` sweep is
|
||||
**byte-identical** to the one the pre-existing 0.33.0 release binary produces
|
||||
(223 violations, 1 file that cannot be lexed), and
|
||||
`git -C … opentitan status --porcelain` shows only the three files it showed
|
||||
before.
|
||||
|
||||
## QA log
|
||||
|
||||
### 2026-09-03 — verification, all in `.claude/worktrees/small-1` at `a4b8ca0`
|
||||
|
||||
**Gates.** `cargo fmt --all -- --check` clean. `cargo clippy --all-targets
|
||||
--workspace` clean, 0 warnings, and no new `#[allow]` in any file this lane
|
||||
touched. `cargo test --workspace --no-fail-fast`: summed **3 226 passed, 0
|
||||
failed, 42 ignored, over 48 binaries** (42 `Running` lines + 6 `Doc-tests`
|
||||
sections) — matches the dev's claim exactly. `git diff --stat d1821ff --
|
||||
crates/vlog_formatter/src/verify.rs` empty. `git diff --stat d1821ff
|
||||
--name-only` is exactly the §29 ownership list: `vlog_refactor` (lib.rs,
|
||||
scope.rs moved, rename/{mod,warnings}.rs), `vlog_semantic`
|
||||
(facts.rs/words.rs/workspace/{index,record}.rs + tests), `lucisv_server/src/
|
||||
rename.rs`, `lucisv` (args.rs/main.rs/tests/cli.rs), `vlog_linter/examples/
|
||||
rules_markdown.rs` (deleted), the four amended READMEs, the new
|
||||
`macro-word-census` README, and `TODO.md`. Nothing outside scope.
|
||||
|
||||
**29.1.** `git diff d1821ff -- crates/vlog_refactor` is exactly the described
|
||||
move: `mod scope;` in `lib.rs`, the re-export path change in `rename/mod.rs`
|
||||
(`super::scope::` → `crate::scope::`), the same in `warnings.rs`, the `//!`
|
||||
sentence swap, and the two `pub(super)` → `pub(crate)` visibility words on
|
||||
`Scope::index`/`Scope::file_id`. Nothing else changed in the crate.
|
||||
|
||||
**29.2 census correctness.** Read `words::raw_text`/`harvest_raw`/`raw_words`
|
||||
in `crates/vlog_semantic/src/words.rs`. Wrote my own probe (temporary,
|
||||
untracked `crates/vlog_semantic/tests/qa29_probe.rs`, run once via `cargo
|
||||
test -p vlog_semantic --test qa29_probe` then deleted — never left in the
|
||||
tree) over five hand-made shapes plus a comment case: a name only in a macro
|
||||
argument, only as a plain identifier, in both, inside a string literal inside
|
||||
a macro (must not count), inside a comment (must not count), and an escaped
|
||||
identifier (must not count) — all 7 assertions passed, confirming
|
||||
`harvest_raw ⊆ harvest` and the per-shape membership independently of the
|
||||
dev's own tests. Codec: `the_macro_word_group_round_trips_and_a_format_16_
|
||||
record_is_rejected` and `the_census_round_trips_through_the_record_format`
|
||||
read as claimed — a record with and without `MW` round-trips, and truncating
|
||||
the fields before the `MW` tag (what format 16 wrote) makes `decode` return
|
||||
`None`. `fingerprint` claim confirmed by reading `workspace/update.rs:142`:
|
||||
`fingerprint()` counts only `facts.words.len()`, never touches
|
||||
`macro_words`, and `git diff d1821ff -- crates/vlog_semantic/src/workspace/
|
||||
update.rs` is empty — the file is untouched by this lane, so the "unchanged"
|
||||
claim is true by construction, not just assertion.
|
||||
|
||||
**29.2 the warning, end to end, real binary.** Built `lucisv-server` and
|
||||
wrote a throwaway e2e test (untracked `crates/lucisv_server/tests/
|
||||
qa29_rename_e2e.rs`, modeled on `tests/e2e.rs`'s framing helpers, run once
|
||||
then deleted) that spawns the real binary, speaks framed JSON-RPC over
|
||||
stdio, and reproduces the three-file pin independently of the dev's Rust-
|
||||
level test: `sub.sv`/`top.sv`/`far.svh` on disk, `initialize` +
|
||||
`didChangeConfiguration` (workspace scope) + `didOpen(top.sv)` +
|
||||
`textDocument/rename` of `sig` at the `.sig(w)` connection. Result: the edit
|
||||
touches exactly `sub.sv` and `top.sv` (not `far.svh`); exactly one
|
||||
`window/logMessage` warning names `far.svh`, with the census's sentence
|
||||
("this rename did not read ... a macro argument cannot be edited"). The
|
||||
control (`far.svh` also instantiates `sub`) produces exactly one warning
|
||||
naming it — the engine's own "one opaque token" sentence — no double
|
||||
warning. Both pass.
|
||||
|
||||
**29.2 on OpenTitan, real tree, read-only.** `git -C opentitan status
|
||||
--porcelain` before touching anything 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`) — unchanged after every rename
|
||||
request below, confirmed again at the end. Renaming `clk_i` (aes_core.sv)
|
||||
and `idle` (aes_idle_check.sv) produced only the engine's own pre-existing
|
||||
warning sentences ("appears in the arguments of the macro invocation" /
|
||||
"in the body of macro") — common names pull in most of the fan-out via
|
||||
rung 1's declaration walk, leaving nothing census-only, which is itself a
|
||||
useful negative check (no spurious census warnings on real code). To find a
|
||||
positive, organic instance I wrote a throwaway probe (`git worktree add
|
||||
.claude/worktrees/qa-play-29 a4b8ca0`, one `#[ignore]`d test appended to
|
||||
`rename.rs`'s own `mod tests`, removed with the worktree afterward) that
|
||||
scans every word `aes_core.sv` declares for one where `files_naming_in_
|
||||
macros` names a file `rename_sources` does not hand the engine. It found
|
||||
`cipher_crypt` (declared `sp2v_e cipher_crypt;`, aes_core.sv:178) named
|
||||
inside `` `DV_CHECK_FATAL(uvm_hdl_read(cipher_crypt_path, cipher_crypt)) ``
|
||||
at `aes_reseed_vseq.sv:151` — grepped and confirmed genuine, a coincidental
|
||||
name collision with that file's own unrelated local `bit cipher_crypt;`
|
||||
(line 100), no reference relationship. Renaming `cipher_crypt` →
|
||||
`cipher_crypt2` with the real server against the real tree: edit touches
|
||||
only `aes_core.sv` (3 ranges — the declaration and its two uses), 2 engine
|
||||
warnings for the file's own two `` `ASSERT `` lines it did read, and exactly
|
||||
**one** census warning naming `aes_reseed_vseq.sv`, worded exactly as
|
||||
promised. Built the 0.33.0 binary from the `v0.33.0` tag in a throwaway
|
||||
worktree and re-ran the identical rename against a store of its own: it
|
||||
produces only the 2 engine warnings — the `aes_reseed_vseq.sv` warning is
|
||||
categorically absent, which is the silent gap §29.2 closes, demonstrated
|
||||
end to end on real, unmodified OpenTitan source (not a synthetic fixture).
|
||||
|
||||
**Timing.** Built both a `v0.33.0` release binary (throwaway worktree) and
|
||||
the dev's release binary, each warmed against its own persistent store
|
||||
directory (distinct `FACTS_FORMAT`s cannot share one), and timed only the
|
||||
`textDocument/rename` round trip via a small streaming harness (spawn,
|
||||
drain until indexing quiesces, then time request→response). For
|
||||
`cipher_crypt` (the realistic, narrow-fan-out case): baseline 20.8/27.4/22.9
|
||||
ms, dev 24.6/20.8/20.8 ms — indistinguishable, no measurable regression. For
|
||||
`clk_i` (a maximal, ~650-file fan-out dominated entirely by the pre-existing
|
||||
engine walk): baseline 7 104–7 173 ms, dev 7 182–7 247 ms over 4 runs each —
|
||||
a consistent but small ~70 ms (~1%) gap at this extreme. That total includes
|
||||
everything the round trip does (fan-out, engine analysis, cache decode of
|
||||
the wider per-file record), not only the isolated walk the dev's own probe
|
||||
measured directly (~0.2 ms over the whole tree); I did not further isolate
|
||||
the source of the ~70 ms and flag it MEDIUM rather than a blocker, since (a)
|
||||
it appears only at an extreme, uncommonly-large fan-out no real rename
|
||||
target should usually reach, (b) it is two orders of magnitude below the
|
||||
already-accepted ~7 s cost of that fan-out itself, and (c) the dev's own
|
||||
narrowly-scoped measurement of the actual new code path is independently
|
||||
reproducible and small. Re-ran the dev's own ignored probes directly:
|
||||
`the_macro_word_group_costs_this_many_store_bytes` over `corpus/` gives
|
||||
**860 records, 3 971 684 store bytes, 123 402 MW bytes (3.11%), 562 with a
|
||||
macro word** — byte-identical to the dev's numbers — and over `opentitan`
|
||||
gives **3 979 records, 44 858 329 bytes, 743 873 MW bytes (1.66%), 3 174**,
|
||||
also identical.
|
||||
|
||||
**Format-16 → 17 store rebuild.** Built a scratch one-file workspace, ran
|
||||
the 0.33.0 binary against a fresh store directory (header written:
|
||||
`lucisv-index-cache 2 16 0.33.0`), then ran the dev binary against the
|
||||
*same* store directory: the header flips to `... 17 0.33.0` and the single
|
||||
record is rewritten in full (new checksum, new `MW 4 ...` group appended) —
|
||||
a whole-record rebuild, not a patch, exactly as `IndexCache::open`'s
|
||||
header-mismatch-discards-everything logic (unmodified by this lane —
|
||||
confirmed via `git diff d1821ff -- crates/lucisv_server/src/index_cache.rs`
|
||||
being empty) predicts. No explicit "stale store" log line exists or is
|
||||
claimed; the discard is silent by construction, which matches the README.
|
||||
|
||||
**29.3.** `lucisv check --rules-doc` prints the reference and exits 0; the
|
||||
output has exactly 17 `## <name>` sections, matching
|
||||
`vlog_linter::registry::all_rules().len()` (17). `lucisv check --rules-doc
|
||||
<file>` and `lucisv --rules-doc <file>` both exit 2 with "`--rules-doc`
|
||||
takes no files"; `lucisv --rules-doc` (no file, format mode) exits 2 with
|
||||
"`--rules-doc` is only valid for `lucisv check`". `crates/vlog_linter/
|
||||
examples/` no longer exists. The flag is documented under `CHECK OPTIONS
|
||||
(`lucisv check` only):` in `--help`. `cargo test -p lucisv rules_doc` — all
|
||||
3 tests pass (`args::tests::rules_doc_is_the_one_check_that_needs_no_input`,
|
||||
`cli::rules_doc_prints_the_generated_reference`,
|
||||
`cli::rules_doc_refuses_files_and_belongs_to_check`).
|
||||
|
||||
**Store growth / corpus / OpenTitan sweep.** `scripts/corpus_gate.sh
|
||||
corpus` (main tree's corpus, this worktree has none of its own): **814/820
|
||||
(99.3%)**, same five failure categories the dev listed. Built a `v0.33.0`
|
||||
release `lucisv` from the tag in a throwaway worktree and ran `lucisv check`
|
||||
over OpenTitan with both binaries: identical exit code 2, identical line
|
||||
count (225), **identical MD5** — byte-for-byte the same 223 violations plus
|
||||
the same 1 file that cannot be lexed. OpenTitan `git status --porcelain`
|
||||
unchanged (only the three pre-existing files) throughout every experiment
|
||||
in this QA pass.
|
||||
|
||||
**Docs.** All four README amendments (`refactor-rename`,
|
||||
`semantic-lints-on`, `index-persistence`, `lint-rules-2`) spot-checked
|
||||
against the code and measurements above and read as true. `git diff
|
||||
d1821ff -- docs/topo.md` is empty, matching this lane's own claim that it
|
||||
does not edit `topo.md` — §2.9-5/§2.9-18 remain open there, correctly left
|
||||
for the lead to strike. `TODO.md` §29's four checked items match verified
|
||||
reality; the QA line is closed by this pass.
|
||||
|
||||
**Housekeeping.** All experiments used either untracked scratch test files
|
||||
in the dev worktree (created, run, then deleted — `git status --porcelain`
|
||||
confirmed clean before and after) or the required throwaway worktrees
|
||||
(`qa-play-29`, `qa-play-29-baseline`, `qa-play-29-v33`, all branched from
|
||||
`a4b8ca0`/`v0.33.0` and removed with `git worktree remove --force` when
|
||||
done). No tracked file in `.claude/worktrees/small-1` was touched other
|
||||
than this README. Noted in passing, not caused by this QA pass and outside
|
||||
its scope: `master` and `.claude/worktrees/small-2` changed during this
|
||||
session (a `small-2` merge landed on `master`) — that was other, concurrent
|
||||
activity in this multi-lane workflow, not a QA action; `small-1` was never
|
||||
touched by it.
|
||||
|
||||
**Findings.** None forcing rework. One MEDIUM note: a ~1% (~70 ms)
|
||||
end-to-end timing gap at an extreme, uncommon fan-out size (`clk_i` across
|
||||
all of OpenTitan) that I could not further isolate within this pass; not
|
||||
reproduced at a realistic fan-out size, and small next to the ~7 s baseline
|
||||
cost of that fan-out itself. Everything else — correctness, the warning's
|
||||
edit/no-edit/no-double-warning behavior on both a crafted pin and an
|
||||
organic OpenTitan example, the format bump and its silent whole-store
|
||||
rebuild, `--rules-doc`, store growth, and documentation — verified exactly
|
||||
as claimed.
|
||||
|
||||
**Verdict: PASS.**
|
||||
|
||||
## Review
|
||||
|
||||
**2026-09-02 — lead.** Accepted. The census does what the §2.9-18
|
||||
ruling asked and nothing more: a second sorted list per file, read from
|
||||
the same lex, consulted by binary search, and the server *warns* from it
|
||||
without reading a file — 58 files in 186 µs on opentitan, against the
|
||||
2.5–3.0 s a `files_mentioning` rung would have cost. QA's organic find
|
||||
(`cipher_crypt` named inside a `` `DV_CHECK_FATAL `` in a sequence file
|
||||
that 0.33.0's rename never mentioned) is the whole point of the item in
|
||||
one example. The three decisions are right: `MW` because `M` is taken;
|
||||
no new rung because `rename_sources` already returns the set it built;
|
||||
and the pin retargeted to a shape that actually resolves rather than
|
||||
one that would have pinned §2.9-23's gap as if it were this item's.
|
||||
`--rules-doc` is small and complete, and removing the example binary is
|
||||
the right call now that the flag exists. The `Scope` move is a pure
|
||||
move with counts identical. The MEDIUM timing note (≈70 ms at an
|
||||
extreme fan-out, invisible at a realistic one, unisolated) is recorded
|
||||
and not chased: the pass is measured at 0.2 ms and the gap sits inside
|
||||
the pre-existing fan-out. Filed by the dev and accepted: a `perf.rs`
|
||||
probe for the rename warning pass. Ships in 0.34.0.
|
||||
@@ -1824,3 +1824,27 @@ would pull in every file that writes the word `clk`, and `rename_sources`
|
||||
`prepare_rename_here` exists to avoid. Accepting the cost, capping the extra
|
||||
set, or answering it in the server from the index without reading anything are
|
||||
three real options; the round has no evidence for choosing and does not.
|
||||
|
||||
**§2.9-18 closed, 2026-09-02 (`macro-word-census`, TODO §29.2): the third
|
||||
option.** The lead ruled against the rung, for the reason above, and for a
|
||||
*second* census instead — one the server can warn from without reading a byte.
|
||||
`vlog_semantic::words::harvest_raw` harvests the words a file writes only
|
||||
inside a macro invocation, a directive line or an attribute; they are stored
|
||||
per file as `FileFacts::macro_words` (`FACTS_FORMAT` 16 → 17) and asked of
|
||||
`WorkspaceIndex::files_naming_in_macros`, the twin of `files_mentioning` over
|
||||
the shorter list. `lucisv_server::rename::rename` appends one sentence per file
|
||||
that census names and `rename_sources` did **not** hand the engine:
|
||||
|
||||
> `` `sig` `` also appears inside a macro invocation in `far.svh`, which this
|
||||
> rename did not read; check it by hand — a macro argument cannot be edited.
|
||||
|
||||
No rung was added and `Workspace` gained no method: `rename_sources` already
|
||||
returns the path set it built, so the server subtracts it directly — which also
|
||||
excludes every open buffer, because that set contains them. The engine's own
|
||||
`macro_use_warnings` is unchanged and still speaks for every file the engine
|
||||
read, so a file that *is* a source is warned about exactly once, in the
|
||||
engine's more precise words (pinned by the control test
|
||||
`a_macro_file_the_rename_does_read_is_warned_about_exactly_once`). The pass
|
||||
costs under 0.2 ms over all 3 979 OpenTitan files and reads nothing, so the
|
||||
`prepare_rename_here` cost stays gone. Details and measurements:
|
||||
`docs/features/macro-word-census/README.md`.
|
||||
@@ -183,6 +183,20 @@ their arguments" is exactly what `FileFacts::words` now holds, and
|
||||
stop losing its informational macro-argument warnings — not wired here, filed
|
||||
in Handshakes.
|
||||
|
||||
**Amended 2026-09-02 (`macro-word-census`, TODO §29.2).** It could not be read
|
||||
as it stands: this census folds the raw words *into* the plain ones, so it
|
||||
answers "does this file name `clk`" and not "does it name `clk` where nothing
|
||||
can edit it" — and a rename asking the first question would pull in every file
|
||||
writing `clk`. So the same split is written down a second time, beside this
|
||||
one, and this one is **unchanged**: `words::harvest_raw` returns the raw half
|
||||
alone, stored as `FileFacts::macro_words` (`FACTS_FORMAT` 16 → 17, `MW`) and
|
||||
queried through `files_naming_in_macros`. Both harvests branch on the same
|
||||
`words::raw_text` predicate and split with the same `raw_words`, so the table
|
||||
above describes both and they cannot drift. The lint rules keep reading
|
||||
`words`, deliberately: a signal read only inside a `` `uvm_info `` argument
|
||||
*is* mentioned, and the union is the false-negative-safe answer.
|
||||
See `docs/features/macro-word-census/README.md`.
|
||||
|
||||
### Why there is no inverted index
|
||||
|
||||
The obvious shape is `BTreeMap<String, Vec<FileId>>`, built in
|
||||
|
||||
Reference in new issue
Block a user