Skip to content

fix: rewrite promote-force e2e to test a real guard force bypasses#122

Merged
joshua-temple merged 1 commit into
mainfrom
fix/promote-force-scenario
Jun 11, 2026
Merged

fix: rewrite promote-force e2e to test a real guard force bypasses#122
joshua-temple merged 1 commit into
mainfrom
fix/promote-force-scenario

Conversation

@joshua-temple

Copy link
Copy Markdown
Collaborator

Problem

The promote-force.yaml e2e scenario asserted that a no-op re-promote is rejected by a guard, then that force bypasses it. The promote code has no no-op guard that errors: a no-op re-promote is silently skipped and succeeds (SkippedEnvs, "all environments are up to date"). The scenario's expect_failure step therefore tested behavior that does not exist and only ever passed on flaky timing. Isolated, it fails deterministically with expected promote to fail but it succeeded.

Fix

Rewrote the scenario to exercise the one guard force genuinely overrides: the patch-containment guard that protects a diverged environment (internal/promote/preflight.go, checkPatchContainment). The breaking-change gate is bypassed by allow_breaking, not force, so it is not the right target.

The new scenario keeps dev behind trunk, marks test diverged with a later trunk commit as a recorded patch, then:

  • non-force promote into the diverged env hits the containment guard and fails (expect_failure), test unchanged
  • the same promote with force: true overrides the guard and succeeds

Ancestry is decided by real git on fully fetched history, so both legs are deterministic. Renamed to "Promote force bypasses the patch-containment guard".

Verification

  • Scenario run in isolation 3 times, all passed (clean Docker between runs)
  • go build ./..., cd e2e && go vet ./..., golangci-lint run ./e2e/... all clean

Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
@joshua-temple joshua-temple merged commit 3e93f10 into main Jun 11, 2026
6 checks passed
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