Skip to content

GH#4150: align recovery test failure propagation with set -e semantics#4160

Merged
marcusquinn merged 1 commit intomainfrom
bugfix/issue-4150-pr-3885-recovery-feedback
Mar 11, 2026
Merged

GH#4150: align recovery test failure propagation with set -e semantics#4160
marcusquinn merged 1 commit intomainfrom
bugfix/issue-4150-pr-3885-recovery-feedback

Conversation

@marcusquinn
Copy link
Owner

@marcusquinn marcusquinn commented Mar 11, 2026

Summary

  • make assert_contains() return non-zero on failed matches so wrapper assertions propagate command failure semantics
  • keep full-sweep behavior by relying on existing set +e guard in run_checks() while preserving final failure accounting via TESTS_FAILED
  • verify the change with shellcheck and direct execution of .agents/scripts/tests/test-pr-3885-recovery.sh

Closes #4150

Summary by CodeRabbit

  • Tests
    • Improved test failure handling to ensure proper error detection and reporting during test execution.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cd2ed073-20ca-4c32-8f8a-18aea3e90c02

📥 Commits

Reviewing files that changed from the base of the PR and between a0611da and b760d7c.

📒 Files selected for processing (1)
  • .agents/scripts/tests/test-pr-3885-recovery.sh

Walkthrough

Modified assert_contains() to return 0 instead of 1 when a pattern is not found, allowing the test harness to continue execution and collect all test failures via a counter instead of aborting on the first failure under set -e.

Changes

Cohort / File(s) Summary
Test Assertion Handler
.agents/scripts/tests/test-pr-3885-recovery.sh
Changed failure return path in assert_contains() from return 1 to return 0 to prevent early script exit under set -e, enabling full test suite execution with failure collection via counters.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • PR #4133: Introduces the test-pr-3885-recovery.sh harness and assert_contains() function that this PR corrects based on review feedback.

Suggested labels

bug

Poem

A one-line fix restores the flow,
Where return 0 lets the tests all go.
No early exits, no rushing away—
Complete the regression, let failures stay! 🎯

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 PR title directly and specifically describes the main change: aligning recovery test failure propagation with set -e semantics, which matches the code change to assert_contains return value.
Linked Issues check ✅ Passed The PR addresses the primary objective from #4150 by changing assert_contains to return 0 on failure, allowing the full test sweep to complete while preserving failure accounting via TESTS_FAILED.
Out of Scope Changes check ✅ Passed The change is narrowly scoped to the single assert_contains return statement and directly addresses the linked issue. No unrelated modifications are present in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bugfix/issue-4150-pr-3885-recovery-feedback

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 and usage tips.

@github-actions
Copy link
Contributor

🔍 Code Quality Report

�[0;35m[MONITOR]�[0m Code Review Monitoring Report

�[0;34m[INFO]�[0m Latest Quality Status:
SonarCloud: 0 bugs, 0 vulnerabilities, 402 code smells

�[0;34m[INFO]�[0m Recent monitoring activity:
Wed Mar 11 18:41:47 UTC 2026: Code review monitoring started
Wed Mar 11 18:41:47 UTC 2026: SonarCloud - Bugs: 0, Vulnerabilities: 0, Code Smells: 402

📈 Current Quality Metrics

  • BUGS: 0
  • CODE SMELLS: 402
  • VULNERABILITIES: 0

Generated on: Wed Mar 11 18:41:50 UTC 2026


Generated by AI DevOps Framework Code Review Monitoring

@sonarqubecloud
Copy link

@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the robustness of test execution by improving how assertion failures are handled. It ensures that individual test failures correctly signal an error condition, which is crucial for scripts operating under strict error propagation rules, while maintaining the ability to run all tests and collect comprehensive failure reports.

Highlights

  • Test Failure Propagation: Modified the assert_contains function in test-pr-3885-recovery.sh to return a non-zero exit code (1) when an assertion fails. This ensures that test failures are properly propagated, aligning with set -e semantics.
  • Test Execution Semantics: Ensured that the overall test suite continues to run to completion (full-sweep behavior) by relying on the existing set +e guard within run_checks(), while still accurately accounting for all failures via the TESTS_FAILED variable.
Changelog
  • .agents/scripts/tests/test-pr-3885-recovery.sh
    • Updated assert_contains() to return a non-zero exit code on failure.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly aligns the assert_contains test helper function with standard shell error handling by making it return a non-zero exit code on failure. The change from return 0 to return 1 in the failure case is appropriate and ensures that test failures can be correctly propagated, especially in environments using set -e. The change is correct and improves the robustness of the test suite.

@marcusquinn marcusquinn merged commit d6f7b55 into main Mar 11, 2026
28 checks passed
@marcusquinn marcusquinn deleted the bugfix/issue-4150-pr-3885-recovery-feedback branch March 11, 2026 23:23
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.

quality-debt: .agents/scripts/tests/test-pr-3885-recovery.sh — PR #4133 review feedback (high)

1 participant