Skip to content

The agent that grows with you

fix: recognize PM source launcher in DMG install driver

ethernet46e9f8746f4e
diff --git a/tests/install/e2e-assets/drive-dmg-install.sh b/tests/install/e2e-assets/drive-dmg-install.sh
index c57d7081403..f69cbb1a00b 100644
--- a/tests/install/e2e-assets/drive-dmg-install.sh
+++ b/tests/install/e2e-assets/drive-dmg-install.sh
@@ -4,7 +4,7 @@
# The Setup app is Tauri (Rust + system webview), so Playwright/Electron
# attach never works. Launch the binary bare in the background (it inherits
# the redirect env), click "Install Hermes ->" with native input, then watch
-# the install land on disk: checkout + venv console script.
+# the install land on disk: checkout + installed source launcher + app.
#
# Usage:
# drive-dmg-install.sh --app-bin <path> --install-dir <path> \
@@ -97,10 +97,12 @@ click_install() {
echo "clicked ${cx},${cy} (window ${x},${y} ${wd}x${ht})"
}
-HERMES_BIN="$INSTALL_DIR/venv/bin/hermes"
-# The bootstrap runs 11 stages; checkout + venv land in the first few and
-# the desktop app build is near the end, so success requires all three or
+# Use the same source-launcher selection as the later read-only checkpoint:
+# PM installs publish .hermes/bin/hermes; older releases use venv/bin/hermes.
+# The desktop app build is near the end, so success requires all three or
# the EXIT trap kills the installer mid-build.
+# shellcheck source=source-driver.sh
+source "$(dirname "${BASH_SOURCE[0]}")/source-driver.sh"
installed_app() {
local cand
for cand in \
@@ -112,7 +114,7 @@ installed_app() {
return 1
}
install_complete() {
- [ -d "$INSTALL_DIR/.git" ] && [ -x "$HERMES_BIN" ] && installed_app
+ [ -d "$INSTALL_DIR/.git" ] && source_hermes "$INSTALL_DIR" >/dev/null 2>&1 && installed_app
}
# The bootstrap parks on an error screen instead of exiting when a stage
# fails (e.g. a transient 429 downloading install.sh), with a Retry button
@@ -139,7 +141,7 @@ FIRST_SHOT=0
CLICKS=0
while :; do
if install_complete; then
- log "install landed: checkout + venv console script + Hermes.app present"
+ log "install landed: checkout + source launcher + Hermes.app present"
shot "02-install-landed"
break
fi
diff --git a/tests/scripts/install/test_dmg_install_driver.py b/tests/scripts/install/test_dmg_install_driver.py
new file mode 100644
index 00000000000..e082568367a
--- /dev/null
+++ b/tests/scripts/install/test_dmg_install_driver.py
@@ -0,0 +1,65 @@
+"""The DMG driver must wait for the source launcher and packaged Desktop."""
+
+import os
+from pathlib import Path
+import subprocess
+
+import pytest
+
+
+DRIVER = Path(__file__).resolve().parents[2] / "install/e2e-assets/drive-dmg-install.sh"
+
+
[email protected]("missing,expected", [
+ ("", True),
+ ("legacy", True),
+ ("checkout", False),
+ ("launcher", False),
+ ("app", False),
+])
+def test_dmg_driver_requires_complete_pm_source_install(tmp_path, missing, expected):
+ root = tmp_path / "installed source"
+ root.mkdir()
+ if missing != "legacy":
+ (root / "pm").mkdir(parents=True)
+ (root / "pm/lock.json").write_text("{}", encoding="utf-8")
+ if missing != "checkout":
+ (root / ".git").mkdir()
+ launcher = root / ".hermes/bin/hermes"
+ if missing not in {"launcher", "legacy"}:
+ launcher.parent.mkdir(parents=True)
+ launcher.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")
+ launcher.chmod(0o755)
+ if missing != "app":
+ (root / "apps/desktop/release/mac-arm64/Hermes.app").mkdir(parents=True)
+ # The legacy file must not mask a missing PM publication.
+ legacy = root / "venv/bin/hermes"
+ legacy.parent.mkdir(parents=True)
+ legacy.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")
+ legacy.chmod(0o755)
+
+ mocks = tmp_path / "mock-bin"
+ mocks.mkdir()
+ for name, script in {
+ "osascript": "#!/bin/sh\nprintf 'no-window\\n'\n",
+ "cliclick": "#!/bin/sh\nexit 0\n",
+ "screencapture": "#!/bin/sh\nexit 0\n",
+ "sleep": "#!/bin/sh\n/bin/sleep 0.05\n",
+ }.items():
+ command = mocks / name
+ command.write_text(script, encoding="utf-8")
+ command.chmod(0o755)
+ app_bin = tmp_path / "Hermes-Setup"
+ app_bin.write_text("#!/bin/sh\nexit 0\n", encoding="utf-8")
+ app_bin.chmod(0o755)
+ home = tmp_path / "home"
+ home.mkdir()
+ result = subprocess.run(
+ ["bash", str(DRIVER), "--app-bin", str(app_bin), "--install-dir", str(root),
+ "--install-timeout-secs", "2", "--proof-dir", str(tmp_path / "proof")],
+ env=dict(os.environ, HOME=str(home), PATH=f"{mocks}:{os.environ['PATH']}"),
+ capture_output=True, text=True, timeout=15,
+ )
+ assert (result.returncode == 0) is expected, result.stdout + result.stderr
+ assert ("install landed:" in result.stdout) is expected, result.stdout