fix(hopper): reserve Linux demo application before launch (#1158)
* test(hopper): give locals oracle explicit stack storage * fix(hopper): reserve Linux demo application before launch * fix(hopper): serialize stale lease recovery
This commit is contained in:
@@ -8,6 +8,7 @@ import Ajv from "ajv/dist/2020.js";
|
||||
import addFormats from "ajv-formats";
|
||||
import { mcpTextValue, requireMcpResult } from "./mcp-verifier-results.mjs";
|
||||
import { verifyHopperCliSelectors } from "./real-hopper-cli-selectors.mjs";
|
||||
import { verifyLinuxHopperLaunchIsolation } from "./real-hopper-session-isolation.mjs";
|
||||
import { verifyHopperNavigationAndText } from "./real-hopper-navigation.mjs";
|
||||
import { verifyHopperWorkflows } from "./real-hopper-workflows.mjs";
|
||||
import {
|
||||
@@ -327,6 +328,16 @@ export async function verifyHopperLifecycleAndCli(client, options, targets) {
|
||||
procedure: entry.value,
|
||||
});
|
||||
const firstDocument = await call("current_document");
|
||||
const linuxApplicationIsolation =
|
||||
process.platform === "linux"
|
||||
? await verifyLinuxHopperLaunchIsolation({
|
||||
call,
|
||||
runCli,
|
||||
dispatcher: new URL("../rea.mjs", import.meta.url).pathname,
|
||||
primary,
|
||||
secondary,
|
||||
})
|
||||
: null;
|
||||
await call("open_binary", { path: secondary });
|
||||
const secondDocument = await call("current_document");
|
||||
assert.notEqual(firstDocument, secondDocument);
|
||||
@@ -464,6 +475,7 @@ export async function verifyHopperLifecycleAndCli(client, options, targets) {
|
||||
cliNamedSelectorParity,
|
||||
callerCancellationRecovered: true,
|
||||
closedDocumentAbsent: true,
|
||||
linuxApplicationIsolation,
|
||||
};
|
||||
} finally {
|
||||
await call("close_binary");
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import assert from "node:assert/strict";
|
||||
|
||||
/** Prove competing Linux launches cannot forward documents into the active MCP owner. */
|
||||
export async function verifyLinuxHopperLaunchIsolation({
|
||||
call,
|
||||
runCli,
|
||||
dispatcher,
|
||||
primary,
|
||||
secondary,
|
||||
}) {
|
||||
const documents = await call("list_documents");
|
||||
const current = await call("current_document");
|
||||
const procedures = await call("list_procedures");
|
||||
for (const target of [primary, secondary]) {
|
||||
let failure;
|
||||
try {
|
||||
await runCli([
|
||||
dispatcher,
|
||||
"inspect",
|
||||
target,
|
||||
"--provider",
|
||||
"hopper",
|
||||
"--format",
|
||||
"json",
|
||||
]);
|
||||
} catch (error) {
|
||||
assert.equal(error.code, 1);
|
||||
failure = JSON.parse(error.stdout);
|
||||
}
|
||||
assert.ok(
|
||||
failure,
|
||||
"A competing CLI launch was allowed to reach Linux Hopper",
|
||||
);
|
||||
assert.equal(failure.code, "provider_unavailable");
|
||||
assert.match(
|
||||
failure.message,
|
||||
/Linux Hopper is already active in REA session/u,
|
||||
);
|
||||
assert.ok(failure.message.includes(target));
|
||||
assert.deepEqual(
|
||||
await call("list_documents"),
|
||||
documents,
|
||||
"A rejected CLI launch changed the owning session's documents",
|
||||
);
|
||||
assert.equal(await call("current_document"), current);
|
||||
assert.deepEqual(await call("list_procedures"), procedures);
|
||||
}
|
||||
return {
|
||||
sameTargetRejected: true,
|
||||
differentTargetRejected: true,
|
||||
ownerDocumentsPreserved: true,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user