(input: {
status: RunReceipt['status'];
prUrl?: string;
reason?: string;
filesChanged?: string[];
verification?: ReceiptCheck[];
summary?: string;
})
| 82 | * This is the uncounterfeitable half: filesChanged + verification are facts QodeX measured. |
| 83 | */ |
| 84 | export function buildGroundTruthReceipt(input: { |
| 85 | status: RunReceipt['status']; |
| 86 | prUrl?: string; |
| 87 | reason?: string; |
| 88 | filesChanged?: string[]; |
| 89 | verification?: ReceiptCheck[]; |
| 90 | summary?: string; |
| 91 | }): RunReceipt { |
| 92 | const byCmd = new Map<string, boolean>(); |
| 93 | for (const c of input.verification ?? []) if (c.command) byCmd.set(c.command, !!c.passed); |
| 94 | const verification = [...byCmd].map(([command, passed]) => ({ command, passed })); |
| 95 | return { |
| 96 | status: input.status, |
| 97 | prUrl: str(input.prUrl), |
| 98 | reason: str(input.reason), |
| 99 | summary: str(input.summary), |
| 100 | filesChanged: input.filesChanged?.length ? dedupeStr(input.filesChanged) : undefined, |
| 101 | verification: verification.length ? verification : undefined, |
| 102 | }; |
| 103 | } |
| 104 | |
| 105 | function dedupeStr(xs: string[]): string[] { |
| 106 | const seen = new Set<string>(); const out: string[] = []; |
no test coverage detected