@@ -131,22 +131,24 @@ export function runLogicBacktest(
131131export const LOGIC_BACKTEST_COMMENT_MARKER = "<!-- loopover-logic-backtest -->" ;
132132
133133/**
134- * Render the standalone advisory PR comment: marker, what was replayed against what, the engine's own
135- * comparison Markdown (#8088), and the never-blocks-merge note. Deliberately its OWN comment, not a section
136- * of ORB's unified review comment — see #8139's Boundaries (this CI job runs outside the Worker's review
137- * flow, and joining that comment would need new Worker↔CI coupling).
134+ * Render the standalone advisory PR comment: marker, what was replayed against what (including the corpus
135+ * checksum — the freeze point that makes the run independently re-runnable, see #8084's manifest), the
136+ * engine's own comparison Markdown (#8088), and the never-blocks-merge note. Deliberately its OWN comment,
137+ * not a section of ORB's unified review comment — see #8139's Boundaries (this CI job runs outside the
138+ * Worker's review flow, and joining that comment would need new Worker↔CI coupling).
138139 */
139140export function renderLogicBacktestComment (
140141 comparison : BacktestComparison ,
141- info : { replayableCount : number ; skippedCount : number ; headSha : string ; baseSha : string } ,
142+ info : { replayableCount : number ; skippedCount : number ; headSha : string ; baseSha : string ; corpusChecksum : string } ,
142143) : string {
143144 const skippedNote = info . skippedCount > 0 ? ` ${ info . skippedCount } historical case(s) lacked captured raw context and were skipped.` : "" ;
144145 return [
145146 LOGIC_BACKTEST_COMMENT_MARKER ,
146147 "## Logic backtest" ,
147148 "" ,
148149 `Replayed ${ info . replayableCount } historical case(s) for \`${ comparison . ruleId } \` through the base` +
149- ` (\`${ info . baseSha . slice ( 0 , 7 ) } \`) and head (\`${ info . headSha . slice ( 0 , 7 ) } \`) versions of its detection logic.${ skippedNote } ` ,
150+ ` (\`${ info . baseSha . slice ( 0 , 7 ) } \`) and head (\`${ info . headSha . slice ( 0 , 7 ) } \`) versions of its detection logic` +
151+ ` (corpus checksum \`${ info . corpusChecksum . slice ( 0 , 12 ) } \`).${ skippedNote } ` ,
150152 "" ,
151153 renderBacktestComparison ( comparison ) ,
152154 "_Advisory only — this check never blocks merge (#8105)._" ,
@@ -164,14 +166,17 @@ export function sqlStringLiteral(value: string): string {
164166 * THRESHOLD_BACKTEST_EVENT_TYPE events, same audit_events columns recordAuditEvent writes (the CLI runs
165167 * outside the Worker, so it goes through `wrangler d1 execute` instead of the repositories module; the
166168 * caller supplies id/createdAt so this stays clock-free like the rest of this file). `metadata.comparison`
167- * is the field backtest-track-record.ts's reader already looks for.
169+ * is the field backtest-track-record.ts's reader already looks for; `corpusChecksum` + the two shas are
170+ * the freeze point (#8136's reproducibility posture) — enough for a skeptic to re-export the corpus,
171+ * verify the checksum, and re-run both sides of this exact comparison independently.
168172 */
169173export function buildLogicBacktestAuditInsertSql ( input : {
170174 id : string ;
171175 targetKey : string ;
172176 comparison : BacktestComparison ;
173177 headSha : string ;
174178 baseSha : string ;
179+ corpusChecksum : string ;
175180 replayableCount : number ;
176181 skippedCount : number ;
177182 createdAt : string ;
@@ -180,6 +185,7 @@ export function buildLogicBacktestAuditInsertSql(input: {
180185 comparison : input . comparison ,
181186 headSha : input . headSha ,
182187 baseSha : input . baseSha ,
188+ corpusChecksum : input . corpusChecksum ,
183189 replayableCount : input . replayableCount ,
184190 skippedCount : input . skippedCount ,
185191 } ) ;
0 commit comments