-
Notifications
You must be signed in to change notification settings - Fork 2
fix(cli): don't run the tart backend when tart isn't installed #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,6 +27,7 @@ function tartExec(args: string[], timeoutMs = 10_000): string { | |
| return execSync(`tart ${args.join(" ")}`, { | ||
| encoding: "utf-8", | ||
| timeout: timeoutMs, | ||
| stdio: ["ignore", "pipe", "pipe"], | ||
| }).trim(); | ||
| } | ||
|
|
||
|
|
@@ -92,6 +93,15 @@ export class TartBackend implements ContainerBackend { | |
| readonly supportsPause = true; | ||
| private instances = new Map<string, TartInstance>(); | ||
|
|
||
| static isAvailable(): boolean { | ||
| try { | ||
| execSync("tart --version", { stdio: "ignore", timeout: 5_000 }); | ||
| return true; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
Comment on lines
+96
to
+103
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: The availability probe treats every failure as “not installed” by catching all exceptions, so transient failures (timeout, permission, execution error) will incorrectly disable Tart and trigger misleading behavior. Restrict the false return to true “command not found” cases and surface/log other failures separately. [incorrect condition logic] Severity Level: Major
|
||
|
|
||
| private vmIsSuspended(vmName: string): boolean { | ||
| const vms = tartList(); | ||
| const vm = vms.find((v) => v.name === vmName); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: This change silently unsets the configured macOS backend when Tart is unavailable, which introduces a new runtime path where macOS sandbox requests throw
UnsupportedErrorfrombackendForand bubble as uncaught 500s inCreateSandbox(that route does not handleUnsupportedError). Return a controlled error path (for example by surfacing an explicit startup/config error or ensuring request handlers map this case to a non-500 response) instead of silently dropping the backend. [api mismatch]Severity Level: Major⚠️
Steps of Reproduction ✅
(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖