You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by wy...@apache.org on 2026/08/22 08:15:11 UTC
(maka) branch feat/desktop-runtime-host-management updated: fix(desktop): verify managed deployment cleanup
This is an automated email from the ASF dual-hosted git repository.
M4n5ter pushed a commit to branch feat/desktop-runtime-host-management
in repository https://gitbox.apache.org/repos/asf/maka.git
The following commit(s) were added to refs/heads/feat/desktop-runtime-host-management by this push:
new 27a355a00 fix(desktop): verify managed deployment cleanup
27a355a00 is described below
commit 27a355a00849206c4b666b828dcf8ff8a733ca31
Author: Wang <m4...@gmail.com>
AuthorDate: Sat Aug 22 16:14:52 2026 +0800
fix(desktop): verify managed deployment cleanup
Keep an uninstall binding recoverable when the remote operator is already absent but its deployment root still contains data. Treat cleanup as complete only when that root is absent or can be removed as an empty directory.
Generated-by: Codex
---
apps/desktop/src/main/__tests__/runtime-host-ssh-terminal.test.ts | 4 +++-
apps/desktop/src/main/runtime-host-ssh-terminal.ts | 7 ++++++-
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/apps/desktop/src/main/__tests__/runtime-host-ssh-terminal.test.ts b/apps/desktop/src/main/__tests__/runtime-host-ssh-terminal.test.ts
index 11eed0064..b495d73ef 100644
--- a/apps/desktop/src/main/__tests__/runtime-host-ssh-terminal.test.ts
+++ b/apps/desktop/src/main/__tests__/runtime-host-ssh-terminal.test.ts
@@ -284,7 +284,7 @@ test('rejects a framed service result for a different action', async () => {
await harness.terminal.close();
});
-test('treats an absent operator as completed deployment cleanup', async () => {
+test('requires an absent operator deployment root to be absent or empty', async () => {
const harness = createHarness('pending');
const cleanup = harness.terminal.cleanupManagedDeployment({
destination: 'operator@example.com',
@@ -293,6 +293,8 @@ test('treats an absent operator as completed deployment cleanup', async () => {
await waitFor(() => harness.pty.hasDataListener());
const remoteCommand = harness.launchArgs.at(-1)?.at(-1) ?? '';
assert.match(remoteCommand, /if \[ ! -e/u);
+ assert.match(remoteCommand, /rmdir --/u);
+ assert.match(remoteCommand, /home\/operator\/\.local\/share\/maka/u);
assert.match(remoteCommand, /__cleanup-managed-deployment/u);
harness.pty.exit(0);
diff --git a/apps/desktop/src/main/runtime-host-ssh-terminal.ts b/apps/desktop/src/main/runtime-host-ssh-terminal.ts
index 24c02c71a..d33465069 100644
--- a/apps/desktop/src/main/runtime-host-ssh-terminal.ts
+++ b/apps/desktop/src/main/runtime-host-ssh-terminal.ts
@@ -1,6 +1,7 @@
import { homedir } from 'node:os';
import { createHash, randomUUID } from 'node:crypto';
import { realpath, stat } from 'node:fs/promises';
+import { posix as pathPosix } from 'node:path';
import type { IpcMain } from 'electron';
import type { IPty } from 'node-pty';
import { spawn as spawnPty } from 'node-pty';
@@ -777,8 +778,12 @@ function runtimeHostServiceManagementRemoteCommand(
function runtimeHostManagedDeploymentCleanupRemoteCommand(operatorPath: string): string {
const operator = quotePosix(operatorPath);
+ const deploymentRoot = quotePosix(pathPosix.dirname(operatorPath));
const invocation =
- `if [ ! -e ${operator} ]; then exit 0; fi; exec ${operator} __cleanup-managed-deployment`;
+ `if [ ! -e ${operator} ]; then ` +
+ `if [ ! -e ${deploymentRoot} ]; then exit 0; fi; ` +
+ `exec rmdir -- ${deploymentRoot}; fi; ` +
+ `exec ${operator} __cleanup-managed-deployment`;
return `exec "\${SHELL:-/bin/sh}" -lic ${quotePosix(invocation)}`;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org