test(handoff): preserve native results in bounded attachment projections

This commit is contained in:
cesnimda
2026-10-29 18:55:20 +01:00
parent 657db9d294
commit c16a66e2c8
4 changed files with 14 additions and 4 deletions
@@ -133,6 +133,12 @@ export function validatePackage(base = directory) {
const bytes = readPackage(item.path);
return item.path.endsWith('.gz') ? zlib.gunzipSync(bytes, { maxOutputLength: 8 * 1024 * 1024 }) : bytes;
};
for (const item of evidence.artifacts.filter(entry => entry.projection)) {
const audit = JSON.parse(artifact(item.projectionAuditArtifactId).toString('utf8'));
const bytes = artifact(item.id);
demand(audit.sourceSha256 === item.sourceSha256 && audit.projectedSha256 === digest(bytes) && audit.removedBodies.length === item.externalizedAttachmentCount, 'Attachment-body export audit differs');
demand(JSON.stringify(audit.sourceStats) === JSON.stringify(JSON.parse(bytes.toString('utf8')).stats), 'Native browser statistics changed during export');
}
for (const report of evidence.reports) {
const expectedCommit = report.bindingScope === 'HANDOFF_VERIFIER' ? evidence.verifierCommit : evidence.testedCommit;
demand(report.sourceCommit === expectedCommit, 'Report source correspondence missing');