Preserve the primary Hopper startup failure and launcher diagnostics while retaining resources when cleanup cannot be confirmed. Reauthenticate matching external application sessions before document cleanup, keep the Python bridge available for bounded reconnects, and expose the provider-owned Hopper startup deadline. Real headless Linux Hopper semantic analysis and 65 focused configuration, handshake, cleanup, and bridge tests passed. macOS authorization/crash causes and saved-HOP behavior require their own real-provider verification. Refs #1808 Co-authored-by: N0zoM1z0 <161784452+N0zoM1z0@users.noreply.github.com> Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
55 lines
1.5 KiB
TypeScript
55 lines
1.5 KiB
TypeScript
import { expect, it } from "vitest";
|
|
|
|
import type { HopperLauncherOutcome } from "../domain/hopperErrors.js";
|
|
import { nativeHopperLaunchWasDenied } from "./HopperProcessDiagnostic.js";
|
|
|
|
// Captured from Hopper 6.1.0-demo and 6.6.0-demo's unmodified helpers with native
|
|
// AppleScript error -1743 before open dispatch. The target script never ran.
|
|
const denied: HopperLauncherOutcome = {
|
|
exit_code: 2,
|
|
signal: null,
|
|
stdout: { text: "", bytes: 0, retained_bytes: 0 },
|
|
stderr: {
|
|
text: "Cannot launch Hopper!\nNot authorized to send Apple events to current application.\n",
|
|
bytes: 82,
|
|
retained_bytes: 82,
|
|
},
|
|
output_closed: true,
|
|
diagnostic_truncated: false,
|
|
};
|
|
|
|
it("recognizes the native helper's complete authorization rejection", () => {
|
|
expect(nativeHopperLaunchWasDenied(denied)).toBe(true);
|
|
});
|
|
|
|
it.each([
|
|
{ output_closed: false },
|
|
{ diagnostic_truncated: true },
|
|
{ signal: "SIGTERM", exit_code: null },
|
|
{ signal: "SIGTERM", exit_code: 2 },
|
|
{ exit_code: 0 },
|
|
{
|
|
stderr: {
|
|
...denied.stderr,
|
|
text: "Cannot launch Hopper!\nExpected end of line, etc. but found identifier.\n",
|
|
},
|
|
},
|
|
{
|
|
stderr: {
|
|
...denied.stderr,
|
|
text: `${denied.stderr.text}another failure\n`,
|
|
},
|
|
},
|
|
{
|
|
stderr: {
|
|
...denied.stderr,
|
|
text: "Not authorized to send Apple events to current application.\n",
|
|
},
|
|
},
|
|
])(
|
|
"preserves unknown document ownership for incomplete or different failures: %j",
|
|
(change) => {
|
|
expect(nativeHopperLaunchWasDenied({ ...denied, ...change })).toBe(false);
|
|
},
|
|
);
|