fix: stage signed Mac app replacements (#104345)

This commit is contained in:
Peter Steinberger
2026-07-11 02:26:06 -07:00
committed by GitHub
parent 518c5823d8
commit ee5834f7c4
3 changed files with 57 additions and 5 deletions

View File

@@ -395,14 +395,32 @@ describe("scripts/restart-mac.sh", () => {
it("keeps the managed app alive until the signed replacement is ready", () => {
const script = readFileSync(restartScriptPath, "utf8");
const packageIndex = script.indexOf('run_step "package app"');
const verifyIndex = script.indexOf('run_step "verify packaged app"');
const switchIndex = script.indexOf('log "==> Switching managed installed');
const installIndex = script.indexOf('run_step "install packaged app"');
const launchIndex = script.indexOf('run_step "launch app"');
expect(packageIndex).toBeGreaterThan(-1);
expect(script).toContain('OPENCLAW_PACKAGE_APP_ROOT="${STAGED_APP_BUNDLE}"');
expect(verifyIndex).toBeGreaterThan(packageIndex);
expect(switchIndex).toBeGreaterThan(packageIndex);
expect(installIndex).toBeGreaterThan(switchIndex);
expect(launchIndex).toBeGreaterThan(installIndex);
expect(launchIndex).toBeGreaterThan(switchIndex);
});
it("restores the previous bundle if the staged install cannot complete", () => {
const script = readFileSync(restartScriptPath, "utf8");
const installBlock = script.slice(
script.indexOf("install_staged_app()"),
script.indexOf("choose_app_bundle()"),
);
expect(installBlock).toContain('mv "${TARGET_APP_BUNDLE}" "${previous}"');
expect(installBlock).toContain('if ! mv "${STAGED_APP_BUNDLE}" "${TARGET_APP_BUNDLE}"');
expect(installBlock).toContain('mv "${previous}" "${TARGET_APP_BUNDLE}"');
});
it("escalates only exact managed app processes when graceful shutdown stalls", () => {
const script = readFileSync(restartScriptPath, "utf8");
const managedKillBlock = script.slice(