Skip to content

Commit 1969cae

Browse files
committed
rename StartupMode "prompt" to "none" for clarity
"prompt" was ambiguous since it could imply prompting for both start and update. "none" makes it clear that no explicit intent was set, and the default behavior (asking) applies.
1 parent c1652f6 commit 1969cae

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/core/mementoManager.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ const PENDING_TTL_MS = 5 * 60 * 1000;
99

1010
/**
1111
* Describes the startup intent when the extension connects to a workspace.
12-
* - "prompt": Normal reconnection; ask before starting a stopped workspace.
12+
* - "none": No explicit intent; ask before starting a stopped workspace.
1313
* - "start": User-initiated open/restart; auto-start without prompting.
1414
* - "update": User-initiated restart + update; use `coder update` to apply
1515
* the latest template version, auto-starting without prompting.
1616
*/
17-
export type StartupMode = "prompt" | "start" | "update";
17+
export type StartupMode = "none" | "start" | "update";
1818

1919
interface Stamped<T> {
2020
value: T;
@@ -62,14 +62,14 @@ export class MementoManager {
6262

6363
/**
6464
* Read and clear the startup mode.
65-
* Returns "prompt" (the default) when no mode was explicitly set.
65+
* Returns "none" (the default) when no mode was explicitly set.
6666
*/
6767
public async getAndClearStartupMode(): Promise<StartupMode> {
6868
const value = this.getStamped<StartupMode>("startupMode");
6969
if (value !== undefined) {
7070
await this.memento.update("startupMode", undefined);
7171
}
72-
return value ?? "prompt";
72+
return value ?? "none";
7373
}
7474

7575
/** Store a chat ID to open after a remote-authority reload. */

src/remote/workspaceStateMachine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class WorkspaceStateMachine implements vscode.Disposable {
7373
this.buildLogStream.close();
7474

7575
if (
76-
this.startupMode === "prompt" &&
76+
this.startupMode === "none" &&
7777
!(await this.confirmStart(workspaceName))
7878
) {
7979
throw new Error(`Workspace start cancelled`);

test/unit/core/mementoManager.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ describe("MementoManager", () => {
7070
it("should return the set mode and clear after read", async () => {
7171
await mementoManager.setStartupMode("start");
7272
expect(await mementoManager.getAndClearStartupMode()).toBe("start");
73-
expect(await mementoManager.getAndClearStartupMode()).toBe("prompt");
73+
expect(await mementoManager.getAndClearStartupMode()).toBe("none");
7474
});
7575

7676
it("should return 'prompt' when nothing is set", async () => {
77-
expect(await mementoManager.getAndClearStartupMode()).toBe("prompt");
77+
expect(await mementoManager.getAndClearStartupMode()).toBe("none");
7878
});
7979

8080
it("should support 'update' mode", async () => {
@@ -84,13 +84,13 @@ describe("MementoManager", () => {
8484

8585
it("should treat legacy bare values as expired", async () => {
8686
await memento.update("startupMode", "start");
87-
expect(await mementoManager.getAndClearStartupMode()).toBe("prompt");
87+
expect(await mementoManager.getAndClearStartupMode()).toBe("none");
8888
});
8989

9090
it("should expire after 5 minutes", async () => {
9191
await mementoManager.setStartupMode("update");
9292
vi.advanceTimersByTime(5 * 60 * 1000 + 1);
93-
expect(await mementoManager.getAndClearStartupMode()).toBe("prompt");
93+
expect(await mementoManager.getAndClearStartupMode()).toBe("none");
9494
});
9595
});
9696

test/unit/remote/workspaceStateMachine.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ function runningWorkspace(
7979
}
8080

8181
function createStateMachine(
82-
startupMode: "prompt" | "start" | "update" = "start",
82+
startupMode: "none" | "start" | "update" = "start",
8383
) {
8484
return new WorkspaceStateMachine(
8585
{ agent: "main" } as unknown as AuthorityParts,
@@ -184,7 +184,7 @@ describe("WorkspaceStateMachine", () => {
184184
vi.mocked(vscodeProposed.window.showInformationMessage).mockResolvedValue(
185185
"Start" as never,
186186
);
187-
const sm = createStateMachine("prompt");
187+
const sm = createStateMachine("none");
188188
const ws = createWorkspace({ latest_build: { status: "stopped" } });
189189

190190
expect(await sm.processWorkspace(ws, progress)).toBe(false);
@@ -195,7 +195,7 @@ describe("WorkspaceStateMachine", () => {
195195
vi.mocked(vscodeProposed.window.showInformationMessage).mockResolvedValue(
196196
undefined as never,
197197
);
198-
const sm = createStateMachine("prompt");
198+
const sm = createStateMachine("none");
199199
const ws = createWorkspace({ latest_build: { status: "stopped" } });
200200

201201
await expect(sm.processWorkspace(ws, progress)).rejects.toThrow(

0 commit comments

Comments
 (0)