test(capture): require mask alpha in inventory PNG compose

Why
Calculate showed accurate numbers but the inventory PNG kept the sheet
background. Measure already uses approvedMask.bitset; encode did not.

Scope
Add composeInventoryFrame and inventory.test.ts alpha/crop proofs.
Wire encodeInventoryPng({ bitmap, mask, source }) at calculate().
This commit still paints the slabBounds AABB without the bitset gate so
the alpha contract fails until the follow-up fix.

Verification
node --import tsx --test src/png/inventory.test.ts
alpha contract fails (sheet green leaks); 3:4 / 80% / floor pass.
This commit is contained in:
2026-09-14 19:11:52 +00:00
parent 114e0b5116
commit b3a9fdf330
3 changed files with 184 additions and 32 deletions
+1 -1
View File
@@ -315,7 +315,7 @@ export function createCaptureSession(): CaptureSession {
let pngBlob: Blob;
let belowFloor = false;
try {
const r = await encodeInventoryPng(bitmap, approvedMask.slabBounds);
const r = await encodeInventoryPng({ bitmap, mask: approvedMask, source });
pngBlob = r.blob;
belowFloor = r.sourceBelowFloor;
} catch {