Repository navigation
seal v2 closure: use module::item is recorded as a missing spec module/item.t27, and the imported module is not in the closure #8351
Description
Summary
t27c seal --save from current master (0.5.2, seal v2, #8110) writes a closure for a spec that imports items with use module::item. In that closure each imported item becomes a spec of its own, specs/<module>/<item>.t27, with "spec_hash": "missing". The module the items come from does not appear.
On specs/queen/actors_hw.t27 (#8336) there are 180 use queen::actors::<item> lines. All 180 come out as specs/queen/actors/<item>.t27 entries, each missing, and specs/queen/actors.t27 itself is not listed. A closure with missing entries cannot match a later build, so a verdict that depends on it can never be reused (#8095). And a change to actors.t27, the file that does decide the result, is not part of the identity.
Reproducer
module UseItem;
use queen::actors::backoff_seconds;
test reads_the_card { assert backoff_seconds(1) == 10; }
Save it as specs/scratch/use_item.t27, then t27c seal --save specs/scratch/use_item.t27. The seal lists specs/queen/actors/backoff_seconds.t27 with "spec_hash": "missing", and does not list specs/queen/actors.t27.
Expected
use a::b::item resolves to the spec of module a::b (specs/a/b.t27), the same resolution test-report --specs-dir already uses, and that spec's hash enters the closure once, however many of its items are imported.
Note
The sibling queen seals on master (queen_QueenTurnStop.json, queen_QueenReviewerSizing.json) are still v1, written by 0.5.0. #8336 keeps a v1 seal for the same reason. Its gen hashes are byte-identical under 0.5.0 and 0.5.2.
User Scenarios
-
Given a spec
specs/scratch/use_item.t27containinguse queen::actors::backoff_seconds;, when runningt27c seal --save specs/scratch/use_item.t27, then the closure listsspecs/queen/actors.t27with its content hash and does not list anyspecs/queen/actors/backoff_seconds.t27entry. -
Given a spec
specs/queen/actors_hw.t27with 180use queen::actors::<item>lines, when runningt27c seal --save specs/queen/actors_hw.t27, then the closure contains exactly one entry forspecs/queen/actors.t27with its hash, and zero entries for individual items underspecs/queen/actors/.
Requirements
- FR-001: The seal v2 closure generator MUST resolve
use a::b::itemto the module specspecs/a/b.t27using the same resolution astest-report --specs-dir. - FR-002: The closure MUST include the resolved module spec once with its content hash, regardless of how many items are imported from that module.
- FR-003: The closure MUST NOT create per-item spec entries (
specs/a/b/item.t27) with"spec_hash": "missing"foruseimports. - FR-004: A change to the module spec file (
specs/a/b.t27) MUST change the closure identity so that verdicts depending on it are invalidated.
Success Criteria
t27c seal --save specs/scratch/use_item.t27produces a closure JSON wherespecs/queen/actors.t27appears exactly once with a non-"missing"spec_hashandspecs/queen/actors/backoff_seconds.t27does not appear — exit 0t27c seal --save specs/queen/actors_hw.t27produces a closure JSON containing exactly one entry forspecs/queen/actors.t27and zero entries underspecs/queen/actors/— exit 0- Re-running the same seal command on unchanged specs yields byte-identical closure JSON — exit 0
- After modifying
specs/queen/actors.t27, the new closure JSON differs from the previous one — exit 0
Boundary
- compiler/cli/spec.t27
- specs/queen/actors.t27
- specs/queen/actors_hw.t27
- specs/a/b.t27
Activity