fix(tests): force the non-TTY condition instead of inheriting it - #177
Open
MCamner wants to merge 1 commit into
Open
fix(tests): force the non-TTY condition instead of inheriting it#177MCamner wants to merge 1 commit into
MCamner wants to merge 1 commit into
Conversation
gitmerge-safe-smoke step 9 asserts that the safe merge refuses without an interactive terminal. The gate is `[[ -t 0 ]]`, and the step ran the script with stdin inherited from whatever launched the suite — so it only tested anything when the suite happened to run without a TTY. Run from mqlaunch's SELF-CHECK in a real terminal, stdin is a TTY, the gate correctly passes, and the script walks on to "No candidate branches found to merge" in the throwaway repo. The grep for 'interactive terminal' then fails and the suite aborts before step 10 — against a script that was behaving exactly as designed. Verified with a real pty on stdin (python pty, not a `script` wrapper): gitmerge-safe.sh does not refuse, exits 1 on the branch check instead. With `</dev/null` the step passes both with and without a TTY. The safety contract itself is unchanged and intact: the script still refuses when there genuinely is no TTY, before any network operation. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Symptom
mqlaunch→ SELF-CHECK stops here:Step 10 never prints. Run from a pipe or CI the same suite passes.
Cause
The gate in
gitmerge-safe.shis:Step 9 ran the script with stdin inherited from whatever launched the suite. That only proves something when the suite happens to run without a TTY. SELF-CHECK runs in a real terminal, so stdin is a TTY, the gate correctly passes, and the script walks on to the next check — in the step's throwaway single-branch repo that is
Error: No candidate branches found to merge.The followinggrep -q 'interactive terminal'finds nothing,set -eaborts, and the suite reports a failure against a script that behaved exactly as designed.Measured with a real pty on stdin, not a
scriptwrapper:Change
One redirect.
/dev/nullis never a TTY, so the condition is forced rather than inherited:Verification
The safety contract is unchanged: the script still refuses when there genuinely is no TTY, before any network operation. Step 10 still pins that the gate precedes
git fetch.🤖 Generated with Claude Code