mirror of
https://github.com/openai/codex-security.git
synced 2026-12-03 10:53:23 +08:00
Keep legacy normalized receipt ownership on replay
This commit is contained in:
@@ -26,9 +26,10 @@ export function workerCoverageReceiptLocation(
|
||||
const workerPrefix = `artifacts/deep_discovery/workers/${basename(worker)}/`;
|
||||
const normalized = components.join("/");
|
||||
const outputPrefix = `${workerPrefix}output/`;
|
||||
const shared =
|
||||
isObject(surface.provenance) &&
|
||||
(surface.provenance.scanReceiptRefs as string[] | undefined)?.includes(ref);
|
||||
const recorded = isObject(surface.provenance)
|
||||
? (surface.provenance.scanReceiptRefs as string[] | undefined)
|
||||
: undefined;
|
||||
const shared = recorded?.includes(ref) || recorded?.includes(normalized);
|
||||
if (archived && !shared && normalized.startsWith(outputPrefix)) {
|
||||
return {
|
||||
context,
|
||||
|
||||
@@ -281,7 +281,8 @@ export function scanCoverage(
|
||||
const ref = posix.normalize(receipt);
|
||||
return ref.startsWith(archivePrefix) ||
|
||||
ref.startsWith(`${artifactPrefix}/`) ||
|
||||
scanRefs?.has(receipt)
|
||||
scanRefs?.has(receipt) ||
|
||||
scanRefs?.has(ref)
|
||||
? ref
|
||||
: `${artifactPrefix}/${ref}`;
|
||||
};
|
||||
|
||||
@@ -806,6 +806,17 @@ async function testCoveragePublicationParity(root: string) {
|
||||
path.join(output, "artifacts/review.md"),
|
||||
"Review evidence.\n",
|
||||
);
|
||||
// Older retained coverage recorded the normalized scan-owned receipt.
|
||||
const historical = structuredClone(original);
|
||||
historical.reviewState.surfaces[0].receiptRefs = ["artifacts/./review.md"];
|
||||
historical.reviewState.surfaces[0].provenance = {
|
||||
scanReceiptRefs: ["artifacts/review.md"],
|
||||
};
|
||||
const projected = scanCoverage(
|
||||
{ ...worker, result: historical },
|
||||
worker.artifacts.scanDir,
|
||||
);
|
||||
assert.deepEqual(projected.surfaces[0].receiptRefs, ["artifacts/review.md"]);
|
||||
for (const ref of [
|
||||
"artifacts/review.md",
|
||||
"artifacts/./review.md",
|
||||
|
||||
Reference in New Issue
Block a user