Skip to content

Phase 4/9: Cut over job APIs, repository assignments, and schedules to job_id #474

Description

@borg-codex-bot

Parent: #447

Depends on: Phase 3/9

Delivery branch: codex/issue-447-immutable-job-ids

Delivery model: This phase is committed to the shared #447 integration branch and the single draft pull request against main. It is not merged or released independently.

Objective

Convert the active configuration and control plane from mutable job_key values to immutable job_id values. Job CRUD, repository relationships, schedules and cron must all address the same logical job after name, archive-prefix, repository or storage changes.

Job API and discovery

  • Discover canonical jobs by <job_id>.json and validated payload identity.
  • Address load, save, enable, disable, run preparation, delete preparation and other job actions by job_id.
  • Return current display name, archive prefix and repository descriptors separately.
  • Retain a bounded legacy-key request adapter only where Introduce immutable job IDs across all job-dependent data and workflows #447 explicitly permits it.
  • Reject ambiguous legacy aliases and log boundary use as deprecated.
  • Never write new mutable-key references.

Repository assignments

  • Replace repository used_by and source_job_keys identity lists with canonical job ID references.
  • Derive display labels from the current job inventory.
  • Update old and new assignments atomically when a repository changes.
  • Preserve one current repository per job.
  • Do not create repository history or move existing archives.
  • Reconciliation must report missing or dangling IDs explicitly.
  • Repository deletion rules remain unchanged.

Schedules and cron

  • Key schedules.json by job_id.
  • Make cron requests submit job_id.
  • Preserve cron expression and enabled state through migration and edits.
  • Remove the current save ordering defect where changing Type ID saves a new job identity but leaves an invalid old schedule key.
  • Regenerate the managed crontab only after schedule verification succeeds.
  • Keep the restore-test scheduler boundary explicit for its later phase.

Transaction boundaries

Job save operations that affect metadata, repository assignment and schedule identity must not leave a partially renamed job. Define rollback or pre-write validation so that failure cannot produce the support-reported state with a saved new identity and an orphaned config_local schedule.

Tests

  • discovery and CRUD by UUID;
  • rename, prefix change, repository change and storage change without identity changes;
  • atomic repository reassignment;
  • schedule migration, save, disable and deletion by ID;
  • cron generation and request payloads by ID;
  • regression for config_local to pfsense_local showing one logical job and a preserved schedule;
  • dangling, duplicate and ambiguous reference rejection;
  • bounded unambiguous legacy API resolution;
  • no new mutable-key persistence.

Test-channel policy

Do not publish a test-channel version. Backup runtime, status writers and readers are not fully converted yet, so a real installation would not have a complete operational path.

Acceptance criteria

  • Job configuration and repository references use only job_id internally.
  • Schedules survive every editable job descriptor change.
  • Cron invokes jobs by ID.
  • A failed save cannot leave metadata and schedule identity out of sync.
  • Repository reconciliation and APIs reject invalid ID relationships clearly.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area::repositoriesRepository storage, Borg maintenance, and remote transport handlingarea::workflowRepository workflow, issues, PRs, and release processimpact::internalInternal-only change without direct user impactpriority::1-criticalHighest priority; address firstrelease-note::noNo user-facing release note neededtype::featureNew user-facing or plugin feature

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions