Skip to content

test(e2e): cover registry retag guard and tag update rollback - #881

Merged
magrhino merged 3 commits into
mainfrom
claude/e2e-test-coverage-7d3150
Oct 14, 2026
Merged

magrhino merged 3 commits into
mainfrom
claude/e2e-test-coverage-7d3150

Conversation

@magrhino

Copy link
Copy Markdown
Owner

Summary

The Docker E2E suite only covered successful updates and a preflight failure. It never proved, against real Docker, that recreation ignores a moved registry tag (#643), or that a failed tag update rolls back. This PR adds both scenarios to tests/e2e-docker-compose.sh.

  • Registry retag guard: the service uses pull_policy: always. A new opt-in hook in the e2e Docker wrapper moves the registry's latest tag to a third image right after the updater's compose pull and before recreation. It does this with a registry-side manifest copy, so local tags are untouched. The test asserts the hook fired, the container runs the pulled new image, the local tag still points at that image, and the run is recorded as success. The scenario then restores latest for later scenarios.
  • Tag update rollback: 1.0 → 2.0 with --allow-tag-updates, where 2.0 fails its healthcheck. The test asserts exit 1, the WUD line is kept, the compose file is byte-identical to the original, the old container is healthy again, and the incident log reports rollback=restored-and-healthy and manual_review_required=no. It also checks the audit status is failure.
  • The hook only runs when E2E_RETAG_AFTER_COMPOSE_PULL is set, so the existing scenarios are unaffected. New local tags are added to cleanup.

Reviewers: a plain same-tag update that fails its health check records health-failed and does not roll back. Only compose-rewrite paths (tag updates, digest pins) restore. That's why the rollback scenario uses a tag update.

Scope

Checklist

  • Tests added or updated
  • README.md or docs/ updated if install, deployment, config, or user-facing behavior changed — N/A: test-only
  • docs/examples/template.env or docs/examples/webui.env.example updated if environment variables or example config changed — N/A
  • Release Please/changelog impact considered; no manual CHANGELOG.md edit needed outside release prep

Test plan

  • tests/run-all.sh — N/A: test-only change to the Docker-gated harness; ran the harness directly instead

  • Focused test(s):

    • bash -n tests/e2e-docker-compose.sh and shellcheck tests/e2e-docker-compose.sh — passed
    • Negative control: with --pull never removed from ComposeCli.up(), the retag scenario failed with app container did not reach version new; the change was reverted
  • Docker or Compose validation, if container behavior changed: tests/e2e-docker-compose.sh passed locally on Docker 29.4 / Compose v5.1.2 with all six scenarios. On macOS, TMPDIR must point at a non-symlinked directory: the default /var/folders temp path resolves to /private/var/folders, which makes the existing stack-recreate scenario fail locally because of a path mismatch. That failure is unrelated to this change and doesn't occur on Linux CI.

@sourcery-ai

sourcery-ai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR expands the Docker Compose E2E harness with an opt-in registry manifest retag race and a failing tag-update rollback scenario, using dedicated image fixtures, compose files, wrapper behavior, cleanup, and assertions for runtime, configuration, queue, incident, and audit state.

File-Level Changes

Change Details Files
Add an end-to-end registry retag race test proving pulled image identity is preserved during recreation.
  • Extend the Docker wrapper with an opt-in, one-shot post-pull hook.
  • Copy a registry manifest server-side to move latest without changing local tags.
  • Build and publish a third image, trigger the update, and assert the container, local tag, queue, and audit record use the pulled image.
  • Restore the registry tag and clean up all temporary images.
tests/e2e-docker-compose.sh
Add an end-to-end failed tag-update scenario proving compose and service state are rolled back.
  • Publish healthy 1.0 and unhealthy 2.0 fixture images and run an allowed tag update.
  • Assert failure status, unchanged work queue, byte-identical compose configuration, and recovery of the old healthy container.
  • Validate incident-log rollback and manual-review fields plus the persisted audit failure status.
tests/e2e-docker-compose.sh
Provide isolated compose fixtures and invoke both scenarios in the full Docker E2E sequence.
  • Add compose definitions for always-pull retag protection and health-checked tag rollback.
  • Run the new scenarios after the existing E2E coverage while preserving behavior when the retag hook is disabled.
tests/e2e-docker-compose.sh

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 202376e7-baff-4742-9a6b-d2263f550c42

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a1efb38c-04e1-4d08-8830-6291126cf5e8
📥 Commits

Reviewing files that changed from the base of the PR and between 87b417b and aef927e.

📒 Files selected for processing: 1
  • tests/e2e-docker-compose.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Covered now are registry retagging after an image pull and rollback after an unhealthy tag update in the Docker Compose E2E script.

Changes: Docker Compose E2E coverage

Layer / File(s) Summary
Shared E2E harness and fixtures
tests/e2e-docker-compose.sh
Added image tracking and cleanup, a Docker wrapper for registry retagging after pulls, Compose fixtures, and a shared query for the latest update-run status.
Registry retag after pull
tests/e2e-docker-compose.sh
The new scenario checks that the updater uses the pulled image after the registry tag moves, consumes the input, and records a successful audit status.
Unhealthy tag update rollback
tests/e2e-docker-compose.sh
The new scenario checks failure status, restoration of the input and Compose files, continued health of the old version, and incident and audit records. The main test sequence runs both new scenarios.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to aef92

The added E2E scenarios are ready to merge after normal checks; no blocking issue was established.

Pre-merge checks: Passed 4
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed Clearly identifies the two main changes: registry retag protection and tag update rollback coverage. Concise and specific it is.
Description check Passed The description follows the template, explains the objective, lists implementation details, documents scope and follow-up work, records checklist decisions, and provides test results and limitations. …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Warnings
⚠️

tests/e2e-docker-compose.sh adds Docker/socket-adjacent text. Confirm socket-proxy/raw-socket assumptions, read-only defaults, and Docker validation.

Add Danger: docker-socket-review-complete if reviewed.

Generated by 🚫 dangerJS against ba786eb

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Oct 14, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/e2e-docker-compose.sh" line_range="762" />
<code_context>
+
+  run compose down -v --remove-orphans
+  write_tag_rollback_compose_file
+  compose_before="$(cat "$COMPOSE_FILE")"
+  run compose up -d
+  wait_for_container_version old
</code_context>
<issue_to_address>
**Trailing newline rollback goes undetected**

When rollback changes only the Compose file’s trailing newline bytes, the `$(cat ...)` captures for `compose_before` and `COMPOSE_FILE` strip trailing newlines, so the equality assertion passes and the test reports a successful restoration despite different file bytes.

Save the original Compose file as a byte-preserving snapshot and compare it with the restored file using a bytewise comparison such as `cmp`.

Also at `tests/e2e-docker-compose.sh:798-799`.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tests/e2e-docker-compose.sh:762


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/e2e-docker-compose.sh Outdated

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sourcery assessment

Approved.

@magrhino
magrhino force-pushed the claude/e2e-test-coverage-7d3150 branch from a69ab41 to aef927e Compare October 14, 2026 01:51
@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@magrhino

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@magrhino
magrhino enabled auto-merge (squash) October 14, 2026 02:26
@magrhino
magrhino force-pushed the claude/e2e-test-coverage-7d3150 branch from aef927e to ba786eb Compare October 14, 2026 02:33
@sonarqubecloud

Copy link
Copy Markdown

@magrhino
magrhino merged commit 37384e0 into main Oct 14, 2026
25 checks passed
@magrhino
magrhino deleted the claude/e2e-test-coverage-7d3150 branch October 14, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant