From 6895b586f0b442b73eac79d81dfc73d8d0d58919 Mon Sep 17 00:00:00 2001 From: McAmner Date: Fri, 7 Aug 2026 00:37:30 +0200 Subject: [PATCH 1/2] fix(tests): force the non-TTY condition instead of inheriting it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ` --- tests/gitmerge-safe-smoke.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/gitmerge-safe-smoke.sh b/tests/gitmerge-safe-smoke.sh index dfa8c5e1..70d0abf0 100755 --- a/tests/gitmerge-safe-smoke.sh +++ b/tests/gitmerge-safe-smoke.sh @@ -60,7 +60,12 @@ tmpdir="$(mktemp -d)" printf 'base\n' > file.txt git add file.txt git commit -qm base - "$MERGE_SCRIPT" >/tmp/gitmerge-safe-smoke.out 2>&1 && exit 1 + # stdin must be redirected explicitly, not inherited. The gate is [[ -t 0 ]], + # so this step only proved anything when the suite happened to run without a + # TTY. Run from mqlaunch's SELF-CHECK in a real terminal the gate correctly + # passed, the script walked on to "No candidate branches found to merge", and + # the assertion below failed against a script that was behaving properly. + "$MERGE_SCRIPT" /tmp/gitmerge-safe-smoke.out 2>&1 && exit 1 grep -q 'interactive terminal' /tmp/gitmerge-safe-smoke.out ) From 43fc7ca27b62c1de845459b2e70d998641acd1a5 Mon Sep 17 00:00:00 2001 From: Mattias Camner Date: Sat, 8 Aug 2026 16:03:47 +0200 Subject: [PATCH 2/2] fix(tests): use mktemp for gitmerge-safe smoke output file Avoid a fixed path in /tmp for the non-TTY smoke check output, which could collide across concurrent runs. Use mktemp for the output file and remove it after the assertion. --- tests/gitmerge-safe-smoke.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/gitmerge-safe-smoke.sh b/tests/gitmerge-safe-smoke.sh index 70d0abf0..900521e4 100755 --- a/tests/gitmerge-safe-smoke.sh +++ b/tests/gitmerge-safe-smoke.sh @@ -65,8 +65,10 @@ tmpdir="$(mktemp -d)" # TTY. Run from mqlaunch's SELF-CHECK in a real terminal the gate correctly # passed, the script walked on to "No candidate branches found to merge", and # the assertion below failed against a script that was behaving properly. - "$MERGE_SCRIPT" /tmp/gitmerge-safe-smoke.out 2>&1 && exit 1 - grep -q 'interactive terminal' /tmp/gitmerge-safe-smoke.out + out="$(mktemp)" + "$MERGE_SCRIPT" "$out" 2>&1 && exit 1 + grep -q 'interactive terminal' "$out" + rm -f "$out" ) echo "[10/10] TTY gate precedes network fetch"