Walker cycle policy by directory identity, and comment slots around a net delay's #
TODO §43 (docs/features/walk-cycles). Closes topo §2.9-8 and §2.9-27 and
repository-analysis finding 3; §2.9-30 filed.
43.1 `lucisv_core::walk::Walk` keeps a `visited` set keyed on `(dev, ino)`
(the canonical path off unix): each directory is entered once, a symlink
to one already entered is skipped, one not yet entered is followed once,
a dangling directory link is skipped. A dangling link that names a source
file is still handed on, so the front end's "no such file" error survives
(review ruling on QA's finding). Both front ends share the walk unchanged
in signature; a cyclic workspace indexes and a cyclic tree formats, each
file once.
43.2 `NetDelay::{before_hash, after_hash}`: the gaps around `#` have
slots, printed inline; the `#SKIP` in net_delay_position.cases is live
and the RTL gap fuzzer covers the construct (374 gaps, 0 failures).
Byte-identity vs 0.42.0: 0 of 820 corpus files differ. On opentitan the
only per-file change is §41's dedup reporting a same-directory symlink
alias once.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
4b2dad87fe
commit
ec9ec42276
13 files changed
+807
-41
No files matched your search
@@ -102,7 +102,8 @@ the last two shapes in that sweep that were grammar work rather than
|
||||
before-type spelling has behaved this way since the delay was first
|
||||
parsed — and the new position inherits it unchanged. Recorded as a `#SKIP`
|
||||
case in `net_delay_position.cases`, not fixed: giving the delay a comment
|
||||
slot is a `comment-slots` change. The other gaps around a delay (an
|
||||
slot is a `comment-slots` change. **Closed by walk-cycles (TODO §43.2),
|
||||
2026-09-05:** `NetDelay::{before_hash, after_hash}`; the `#SKIP` is live. The other gaps around a delay (an
|
||||
attribute in front of the declaration, a comment after the delay) do
|
||||
round-trip.
|
||||
|
||||
@@ -151,7 +152,8 @@ the last two shapes in that sweep that were grammar work rather than
|
||||
- **`comment-slots`**: a net delay has no slot for the comment written
|
||||
immediately in front of its `#`, so such a file is refused by the safety
|
||||
net rather than reformatted. Pre-existing, both positions, recorded as a
|
||||
`#SKIP` case (see Assumptions).
|
||||
`#SKIP` case (see Assumptions). **Answered by walk-cycles (TODO §43.2),
|
||||
2026-09-05.**
|
||||
|
||||
## Status / TODO
|
||||
|
||||
|
||||
@@ -0,0 +1,447 @@
|
||||
# walk cycles
|
||||
|
||||
## Goal
|
||||
|
||||
Two unrelated residues of the repository analysis (finding 3), landed
|
||||
together as TODO §43 because each is small and neither collides with the
|
||||
other.
|
||||
|
||||
**43.1 — a cycle policy for the shared walk.** `lucisv_core::walk` recursed
|
||||
on `Path::is_dir()` with no memory of where it had been. A symlink that
|
||||
points back into the tree it sits in — `a/loop -> ../a`, `a/sub/up -> ..`,
|
||||
the `rtl -> ../shared/rtl` pair a vendored checkout writes twice — made the
|
||||
walk descend forever, one directory deeper each time, until the operating
|
||||
system refused the path. Both front ends share that walk: `lucisv` (and so
|
||||
`format`, `check`, `--check`, `--diff`) and the language server's index scan,
|
||||
where the symptom is not an error message but an index that never comes up.
|
||||
The policy is now **each directory is entered once, by identity**: a symlink
|
||||
naming a directory the walk has already entered is skipped silently, and a
|
||||
symlink naming one it has not is still followed, once. No traversal budget —
|
||||
identity *is* the policy, and a budget would be a second, weaker rule
|
||||
answering the same question differently.
|
||||
|
||||
**43.2 — the net delay's comment slots.** `wire /* c */ #5 w;` and
|
||||
`wire [7:0] /* c */ #1 w;` were refused outright: `NetDelay` had no field for
|
||||
a comment written in front of its `#`, so the comment was printed one node
|
||||
later and `verify.rs` — correctly — refused the whole file (exit 2, no
|
||||
output). `NetDelay` now owns both of its gaps, `before_hash` and
|
||||
`after_hash`, and the `#SKIP` `parser-skips` left in
|
||||
`net_delay_position.cases` is retired.
|
||||
|
||||
## Assumptions
|
||||
|
||||
- **Directory identity on unix is `(dev, ino)`.** `fs::metadata` follows
|
||||
symlinks, so the link and its target return the same pair, which is exactly
|
||||
the question being asked. Elsewhere (there is no non-unix CI today, but the
|
||||
crate compiles there) it is `fs::canonicalize`, which resolves the same way
|
||||
at the cost of a path lookup. Both are `Option`: a name whose metadata
|
||||
cannot be read is not a directory the walk can enter.
|
||||
- **A hard link is not a cycle, and is not treated as one.** Two hard-linked
|
||||
*files* have one inode and the visited set never sees them: only
|
||||
directories are recorded. (Hard-linked directories are not creatable on any
|
||||
filesystem lucisv runs on.)
|
||||
- **The visited set lives for one `collect_files` call.** Two inputs named on
|
||||
one command line each get their own walk, so a directory reachable from
|
||||
both is still walked twice — unchanged, and the CLI's own path dedup is
|
||||
what answers that (`§41`). Inside one walk the same file reached under two
|
||||
spellings is reported once, under the first spelling that reaches it: entry
|
||||
order is `read_dir` sorted by path, so `link_a/x.sv` wins over `shared/x.sv`
|
||||
and `shared/x.sv` wins over `zlink/x.sv`. This is the same rule §41 already
|
||||
applies to a symlinked *file*.
|
||||
- **A dangling symlink is not an input.** `metadata` fails on it, so it is
|
||||
neither walked nor collected. Before this round a dangling `x.sv` link was
|
||||
collected and failed later, at read time, with a "no such file" error the
|
||||
user did not write.
|
||||
- **The `.gitignore`/`--exclude` decision still comes first.** A cycle inside
|
||||
an ignored or excluded directory is never entered at all, so the visited
|
||||
set never sees it; the ignore rules were not touched.
|
||||
- **A comment in front of a `#` belongs to the delay** (43.2), the way
|
||||
`Typedef::before_name` owns the gap in front of its name: the gap is taken
|
||||
only on the branch that actually consumes the `#`, so a `#` that is not a
|
||||
net delay leaves the comment for whoever comes next.
|
||||
|
||||
## Handshakes
|
||||
|
||||
- **`lucisv_core::walk` → `lucisv` and `lucisv_server`** (topo §2.9-8, struck
|
||||
by this round). `collect_files`'s signature is unchanged. What changed is
|
||||
what it returns for a tree containing symlinked directories: it terminates,
|
||||
and a directory reachable under several names contributes its files once.
|
||||
`lucisv_server::state::Workspace::walked_files` is the server's only caller
|
||||
and needed no change — its `sort`/`dedup` still runs, and now has less to
|
||||
do. `vlog_linter` uses `walk::is_excluded` only, which is untouched.
|
||||
- **`vlog_parser::ast::NetDelay` → `vlog_formatter`** (topo §2.9-27, struck).
|
||||
Two new public fields, `before_hash` and `after_hash`, both
|
||||
`Vec<Comment>`. The only constructor is `Parser::parse_net_delay`; the only
|
||||
reader is `Fmt::net_delay`. `vlog_semantic`, `vlog_linter` and
|
||||
`vlog_refactor` do not name the type.
|
||||
- **Not taken:** the gaps *inside* a delay's `#( … )` — `#( /*c*/ 1:2:3 )`
|
||||
and each side of its two `:` — are still refused. They are
|
||||
`parse_delay_values`, shared with a gate instantiation's delay list, and
|
||||
they fail identically outside a net declaration; they belong with the rest
|
||||
of the shared expression machinery in topo §2.9-22, not here. Recorded
|
||||
below and left for a future round.
|
||||
|
||||
## Status / TODO
|
||||
|
||||
- [x] 43.1 `Walk::visited`, `Walk::enter`, `dir_id` per platform; `dir()`
|
||||
checks-and-inserts before `read_dir`
|
||||
- [x] 43.1 a dangling symlink is skipped rather than collected
|
||||
- [x] 43.1 unit tests: self-loop, ancestor link from a nested start, two
|
||||
links to one target, a link to a directory not yet walked, a dangling
|
||||
link, a cycle inside an ignored directory
|
||||
- [x] 43.1 CLI test (`--check` over a cyclic tree names each file once)
|
||||
- [x] 43.1 server test (a cyclic workspace scans once and finishes)
|
||||
- [x] 43.2 `NetDelay::before_hash` + `after_hash`, parser and formatter
|
||||
- [x] 43.2 the `#SKIP` in `net_delay_position.cases` retired, three live
|
||||
cases in its place
|
||||
- [x] 43.2 the RTL gap fuzzer covers a net delay (352 → 374 gaps, still zero
|
||||
failures)
|
||||
- [x] Gates: fmt, clippy, workspace tests, corpus, both binaries over a
|
||||
cyclic tree
|
||||
|
||||
## Docs to apply at merge (lead)
|
||||
|
||||
- `docs/topo.md` §2.9-8 — strike: **delivered 2026-09-05 by walk-cycles
|
||||
(TODO §43.1)**: `lucisv_core::walk::Walk` keeps a `visited` set keyed on
|
||||
`(dev, ino)` on unix and the canonical path elsewhere; each directory is
|
||||
entered once, a symlink to a directory already entered is skipped
|
||||
silently, a symlink to one not yet entered is still followed, a dangling
|
||||
symlink is skipped. Both front ends: CLI `--check` over a cyclic tree names
|
||||
each file once; the server's `walked_files` scan finishes.
|
||||
- `docs/topo.md` §2.9-27 — strike: **delivered 2026-09-05 by walk-cycles
|
||||
(TODO §43.2)**: `NetDelay::before_hash` and `after_hash` own the two gaps
|
||||
around the `#`; the formatter prints them inline; the
|
||||
`net_delay_position.cases` `#SKIP` is retired and the RTL gap fuzzer covers
|
||||
the construct. The gaps *inside* `#( 1:2:3 )` remain refused and belong to
|
||||
§2.9-22 (`parse_delay_values`, shared with gate delays).
|
||||
- `docs/repository-analysis.md` finding 3 — annotate as closed by TODO §43.1
|
||||
with the identity policy above, and note that the "no traversal budget"
|
||||
ruling was the lead's.
|
||||
- `docs/features/parser-skips/README.md` — its Assumptions (line ~103),
|
||||
Handshakes (line ~151) and QA log (lines ~343, ~409) describe the net-delay
|
||||
comment as a live `#SKIP` and as a handshake request to `comment-slots`.
|
||||
That request is now answered; a one-line "closed by walk-cycles (TODO
|
||||
§43.2), 2026-09-05" under each is the honest amendment. Not edited here —
|
||||
it is another feature's README, and this lane owns none of it.
|
||||
- `README.md` — no change needed: the walk's user-visible contract
|
||||
(extensions, `--exclude`, `.gitignore`) is unchanged. If a line is wanted,
|
||||
it is in the CLI section: "a symlinked directory is walked once; a cycle
|
||||
terminates".
|
||||
|
||||
## Work log
|
||||
|
||||
**2026-09-05 — dev (Opus 5).**
|
||||
|
||||
*43.1, `crates/lucisv_core/src/walk.rs`.* `Walk` gained
|
||||
`visited: HashSet<DirId>` and one method, `enter`, which is the whole policy:
|
||||
`dir_id(dir).is_some_and(|id| self.visited.insert(id))`. `dir()` calls it
|
||||
first and returns `Ok(())` when it answers false, so a directory already
|
||||
entered costs one `metadata` call and nothing else — no `read_dir`, no
|
||||
ignore-stack push, no recursion. `DirId` is `(u64, u64)` under `#[cfg(unix)]`
|
||||
from `MetadataExt::dev`/`ino`, and `PathBuf` from `fs::canonicalize`
|
||||
otherwise; `dir_id` returns `Option`, and `None` (a dangling link, a
|
||||
directory that vanished mid-walk) means "not entered".
|
||||
|
||||
The entry loop's `path.is_dir()` became one `fs::metadata(&path)` — the same
|
||||
single stat, and it follows symlinks exactly as `is_dir()` did, so a
|
||||
symlinked directory is still recognized as a directory. Three things fall out
|
||||
of having the metadata rather than a bool: `meta.is_dir()` for the walk arm,
|
||||
`meta.is_file()` for the collect arm, and a dangling link (no metadata at
|
||||
all) skipped by the `let … else { continue }` in front of both. The extension
|
||||
test moved into a small `is_source` helper so the collect arm stays one line.
|
||||
|
||||
The one behaviour change beyond termination that a user could notice: a
|
||||
dangling symlink named `x.sv` used to be *collected* and then failed at read
|
||||
time. It is now skipped. That is in the plan's test list ("a dangling symlink
|
||||
is skipped") and is the same judgment as the directory case.
|
||||
|
||||
Six unit tests in `walk.rs`, all `#[cfg(unix)]` because they need real
|
||||
symlinks, over a `TempTree` helper in the test module (the third such helper
|
||||
in the crate — `config.rs` and `cache.rs` have their own; a fourth copy is
|
||||
cheaper than a shared test-support module for two dozen lines). Each of them
|
||||
would have run until the OS refused a path before this change.
|
||||
|
||||
*43.2, three crates.* `NetDelay` gained `before_hash` and `after_hash`.
|
||||
`parse_net_delay` takes the first with `take_gap()` **after** the
|
||||
`cur().is_sym("#")` check — the `gap_before("#")` contract, spelled out
|
||||
rather than called, because the check is already there for the `is_net` gate
|
||||
— and the second with `take_gap()` after the `bump()`.
|
||||
|
||||
`Fmt::net_delay` now owns the separator in front of the delay as well as the
|
||||
delay: it emits the `before_hash` comments *instead of* the plain space when
|
||||
there are any, and the plain space when there are not, so a declaration with
|
||||
no comment there is laid out byte-identically to before. That moved the
|
||||
trailing space off `net` (`text(format!("{net} "))` → `text(net.clone())`)
|
||||
and off the data type, which is why `data_decl` changed shape slightly; the
|
||||
two call sites are now inside the `if let Some(net)` and
|
||||
`if let Some(t) = self.data_type(…)` arms, which is also correct, since a
|
||||
delay is only ever read after a net keyword, and an after-type delay only
|
||||
after a data type that was actually written.
|
||||
|
||||
*Deviation from the plan: `after_hash`.* The plan asks for `before_hash`
|
||||
only, and also asks that the gap fuzzer cover the new slot. Those two are in
|
||||
tension: `assert_no_failing_gaps` demands **zero** failures across a fixture
|
||||
set, and the smallest fixture that exercises `before_hash` (`wire #5 a;`)
|
||||
also contains the gap between `#` and `5`, which had no owner either. So the
|
||||
fixture could not be added without it. `after_hash` is four lines (one field,
|
||||
one `take_gap`, one `slot_comments`) on the same construct, and closes the
|
||||
delay's own gaps completely; the alternative was to leave the fuzzer without
|
||||
a net-delay fixture, which is the thing the plan explicitly asked for. Flagged
|
||||
here for the lead.
|
||||
|
||||
The gaps inside `#( 1:2:3 )` are *not* closed — eight of them, measured with
|
||||
the fixture `wire [7:0] #(1:2:3) b = c;` before it was narrowed to `#1`. They
|
||||
live in `parser/instance.rs::parse_delay_values`, shared with gate
|
||||
instantiation delay lists, fail identically there, and are §2.9-22 shared
|
||||
machinery. The RTL fuzzer fixture is `wire #5 a;` / `wire [7:0] #1 b = c;`,
|
||||
which covers both sides of the type and both new slots; `EXPECTED_RTL_GAPS`
|
||||
352 → 374, zero failures.
|
||||
|
||||
*Files touched outside the plan's expected set.* None beyond what the plan
|
||||
names, with one addition: `crates/vlog_formatter/tests/verification.rs` (the
|
||||
gap fuzzer's fixture and count — the plan says "find how the fuzzer
|
||||
enumerates slots and add this one", which is this file). Full list:
|
||||
`crates/lucisv_core/src/walk.rs`, `crates/lucisv/tests/cli.rs`,
|
||||
`crates/lucisv_server/src/state.rs` (test only),
|
||||
`crates/vlog_parser/src/ast/decl.rs`,
|
||||
`crates/vlog_parser/src/parser/decl.rs`,
|
||||
`crates/vlog_formatter/src/format/decl.rs`,
|
||||
`crates/vlog_formatter/tests/cases/net_delay_position.cases`,
|
||||
`crates/vlog_formatter/tests/verification.rs`, `TODO.md`, this README.
|
||||
|
||||
*Do the tests have teeth?* Asked directly rather than assumed: the `enter`
|
||||
call was short-circuited (`if false && !self.enter(dir)`) and the walk tests
|
||||
re-run. Three of the six failed — the self-loop, the ancestor link and the two
|
||||
links — with paths 31 levels of `a/up/` deep, which is what the OS refuses at
|
||||
rather than a hang. The other three (the sibling link, the dangling link, the
|
||||
ignored cycle) pass either way by construction: they are about the *other*
|
||||
half of the policy. The short-circuit was reverted immediately and the file
|
||||
compared against a copy taken before it; `walk::` is green again.
|
||||
|
||||
*Gates, all guarded.* `cargo fmt --check` on the five touched crates: clean.
|
||||
`cargo clippy --all-targets`: clean, no new `#[allow]`. `cargo test
|
||||
--workspace`: **3 788 passed, 0 failed** (baseline 3 780 + the 8 tests this
|
||||
round adds: 6 in `walk.rs`, 1 CLI, 1 server). `tools/corpus_check.sh`:
|
||||
**814/820 (99.3%)**, the same six failures (five parse, one lex) and the same
|
||||
10 already-clean files. Byte-identity: no corpus file writes a comment before
|
||||
a net delay's `#` — checked with a direct grep over `corpus/`, 0 hits — and
|
||||
the empty-slot path emits exactly the `text(" ")` it did before, so the
|
||||
formatter's output over the corpus cannot have moved; the corpus counts
|
||||
confirm it. `node editors/vscode/smoke.js target/release/lucisv-server`: OK,
|
||||
20 messages. The cyclic scratch tree (a self-link, a `..` link one level down,
|
||||
a `../../..` link three levels down, a second name for one directory, and a
|
||||
dangling `x.sv` link) through both release binaries under
|
||||
`tools/guard.sh -t 120`: `lucisv --check` finishes in ~1s and names its three
|
||||
files once each; an LSP session (initialize with that `rootUri`, `initialized`,
|
||||
one `didOpen`, `workspace/symbol`) finishes in ~1s with each package indexed
|
||||
exactly once. No guard kill anywhere in the round.
|
||||
|
||||
### 2026-09-05 — lead, at review
|
||||
|
||||
QA's MEDIUM (the dangling-symlink change made a "no such file" error
|
||||
silent) is ruled and fixed: a dangling link that *names a source file* is
|
||||
handed on again, so the front end reports it exactly as 0.42.0 did (exit 2);
|
||||
a dangling link to anything else is skipped as the dev wrote. The test is
|
||||
renamed to say both halves. QA's LOW (a link to `/` is followed and the
|
||||
first permission-denied directory aborts the whole walk, dropping the files
|
||||
already found) is pre-existing `?` propagation and is filed as topo §2.9-30
|
||||
together with the warning channel the walk lacks. The opentitan
|
||||
`tlul_adapter_vh.sv` divergence QA root-caused is §41's canonical dedup
|
||||
reporting a same-directory symlink alias once — the intended change, noted
|
||||
in 0.43.0's release notes.
|
||||
|
||||
## QA log
|
||||
|
||||
**2026-09-05 — QA (Sonnet).** Built `target/release/{lucisv,lucisv_server}` once
|
||||
and attacked both halves of the round on scratch trees under
|
||||
`tools/guard.sh -t 120`; nothing was ever killed (no memory or wall-clock hit)
|
||||
in this pass.
|
||||
|
||||
*Diff review.* Read `crates/lucisv_core/src/walk.rs`,
|
||||
`crates/vlog_parser/src/{ast,parser}/decl.rs`,
|
||||
`crates/vlog_formatter/src/format/decl.rs`, the two test files, and
|
||||
`crates/lucisv/tests/cli.rs` / `crates/lucisv_server/src/state.rs` line by
|
||||
line against the plan. Traced the `data_decl` reshuffle by hand for the
|
||||
empty-slot case on both sides of the type: `net_delay`'s separator branch
|
||||
degrades to the same `text(" ")` the old unconditional call emitted, so a
|
||||
declaration with neither a delay nor a comment is unaffected — confirmed
|
||||
this holds for the "after_type but no data_type" case too, which cannot
|
||||
arise (`parse_net_delay(is_net, true)` only ever succeeds after
|
||||
`parse_opt_data_type` actually consumed tokens, since an omitted type
|
||||
leaves the `#` for the `before` call to claim first).
|
||||
|
||||
*43.1 — cycle attacks (all via `tools/guard.sh -t 120`, actual wall times
|
||||
well under that in every case).*
|
||||
- Depth 1/2/3 cycles (`a/loop -> a`, `a/b/up -> ..`, `a/b/c/top -> ../../..`):
|
||||
terminate, each file named once. Two-link cycle (`a/x -> ../b`,
|
||||
`b/y -> ../a`): terminates, `ma.sv` and `mb.sv` each reported once, `mb.sv`
|
||||
under the alias spelling `a/x/mb.sv` (first spelling reached, as documented).
|
||||
Chain of 50 symlinked directories collapsing to one target: resolved
|
||||
correctly and fast (single `metadata` call per hop, no manual recursion) —
|
||||
no `ELOOP`, no slowdown.
|
||||
- **Ancestor-of-start escape.** Built `start/out -> ../..` where the target is
|
||||
*outside* `start` entirely (not just the walk's own root) and ran
|
||||
`--check` with `start` as the CLI argument (not its parent). The link is
|
||||
followed once — per the ruling, identity is the policy, not location — and
|
||||
pulls in a sibling file and a grandparent-level file that are not inside
|
||||
`start` at all. It terminates (~1s) because the walk eventually re-enters
|
||||
`start` itself from the other direction and that's already visited. Not a
|
||||
bug — this is the plan's own explicit choice (no budget, `rtl ->
|
||||
../shared/rtl` must keep working) — but it is a real, user-visible
|
||||
consequence: pointing lucisv at a subdirectory can pull in files from
|
||||
outside it if that subdirectory contains an upward-and-back symlink.
|
||||
Flagged as **LOW / informational** for the lead's record, not a defect.
|
||||
- **Link to `/`.** Followed once, as the ruling implies it must be; spent
|
||||
~14.6s doing real `readdir`/`stat` work under `/System`, `/Library`,
|
||||
`/private` etc. before hitting a permission-denied directory, at which
|
||||
point the *entire* run aborted with `error: <original start path>:
|
||||
Permission denied` — none of the user's own files were reported, not even
|
||||
the ones already found. Reproduced this abort-on-any-`read_dir`-error
|
||||
behaviour with a controlled example (`crates/lucisv_core/src/walk.rs`'s
|
||||
`dir()` uses `?` on `read_dir(dir)?.collect::<Result<_,_>>()?`, unchanged
|
||||
by this diff) — it is pre-existing, not introduced by 43.1: the old,
|
||||
cycle-blind walker would have followed `/` identically and hit the same
|
||||
wall. Filed as **LOW / informational**, since it predates this round, but
|
||||
worth the lead's attention because 43.1 is what makes "follow a link
|
||||
outside the tree" a documented, intentional feature rather than an
|
||||
accident — a link to `/` (or to any tree with a permission-restricted
|
||||
subdirectory anywhere under it) now silently costs the *entire* check, not
|
||||
just the linked file. Link to a real bounded tree (`/usr/share`, 250 MB):
|
||||
walked completely in ~1s, correctly found and lex-errored on a
|
||||
coincidentally `.sv`-named file (`vim/vim91/tutor/tutor1.sv`, Swedish
|
||||
locale code) — confirms outside-of-start links are followed and that nothing
|
||||
hangs on a moderately large real directory.
|
||||
- Hard-linked **files**: reported twice, once per directory, confirming
|
||||
identity is directory-only as documented. Two directories with identical
|
||||
content but different inodes: both walked (not deduped) — confirmed
|
||||
content-blind, inode-based identity.
|
||||
- Gitignore interplay: a cycle inside an ignored directory never runs
|
||||
(confirmed — the `loop` symlink inside `build/` was never touched); an
|
||||
ignored symlinked directory name is skipped by that spelling but the real
|
||||
target directory (different name, not itself ignored) is still walked
|
||||
directly — this is unchanged, pre-existing per-spelling ignore matching,
|
||||
not a 43.1 regression; a `.gitignore` inside a followed link's target
|
||||
applies to the walk (its `sub/` pattern correctly hid the target's own
|
||||
subdirectory when reached through the link).
|
||||
- **The dangling `x.sv` behaviour change**, `lucisv format --check dir`
|
||||
with a dangling `x.sv` link, new binary vs.
|
||||
`~/.cache/lucisv-baselines/lucisv-0.42.0`: confirmed exactly as the
|
||||
work log describes — 0.42.0 collects it, fails at read time
|
||||
(`error: .../x.sv: No such file or directory`, exit 2, "1 file would be
|
||||
reformatted, 1 file failed to format"); the new binary skips it silently
|
||||
(exit 1, "1 file would be reformatted", no mention of `x.sv` anywhere).
|
||||
**Finding, MEDIUM, for the lead's ruling** (this is what the plan and
|
||||
TODO explicitly asked for, so not a defect against the dev — but the
|
||||
silence itself is worth a second look): a dangling symlink named like a
|
||||
source file usually means something real broke (a missing vendor drop, a
|
||||
bad checkout), and the user now gets no signal at all instead of a
|
||||
specific, actionable error. The CLI already has a precedent for this exact
|
||||
tension — a missing file named in a `-f` filelist is a **warning on
|
||||
stderr**, changing no exit code — and the same shape (warn, don't fail,
|
||||
don't stay silent) seems like it would keep 43.1's win (no more hard
|
||||
crash on a broken symlink) without losing the signal. Recommend the lead
|
||||
decide whether `walk.rs` should carry a callback/return channel for this
|
||||
one case, or whether silence is accepted as-is.
|
||||
- **Both front ends.** CLI `--check` over a two-directory cyclic tree
|
||||
(`rtl/self -> ../rtl`, `rtl/sub/up -> ..`): 2 files, once each. The same
|
||||
tree over `lucisv_server` (drove the real binary over stdio, same framing
|
||||
`talk_with` uses: `initialize` with that `rootUri` +
|
||||
`workspace/didChangeConfiguration` for the wide index scope +
|
||||
`workspace/symbol` queries): both declared modules found exactly once,
|
||||
finished in-process with no hang. **File counts agree between CLI and
|
||||
server for the same tree (2 and 2).**
|
||||
Explicit file argument that is a symlink to a directory, and a start
|
||||
directory that is itself a symlink: both work, both find the expected
|
||||
file under the given spelling.
|
||||
|
||||
*43.2 — comment-slot attacks, all via `format --stdout`, then idempotency
|
||||
(format twice) and a before/after comment-count check on every shape:*
|
||||
`wire /* c */ #5 w;`, `wire // c` + `#5 w;` on the next line, `wire [7:0]
|
||||
/* c */ #1 b = c;`, `wire # /* c */ 5 w;` (`after_hash`), both slots at once
|
||||
(`wire /* c1 */ # /* c2 */ 5 w;`), two comments in one slot
|
||||
(`wire /* one */ /* two */ #5 w;`), a comment on the after-type side
|
||||
(`wire [7:0] /* c */ #1 b = c;`), `tri`/`wand` with a delay comment,
|
||||
an attribute ahead of the module. All ten: format cleanly, round-trip
|
||||
idempotent, comment count preserved exactly. The refused shapes stayed
|
||||
refused and did **not** corrupt: all four gaps inside `#(1:2:3)` — before
|
||||
`1`, around each `:`, after `3` — still fail with a `verification failed:
|
||||
token stream diverges` error and no output, matching the "not taken" scope
|
||||
in Handshakes (topo §2.9-22). Ran the gap fuzzer directly
|
||||
(`cargo test -p vlog_formatter a_comment_in_every_rtl_gap_still_formats`
|
||||
under guard): passes; confirmed `EXPECTED_RTL_GAPS` is 374 in the tree and
|
||||
that the added fixture (`wire #5 a;\n wire [7:0] #1 b = c;`) genuinely
|
||||
exercises both new slots (both are comment-free in the fixture itself, but
|
||||
the fuzzer inserts a comment into every inter-token gap in turn, which is
|
||||
what raised the count from 352).
|
||||
|
||||
*Gates, all guarded.* `cargo fmt --check` (five touched crates): clean.
|
||||
`cargo clippy --all-targets`: clean, 0 warnings. `cargo test --workspace`:
|
||||
**3 788 passed, 0 failed** — matches the work log exactly. Re-ran just
|
||||
`lucisv_core`'s `walk::tests` in isolation: 17 passed (11 pre-existing + the
|
||||
6 new ones), including the 6 cycle tests as their own filtered run.
|
||||
`tools/corpus_check.sh`: **814/820 (99.3%)**, same 6 failures
|
||||
(`ibex/dv/formal/check/peek/compare_helper.sv`,
|
||||
`ibex/dv/uvm/core_ibex/riscv_dv_extension/riscv_core_setting.tpl.sv`,
|
||||
`ibex/syn/rtl/latch_map.v`,
|
||||
`ibex/vendor/google_riscv-dv/src/riscv_instr_cover_group.sv`,
|
||||
`picorv32/scripts/romload/testbench.v`,
|
||||
`picorv32/scripts/smtbmc/mulcmp.v`), same 10 already-clean files.
|
||||
`node editors/vscode/smoke.js target/release/lucisv-server`: OK, 20
|
||||
messages.
|
||||
|
||||
*Byte-identity vs 0.42.0.* Over the 820-file corpus, each file individually
|
||||
through `format --stdout` (bypasses directory-walk dedup, isolates the
|
||||
formatter itself): **0 differing**, exit codes included. Opentitan
|
||||
`format --check` (using `--no-cache` on both sides after the first pass
|
||||
showed cache-hit-count noise from a shared `.lucisv_cache`; see below) over
|
||||
`hw/ip`, `hw/top_earlgrey/ip`, `hw/top_darjeeling/ip`, `hw/dv`, `hw/vendor`:
|
||||
`hw/top_earlgrey/ip`, `hw/top_darjeeling/ip`, `hw/dv`, `hw/vendor` are
|
||||
byte-identical between the two binaries (including exit codes: 1, 2, 1, 2
|
||||
respectively). **`hw/ip` differs by exactly one file**:
|
||||
`hw/ip/tlul/rtl/tlul_adapter_vh.sv` is reported "would reformat" by 0.42.0
|
||||
and silently absorbed (not reported at all) by the new binary — 1773 vs.
|
||||
1772 files. Root-caused, not a §43 regression: `hw/ip/tlul/rtl` contains
|
||||
`tlul_adapter_shim.sv -> tlul_adapter_vh.sv`, a **symlinked file next to its
|
||||
own target in the same directory**, and `crates/lucisv/src/main.rs`'s
|
||||
`dedup()` (canonical-path fold, keeps the first spelling — this is §41,
|
||||
already in trunk, *not* touched by this diff, and shipped in a release
|
||||
*after* 0.42.0 per the loop order in `TODO.md`) now folds
|
||||
`tlul_adapter_shim.sv`/`tlul_adapter_vh.sv` onto one entry, keeping
|
||||
`tlul_adapter_shim.sv` (alphabetically first) and dropping the other.
|
||||
Reproduced in isolation on a two-file scratch directory
|
||||
(`real.sv` + `shim.sv -> real.sv`) with both binaries, `--no-cache`: 0.42.0
|
||||
reports both, the new binary reports one — confirms this is `main.rs`'s
|
||||
existing dedup (unmodified by 43.1/43.2) becoming visible only because the
|
||||
0.42.0 baseline predates it, not anything in this round's diff. Filed as
|
||||
**informational**, not a §43 finding: the "byte-identity vs 0.42.0" gate is
|
||||
not a clean isolation of this round alone once §41/§42 sit between the
|
||||
baseline and trunk; recommend future rounds diff against trunk-before-the-
|
||||
lane (or the `wip-43` backup already under
|
||||
`~/.cache/lucisv-baselines/`) for a true delta, and use 0.42.0 only for the
|
||||
"nothing has moved since the last *release*" question. Confirmed
|
||||
`git -C ~/repo/opentitan status --porcelain` still shows only the three
|
||||
expected pre-existing modifications (`hw/ip/aes/dv/tb/tb.sv`,
|
||||
`hw/top_darjeeling/ip/ast/rtl/ast.sv`, `hw/top_earlgrey/ip/ast/rtl/ast.sv`)
|
||||
after all opentitan runs; `.lucisv_cache/` is gitignored and untouched by
|
||||
this statement either way.
|
||||
|
||||
*Verdict:* **PASS.** No corruption, no idempotency break, no dropped
|
||||
comment, in any attack. Both hard invariants around cycles (identity,
|
||||
no budget) and the two new comment slots hold up under adversarial input,
|
||||
and the refused inside-`#(...)` gaps stay refused rather than silently
|
||||
accepted. Two behavioural points are flagged above for the lead's ruling
|
||||
(the dangling-symlink silence, MEDIUM; the link-to-`/` full-run abort on a
|
||||
permission wall, LOW/pre-existing) plus one informational note on the
|
||||
baseline choice for byte-identity gates — none of them block this round.
|
||||
|
||||
## Review
|
||||
|
||||
**2026-09-05 — lead.** Accepted; ships in 0.43.0. 43.1 is the ruled policy
|
||||
in one method — identity is the whole rule, and QA's cycles of every shape,
|
||||
the 50-link chain and the two-link cycle all terminate with each file once.
|
||||
The dev's `after_hash` slot beyond the plan is accepted: the gap fuzzer's
|
||||
zero-failure bar made it necessary, and four lines on the same construct is
|
||||
the right size; the `#(1:2:3)` interior stays §2.9-22's. The one behaviour
|
||||
change QA flagged is corrected above so no user loses an error they had.
|
||||
Both front ends share the walk unchanged in signature, and the byte-identity
|
||||
gate over the corpus is 0 differing.
|
||||
@@ -145,6 +145,15 @@ suite also retains a refusal for comments immediately before a net-delay `#`
|
||||
(27). These limitations should remain visible when widening grammar or index
|
||||
coverage; formatter verification must continue to reject unsupported output.
|
||||
|
||||
**Fixed by TODO §43 (0.43.0, 2026-09-05):** the walker enters each directory
|
||||
once by identity (`(dev, ino)` on unix, the canonical path elsewhere); a
|
||||
symlink cycle terminates and a doubly reachable file is reported once. The
|
||||
"no traversal budget" ruling was the lead's: identity is the policy. The
|
||||
net-delay comment refusal (handshake 27) is closed by `NetDelay`'s comment
|
||||
slots. Still open from this finding: handshakes 2, 16, 17, 23, and the new 30
|
||||
(an unreadable directory aborts the walk). See
|
||||
`docs/features/walk-cycles/README.md`.
|
||||
|
||||
## Documentation changes from this audit
|
||||
|
||||
- Expanded the README's architecture to cover all eight crates and documented
|
||||
|
||||
+3
-2
@@ -621,7 +621,7 @@ update the filing README(s) and this file.
|
||||
| ~~5~~ | ~~`lucisv check --rules-doc` printing `rules_markdown()`~~ — **delivered 2026-09-02 by macro-word-census (TODO §29.3)**: `lucisv check --rules-doc` prints `rules_markdown()` and exits 0, takes no files, is lint-only; the example binary is gone | lint-rules-2 | ~~crates/lucisv~~ done |
|
||||
| ~~6~~ | ~~Workspace-wide "does any file mention this name" query — the precondition for the semantic lints defaulting on~~ — **delivered 2026-09-02 by semantic-lints-on**: `FileFacts::words` (one identifier harvest, `vlog_semantic::words`, lifted from the server's candidates) and `WorkspaceIndex::files_mentioning` / `mentioned_outside(name, own_file)`; `FACTS_FORMAT` 12 → 13. The three rules consult a `MentionOracle` and are on by default whenever one exists. | semantic-lints | ~~vlog_semantic (index)~~ done |
|
||||
| ~~7~~ | ~~`SymbolKind::Interface` (interfaces currently indexed as `Module`; modport/clocking names unbound)~~ — **delivered 2026-09-01 by interface-semantics**: `SymbolKind::{Interface, Modport, Clocking}`, `is_instantiable()` threaded through every Module-exact filter, an interface export rule that treats its signals as its surface, modport/clocking-internal names bound as scope-local references, the modport half of a glued type name bound as `Target::TypeMember`. `program` still indexes as `Module`. Corpus unresolved fell 1 256 → 1 203 | interfaces | ~~vlog_semantic~~ done |
|
||||
| 8 | Symlink-cycle detection in the shared walk (both front ends exposed; wants its own round — it changes CLI behavior) | lucisv-core-lift | lucisv_core |
|
||||
| ~~8~~ | ~~Symlink-cycle detection in the shared walk (both front ends exposed; wants its own round — it changes CLI behavior)~~ — **delivered 2026-09-05 by walk-cycles (TODO §43.1):** `Walk` keeps a `visited` set keyed on `(dev, ino)` (canonical path elsewhere); each directory entered once, a link to one already entered skipped, a link to one not yet entered followed once, a dangling directory link skipped (a dangling source-file link is still handed on so the front end's "no such file" survives). Both front ends. | lucisv-core-lift | lucisv_core |
|
||||
| ~~9~~ | ~~Chasing `InheritedCandidate` through the member tables (in-file and cross-file) + hover for `extends`~~ — **delivered 2026-09-01 by class-member-access**: `resolve::member_in_chain` walks the in-file `extends` chain, `WorkspaceIndex::base_of` + `member_chain` walk it across files (inside `follow_one`, so hover and cross-file references agree), both cycle-guarded; `this.x`/`super.x` misses ride the same loop. `extends` hover/definition on the base name was already answered by overlay-promotion's type-position promotion. Residue filed in TODO §15 round 2: a `base` field on `ReferenceFact` so `this.x` misses get index postings too | class-semantics | ~~vlog_semantic~~ done |
|
||||
| ~~10~~ | ~~`Fmt::raw_text`'s string-crossing path emits a `Doc::Text` carrying newlines~~ — **delivered 2026-08-26 (`53f2269`)**: both `raw_text` and the parameterized-type `#( … )` now emit `Doc::Inline`, whose printer arm resumes measuring from the text's own last line. directive-split's README (QA round 3 note) still documents it as open and should be struck there too | directive-split QA | ~~vlog_formatter~~ done |
|
||||
| 11 | Corpus scripts match `parse error:` / `lex error:` / `verification failed:` textually; a structured `--output-format json` for format mode would remove it | corpus-check | crates/lucisv |
|
||||
@@ -641,9 +641,10 @@ update the filing README(s) and this file.
|
||||
| ~~25~~ | ~~The parser **refuses** a module-scope `begin … end` and a bare `begin` inside a `generate` region (an `ItemKind::Error`) rather than recovering them as an unnamed generate block, so `module-begin-block` and `v2001-generate-begin` (TODO §35) fire on an error leaf and the rest of the unit is lost to recovery. Wanted: tolerant-mode recovery that keeps the block's items.~~ — **delivered 2026-09-04 by small-items-3 (TODO §36)** | linter-expansion-3 (dev) | vlog_parser |
|
||||
|
||||
| ~~26~~ | ~~**Same-target atomic writers share a temp path.** `atomic::temp_path` uses canonical target + process ID; parallel workers following distinct symlink spellings can reach that same name, while CLI dedup is lexical. A bounded direct helper probe (100 rounds, two threads, 1 MiB each) returned 100 write errors in 200 calls; no mixed final bytes observed in that probe. Use exclusive per-operation temp creation and coordinate/deduplicate target writes. See repository-analysis.md for limits.~~ — **closed by §41 (0.43.0):** unique `O_EXCL` temps (`.{name}.{pid}.{n}.lucisv-tmp`), dedup on `fs::canonicalize`; two *processes* remain last-writer-wins by design, stated in `atomic.rs` | repository audit, 2026-09-04 | lucisv_core / lucisv |
|
||||
| 27 | **Net-delay comment slot**: parser-skips records a pre-existing refusal for a comment immediately before `#` in a net declaration. The regression cases mark it `#SKIP`; preserve the verifier's rejection until a parser/formatter comment slot handles it. | parser-skips (dev + QA) | vlog_parser / vlog_formatter |
|
||||
| ~~27~~ | ~~**Net-delay comment slot**: parser-skips records a pre-existing refusal for a comment immediately before `#` in a net declaration. The regression cases mark it `#SKIP`; preserve the verifier's rejection until a parser/formatter comment slot handles it.~~ — **delivered 2026-09-05 by walk-cycles (TODO §43.2):** `NetDelay::{before_hash, after_hash}` own the gaps around `#`; the `#SKIP` is retired; the RTL gap fuzzer covers it. The gaps inside `#(1:2:3)` remain §2.9-22's. | parser-skips (dev + QA) | vlog_parser / vlog_formatter |
|
||||
| ~~28~~ | ~~**Project lint selection is not consumed by the server.** `enabled_rules` reads `ClientSettings`; `configured` reads project rule options and line length only. `[lint] select/ignore` currently controls CLI runs, while the editor needs `lucisv.lint.select/ignore`. Decide and test a common precedence contract before claiming project-wide parity.~~ — **closed by §42 (0.43.0):** `enabled_rules` picks the editor's list when set, else the project's, key by key (the CLI's `pick`); rejected project entries logged once with file:line | repository audit, 2026-09-04 | lucisv_server |
|
||||
| 29 | An unknown rule name in the **editor's** `lucisv.lint.select`/`ignore` is still dropped silently, while §42 logs the same mistake in a project file (and `lucisv.lint.options` logs its bad entries). Wants the same once-only log through `notification.rs`. | lint-config-contract (QA) | lucisv_server |
|
||||
| 30 | **An unreadable directory aborts the whole walk.** `Walk::dir` propagates `read_dir`'s error with `?`, so one permission-denied directory anywhere under the start — reachable now that a symlink to an outside directory is followed once (§2.9-8's ruling) — drops every file already found and fails the run. Found by walk-cycles' QA on a link to `/`. Wanted: skip the directory and say so through a warning channel the walk does not have today (the filelist-missing-file precedent), which is also where a dangling source link's warning belongs. | walk-cycles (QA) | lucisv_core / lucisv / lucisv_server |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in new issue
Block a user