feat: persistent run history logs for searcher and filter

- search_runs.json: append-only history of every searcher run
  (started_at, finished, added, seen, platforms, lookback_days)
- search_progress_last.json: snapshot of final progress state after
  each completed run — answers 'what keywords/tracks were searched?'
- filter_runs.json: append-only history of every filter batch
  (batch_id, submitted/collected timestamps, model, passed/filtered/errors)
Fixes the 'did the 90-day run complete?' ambiguity going forward
This commit is contained in:
2026-03-06 10:16:06 +00:00
parent dbe9967713
commit d610060dbb
2 changed files with 37 additions and 3 deletions

View File

@@ -133,6 +133,21 @@ async function collect(state, settings) {
clearState();
// Append to filter run history
const runsPath = resolve(__dir, 'data/filter_runs.json');
const runs = existsSync(runsPath) ? JSON.parse(readFileSync(runsPath, 'utf8')) : [];
runs.push({
batch_id: state.batch_id,
submitted_at: state.submitted_at,
collected_at: new Date().toISOString(),
job_count: state.job_count,
model: state.model,
passed,
filtered,
errors,
});
writeFileSync(runsPath, JSON.stringify(runs, null, 2));
const summary = `✅ Filter complete — ${passed} passed, ${filtered} filtered, ${errors} errors`;
console.log(`\n${summary}`);
@@ -182,11 +197,13 @@ async function submit(settings, searchConfig, candidateProfile) {
const batchId = await submitBatch(filterable, jobProfilesByTrack, searchConfig, candidateProfile, model, apiKey);
const submittedAt = new Date().toISOString();
writeState({
batch_id: batchId,
submitted_at: new Date().toISOString(),
submitted_at: submittedAt,
job_count: filterable.length,
model,
tracks: Object.keys(jobProfilesByTrack),
});
console.log(` Batch submitted: ${batchId}`);