Every tracked file that can carry a comment (880 of them) now opens with "Author: Guoliang Chen, a Senior Digital Design Engineer" and closes with "Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com", in the file's own comment syntax. No behaviour change: the diff outside the version bump and changelogs is comment lines only. - tools/stamp_author.py: writes the lines; idempotent, `--check` lists what is missing. Headers go under a shebang and under Markdown front matter. - Left alone: test fixtures, cases and snapshots (byte-exact inputs), JSON and JSONL, logs, images, lockfiles, docs/site/dist (regenerated) and the LICENSE files (already carry the copyright line). - tools/linux_check.sh: --help reads its header from line 3, now that the author line sits under the shebang. - tools/gates.sh green on this tree: 5 545 tests, corpus 814/6 as before. Co-Authored-By: Claude Mythos 5.2 <[email protected]>
486 lines
28 KiB
Markdown
486 lines
28 KiB
Markdown
<!-- Author: Guoliang Chen, a Senior Digital Design Engineer -->
|
||
|
||
# package re-exports (TODO §48)
|
||
|
||
## Goal
|
||
|
||
`export b_pkg::x;` inside `package a_pkg` was an opaque leaf: the binder bound
|
||
nothing for it and the index recorded nothing about it, so a file that did
|
||
`import a_pkg::*` and named `x` resolved nothing, `a_pkg::` offered nothing,
|
||
and a rename of `x` left the `export` line behind. This round makes the
|
||
re-export a real edge in both layers, which is `docs/topo.md` §2.9-16 and
|
||
request (a) of `docs/features/dpi-export/README.md`.
|
||
|
||
**The binding half.** `bind_export_path` (beside `bind_import_path`, sharing
|
||
its path walk) records the two halves an import records — `pkg` as a
|
||
`Target::Package` use, `item` as a `Target::UnitMember(pkg)` use — and pushes
|
||
**no** scope import, because a re-export brings nothing into the exporting
|
||
package (IEEE 1800 §26.6). `export *::*;` records nothing: neither half is an
|
||
identifier. A DPI export (`export "DPI-C" function f;`) stays the opaque leaf
|
||
it was.
|
||
|
||
**The resolution half.** `FileFacts` gains an `RX` group (`FACTS_FORMAT`
|
||
17 → 18): per package, the packages and names it re-exports. The member walk
|
||
in `workspace/external.rs` — the one lookup both the overlay and the index's
|
||
own reference postings go through — follows those edges after a unit's own
|
||
members and its `extends` chain, with a visited set so a cycle terminates. So
|
||
definition, hover, completion after `a_pkg::`, find-references and rename all
|
||
read the same edge and cannot disagree about it.
|
||
|
||
## Assumptions
|
||
|
||
- **`export *::*;` is expanded at record time into the exporting package's own
|
||
imports**, rather than stored as a flag for a later walk to interpret. §26.6
|
||
reads "everything imported into this package is re-exported", and which
|
||
packages those are is a property of the very file being read off — so a flag
|
||
would only move the same lookup somewhere with strictly less information,
|
||
and nothing would ever read it. `export *::*;` in a package that imports
|
||
nothing therefore records nothing, which is also what it re-exports. **This
|
||
is the one deviation from §48's letter**, which asked for "`(pkg, item)`
|
||
pairs, `(pkg, "*")`, and a `*::*` flag"; the first two are exactly what `RX`
|
||
holds, and the third is expanded instead of stored. Behaviour is identical
|
||
either way (pinned in `an_export_of_everything_reexports_what_the_package_imports`).
|
||
- **A re-export is followed only for a *package*.** The `RX` group is keyed by
|
||
the name of the package whose body writes the `export`, and only
|
||
`ItemKind::Package` bodies are scanned. A compilation-unit-scope `export` is
|
||
not recorded; the LRM does not put one there.
|
||
- **The re-export hop is taken after a unit's own members and its bases**,
|
||
never before, so a package's own declaration of a name it also re-exports is
|
||
what a lookup finds and what completion lists
|
||
(`a_local_declaration_wins_over_a_reexported_name_of_the_same_spelling`).
|
||
- **The walk is two levels deep, deliberately.** Each hop of the re-export walk
|
||
asks `own_chain` — a package and its `extends` chain — not `member_chain`,
|
||
which would recurse into the very walk that called it. Chasing a chain of
|
||
re-exports is the walk's own job, and it does it with an explicit queue.
|
||
- **The visited set is package names for a lookup, `(package, name)` pairs for
|
||
a listing.** A lookup for one name only ever follows edges that admit that
|
||
name, so the filter is constant and a package need be asked once; a listing
|
||
follows every edge, so the same package may be reached once per specific
|
||
name it is re-exported through. Both sets are bounded by the workspace.
|
||
- **`WorkspaceIndex::member` is unchanged** — it stays the raw table read.
|
||
Every walk that should follow re-exports goes through `member_chain` or
|
||
`members_of_chain`, which is where the hop was added.
|
||
- **A re-export edge is untyped.** Nothing checks that the named package
|
||
exists, that it declares the name, or that the exporting package imports it
|
||
(§26.6 requires the last of these, and lucisv is not an elaborator). An edge
|
||
that leads nowhere simply answers nothing.
|
||
|
||
## Handshakes
|
||
|
||
- **vlog_parser → vlog_semantic (consumed, unchanged).** `ItemKind::Export`
|
||
carries `ExportDecl::Package(Vec<ImportPath>)`, each `ImportPath` holding two
|
||
`Name`s with exact token spans, and `export *::*;` is one path whose
|
||
**package** half is `"*"`. Both halves' spans come straight off the token, so
|
||
§47's `exact_or_empty` guard is not needed here (there is no derived span to
|
||
check) — `an_export_records_both_halves_on_exactly_their_own_bytes` asserts
|
||
the bytes anyway.
|
||
- **vlog_semantic → lucisv_server (promised, additive).** `FACTS_FORMAT` is
|
||
**18**. `index_cache` drops a store stamped with any other number, which it
|
||
already did; its `a_store_from_any_previous_facts_format_is_dropped_not_misread`
|
||
enumerates `1..FACTS_FORMAT` and needed no change.
|
||
`WorkspaceIndex::members_of_chain` and the member lookup behind
|
||
`resolve_external` may now answer with a `Def` in a package the asking path
|
||
never named — the declaring one. No signature changed and no caller was
|
||
touched.
|
||
- **vlog_semantic internal.** `external::member_chain` keeps its signature and
|
||
its contract; `own_chain` and `own_members` are the base-chain halves split
|
||
out of it and out of `members_of_chain`, so a re-export hop lists exactly
|
||
what a lookup through it would find. `WorkspaceIndex::fingerprint` gained
|
||
`reexport …` lines: the edges decide what `a_pkg::x` means, so a merge that
|
||
dropped one must be visible as more than whichever references happened to
|
||
resolve through it.
|
||
- **dpi-export README, request (a): answered** (edited there, one paragraph).
|
||
Request (b) — binding a DPI export's `name` — is untouched and still open.
|
||
|
||
## Status / TODO
|
||
|
||
- [x] 48.1 `bind_export_path`: both halves recorded, no scope import,
|
||
`export *::*;` records nothing; the negative pinned
|
||
- [x] 48.2 `RX` group, `FACTS_FORMAT` 17 → 18, the member walk and the member
|
||
listing follow re-exports transitively with a visited set
|
||
- [x] `Affected::exporters` so a restricted merge rebuilds the table, and the
|
||
fingerprint witnesses it
|
||
- [x] unit tests (`crates/vlog_semantic/tests/reexports.rs`, 14) and one
|
||
wire-level e2e (`crates/lucisv_server/tests/e2e.rs`)
|
||
- [x] cycle, unknown item, transitive chain, local-beats-reexported
|
||
- [x] census re-derived and the delta explained
|
||
- [x] gates
|
||
- [x] QA
|
||
|
||
## Files touched
|
||
|
||
Exactly the expected set, plus the two docs edits:
|
||
|
||
- `crates/vlog_semantic/src/bind/item.rs` — the `Export` arm split,
|
||
`bind_export_path`
|
||
- `crates/vlog_semantic/src/workspace/reexport.rs` — **new** (189 lines)
|
||
- `crates/vlog_semantic/src/workspace/mod.rs` — `mod reexport;`, the
|
||
`reexports` table
|
||
- `crates/vlog_semantic/src/workspace/record.rs` — the `FileFacts` field
|
||
- `crates/vlog_semantic/src/workspace/index.rs` — `reexports()`,
|
||
`members_of_chain`
|
||
- `crates/vlog_semantic/src/workspace/external.rs` — `own_chain`,
|
||
`own_members`, the hop in `member_chain`
|
||
- `crates/vlog_semantic/src/workspace/update.rs` — merge, `Affected`,
|
||
fingerprint
|
||
- `crates/vlog_semantic/src/facts.rs` — the `RX` group, `FACTS_FORMAT` 18
|
||
- `crates/vlog_semantic/tests/reexports.rs` — **new**
|
||
- `crates/lucisv_server/tests/e2e.rs` — one test appended
|
||
- `docs/features/dpi-export/README.md` — request (a) answered
|
||
- `TODO.md` — §48's own checkboxes
|
||
|
||
## Docs to apply at merge (lead)
|
||
|
||
**`docs/topo.md` §2.9 row 16** — strike it. Suggested text:
|
||
|
||
> ~~16. `ItemKind::Export` is an opaque leaf: a package re-export's `pkg::item`
|
||
> halves are not references, so `export b_pkg::x;` is invisible to
|
||
> go-to-definition, to find-references and to a rename, and a file importing
|
||
> the re-exporting package cannot resolve the name at all.~~ **Closed
|
||
> 2026-09-05 (§48, `docs/features/package-reexports/README.md`).** Both halves
|
||
> are references (`bind_export_path`, no scope import), the index records each
|
||
> package's re-exports (`FACTS_FORMAT` 18, the `RX` group), and the member
|
||
> walk follows them transitively with a visited set — definition, hover,
|
||
> completion, references and rename all read the one edge. A **DPI** export's
|
||
> `name` is still unbound (dpi-export request (b)).
|
||
|
||
Nothing to change in `README.md`, `docs/repository-analysis.md` or
|
||
`docs/site/`.
|
||
|
||
## Work log
|
||
|
||
**2026-09-05 — dev (Opus 5).**
|
||
|
||
- Read the plan, `docs/topo.md` §2.9-16 and dpi-export's request (a). The
|
||
parser already had everything: `ExportDecl::Package(Vec<ImportPath>)` with
|
||
exact spans on both halves, and `"*"` as the package name for `*::*`.
|
||
- **48.1.** Split the `ItemKind::Export` arm in `bind/item.rs`: the package
|
||
form calls a new `bind_export_path`, the DPI form stays in the opaque-leaf
|
||
arm. `bind_export_path` is `bind_import_path` minus the
|
||
`scopes[scope].imports.push(...)`, plus the early return for a `*` package.
|
||
Used `Target::Package` rather than the plan's `Target::Unit`, because that is
|
||
what `bind_import_path` records for the same half and the plan's own words
|
||
were "exactly the halves `bind_import_path` records"; `Package` is the
|
||
narrower and therefore the more honest of the two (only a package may be
|
||
re-exported), and it produces the same `ExternalCandidate { paths: ["b_pkg"] }`
|
||
for the workspace.
|
||
- **48.2.** New module `workspace/reexport.rs` — the `Reexport` record, the
|
||
read-off (`of`, with the `*::*` expansion), and the two walks (`member`,
|
||
`members`). `external.rs` grew `own_chain` and `own_members`, the base-chain
|
||
halves the walk asks at each hop; `member_chain` is now `own_chain` else
|
||
`reexport::member`, and `members_of_chain` is `own_members` chained with
|
||
`reexport::members` under one dedup. New machinery went in the new module
|
||
rather than into `external.rs` (301 → 349 lines) or `index.rs` (521 → 523),
|
||
as the brief asked.
|
||
- Cost of the hop for a workspace with no re-exports: one `BTreeMap` lookup
|
||
returning an empty slice, per member miss — `reexport::member` returns on
|
||
that lookup before it allocates anything, which matters because
|
||
`merge_references` asks `member_chain` once per external reference in the
|
||
workspace (hundreds of thousands on opentitan). Nothing else changed shape.
|
||
- The fingerprint gained `reexport <exporter> <- <pkg>::<item>` lines, and
|
||
`Affected` gained `exporters` so a one-file update rebuilds only that
|
||
package's edges — checked by `an_update_and_a_build_agree_on_the_reexport_table`.
|
||
- Wrote 14 unit tests and one e2e. Confirmed the e2e really depends on the
|
||
feature by temporarily emptying `FileFacts::reexports` (it failed on the
|
||
first definition), then restored — the same trick that produced the "before"
|
||
binary for the opentitan probe.
|
||
|
||
### Census delta
|
||
|
||
Re-derived with `cargo test -p vlog_semantic --test corpus -- --nocapture`:
|
||
|
||
| | before | after |
|
||
|---|---|---|
|
||
| files | 860 | 860 |
|
||
| symbols | 27 486 | 27 486 |
|
||
| references | 103 870 | **103 875** |
|
||
| unresolved | 1 197 | 1 197 |
|
||
| names unplaced | 0 | 0 |
|
||
|
||
**+5 references, nothing else moved** — and they are exactly the five names the
|
||
corpus's two *package* re-export lines write:
|
||
|
||
- `ibex_mem_intf_agent_pkg.sv:28` `export ibex_mem_intf_pkg::*;` — 1 (the
|
||
package half; the `*` is not a name)
|
||
- `csr_utils_pkg.sv:10`
|
||
`export dv_base_reg_pkg::csr_field_t, dv_base_reg_pkg::decode_csr_or_field;`
|
||
— 4 (two package halves, two item halves)
|
||
|
||
The corpus's other nine `export` lines are all DPI exports, which are
|
||
deliberately unchanged. Unresolved is flat, so all five became external
|
||
candidates rather than dead ends; no symbol was declared and no span was
|
||
derived, so `symbols` and `unplaced` could not move.
|
||
|
||
### Gates (all through `tools/guard.sh`; no guard kill)
|
||
|
||
| gate | result |
|
||
|---|---|
|
||
| `cargo fmt -p vlog_semantic -p lucisv_server` | clean (never `--all`); `--check` clean at the end |
|
||
| `cargo clippy --all-targets` | clean, no new `#[allow]` |
|
||
| `cargo test --workspace` | **3 829 passed, 0 failed, 44 ignored** — baseline 3 814, **+15** (14 unit tests in `tests/reexports.rs`, 1 e2e) |
|
||
| `tools/corpus_check.sh corpus` | **814/820 (99.3%)**, the same six parse errors; `corpus-check-results.tsv` unmodified in `git status` |
|
||
| formatter byte-identity | `format --stdout` of all **860** corpus files, this build vs `~/.cache/lucisv-baselines/lucisv-0.44.0`: **0 differ** |
|
||
| `cargo build --release -p lucisv_server` + smoke | OK — the release server answers `definition` on a name reached through `export b_pkg::x;` in a three-file scratch workspace |
|
||
| semantic corpus census | 860 files, 27 486 symbols, **103 875** references, 1 197 unresolved, **0 unplaced** (delta above) |
|
||
| opentitan `definition` through a re-export | **before `[]`, after the declaration** — see below |
|
||
|
||
Largest resident set observed by the guard: nothing came near the 8 GB limit,
|
||
and no command was killed.
|
||
|
||
### opentitan (read-only, scratch index store)
|
||
|
||
The tree does have real package re-exports, so the check was run rather than
|
||
skipped:
|
||
|
||
- `hw/ip/spi_device/rtl/spi_device_pkg.sv:425-451` — eight (QA's count; the work log first said nine)
|
||
`export spi_device_reg_pkg::<name>;` lines, each beside its `import`
|
||
- `hw/top_englishbreakfast/ip_autogen/flash_ctrl/rtl/flash_ctrl_top_specific_pkg.sv:12-18`
|
||
— seven `export flash_ctrl_pkg::<name>;` lines
|
||
- `hw/ip/spi_host/dv/env/spi_host_env_pkg.sv:21` — one, used by
|
||
`hw/ip/spi_host/dv/tb.sv:31` (added at review from QA's inventory)
|
||
- `hw/dv/sv/csr_utils/csr_utils_pkg.sv:10` — the two-path line the corpus copy
|
||
also holds
|
||
|
||
**The probe.** `hw/ip/spi_device/pre_dv/program/prog_passthrough_sw.sv:205`
|
||
writes `spi_device_pkg::SramDepth`, and `SramDepth` is declared in
|
||
`spi_device_reg_pkg.sv:10` and reaches `spi_device_pkg` only through
|
||
`spi_device_pkg.sv:451`'s `export`. One server session per binary, root
|
||
`hw/ip/spi_device`, `index.scope: "workspace"`, `initializationOptions.storagePath`
|
||
pointed at a scratch directory, one read-only `didOpen`, one
|
||
`textDocument/definition` at line 205 char 52:
|
||
|
||
| build | answer |
|
||
|---|---|
|
||
| before (this tree with `FileFacts::reexports` emptied, release) | `[]` |
|
||
| after (this tree, release) | `spi_device_reg_pkg.sv`, LSP range line 9 chars 25–34 — i.e. `SramDepth` on line 10, the declaration |
|
||
|
||
The "before" binary was produced by temporarily emptying the record's re-export
|
||
list and rebuilding, then restoring it and rebuilding again; `git diff` of
|
||
`record.rs` afterwards shows only this round's intended change, and the tree was
|
||
never checked out, reset or stashed. `git -C ~/repo/opentitan status --porcelain`
|
||
showed only the three 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`)
|
||
before and after. Probe script:
|
||
`<scratchpad>/defprobe.py`.
|
||
|
||
### File sizes after the round
|
||
|
||
`reexport.rs` 189, `external.rs` 301 → 346, `index.rs` 521 → 525, `mod.rs`
|
||
340 → 349, `record.rs` 558 → 566, `update.rs` 397 → 421, `bind/item.rs`
|
||
555 → 590, `facts.rs` 733 → 760 (all raw line counts, comments included).
|
||
Nothing crossed 600; the new machinery went in the new module, as the brief
|
||
asked.
|
||
|
||
## QA log
|
||
|
||
**2026-09-05 — QA (Sonnet).**
|
||
|
||
Read the plan (TODO §48), the feature README in full, and the diffs of every
|
||
file it lists plus `crates/lucisv_server/tests/e2e.rs`. Built
|
||
`cargo build --release -p lucisv -p lucisv_server` once. Every suite run and
|
||
every server session below went through `tools/guard.sh`; no guard kill.
|
||
Attacked the two stated deviations (`Target::Package`, `*::*` expanded at
|
||
record time) directly by reading `bind_export_path` against `bind_import_path`
|
||
and `reexport::of`/`exports_of` line by line — both match the README's
|
||
justification and produce the documented behavior.
|
||
|
||
**Gates.**
|
||
|
||
| gate | result |
|
||
|---|---|
|
||
| `cargo clippy --all-targets` | clean, no new `#[allow]` |
|
||
| `tools/guard.sh -- cargo test --workspace` | **3 829 passed, 0 failed, 44 ignored** — matches the dev's number exactly, both before and after my scratch files were removed |
|
||
| `tools/guard.sh -- tools/corpus_check.sh corpus` | **814/820 (99.3%)**, same six parse errors; `corpus-check-results.tsv` untouched in `git status` |
|
||
| formatter byte-identity vs `~/.cache/lucisv-baselines/lucisv-0.44.0` | 860/860 corpus files, **0 differ** (script wrapped in `tools/guard.sh`) |
|
||
| semantic corpus census (`cargo test -p vlog_semantic --test corpus -- --nocapture`) | **860 files, 27 486 symbols, 103 875 references, 1 197 unresolved, 0 unplaced** — exact match |
|
||
| census delta grep | confirmed by hand: `corpus/ibex/dv/uvm/core_ibex/common/ibex_mem_intf_agent/ibex_mem_intf_agent_pkg.sv:28` (`export ibex_mem_intf_pkg::*;`, 1 name — the package half) and `corpus/ibex/vendor/lowrisc_ip/dv/sv/csr_utils/csr_utils_pkg.sv:10` (two paths, 4 names) sum to exactly **+5**; the corpus's other 9 `export` lines are all `"DPI-C"` (confirmed by grep), unchanged |
|
||
|
||
**Attack 1 — the three-file shape, wire-level (`tests/reexports.rs`, the dev's
|
||
`e2e.rs` test, and two temporary tests of my own added to `e2e.rs` and removed
|
||
after).** The dev's 14 unit tests and the one e2e test all pass and were read
|
||
line-by-line, not just run: they cover single-name, `pkg::*`, `*::*` (with and
|
||
without a same-named import), a chain, a two-package cycle, an undeclared
|
||
name, local-beats-reexported, and the reference-posting/rename fan-out
|
||
(`export` line rewritten, package half untouched implicitly since it is a
|
||
different reference). Two gaps I closed with temporary `#[test]`s in
|
||
`e2e.rs` (run, confirmed, then deleted — `git diff` on that file is exactly
|
||
the dev's 145-line addition again):
|
||
- A bare re-exported-but-not-imported name inside the exporting package stays
|
||
unresolved **over the real wire**, and a rename of the source declaration
|
||
edits **exactly one** site in the exporting file — the `export` line's item
|
||
half, column 16 — never the bare use (still `NotFound`) and never the
|
||
package half (column 9, a different reference entirely).
|
||
- `export *::*;` with **no** `import` beside it offers nothing in completion
|
||
and resolves nothing in definition — the negative half of the dev's own
|
||
`an_export_of_everything_reexports_what_the_package_imports` unit test,
|
||
confirmed again over the wire.
|
||
|
||
**Attack 2 — chains, cycles, negatives (12 temporary tests in a new
|
||
`crates/vlog_semantic/tests/qa_reexport_attack.rs`, run then deleted).** All
|
||
12 passed on the first try — no findings:
|
||
- three-package cycle (a→b→c→a via `*`), terminates and answers correctly;
|
||
- self re-export of an undeclared name (`export a_pkg::thing;` inside
|
||
`a_pkg`) terminates in <2 s and stays unresolved — the visited set seeds
|
||
itself with `unit`, so the one-hop-back edge is dropped without a second
|
||
lookup;
|
||
- self re-export of a name the package **does** declare is indistinguishable
|
||
from an ordinary local declaration, because `own_chain` (tried first) wins
|
||
before the reexport hop is ever asked;
|
||
- re-export of a nonexistent package: unresolved, no panic;
|
||
- a package that only **imports** a name (no `export` line at all) does not
|
||
leak it — `offered()` is empty, matching §26.6 and the README's stated
|
||
assumption;
|
||
- duplicate `export b_pkg::x;` lines: the edge table dedupes to one listed
|
||
name, but **both** source lines remain real references (`references_to`
|
||
finds both) — correct, since dedup lives in `reexport::add`, not in the
|
||
binder;
|
||
- 50 packages in a straight re-export chain: build + lookup in **2.7 ms**
|
||
— no accidental quadratic walk;
|
||
- two packages both re-exporting the same name into a third: no panic, one
|
||
deterministic answer (whichever edge the BFS queue reaches first, which is
|
||
file order — not specified by the plan but not undefined either, and
|
||
`members_of_chain`'s dedup-by-first-hit makes the listing agree with the
|
||
lookup);
|
||
- a DPI export beside a package export inside the same package body
|
||
contributes no edge to the reexport table (the split arm in `bind/item.rs`
|
||
holds);
|
||
- **incremental**: editing the *declaring* package (`b_pkg`, not the
|
||
exporter) to drop the re-exported name unresolves `a_pkg::x` on the very
|
||
next lookup with only `b.sv` touched — `Affected::exporters` is keyed by
|
||
the exporter for good reason, and nothing else needed to invalidate for
|
||
this case to work; and adding a fresh `export` line to a package that had
|
||
none is visible on the very next lookup, no separate rebuild step.
|
||
|
||
**Attack 3 — incremental,** covered above and by the dev's own
|
||
`an_update_and_a_build_agree_on_the_reexport_table` (read and re-run).
|
||
|
||
**Attack 4 — the `FACTS_FORMAT` 18 bump, for real, not just the existing unit
|
||
test.** Built the real `v0.44.0` server in a worktree
|
||
(`git worktree add … v0.44.0`, removed after). Ran it against a fresh 3-file
|
||
scratch workspace (`b_pkg` declares `x`; `a_pkg` does `export b_pkg::x;`;
|
||
`top.sv` does `import a_pkg::*` and uses both the bare and qualified form),
|
||
`initializationOptions.storagePath` pointed at a scratch dir:
|
||
- 0.44.0, cold: `scan finished: 3 files (0 skipped, 0 from cache)`,
|
||
`definition` on `a_pkg::x` → `[]` (matches the README's "before").
|
||
Store header afterward: `lucisv-index-cache 2 17 0.44.0`.
|
||
- 0.44.0 again, same store: `3 from cache` — sanity that the store format
|
||
itself round-trips for the version that wrote it.
|
||
- **New server, same (format-17) store**: `scan finished: 3 files (0 skipped,
|
||
**0** from cache)` — dropped whole, not misread, exactly as
|
||
`index_cache.rs`'s module doc promises (silent, not logged as an error;
|
||
the "0 from cache" `--verbose` timing line is the observable). `definition`
|
||
now correctly lands on `b_pkg.sv`'s declaration. Store header rewritten to
|
||
`lucisv-index-cache 2 18 …`; `RX 1` appears for `a.sv`, `RX 0` for the
|
||
other two.
|
||
- **New server again, same (now format-18) store**: `3 from cache` — the
|
||
round trip holds, same correct answer, `RX` group intact.
|
||
|
||
**Attack 5 — census,** re-run and cross-checked by hand above; matches
|
||
exactly.
|
||
|
||
**Attack 6 — opentitan, read-only, scratch stores throughout.** Enumerated
|
||
every `^\s*export ` line under `hw/` myself rather than trusting the dev's
|
||
inventory, and found it **incomplete**: `hw/ip/spi_device/rtl/spi_device_pkg.sv`
|
||
has **8** `export spi_device_reg_pkg::<name>;` lines (425, 431, 433, 435, 437,
|
||
439, 441, 451), not the nine the dev's work log states, and the dev's list
|
||
omits `hw/ip/spi_host/dv/env/spi_host_env_pkg.sv:21`
|
||
(`export spi_host_env_cfg_pkg::SPI_HOST_NUM_CS;`) entirely — see **findings**
|
||
below. Both are documentation-accuracy issues in the work log, not behavior
|
||
bugs; I tested the missed file anyway.
|
||
- **Reproduced the dev's own probe with the real `v0.44.0` binary** (not the
|
||
dev's "emptied-`reexports`-field" stand-in): root `hw/ip/spi_device`,
|
||
`prog_passthrough_sw.sv:205` char 52 — real 0.44.0 → `[]`; new server, same
|
||
workspace → `spi_device_reg_pkg.sv` line 9 chars 25–34 (`SramDepth`'s
|
||
declaration). Exact match to the dev's claim.
|
||
- **Every other real-world re-export site**, new server only (all correct,
|
||
real UVM/DV code, not synthetic):
|
||
- `hw/ip/spi_host/dv/tb.sv:31` — bare `SPI_HOST_NUM_CS` under
|
||
`import spi_host_env_pkg::*` → `spi_host_env_cfg_pkg.sv:7`, the real
|
||
declaration, through the exact chain the missed inventory entry describes.
|
||
- `hw/top_englishbreakfast/ip_autogen/flash_ctrl/rtl/flash_ctrl_lcmgr.sv:56`
|
||
— bare `NumSeeds` under `import flash_ctrl_top_specific_pkg::*` →
|
||
`hw/ip/flash_ctrl/rtl/flash_ctrl_pkg.sv:10`, across two disjoint top-level
|
||
`hw/` subtrees (root had to be the whole `hw/`, 3 976 files, 182 s to
|
||
scan — well inside the guard's defaults, no kill).
|
||
- `hw/vendor/.../ibex_mem_intf_agent/ibex_mem_intf_agent_pkg.sv:28`
|
||
(`export ibex_mem_intf_pkg::*;`) — completion after
|
||
`ibex_mem_intf_agent_pkg::` in a synthetic **in-memory-only** overlay
|
||
buffer (a `didOpen` at a URI under the read-only tree that was never
|
||
saved, so nothing touched disk) lists exactly `ibex_mem_intf_pkg`'s five
|
||
members plus the package's own local `ibex_mem_intf_request_sequencer`
|
||
and `rw_e` — and none of `uvm_pkg`/`mem_model_pkg`/`ibex_cosim_agent_pkg`,
|
||
which that package only imports, never re-exports. Definition on
|
||
`DATA_WIDTH` through the same path lands on `ibex_mem_intf_pkg.sv`.
|
||
- `hw/dv/sv/csr_utils/csr_utils_pkg.sv:10` — both `csr_field_t` and
|
||
`decode_csr_or_field` (the export line's own item halves) resolve to
|
||
`dv_base_reg_pkg.sv`.
|
||
- **30 random `pkg::name` positions**, old vs new server, same workspace
|
||
(`hw/ip/spi_device`, 64 files): first pass (no file opened) was a false
|
||
start — this server needs the target file **open** for `definition` to
|
||
answer at all, old or new, so I reran with the 8 distinct files in the
|
||
sample opened first. **29 of 29 usable positions** (one sample line fell
|
||
outside `.sv`/`.svh` and was dropped) answered **identically** between
|
||
0.44.0 and the new build but one: `spi_device_pkg.sv:433`
|
||
(`export spi_device_reg_pkg::SramPayloadDepth;`) — old `[]`, new resolves to
|
||
`spi_device_reg_pkg.sv`. That is the export line's own item reference,
|
||
exactly the new capability `bind_export_path` adds — not a regression, the
|
||
feature working as designed on real code outside the corpus. No other
|
||
position moved.
|
||
- `git -C ~/repo/opentitan status --porcelain` before and after every session:
|
||
only the three 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`).
|
||
|
||
**Attack 7 — formatter byte-identity,** covered in the gates table; the
|
||
`ExportDecl::Package`/`Dpi` arm split changes no formatting.
|
||
|
||
### Findings
|
||
|
||
- **LOW — doc accuracy, `docs/features/package-reexports/README.md` Work
|
||
log, "opentitan" section.** States "nine `export spi_device_reg_pkg::…;`
|
||
lines" for `hw/ip/spi_device/rtl/spi_device_pkg.sv`; there are 8
|
||
(lines 425, 431, 433, 435, 437, 439, 441, 451 — verified by
|
||
`grep -c '^\s*export spi_device_reg_pkg::'`). Off-by-one in the write-up
|
||
only; every one of the 8 resolves correctly (checked above).
|
||
- **LOW — doc completeness, same section.** The inventory of real package
|
||
`export` lines under `hw/` omits
|
||
`hw/ip/spi_host/dv/env/spi_host_env_pkg.sv:21`
|
||
(`export spi_host_env_cfg_pkg::SPI_HOST_NUM_CS;`), a genuine re-export used
|
||
by real code (`hw/ip/spi_host/dv/tb.sv:31`, bare `SPI_HOST_NUM_CS` through
|
||
`import spi_host_env_pkg::*`). Tested directly above — resolves correctly —
|
||
so this is a documentation gap, not a functional one.
|
||
- No MEDIUM or HIGH findings. No panic, no corruption, no idempotency
|
||
violation, no incorrect resolution, no regression in any of the attacks
|
||
above, across both a synthetic scratch workspace and ~4 000 files of real
|
||
read-only opentitan RTL/DV code.
|
||
|
||
### Verdict
|
||
|
||
**PASS.** The two findings above are both LOW (documentation accuracy in the
|
||
feature README's Work log, not in the shipped behavior) and do not block
|
||
merge; the lead may want the dev to fix the "nine" → "eight" count and add
|
||
the missed `spi_host_env_pkg.sv` line to the inventory, but nothing about the
|
||
binding, the resolution walk, the incremental update, the on-disk format
|
||
bump, or the formatter needs rework.
|
||
|
||
## Review
|
||
|
||
## Review
|
||
|
||
**2026-09-05 — lead.** Accepted; ships in 0.45.0 with §47 and §49. Both
|
||
halves of the plan are the ruled ones and the two deviations are right:
|
||
`Target::Package` is what the import half already records, and expanding
|
||
`export *::*` into the package's own imports at record time is the honest
|
||
encoding of §26.6 — a stored flag would have had no reader. The walk is
|
||
two layers deep by construction (`own_chain` at every hop, never back into
|
||
`member_chain`) with a visited set seeded on the starting unit, and QA's
|
||
cycles, 50-package chain (2.7 ms) and self re-export all terminate. The
|
||
store bump was verified against a genuine 0.44.0-written store. The census
|
||
moved by exactly the five references the corpus's two package export lines
|
||
carry. On opentitan a real gap closed: `spi_device_pkg::SramDepth` is
|
||
reached only through a re-export and now resolves, with the four further
|
||
sites QA found all correct. The two doc counts QA caught are corrected
|
||
above.
|
||
|
||
<!-- Author: Guoliang Chen. Lucisv is made by Guoliang Chen with love, luciochen.com -->
|