Skip to content

feat(manifest): let a job stop its own service before it runs #239

Description

@PiquelChips

Problem

A before-rollout job runs while the previous version of its service keeps serving. That's right for additive migrations, but a migration that drops or renames something the previous version still uses breaks it for the length of the job and the rollout.

piquel.fr hits this in sourceorigin-dev/sourceorigin#128: 0003 drops sessions.management_expires_at, which every session query of the running auth release reads. Between the migration and the new release going live, auth fails every request that loads a session.

volume_access = "exclusive" can't help. It stops the services that mount the job service's writable volumes, but auth mounts none (the job is rejected with job_volume_access_invalid), and the only writable volume belongs to postgres, which the migration needs.

Proposed solution

Let a job stop its own service before it runs:

[[spec.jobs]]
name = "migrate"
service = "auth"
command = ["auth-service", "migrate"]
run = "before-rollout"
stop_service = true

Once the job's dependencies are ready, the previous version of auth stops, and the job starts after its containers have exited. The service starts again with the rollout. If the job fails or the deployment is cancelled, active-target repair starts it again, as it already does for services stopped by an exclusive job. Plans warn with the existing job_stops_services.

This trades a short, explicit outage for never running the old code against a schema it doesn't understand. Expand/contract migrations remain the way to avoid the outage when it matters.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

🤖 Generated with Claude Code

Activity

  1. moved this from Needs Triage to Up Next in sourceorigin.devon Oct 17, 2026
  2. added this to the 0.1 milestone on Oct 17, 2026
  3. self-assigned this
    on Oct 22, 2026
  4. moved this from Up Next to In Progress in sourceorigin.devon Oct 29, 2026
  5. added a commit that references this issue on Oct 30, 2026
    92d4118
  6. moved this from In Progress to Done in sourceorigin.devon Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions