Skip to content

fix(e2e): keep backup preflight failure evidence across attempts - #4242

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/e2e-preflight-failure-log
Sep 15, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/e2e-preflight-failure-log

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

The S3 access preflight that runs before a backup roundtrip prints its port-forward capture only when the port-forward never comes up. On the failure that actually happens, a healthy port-forward and an S3 roundtrip that never completes, that capture is written and then thrown away. The mc log is truncated at the top of every attempt on top of that, so what reaches the job log is the tail of the last attempt with nothing in it to say which stage died. One real run left a single line of evidence, an upload progress line, which reads as an upload that finished and a download that hung. The upload was what failed.

The timeout path now prints both logs, the mc log accumulates across attempts, and every attempt records which of PUT, GET, compare or DELETE it reached. That is enough to tell a broken channel to S3 from S3 refusing the operation, and to see how many attempts ran and how each one ended.

The port-forward log goes in whole rather than filtered. kubectl port-forward writes one Handling connection for <port> line per TCP connection, and whether those lines are there at all is the answer to whether mc ever reached the forwarder, so dropping them to cut noise would delete the signal this change exists to produce.

Diagnosability only. Nothing changes about what the preflight passes or fails.

Closes #4240

Screenshots

No UI change.

Downstream repositories

Walked the trigger map in docs/agents/contributing.md against the diff. Nothing under hack/ is moved or renamed, no make target changes behaviour, and the node prerequisites the Ansible collection and talm mirror are untouched.

Release note

fix(e2e): a backup access preflight that times out now prints the port-forward log and the outcome of every attempt, not just the tail of the last one

Summary by CodeRabbit

  • Bug Fixes

    • Backup access preflight checks now validate the complete upload, download, comparison, and cleanup sequence.
    • Retry results identify the specific operation that failed and preserve failure details across attempts, improving troubleshooting.
  • Tests

    • Added coverage for reporting the first failed upload.
    • Added timeout-path coverage for readiness checks, repeated operation failures, and reporting each affected stage.

@github-actions github-actions Bot added area/testing Issues or PRs related to testing (e2e, bats, unit tests) kind/bug Categorizes issue or PR as related to a bug labels Sep 14, 2026
@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a19e79a9-dd9d-4257-83d8-bd31e2f0dc69

📥 Commits

Reviewing files that changed from the base of the PR and between 4a5d074 and 65c183e.

📒 Files selected for processing (1)
  • hack/backup-access-preflight.bats

Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The backup access preflight now tracks failed PUT, GET, compare, and DELETE stages across retries. It preserves retry logs and reports port-forward output on timeout. Bats tests cover first-attempt PUT failures and successive failures across all stages.

Changes

Backup access preflight diagnostics

Layer / File(s) Summary
Retry failure-stage tracking
hack/e2e-chainsaw/_lib/backup-access-preflight.sh
The retry loop tracks the active S3 operation, appends failure records to mc.log, and records PUT, GET, compare, and DELETE failures separately.
Failure-path test coverage
hack/backup-access-preflight.bats
Tests verify first-attempt PUT reporting, timeout behavior, preserved port-forward output, and failure reporting across successive S3 stages.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 65c18

The updated timeout diagnostics preserve the relevant logs and identify each failed S3 stage without changing preflight pass/fail behavior. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving backup preflight failure evidence across retry attempts.
Linked Issues check ✅ Passed The PR satisfies the coding requirements in #4240. The timeout path prints port-forward.log and the accumulated mc.log. The retry loop appends logs and records PUT, GET, compare, or DELETE for eac…
Out of Scope Changes check ✅ Passed The changes stay within #4240. The shell changes improve backup access preflight diagnostics. The Bats changes test the required timeout and retry evidence. No unrelated product, UI, downstream, or pu…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/e2e-preflight-failure-log

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.

The backup access preflight printed its port-forward capture only when
the port-forward never came up, and truncated its mc log at the top of
every attempt. On the path that fails in practice, a healthy
port-forward and an S3 round trip that never completes, the output was
the tail of the last attempt with nothing to say which stage it died
at, which reads as a successful upload followed by a hung download.

Print the port-forward capture alongside the mc log on the timeout
path, append the mc log across attempts, and record which of PUT, GET,
compare or DELETE each attempt reached.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>

@IvanHunters IvanHunters left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict

LGTM with non-blocking notes

Pass/fail behaviour is identical to the merge base on all 16 outcome combinations, the new evidence lines are mutation-covered, and the red check on this head is not from this change.

Findings

  • [MINOR] hack/backup-access-preflight.bats:160, clock comment describes a stub discipline the stub does not have

Caveats

  • The red E2E (in-tree) check on 65c183e31 is pre-existing. Its Run E2E tests step ends in 7 chainsaw failures, every backup one being BackupJob ... reached terminal 'Failed' after the preflight had already logged passed PUT, GET, compare, and DELETE on attempt 1. Unrelated PR #4237 fails the same set the same day, so the diff is not the cause and the changed path is not implicated.
  • The branch this PR rewrites has still never run in CI. All four preflight call sites passed on their first attempt in that job, so a cluster exercised only the success path; the timeout path is held by the bats suite alone.
  • Dump volume is bounded on the mc side only. A 90s budget admits 19 attempts (sleep 5 per iteration) and a fail-fast run emits 40 stderr lines, measured locally. The kubectl port-forward half is a real client whose per-connection line count I could not measure without a cluster.

Recommended follow-ups

  • The stage line says where an attempt stopped, not how it stopped. In the run cited by #4240 the one surviving line was mc's arrow line with no error after it, which is the shape of timeout 15 killing it rather than S3 refusing the operation. Carrying the exit status (rc=124 against rc=1) onto the stage line would settle that without falling back to the port-forward block.

esac
}
# A stubbed clock keeps the retry budget independent of how fast the
# stubs run: only a completed PUT advances it, so the loop ends after a

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[MINOR] clock comment describes a stub discipline the stub does not have

The comment reads "only a completed PUT advances it", but the upload arm bumps $now by 10 before it reaches if [ "$count" -eq 3 ], so attempt 4's failing PUT advances the clock too, and that advance (130 to 140, past the 135 deadline) is what ends the loop. Reordering the stub to match the sentence leaves the suite green, so nothing is hidden by the mismatch, but the next person to tidy this arm is being told the wrong rule. Drop "completed", or move the two clock lines below the failure check.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 999a8f5 into main Sep 15, 2026
18 of 20 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/e2e-preflight-failure-log branch September 15, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/testing Issues or PRs related to testing (e2e, bats, unit tests) kind/bug Categorizes issue or PR as related to a bug size/L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

e2e: backup access preflight discards the port-forward log on the failure path that needs it

2 participants