refactor(artifacts): share unavailable JavaScript evidence construction (#15821)

This commit is contained in:
Vincent Koc authored and GitHub committed 2026-12-02 07:25:37 +00:00
1 parent 0b5d4f0b1c
commit 26756f3c28
1 file changed
+12 -28
@@ -376,6 +376,14 @@ const addUnavailableArtifactEntries = (
...(file.limitations ?? []),
`The inventoried ${file.kind ?? "relevant"} entry has unavailable bytes; no content artifact identity can be established.`,
];
const observation = (operation: string) =>
artifactObservationEvidence({
sha256: file.container_sha256,
path: file.path,
operation,
coverage: partialApplicationCoverage([], null),
limitations,
});
const entry = context.accumulator.addNode({
kind: asar ? "asar-entry" : "artifact",
identity: {
@@ -404,13 +412,7 @@ const addUnavailableArtifactEntries = (
...(file.kind === undefined ? {} : { kind: file.kind }),
content_available: false,
},
evidence: artifactObservationEvidence({
sha256: file.container_sha256,
path: file.path,
operation,
coverage: partialApplicationCoverage([], null),
limitations,
}),
evidence: observation(operation),
},
],
});
@@ -427,13 +429,7 @@ const addUnavailableArtifactEntries = (
? {}
: { hash_status: file.hash_status }),
},
evidence: artifactObservationEvidence({
sha256: file.container_sha256,
path: file.path,
operation,
coverage: partialApplicationCoverage([], null),
limitations,
}),
evidence: observation(operation),
});
const scope =
file.kind === undefined
@@ -479,13 +475,7 @@ const addUnavailableArtifactEntries = (
? {}
: { inventory_occurrence_id: file.inventory_occurrence_id }),
},
evidence: artifactObservationEvidence({
sha256: file.container_sha256,
path: file.path,
operation: "classify-unavailable-native-addon",
coverage: partialApplicationCoverage([], null),
limitations,
}),
evidence: observation("classify-unavailable-native-addon"),
},
],
});
@@ -497,13 +487,7 @@ const addUnavailableArtifactEntries = (
classification: "native-addon",
content_available: false,
},
evidence: artifactObservationEvidence({
sha256: file.container_sha256,
path: file.path,
operation: "classify-unavailable-native-addon",
coverage: partialApplicationCoverage([], null),
limitations,
}),
evidence: observation("classify-unavailable-native-addon"),
});
}
}