The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(e2e): detect historical browser flag from installer help
ethernet315fa6882e5c
diff --git a/tests/install/e2e-assets/installer-common.sh b/tests/install/e2e-assets/installer-common.shindex b6de00dcbf5..d7c078f32ca 100644--- a/tests/install/e2e-assets/installer-common.sh+++ b/tests/install/e2e-assets/installer-common.sh@@ -69,12 +69,15 @@ resolve_update_ref() {run_source_installer() {local repo="$1" work="$2" logs="$3" ref="$4" label="$5" desktop="${6:-}"- local script="$work/install-$label.sh" text rc=0+ local script="$work/install-$label.sh" text help_text rc=0# Buffer before grep: git show | grep -q can lose to SIGPIPE under pipefail.text="$(git -C "$repo" show "$ref:scripts/install.sh")" || returngit -C "$repo" show "$ref:scripts/install.sh" > "$script" || returnlocal flags=(--skip-setup)- if grep -qF -- --skip-browser <<< "$text"; then flags+=(--skip-browser); fi+ # Rejection messages also mention --skip-browser. Only pass it when this+ # version's public help advertises the flag as supported.+ help_text="$(bash "$script" --help < /dev/null 2>/dev/null)" || help_text=""+ if grep -qF -- --skip-browser <<< "$help_text"; then flags+=(--skip-browser); fiif [ "$desktop" = desktop ]; thengrep -qF -- --include-desktop <<< "$text" \|| { fail "ref $ref does not support --include-desktop; this leg cannot mean what it claims"; return 1; }diff --git a/tests/installation/test_installer_common.py b/tests/installation/test_installer_common.pyindex 750c54837f4..9b395669399 100644--- a/tests/installation/test_installer_common.py+++ b/tests/installation/test_installer_common.py@@ -27,7 +27,9 @@ def test_redirect_and_historical_installer_keep_transport_flags_and_exit(tmp_patgit("add", ".")git("commit", "-qm", "old")old = git("rev-parse", "HEAD")- script.write_text('# --skip-browser --include-desktop\n' + script.read_text(encoding="utf-8"), encoding="utf-8")+ source_body = script.read_text(encoding="utf-8")+ script.write_text('case "$1" in --help) printf "%s\\n" "--skip-browser --include-desktop"; exit 0;; esac\n'+ '# --skip-browser --include-desktop\n' + source_body, encoding="utf-8")git("commit", "-qam", "new")new = git("rev-parse", "HEAD")subprocess.run(["git", "clone", "--bare", "-q", str(repo), str(serve)], env=env, check=True)@@ -57,6 +59,18 @@ run_source_installer "$2" "$3" "$3" "$6" new desktoprefused = run('run_source_installer "$2" "$3" "$3" "$5" unavailable desktop')assert refused.returncode != 0 and "does not support --include-desktop" in refused.stderrassert not (work / "install-unavailable.log").exists()+ script.write_text('case "$1" in\n'+ ' --help) printf "%s\\n" "--include-desktop"; exit 0;;\n'+ ' --skip-browser) exit 23;;\n'+ 'esac\n'+ '# --skip-browser no longer skips browser installation; --include-desktop stays supported\n'+ + source_body, encoding="utf-8")+ git("commit", "-qam", "reject retired browser flag")+ current = run('run_source_installer "$2" "$3" "$3" HEAD current desktop')+ assert current.returncode == 0, current.stderr+ assert (work / "install-current.log").read_text(encoding="utf-8").splitlines() == [+ "--skip-setup", "--include-desktop",+ ]script.write_text("exit 23\n", encoding="utf-8")git("commit", "-qam", "failed installer")failed = run('run_source_installer "$2" "$3" "$3" HEAD broken')