Skip to content

Commit 62fc8a6

Browse files
committed
fix(review): retain verified provenance when author is unsafe
1 parent 8f283a7 commit 62fc8a6

2 files changed

Lines changed: 23 additions & 3 deletions

File tree

‎src/clawsweeper-regression-provenance.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ export function createRegressionProvenanceVerifier({
110110
if (hasBlameBoundary(blame) || !sourceCommitSha) return null;
111111

112112
const sourceAuthor = blamedAuthor(blame);
113-
if (!sourceAuthor || !isSafeSourceAuthor(sourceAuthor)) return null;
114113

115114
if (sourceCommitSha !== candidate.mergeCommitSha) {
115+
if (!sourceAuthor || !isSafeSourceAuthor(sourceAuthor)) return null;
116116
runGit(["merge-base", "--is-ancestor", sourceCommitSha, reviewedBaseCommitSha], {
117117
cwd: options.checkoutDir,
118118
env,
@@ -151,8 +151,9 @@ export function createRegressionProvenanceVerifier({
151151
evidenceType: "blame_to_merge_commit",
152152
mergedAt: pull.mergedAt,
153153
reviewedCommitSha: checkoutHeadSha,
154-
sourceCommitSha: candidate.mergeCommitSha,
155-
sourceAuthor,
154+
...(sourceAuthor && isSafeSourceAuthor(sourceAuthor)
155+
? { sourceCommitSha: candidate.mergeCommitSha, sourceAuthor }
156+
: {}),
156157
};
157158
} catch {
158159
// Metadata, checkout history, and tracked-path failures are unknown, not

‎test/regression-provenance.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,25 @@ test("regression provenance publishes only an exact blame-to-merge match", () =>
104104
}
105105
});
106106

107+
test("exact verified provenance survives unsafe author redaction", () => {
108+
const { result } = verify({
109+
git: (args) => {
110+
if (args[0] === "rev-parse") return `${reviewedSha}\n`;
111+
if (args[0] === "blame") {
112+
return `${mergeSha} 42 42 1\nauthor Private Author <[email protected]>\n`;
113+
}
114+
return "src/clawsweeper-review-runtime.ts\n";
115+
},
116+
});
117+
118+
assert.deepEqual(result, {
119+
...candidate(),
120+
evidenceType: "blame_to_merge_commit",
121+
mergedAt: "2026-07-31T12:00:00Z",
122+
reviewedCommitSha: reviewedSha,
123+
});
124+
});
125+
107126
test("regression provenance rejects malformed or self candidates before metadata or Git", () => {
108127
for (const invalid of [
109128
candidate({ sourcePath: "../secrets" }),

0 commit comments

Comments
 (0)