



















@@ -293,6 +293,40 @@ describe("secrets CLI", () => {
293293expect(runtimeLogs.at(-1)).toContain("Secrets applied");
294294});
295295296+it("shows the irreversibility warning on the interactive apply path (#83883)", async () => {
297+runSecretsConfigureInteractive.mockResolvedValue(
298+createConfigureInteractiveResult({ changed: true }),
299+);
300+// Interactive path: no --apply flag. First confirm is "Apply this plan
301+// now?", second must be the one-way-migration irreversibility warning.
302+confirm.mockResolvedValueOnce(true); // Apply this plan now?
303+confirm.mockResolvedValueOnce(true); // one-way migration warning
304+runSecretsApply.mockResolvedValue(createSecretsApplyResult({ mode: "write", changed: true }));
305+306+await createProgram().parseAsync(["secrets", "configure"], { from: "user" });
307+308+// Before the fix the interactive path skipped the irreversibility prompt
309+// (it checked opts.apply), so confirm was called only once.
310+expect(confirm).toHaveBeenCalledTimes(2);
311+const secondPrompt = confirm.mock.calls[1]?.[0] as { message?: string } | undefined;
312+expect(secondPrompt?.message ?? "").toContain("one-way");
313+expect(runSecretsApply).toHaveBeenCalledTimes(1);
314+});
315+316+it("cancels apply when the interactive irreversibility warning is declined (#83883)", async () => {
317+runSecretsConfigureInteractive.mockResolvedValue(
318+createConfigureInteractiveResult({ changed: true }),
319+);
320+confirm.mockResolvedValueOnce(true); // Apply this plan now?
321+confirm.mockResolvedValueOnce(false); // decline the irreversibility warning
322+323+await createProgram().parseAsync(["secrets", "configure"], { from: "user" });
324+325+expect(confirm).toHaveBeenCalledTimes(2);
326+expect(runSecretsApply).not.toHaveBeenCalled();
327+expect(runtimeLogs.at(-1)).toContain("Apply cancelled");
328+});
329+296330it("forwards --agent to secrets configure", async () => {
297331runSecretsConfigureInteractive.mockResolvedValue(createConfigureInteractiveResult());
298332confirm.mockResolvedValue(false);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。