Skip to content

The agent that grows with you

test(e2e): wait for native DMG bootstrap completion across old releases

ethernet7289bff2c301
diff --git a/tests/install/e2e-assets/drive-dmg-install.sh b/tests/install/e2e-assets/drive-dmg-install.sh
index e56649092e5..68a2aa4218b 100644
--- a/tests/install/e2e-assets/drive-dmg-install.sh
+++ b/tests/install/e2e-assets/drive-dmg-install.sh
@@ -100,8 +100,9 @@ click_install() {
# 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 first packaged app can land before the products stage finishes (and can
-# be rebuilt again). Wait for the bootstrap's terminal marker, published only
-# after every stage succeeds, before the EXIT trap stops the installer.
+# be rebuilt again). Wait for native bootstrap completion, not install.sh's
+# marker (historical releases predate it, and it precedes the native handoff).
+# The published native bootstrap logs completion only after every stage succeeds.
# shellcheck source=source-driver.sh
source "$(dirname "${BASH_SOURCE[0]}")/source-driver.sh"
installed_app() {
@@ -114,8 +115,17 @@ installed_app() {
done
return 1
}
+BOOTSTRAP_LOG="$HOME/.hermes/logs/bootstrap-installer.log"
+bootstrap_completed() {
+ [ -f "$BOOTSTRAP_LOG" ] || return 1
+ local line
+ while IFS= read -r line; do
+ [[ "$line" == *"bootstrap complete install_root=$INSTALL_DIR" ]] && return 0
+ done < "$BOOTSTRAP_LOG"
+ return 1
+}
install_complete() {
- [ -f "$INSTALL_DIR/.hermes-bootstrap-complete" ] \
+ bootstrap_completed \
&& [ -d "$INSTALL_DIR/.git" ] \
&& source_hermes "$INSTALL_DIR" >/dev/null 2>&1 \
&& installed_app
@@ -126,7 +136,6 @@ install_complete() {
# watch for new failure lines, let the regular click drive the retry, and
# give up after a few so a persistent failure reports the real error
# instead of burning the whole install timeout.
-BOOTSTRAP_LOG="$HOME/.hermes/logs/bootstrap-installer.log"
bootstrap_error() {
[ -f "$BOOTSTRAP_LOG" ] || return 0
# Match REAL failure shapes only: the structured stage log's state=Failed,
diff --git a/tests/scripts/install/test_dmg_install_driver.py b/tests/scripts/install/test_dmg_install_driver.py
index 237659464ca..403723d917a 100644
--- a/tests/scripts/install/test_dmg_install_driver.py
+++ b/tests/scripts/install/test_dmg_install_driver.py
@@ -1,7 +1,8 @@
-"""The DMG driver must wait for bootstrap completion, not merely a packaged Desktop."""
+"""The DMG driver must wait for native bootstrap completion, not install.sh's marker."""
import os
from pathlib import Path
+import shutil
import subprocess
import pytest
@@ -18,6 +19,9 @@ DRIVER = Path(__file__).resolve().parents[2] / "install/e2e-assets/drive-dmg-ins
("launcher", False),
("app", False),
("completion", False),
+ ("historical", True),
+ ("marker-only", False),
+ ("wrong-root-log", False),
])
def test_dmg_driver_requires_complete_pm_source_install(tmp_path, missing, expected):
root = tmp_path / "installed source"
@@ -34,7 +38,7 @@ def test_dmg_driver_requires_complete_pm_source_install(tmp_path, missing, expec
launcher.chmod(0o755)
if missing != "app":
(root / "apps/desktop/release/mac-arm64/Hermes.app").mkdir(parents=True)
- if missing != "completion":
+ if missing not in {"completion", "historical", "wrong-root-log"}:
(root / ".hermes-bootstrap-complete").write_text("completed", encoding="utf-8")
# The legacy file must not mask a missing PM publication.
legacy = root / "venv/bin/hermes"
@@ -48,7 +52,7 @@ def test_dmg_driver_requires_complete_pm_source_install(tmp_path, missing, expec
"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",
+ "sleep": f"#!/bin/sh\n{shutil.which('sleep')} 0.05\n",
}.items():
command = mocks / name
command.write_text(script, encoding="utf-8")
@@ -58,6 +62,14 @@ def test_dmg_driver_requires_complete_pm_source_install(tmp_path, missing, expec
app_bin.chmod(0o755)
home = tmp_path / "home"
home.mkdir()
+ if missing != "marker-only":
+ logs = home / ".hermes/logs"
+ logs.mkdir(parents=True)
+ logged_root = tmp_path / "other-install" if missing in {"completion", "wrong-root-log"} else root
+ (logs / "bootstrap-installer.log").write_text(
+ f"INFO hermes_bootstrap_lib::bootstrap: bootstrap complete install_root={logged_root}\n",
+ encoding="utf-8",
+ )
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")],