test(packer): qualify asset contracts and improve Jenkins reporting

This commit is contained in:
2026-10-16 11:47:58 +01:00
parent 13c0ababbb
commit 91eb86f317
8 changed files with 506 additions and 51 deletions
@@ -0,0 +1,59 @@
# Packer binary contract fixtures
These expectations are authored from the published wire contract, independently
of the Java writer. They are not captured from packer output. Tests call the real
`packWorkspace` service and read the embedded header and payload of `assets.pa`;
JSON sidecars alone are not the oracle.
Reference snapshot: runtime `f7d7c167531bb662a1af9d73fc326bb476bf8aa7`:
- `docs/specs/runtime/15-asset-management.md`, sections 3–4 and 9;
- `crates/console/prometeu-hal/src/asset.rs`, scene layout constants;
- `crates/console/prometeu-drivers/src/asset/decode.rs`, nibble and channel order.
The Studio producer's fixed 256×256 sheet and asset envelope are documented in
`docs/specs/packer/4. Build Artifacts and Deterministic Packing Specification.md`.
No runtime checkout, executable or decoder is needed to execute these tests.
## Fixture interpretation
- `glyph-row.hex`: eight indexed pixels `0,1,2,3,0,1,2,3`, high nibble first.
The test repeats this row within the first 8/16/32-pixel tile and leaves the
rest of the 256×256 sheet at index zero.
- `glyph-colors.hex`: four independent RGBA colors, including opaque index zero,
partial alpha at index one, transparent index two and distinct channel values.
Each palette has these four colors followed by twelve zero entries. Tests
exercise 1, 3 and 64 palettes and compare the entire serialized bank.
- `scene-v1.hex`: a 12-byte SCNE/version-1/four-layer header followed by four
32-byte layer headers and one four-byte tile per layer. All layers are active,
use glyph AssetId `0x01020304` (16909060, not its preload slot 1), tile size 8,
parallax (1.0, 0.5), width/height/count 1 and zero reserved fields. Tile flags
are 1/3/5/7, exercising both flip bits; palette is zero and glyph IDs are
0/1/2/3. Serialized size is 156; decoded size is 4 × (16 + 8) = 96.
The mixed-asset test includes an asset with preload disabled and two GLYPH
preloads in slots 0/1 plus a SCENE preload in slot 0. It checks payload-relative
nonzero offsets, stable IDs, no payload gaps/trailing bytes, and equality between
the embedded header and exported sidecars. The invalid-palette case verifies
that palette index 64 cannot publish a new `assets.pa`.
Existing `FileSystemPackerWorkspaceServiceTest` coverage remains responsible for
basic emission, sparse palettes, material remapping, frozen snapshots and
selected SCENE fields. These fixtures complement those tests at the complete
artifact boundary rather than porting the runtime's decoder corpus.
## Execution and limits
```sh
./gradlew :prometeu-packer:prometeu-packer-v1:test --tests '*PackerAssetContractTest'
```
The suite also runs under ordinary `./gradlew test`. ImageIO uses in-memory
images and temporary files; no display is needed. Fixtures never launch a
runtime, skip for missing runtime, or fall back to a simulated runtime.
Passing these tests demonstrates producer contract coverage, not runtime
loading/rendering. Integrated verification is manual using existing games.
Record the game, Studio/runtime revisions, actions and observed result when
that verification is actually performed; do not infer a gameplay pass from
these byte comparisons.
@@ -0,0 +1 @@
123456ff abcdef80 34567800 876543ff
@@ -0,0 +1,9 @@
53434e45 0100 0400 00000000
01 04030201 08 0000 0000803f 0000003f 01000000 01000000 01000000 00000000
01 00 0000
01 04030201 08 0000 0000803f 0000003f 01000000 01000000 01000000 00000000
03 00 0100
01 04030201 08 0000 0000803f 0000003f 01000000 01000000 01000000 00000000
05 00 0200
01 04030201 08 0000 0000803f 0000003f 01000000 01000000 01000000 00000000
07 00 0300