// settings.jobs — what the job system does on its own across a restart // (jobs/resumeInterrupted.ts). Pure: the type, its defaults, the sanitizer // settingsSchema.ts runs it through and the per-field docs SETTINGS.md renders. import type { FieldDocs } from "./fieldDocs"; export type JobsSettings = { resumeInterruptedOnBoot: boolean; }; // ON BY DEFAULT (operator, 2026-10-26): a restart during the Ethanalyzer // archive killed an archive.org import, a feed download and a forum catch-up, // each already built to skip what it held on a re-run, and each was re-queued // by hand. export const DEFAULT_JOBS_SETTINGS: JobsSettings = { resumeInterruptedOnBoot: true, }; export const JOBS_SETTINGS_FIELD_DOCS: FieldDocs = { resumeInterruptedOnBoot: "When the editor starts, re-queue the jobs the previous process left RUNNING (closed \"interrupted\") whose kind " + "resumes on a re-run — it skips what the first run finished: an archive.org import, a download-missing, a " + "posts fetch, a persist, a clip-window fetch, a transcription batch, a post capture, a cues pass, a report, " + "a chat backlog (`resumeOnBoot` in common/jobs/jobKinds.ts). Each resumed job's log says which job it resumes. " + "A job interrupted twice in a row is not resumed again, a dry run or a full re-walk never is, and an idle boot " + "(ARCHILYZER_IDLE_BOOT) resumes nothing. `pnpm ops job resume-interrupted [--dry-run]` does the same by hand. " + "Default true.", }; export function sanitizeJobs(value: unknown): JobsSettings { const r = (value && typeof value === "object" && !Array.isArray(value) ? value : {}) as Record; return { resumeInterruptedOnBoot: r.resumeInterruptedOnBoot !== false }; }