Repository navigation
Read the installers' own code, not the scripts they emit - #10701
Merged
Merged
Conversation
tests/sh/test_tauri_retry_failure_context.sh asserts studio/setup.ps1 exits in exactly one place, the tail of Exit-SetupFailure. It counted `exit` lines with a grep over the raw file, so when #10540 made the installer emit its native path helper through a here-string instead of compiling it, the emitted probe's `exit 1` counted as the installer's own and main went red. The installer change is right; the test was reading the wrong text. tests/sh/_ps1_source.sh adds ps1_code, which blanks here-string bodies and keeps one blank line per body line so grep -n and sed addresses still point at the real file. Two details it has to get right, both learned from the files themselves: the opener is detected with quoted strings blanked first, because setup.ps1:909 and install.ps1:2280 redact credentials with a -replace whose line genuinely ends in @'; and the terminator must sit in column 0, because install.ps1 builds a .bat from an array containing "@echo off",. Two more readers were looking at emitted text: - tests/studio/test_installer_av_shapes.py opened a here-string on that same redaction line, then stayed open until the next terminator. Every check in the file silently skipped setup.ps1:910-1692 and install.ps1:2281-3024. With the fix those lines are scanned again and all 44 assertions still hold. - tests/sh/test_install_rollback_lifecycle.sh matched `} finally {` inside the emitted launcher at install.ps1:2894, and passed only because grep -A3 concatenated the context of all four matches. tests/sh/test_ps1_code_view.sh guards the filter both ways: an exit added to real code is counted, an exit added inside a here-string is not.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Repo tests (CPU)has been red on main since #10540, and the installer change is right. The test was reading the wrong text.What broke
tests/sh/test_tauri_retry_failure_context.shasserts thatstudio/setup.ps1exits in exactly one place, the tail ofExit-SetupFailure. It countedexitlines with a grep over the raw file:#10540 made the Windows installer emit its native path helper instead of compiling it, which put a probe script into a here-string:
That
exit 1is the emitted probe's control flow, not the installer's. The count went to 2 and the guard fired.The fix
tests/sh/_ps1_source.shaddsps1_code, which blanks here-string bodies and keeps one blank line per body line sogrep -nandsedaddresses still point at the real file. Two details it has to get right, both learned from the files themselves:The opener is detected with quoted strings blanked first. Both
studio/setup.ps1:909andinstall.ps1:2280redact credentials with a-replacewhose line genuinely ends in@':The terminator must sit in column 0, which is PowerShell's rule.
install.ps1builds a.batfrom an array containing"@echo off",, and a lenient match closes the here-string there.Two more readers were looking at emitted text
Neither was red, and one of them was quietly wrong:
tests/studio/test_installer_av_shapes.pyopened a here-string on that same redaction line and stayed open until the next terminator. Every check in the file silently skippedsetup.ps1:910-1692andinstall.ps1:2281-3024, about 780 and 740 lines each, including the whole emit-probe region the file exists to police. With the fix those lines are scanned again and all 44 assertions still hold.tests/sh/test_install_rollback_lifecycle.shmatched^ } finally {$atinstall.ps1:2894, inside the emitted launcher ($launcherContent = @", lines 2823-3024). It passed only becausegrep -A3concatenated the context of all four matches and one of the real ones suppliedRestore-StudioVenvRollback.Guarding the filter
tests/sh/test_ps1_code_view.shpins it both ways: anexitadded to real code is counted, anexitadded inside a here-string is not. Also covers the redaction line, the column-0 rule, the expandable@" ... "@form, a comment that merely mentions a delimiter, and that line numbers survive.Verification
All 64
tests/sh/test_*.shsuites pass.tests/studio/test_installer_av_shapes.pyandtests/test_installer_interactive_prompts.pypass 136/136.No production file changes.