Skip to content

Add ESC to abort image pull with fall-back to local#341

Draft
gtsiolis wants to merge 1 commit into
mainfrom
pro-324-esc-to-abort-image-pull-with-fall-back-to-local-b20c
Draft

Add ESC to abort image pull with fall-back to local#341
gtsiolis wants to merge 1 commit into
mainfrom
pro-324-esc-to-abort-image-pull-with-fall-back-to-local-b20c

Conversation

@gtsiolis

Copy link
Copy Markdown
Member

Instead of a pre-pull prompt, pull immediately but let the user bail. When a floating-tag (latest/empty) pull starts downloading real layers, a local copy of the image is present, and we're interactive, the spinner shows:

Pulling new version… (press esc to keep current version)

Pressing ESC cancels only the in-flight pull (Ctrl+C still quits the program) and starts the emulator with the existing local image. The same fall-back happens automatically — regardless of interactive mode — when a pull fails (e.g. offline) and a local copy exists, rather than aborting the start. The hint only appears once Docker reports actual layer download, so it never flashes on a cache hit.

How it works

  • pullImages now checks ImageExists for every image and delegates each pull to a new pullImage helper that runs the pull under a per-pull cancel context and selects on a skip channel.
  • The domain stays UI-free: it emits a new PullSkippableEvent carrying a cancel channel it owns; the TUI binds ESC during the pulling phase to signal it. Non-interactive mode never emits the event, and PlainSink has no rendering for it.
  • A failed pull with no local copy stays fatal (ErrorEvent + silent error), preserving prior behavior.

Tests

  • Unit (pullImage): ESC → skip + use local; pull error + local present → auto fall-back; pull error + no local → fatal; non-interactive → never skippable.
  • UI (app): ESC signals the skip channel and shows the hint without quitting; ESC is inert with no pull in flight.
  • Formatter parity: PlainSink suppresses PullSkippableEvent.

Deterministic integration tests aren't practical here — forcing an offline pull error requires intercepting the hardcoded registry, and an ESC-during-pull PTY test depends on pull timing — so the behavior is covered by the unit/UI tests above.

Depends on PRO-323 (ImageExists), already merged.

During a floating-tag pull, if a local copy of the image is already present
and we're interactive, show "press esc to keep current version" once real
layer download begins. Pressing ESC cancels only the in-flight pull (Ctrl+C
still quits) and starts the emulator with the existing local image. A failed
pull (e.g. offline) with a local copy present now falls back automatically
instead of aborting the start.

The domain stays UI-free: pullImage runs the pull under a per-pull cancel
context and selects on a skip channel the TUI signals via the new
PullSkippableEvent.

Generated with [Linear](https://linear.app/localstack/issue/PRO-324/esc-to-abort-image-pull-with-fall-back-to-local#agent-session-ee6a32f4)

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
@gtsiolis gtsiolis self-assigned this Jun 25, 2026
@gtsiolis gtsiolis added semver: patch docs: needed Pull request requires documentation updates labels Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs: needed Pull request requires documentation updates semver: patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant