ren worker folder adding orig, mv new one into root
This commit is contained in:
@@ -16,10 +16,10 @@ import yargs from 'yargs';
|
||||
import { hideBin } from 'yargs/helpers';
|
||||
|
||||
import {
|
||||
DETECTOR_REPORT_INPUTS,
|
||||
INPUT_CHECKSUMS_FILENAME,
|
||||
REFERENCE_RUN_INPUTS,
|
||||
captureTaskInputs,
|
||||
detectorReportInputs,
|
||||
diffTaskInputs,
|
||||
readTaskInputChecksums,
|
||||
} from './lib/input-checksums';
|
||||
@@ -581,7 +581,8 @@ export function validateTask(
|
||||
unstamped.push(report);
|
||||
continue;
|
||||
}
|
||||
const changed = diffTaskInputs(stamp, currentInputs, DETECTOR_REPORT_INPUTS);
|
||||
const detectorName = report.replace(/\.md$/, '');
|
||||
const changed = diffTaskInputs(stamp, currentInputs, detectorReportInputs(detectorName));
|
||||
staleness.detectors.push({
|
||||
report,
|
||||
status: changed.length > 0 ? 'stale' : 'fresh',
|
||||
@@ -593,14 +594,21 @@ export function validateTask(
|
||||
if (changed.length > 0) staleStamped.push({ report, changed });
|
||||
}
|
||||
if (staleStamped.length > 0) {
|
||||
const changedLabels = [...new Set(staleStamped.flatMap((s) => s.changed))];
|
||||
// Grouped by cause, not unioned across reports: a report is only ever
|
||||
// stale on the inputs its own detector reads.
|
||||
const byCause = new Map<string, string[]>();
|
||||
for (const { report, changed } of staleStamped) {
|
||||
const cause = changed.join(' and ');
|
||||
byCause.set(cause, [...(byCause.get(cause) ?? []), report]);
|
||||
}
|
||||
const causes = [...byCause].map(([cause, reports]) => `${cause} → ${reports.join(', ')}`);
|
||||
const staleNames = staleStamped.map((s) => s.report);
|
||||
logger.warn(
|
||||
{ stale: staleNames, changed: changedLabels },
|
||||
`You modified your ${changedLabels.join(' and ')} after these detector reports were written, so they assessed an older revision of this task: ${staleNames.join(', ')}. Re-run those detectors (e.g. /${staleNames[0].replace(/\.md$/, '')}) and re-package.`
|
||||
{ stale: staleStamped },
|
||||
`These detector reports assessed an older revision of this task — you modified an input each one reads after it was written: ${causes.join('; ')}. Re-run those detectors (e.g. /${staleNames[0].replace(/\.md$/, '')}) and re-package.`
|
||||
);
|
||||
warnings.push(
|
||||
`${staleStamped.length} stale detector report(s) — ${changedLabels.join(', ')} changed since they were written: ${staleNames.join(', ')} — ` +
|
||||
`${staleStamped.length} stale detector report(s) — ${causes.join('; ')} — ` +
|
||||
're-run them against the current task'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user