#1956

fix(deployments): remove registry-pulled release images past the rollback window

Opensx4imwants to merge intofrom

Summary

Releases past the rollback window now actually lose their registry-pulled images from disk, not just their artifactRetainedAt marker.

Motivation

Retention cleared the marker for overflow releases, but DockerRuntime.purge only removed images carrying Openship-built tags. A release deployed from a registry image was recorded by digest, so its image stayed on the host forever and images:gc never saw it (no openship.project label).

Changes

  • DockerRuntime.purge also removes references pinned to an exact registry digest (repo@sha256:...). A digest names one image content and re-pulls on rollback, so this cannot strand a mutable tag. Mutable tags, migration-adopted tags, and bare image ids stay untouched, and Docker still refuses images a container is using.
  • Compose services are reclaimed by their recorded imageDigest instead of their mutable tag, and retained service digests join the keep-set so a digest a kept release references is never purged.

Verification

  • New regression tests fail before the change and pass after: digest purge and predicate coverage in docker-purge-image-ownership.test.ts, digest purge and keep-set protection in rollback-prune.test.ts.
  • Neighboring suites pass: image-gc, deployment-artifacts, project-cleanup ref-shape, cloud docker.
  • tsc --noEmit clean for packages/platform and packages/adapters.

Follow-up

This covers point (1) of the issue. Older Openship component images after self-updates (2) and a build-cache/unused-image cap for connected servers (3) are separate housekeeping work. Images orphaned by releases purged before this fix also still need a one-time manual prune.

Fixes #1955