You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add text-based e2e assertion helpers for already-captured output
update the Python GitHub attestation e2e test to avoid re-evaluating captured output through bash -c
Why
When mise install output contains warning text with shell-sensitive characters, e.g. (403 Forbidden) inside a quoted URL error, assert_contains "echo "$output"" ... can turn captured output back into shell syntax and fail with bash: -c: line 5: syntax error near unexpected token ('`.
synthetic assertion check with (403 Forbidden) warning text
mise run test:e2e e2e/core/test_python_github_attestations
This PR was generated by an AI coding assistant.
Note
Low Risk
Test-only assertion helpers and one e2e test update; no production or runtime behavior changes.
Overview
Adds assert_contains_text and assert_not_contains_text in e2e/assert.sh so e2e tests can assert substrings on already-captured stdout/stderr without wrapping it in a command that runs under bash -c.
The Python GitHub attestations e2e test now passes $output directly to those helpers instead of assert_contains "echo \"$output\"" ..., avoiding shell parse errors when install logs include parenthesized text (e.g. (403 Forbidden) in URL errors).
Reviewed by Cursor Bugbot for commit 4a6a86c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Release Notes
Tests
Added new assertion helpers for substring validation in test framework
Updated existing tests to use improved assertion methods
This PR adds two new e2e assertion helper functions—assert_contains_text and assert_not_contains_text—to validate substring presence/absence in already-captured text, and updates the GitHub attestations e2e test to use these helpers for cleaner attestation message checking.
Changes
E2E Substring Assertion Helpers
Layer / File(s)
Summary
Substring assertion helpers and test usage e2e/assert.sh, e2e/core/test_python_github_attestations
New assert_contains_text(actual, substring) and assert_not_contains_text(actual, substring) functions verify substring presence/absence with simple success/fail output. The GitHub attestations test switches from assert_contains to assert_contains_text for cleaner verification of the mise install output messages.
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~5 minutes
Poem
🐰 Two helpers hopping into the test,
Searching for substrings, putting assertions to rest, contains_text, not_contains_text dance hand in hand,
Attestations verified with the finest of sand! ✨
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name
Status
Explanation
Resolution
Docstring Coverage
⚠️ Warning
Docstring coverage is 60.87% 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
Title check
✅ Passed
The title 'test(e2e): assert captured output without shell eval' accurately describes the main change—adding assertion helpers to check captured output without shell re-evaluation, directly addressing the core issue of shell interpretation errors.
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.
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches📝 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-assert-captured-output
Comment @coderabbitai help to get the list of available commands and usage tips.
This PR fixes a shell-injection bug in the e2e test framework where capturing mise install output containing shell-sensitive characters (e.g. (403 Forbidden) in a URL) and then re-evaluating it via assert_contains "echo \"$output\"" would cause a bash syntax error.
Adds assert_contains_text and assert_not_contains_text helpers that accept pre-captured text directly as the first argument, bypassing the bash -c re-evaluation path entirely.
Updates test_python_github_attestations to use the new helpers, eliminating the unsafe echo "$output" shell re-evaluation pattern.
Confidence Score: 5/5
Safe to merge — changes are confined to the e2e test helpers and a single test file, with no production code affected.
The fix is correct and well-scoped: the new helpers directly compare pre-captured text without shell re-evaluation, and the updated test properly passes the captured variable rather than wrapping it in a command string. No production code paths are touched.
No files require special attention.
Important Files Changed
Filename
Overview
e2e/assert.sh
Adds assert_contains_text and assert_not_contains_text helpers that check pre-captured text directly without re-evaluating it via bash. Logic is correct; failure messages omit the actual captured value (P2).
e2e/core/test_python_github_attestations
Switches from assert_contains "echo \"$output\"" to assert_contains_text "$output", correctly avoiding shell re-evaluation of captured output that could contain special characters like (403 Forbidden).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
bash -cWhy
When
mise installoutput contains warning text with shell-sensitive characters, e.g.(403 Forbidden)inside a quoted URL error,assert_contains "echo "$output"" ...can turn captured output back into shell syntax and fail withbash: -c: line 5: syntax error near unexpected token('`.Verification
bash -n e2e/assert.sh e2e/core/test_python_github_attestations(403 Forbidden)warning textmise run test:e2e e2e/core/test_python_github_attestationsThis PR was generated by an AI coding assistant.
Note
Low Risk
Test-only assertion helpers and one e2e test update; no production or runtime behavior changes.
Overview
Adds
assert_contains_textandassert_not_contains_textine2e/assert.shso e2e tests can assert substrings on already-captured stdout/stderr without wrapping it in a command that runs underbash -c.The Python GitHub attestations e2e test now passes
$outputdirectly to those helpers instead ofassert_contains "echo \"$output\"" ..., avoiding shell parse errors when install logs include parenthesized text (e.g.(403 Forbidden)in URL errors).Reviewed by Cursor Bugbot for commit 4a6a86c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Release Notes