4.0 KiB
Contract: Jobs Migration Notes
Migration Goal
Move plugin-specific long-running work into the shared jobs domain without breaking existing plugin queues, status screens, or backend routes during the transition.
Native Provider Pattern
A migrated plugin should:
- Declare the
jobsdomain in its manifest as a provider/requester as appropriate. - Register a native job provider after hydration.
- Report supported job types, actions, availability, capacity, and recovery support.
- Accept public jobs commands only through the jobs control plane.
- Emit or report progress, log, completion, cancellation, failure, retryability, and recovery state through normalized provider operations.
- Keep actual artifacts, file paths, command lines, downloads, subprocess handles, and plugin-private state inside the provider.
Compatibility Bridge Pattern
Existing plugin queues and status screens remain allowed during migration. Core or the plugin should record a bridge hit when a legacy queue, status surface, or job-like route is used.
Recommended bridge ids:
jobs.legacy-plugin-queuejobs.legacy-status-screenjobs.legacy-backend-routejobs.legacy-progress-polljobs.legacy-update-flow
A compatibility bridge may create or update a diagnostic job summary only when it can identify a logical job without exposing private payloads. If a native provider describes the same logical job, the native provider owns the user-visible job and the compatibility record remains diagnostics-only.
Provider Adoption Examples
Sloppak Converter
- Job types: conversion and optional stem-prep coordination.
- Expected actions: enqueue, inspect, cancel when supported, retry when inputs are unchanged.
- Bridge sources: existing converter queue UI and backend conversion routes.
Tab/Profile Import
- Job types: import and validation.
- Expected actions: enqueue, inspect, cancel before start, retry failed validation/import when safe.
- Bridge sources: plugin-specific import routes and status screens.
Update Manager / Plugin Manager
- Job types: update check, download, install, rollback coordination.
- Expected actions: enqueue, inspect, cancel during safe phases, retry failed downloads.
- Extra care: plugin install/update policy and external-service trust remain outside this slice; jobs records only safe state and outcome summaries.
Studio / Preview Work
- Job types: preview generation, render, analysis, studio processing.
- Expected actions: enqueue, inspect, cancel, pause/resume only when provider can safely preserve state.
- Extra care: recording and audio processing semantics remain outside this slice.
Removal Gates
Legacy job bridges can be removed only when:
- Bundled providers use native
jobsregistration for normal queue/progress/cancel/retry flows. - Normal conversion, import, update, preview, and studio smoke runs show no unexpected bridge hits.
- Provider rehydration does not duplicate providers, active jobs, terminal jobs, or status listeners.
- Privileged enqueue without explicit user approval returns denied or user-action-required before work begins.
- Provider-selection-required is observable when multiple compatible providers lack selected/default choice.
- Scheduling tests show user-approved interactive jobs before background/maintenance jobs and FIFO within priority.
- Reload tests show only provider-recoverable jobs restored; other non-terminal jobs become orphaned or provider-unavailable with safe reasons.
- Diagnostics contain no unredacted paths, tokens, command lines, raw artifacts, media data, native handles, subprocess handles, or provider-private payloads.
Out Of Scope During Migration
The jobs domain does not define:
- media import/export file semantics
- plugin installation trust or rollback policy
- external service endpoint trust rules
- recording capture or take storage semantics
- audio-effects processing, model loading, or IR inventory
- backend route privilege review
Those domains may use jobs state later, but they should not hide their own trust and data contracts inside this slice.