Files
lucisv/ROADMAP.md

178 lines
12 KiB
Markdown

# ROADMAP — autonomous coverage loop
Running log of the coverage-improvement loop (started 2026-08-20). The metric
is `scripts/score.sh`: share of corpus `.v`/`.sv` files that the formatter
accepts (parse + runtime safety net) and the linter runs over without error.
**Baseline (commit ae8a44c): 636/820 = 77.6%.**
## How the loop runs
- Each round: one dev agent per cluster (Opus 5), run **one at a time** (the
concurrency cap is 1 dev + 1 QA), each restricted to its cluster; then one
adversarial QA agent (Sonnet 5) over the round's whole diff, with a standing
mandate to attack macro re-indentation vs. multi-line string literals and to
hunt for swallowed errors in `verify.rs` / the safety net. Blocking QA
findings → the cluster is re-dispatched with the findings attached. Then
`score.sh`, full `cargo test`, one commit per round with the delta.
- Stop when `pct` improves ≤ 1% over two consecutive rounds, or on an
architectural decision that is not mine to make.
**Deviation from the brief, stated up front:** "clusters with no overlapping
file ownership" cannot be honored at the Rust-file level — the parser is one
4.6k-line `parser.rs` and the formatter one 2.7k-line `format.rs`, and every
parser feature touches both. Ownership is therefore enforced on (a) the
cluster's corpus files, (b) its feature README under `docs/features/`, (c) its
`.cases` test file; shared sources are edited only in the region for the
cluster's construct, and because dev agents run sequentially there are no
concurrent edits to reconcile. Splitting `parser.rs` into modules first would
be the clean fix; I did not do it unasked (see Open questions).
## Clusters (round 1 plan)
| # | cluster | score.sh categories | files blocked | construct |
|---|---|---|---|---|
| 1 | item-misc | macro-items, elab-tasks | 27 | `` `MACRO (args) `` with a space before `(`; bare `` `MACRO `` on its own line followed by a declaration (misparsed as a macro-typed declaration); `` `error "..." `` directive; `$error/$fatal/$warning/$info(...)` as module/generate items |
| 2 | dpi-export | dpi-export | 11 | `import "DPI-C" [context] function/task ...;`, `export "DPI-C" function name;`, `export pkg::*;` / `export pkg::item, ...;` |
| 3 | bind | bind | 28 | `bind <target> <module> [#(...)] <inst> (...);` incl. multi-line and `.*` |
| 4 | assertions | assertions | 13 | concurrent assertions `assert/assume/cover/restrict property (...) [else ...];`, `[label:]` prefix, `sequence ... endsequence`, `property ... endproperty` — verbatim pass-through like `constraint` |
| 5 | interface | interface | 31 | `interface ... endinterface` (params, ports, `import pkg::*;` before ports), `modport`, `clocking ... endclocking`, `default clocking`, `virtual <iface>[#(...)]` as a type |
| 6 | types-decls | types-decls | 11 | `enum ... {..} a, b;` without typedef; `struct packed {...}` as a `parameter type` default; `user_t [N:0] x;` typedef'd type with packed dims before the name; `typedef enum user_t {...}`; nested anonymous struct; `localparam type`; `for (int i = 0, T t = ...; ...)` |
| 7 | expressions | expressions | 18 | casts with parenthesized / keyword base `(W)'(x)`, `unsigned'(x)`; streaming `{<<8{v}}`; `->` implication; `assign (weak0, pull1)` drive strengths; `(* attr *)` on a named connection; `'{N{0}}` replication in assignment patterns; `x inside `MACRO` |
| 8 | dv-statements | dv-statements | 24 | `randomize() with {..}`, `.sum() with (..)`, `.sort(x) with (..)`; `foreach (pkg::arr[i])`, `foreach (a[i].b[j])`; `randcase`; `wait fork;`; `import pkg::x;` inside function/generate bodies; `let`; empty call argument `f(a, , b)`; labeled immediate assertion `lbl: assert (...)`; `endtask: name;` |
Blocked / not attempted (23 files): `directive-split` (14: an `` `ifdef``
whose arms each hold *half* a declaration — `` `ifdef DSIM T x[] = { `else const T x[] = { `endif ``; needs a preprocessing model, architectural), `lex-macro-number` (2: `32'h`BOOT_ADDR`), `invalid-or-fragment` (3: yosys `module $_DLATCH_P_`, an include fragment, a file missing `begin`), `not-verilog` (1: `.tpl.sv` Mako template), `other` (1: trailing comma in a connection list — invalid Verilog).
Theoretical ceiling with every cluster done: ~797/820 (97.2%).
## Done
- Round 0: `scripts/score.sh` (ae8a44c), baseline 77.6%.
- Round 1 (2026-08-20/21): all 8 clusters landed, one commit each, dev work
636 → 796 / 820 (77.6% → **97.1%**). QA: no blocking findings (0557933).
Per cluster: item-misc +25, dpi-export +10, bind +28, assertions +13,
interfaces +28, types-decls +11, expressions-2 +21, dv-statements +24.
Every cluster verified its passing set was a strict superset of the
previous one; `verify.rs` untouched by all eight. `picorv32.v` now
formats end to end.
- Round 2 (2026-08-21): mop-up (e35da29) 796 → 800 / 820 (**97.6%**): macro
items ending their line, `new <expr>` shallow copy, `32'h`MACRO`; plus the
round-1 QA fixes (a4f8476: printer `fits()` vs `Doc::Inline`, action-block
nesting, comment slots on bind/call/with). QA: no blocking findings
(71a300d). Every commit pushed to origin.
- **Loop stopped after round 2.** Round 2 gained 0.5% (< 1%) and round 3 has
no candidate work that is not an architectural decision (below), so a
third round would gain 0% — the plateau rule is met without running it.
## Blocked
- ~~`directive-split` (14 files, 1.7%) — needs a decision (open question 2)~~ —
**decided 2026-08-26** (owner chose option 1, verbatim pass-through
fallback) and delivered in round 3: 13 of the 14 pass;
`riscv_instr_cover_group.sv` was never a split conditional (macro-bracketed
covergroups needing expansion) and stays out of reach by design.
- `invalid-or-fragment` (3), `not-verilog` (1), `other: mulcmp.v` (1, a
trailing comma in a connection list) — not valid standalone Verilog;
will never pass and should not.
- `compare_helper.sv` (`assign x = `MACRO 1;`) — needs the macro's
expansion; lucisv deliberately does not read `` `define`` bodies for
parsing. Confirmed by the expressions-2 dev, being re-confirmed by the
round-2 mop-up.
## Open questions for you
0. **Commit granularity** — per your mid-run note, each cluster is its own
commit (no squashing). QA fixes, if any, land as separate small commits.
1. Should `parser.rs` / `format.rs` be split into per-construct modules so
clusters can genuinely own files? Mechanical, test-verified, but a big
diff you did not ask for — I left it alone.
2. `directive-split` (14 files, 1.7%): supporting it means a preprocessor
model (or Verible-style "balance the arms" token hackery). I will not
start that without a decision from you.
3. Concurrent assertions / sequences / properties are being taken as
**verbatim pass-through** (the `constraint`/`covergroup` precedent). If you
would rather have structural formatting for them, say so before cluster 4
lands.
## Round log
### Round 1 — 2026-08-20 → 2026-08-21
| cluster | commit | before → after | notes |
|---|---|---|---|
| item-misc | f52beff | 636 → 661 | spaced `` `M (a) `` kept verbatim (tightening would need a verify.rs normalization — declined); `` `error``/`` `warning`` are a closed directive list |
| dpi-export | 8007a71 | 661 → 671 | DPI imports modelled as `FunctionDecl`/`TaskDecl` + `dpi` field, so they are symbols for free |
| bind | f7c66c7 | 671 → 699 | `bind` recognised by shape, not keyword (`obj.bind()` keeps parsing) |
| assertions | e24d33a | 699 → 712 | verbatim pass-through; 12 attack tests added; cosmetic: a column-1 assertion with a multi-line string in its action block re-indents only its first line |
| interfaces | 2a63faf | 712 → 740 | `interface` = `ItemKind::Module{kw:"interface"}`; `clocking`/`endclocking` now reserved; `module-filename` applies to interfaces |
| types-decls | d071957 | 740 → 751 | `ident [..] ident` at statement position is a declaration (assignments pinned by negative tests) |
| expressions-2 | c2ea165 | 751 → 772 | `Cast::ty` is now `Box<Expr>`; `<->` lexed |
| dv-statements | f1db1e5 | 772 → 796 | new `Doc::Inline` IR node; `with {}` verbatim; fixed pre-existing comment-before-`else` verification failure |
Round-1 QA (0557933): no blocking findings. Whole-corpus idempotency +
comment-multiset sweep clean, 476-run mutation fuzz clean, no swallowed
errors. One real non-blocking bug (printer `fits()` ignored what follows a
multi-line `Doc::Inline`) and two clean-error gaps → fixed in a4f8476, not
re-dispatched as a rejection since nothing was corrupting.
### Round 2 — 2026-08-21
| unit | commit | before → after | notes |
|---|---|---|---|
| mop-up-2 | e35da29 | 796 → 800 | two shapes that used to parse now error cleanly: a macro-named type/module whose `[dims]`/`#(params)` open the NEXT line (zero corpus hits, documented) |
| QA fixes | a4f8476 | 800 → 800 | all 800 passing files byte-identical before/after |
Round-2 QA (71a300d): no blocking findings. Sweeps at default,
`--line-length 40`, `--indent 4`; 3038 mutation trials; `fits()` change
isolated to zero output differences. Noted for the record: the hoisted
macro line rule also reaches connection lists (`take_list_directives`), so
3 previously-passing files changed layout between 0557933 and HEAD —
equivalence-checked and idempotent, recorded in mop-up-2's Assumptions.
## Final state
`{"passing":800,"total":820,"pct":97.6}` — remaining 20: directive-split 14,
invalid-or-fragment 3, macro-items 1 (`` `X_EACH_CSR 1 `` needs expansion),
not-verilog 1, other 1 (invalid trailing comma).
### Round 3 — 2026-08-26 (directive-split verbatim fallback)
Owner decided open question 2: option 1, verbatim pass-through. One Opus
dev cluster, one Sonnet QA — **two QA rejection cycles** before the pass:
| pass | outcome |
|---|---|
| dev v1 | recovery in `parse_item_inner`; trigger = closing directive + region the item never opened + unmatched open bracket; 800 → 813 |
| QA 1 | **BLOCK**: a stray unmatched `` `endif `` beside a bracket-opening item was swallowed as verbatim (exit 0) — no check that any region was ever opened |
| dev v2 | `Parser::open_conds` file-scope state, maintained in `bump`; trigger and extent scan gated on it |
| QA 2 | **BLOCK**: `open_conds` polluted by unbalanced directives *inside opaque verbatim bodies* (constraint/covergroup/property walked via `bump`) — same laundering, different door |
| dev v3 | counting moved off `bump` entirely to the single `ItemKind::Directive` producer (item scope by definition; opaque walks safe by default); recovered blocks hand back the nesting they swallow |
| QA 3 | **PASS**: no invariant violation across cross-scope interleavings, multi-split accounting, re-walk double-count probes, tolerant mode, 150-trial directive fuzz |
Result: `{"passing":813,"total":820,"pct":99.1}` — +13 files (the 12
`riscv_core_setting.sv` copies + `riscv_instr_pkg.sv`), strict superset of
the 800, `verify.rs` untouched, 1672 tests / 0 failed. Accepted residual
risk and follow-ups are in the feature README's Review section
(`docs/features/directive-split/README.md`). Known pre-existing issues
surfaced by QA, not caused by this round: `Fmt::raw_text` emits `Doc::Text`
with embedded newlines (printer col goes conservative, no corruption); a
blank line between a leading comment block and its item is dropped.
Per the owner's standing instruction for this round: had QA blocked a third
time, the effort would have been stopped and the patch discarded uncommitted.
### Re-verification — 2026-08-25 (HEAD eeaffaf, post-rename)
Loop restart requested; re-scored before dispatching anything. At current
HEAD (v0.7.0, after the vfmt→lucisv rename and the ghost-text releases):
`{"passing":800,"total":820,"pct":97.6,"failures_by_category":{"directive-split":14,"invalid-or-fragment":3,"macro-items":1,"not-verilog":1,"other":1}}`
— identical to the round-2 final state, file for file. Full `cargo test`:
1644 passed, 0 failed. No regression from the intervening releases, and no
new fixable headroom: every remaining failure is either architectural
(directive-split — open question 2, still unanswered; compare_helper.sv —
needs macro expansion, a deliberate non-goal) or not valid standalone
Verilog. The stop condition holds before round 1 of a restart, so **no dev
round was dispatched**. The loop resumes only if open question 2 is decided
(a preprocessing model would put ~1.7% back in reach) or the corpus grows.