({
codebaseLabel,
fixturePath,
summary
}: FormatEditPreflightReportParams)
| 193 | } |
| 194 | |
| 195 | export function formatEditPreflightReport({ |
| 196 | codebaseLabel, |
| 197 | fixturePath, |
| 198 | summary |
| 199 | }: FormatEditPreflightReportParams): string { |
| 200 | const lines: string[] = []; |
| 201 | const unsafeFalsePositives = summary.results.filter( |
| 202 | (result) => result.risk === 'unsafe' && result.ready |
| 203 | ); |
| 204 | const safeMisses = summary.results.filter((result) => result.risk === 'safe' && !result.ready); |
| 205 | |
| 206 | lines.push(`\n=== Edit Preflight Eval Report: ${codebaseLabel} ===`); |
| 207 | lines.push(`Fixture: ${fixturePath}`); |
| 208 | lines.push( |
| 209 | `Tasks: ${summary.totalTasks} (${summary.safeTasks} safe, ${summary.unsafeTasks} unsafe)` |
| 210 | ); |
| 211 | lines.push( |
| 212 | `Top-target in top-3: ${summary.topTargetInTop3Count}/${summary.targetableTasks} (${formatRate(summary.topTargetInTop3Rate)})` |
| 213 | ); |
| 214 | lines.push(`Average first relevant hit: ${formatHit(summary.averageFirstRelevantHit)}`); |
| 215 | lines.push( |
| 216 | `Best-example hit rate: ${summary.bestExampleHitCount}/${summary.bestExampleTasks} (${formatRate(summary.bestExampleHitRate)})` |
| 217 | ); |
| 218 | lines.push( |
| 219 | `Safe-task ready rate: ${summary.safeTaskReadyCount}/${summary.safeTasks} (${formatRate(summary.safeTaskReadyRate)})` |
| 220 | ); |
| 221 | lines.push( |
| 222 | `Unsafe-task abstain rate: ${summary.unsafeTaskAbstainCount}/${summary.unsafeTasks} (${formatRate(summary.unsafeTaskAbstainRate)})` |
| 223 | ); |
| 224 | lines.push( |
| 225 | `Unsafe ready=true false-positive rate: ${summary.unsafeReadyFalsePositiveCount}/${summary.unsafeTasks} (${formatRate(summary.unsafeReadyFalsePositiveRate)})` |
| 226 | ); |
| 227 | lines.push(''); |
| 228 | lines.push('Task results:'); |
| 229 | |
| 230 | for (const result of summary.results) { |
| 231 | const taskLine = [ |
| 232 | `- ${result.taskId}`, |
| 233 | `[${result.risk}]`, |
| 234 | `ready=${result.ready ? 'yes' : 'no'}`, |
| 235 | `abstain=${result.abstain ? 'yes' : 'no'}`, |
| 236 | `firstRelevant=${result.firstRelevantHit ?? 'n/a'}`, |
| 237 | `top3=${result.topTargetInTop3 === null ? 'n/a' : result.topTargetInTop3 ? 'hit' : 'miss'}`, |
| 238 | `bestExample=${result.bestExampleHit === null ? 'n/a' : result.bestExampleHit ? 'hit' : 'miss'}`, |
| 239 | `quality=${result.searchQualityStatus}` |
| 240 | ]; |
| 241 | lines.push(taskLine.join(' ')); |
| 242 | } |
| 243 | |
| 244 | lines.push(''); |
| 245 | lines.push('Unsafe false positives:'); |
| 246 | if (unsafeFalsePositives.length === 0) { |
| 247 | lines.push(' (none)'); |
| 248 | } else { |
| 249 | for (const result of unsafeFalsePositives) { |
| 250 | lines.push(` - ${result.taskId}: "${result.query}"`); |
| 251 | } |
| 252 | } |
no test coverage detected