Skip to content

Commit 71c3601

Browse files
roodboiclaude
andcommitted
fix(doctor): host TLS repair runs under --no-interactive
The step delegates to hack global trust, which is itself non-interactive-safe (sudo preflight; keychain-only skip; host trust env always written) — classifying the whole repair as destructive denied non-interactive runs the safe env/bundle writes. From PR review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 90d1514 commit 71c3601

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/commands/doctor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3138,11 +3138,13 @@ async function maybeRepairMacHostTlsTrust(): Promise<void> {
31383138
}
31393139

31403140
note(hostTlsTrust.message, "doctor");
3141+
// Not classified destructive: `hack global trust` is itself
3142+
// non-interactive-safe — it preflights sudo and skips only the System
3143+
// keychain step, while the safe host trust env/bundle writes always run.
31413144
const okRepair = await doctorConfirm({
31423145
message:
3143-
"Repair macOS host TLS trust now? (Bun/Node/curl/git trust for https://*.hack; may prompt for sudo to update the System keychain)",
3146+
"Repair macOS host TLS trust now? (Bun/Node/curl/git trust for https://*.hack; the sudo System-keychain step is skipped automatically when it would prompt)",
31443147
initialValue: true,
3145-
destructive: true,
31463148
});
31473149
if (!okRepair) {
31483150
return;

tests/doctor-fix-noninteractive.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,15 +203,16 @@ test("doctor --fix under HACK_NO_INTERACTIVE skips macOS keychain repair and rep
203203
]);
204204

205205
expect(code).toBe(0);
206-
// Destructive/system-level step (macOS host TLS trust repair, which chains
207-
// into a System keychain sudo prompt) is declined automatically and
208-
// surfaced in the skipped-steps summary instead of hanging on a prompt.
206+
// Host TLS repair is safe to run non-interactively: it delegates to
207+
// `hack global trust`, which preflights sudo and skips only the System
208+
// keychain step while still writing the host trust env. It must NOT be
209+
// in the skipped-steps summary.
209210
const skippedNote = noteCalls.find((message) =>
210211
message.includes("Skipped (non-interactive")
211212
);
212-
expect(skippedNote).toBeDefined();
213-
expect(skippedNote).toContain("Repair macOS host TLS trust");
214-
expect(skippedNote).toContain("hack doctor --fix");
213+
if (skippedNote !== undefined) {
214+
expect(skippedNote).not.toContain("Repair macOS host TLS trust");
215+
}
215216
});
216217

217218
test("doctor --fix never calls the raw clack confirm prompt under HACK_NO_INTERACTIVE", async () => {

0 commit comments

Comments
 (0)