docs/references/job-and-scheduler/migration-checklist.md
Use this checklist when migrating an existing service (KnowledgeRuntime / FileProcessing / agent task / heartbeat) to the unified JobManager. Each migration is a separate project — this doc is the per-handler discipline applied within each.
recovery strategy:
abandon — fire-and-forget (heartbeats, notifications)retry — "must complete" (ingestion, indexing, model sync)singleton — "at most one active per type" (init, periodic refresh)defaultQueue if per-resource serialization is needed (e.g. base.${baseId} for per-base writes)defaultConcurrency based on resource budget (vector store / GPU / network)defaultRetryPolicy if retries are valuabledefaultTimeoutMs if the handler can be long-runningexecute:
ctx.signal.aborted in every loop body and every awaitctx.patchMetadata for cross-restart state hand-off (e.g., remote task IDs)ctx.reportProgress(percent, detail) for renderer-visible progresswhile (true) — always while (!ctx.signal.aborted)onMissed if business needs catch-up observability or breakeronSettled if business needs terminal-state reactions — the event carries typed input, parentId, and final metadata (no getById reverse lookup needed); for a failure-rate breaker query
jobService.listRecentTerminalByScheduleId(scheduleId, N) for the truth, do NOT build a separate counter tableonInitjobTable / jobScheduleTable rowsv2-refactor-temp/tools/data-classify flowsrc/main/data/migration/v2/migrators/ for clean-restart safetyv2-refactor-temp/docs/breaking-changes/ entry if user-visible behavior changes (e.g., agent task: per-attempt log → single row per enqueue)kill -9, verify recovery acts per recovery strategycancelled terminal status and handler observed ctx.signal.abortedonMissed event and (for after-startup) the make-up jobpnpm lint + pnpm test + pnpm format cleanpaths.ts / types.ts