Skip to content

Commit 82e8557

Browse files
ndycodecodex
andcommitted
test(sync): address comment follow-ups
Co-authored-by: Codex <noreply@openai.com>
1 parent c55d7b8 commit 82e8557

1 file changed

Lines changed: 22 additions & 1 deletion

File tree

test/codex-cli-sync.test.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
import { setCodexCliActiveSelection } from "../lib/codex-cli/writer.js";
1313
import { MODEL_FAMILIES } from "../lib/prompts/codex.js";
1414

15-
const RETRYABLE_REMOVE_CODES = new Set(["EBUSY", "EPERM", "ENOTEMPTY", "EACCES"]);
15+
const RETRYABLE_REMOVE_CODES = new Set(["EBUSY", "EPERM", "ENOTEMPTY", "EACCES", "ETIMEDOUT"]);
1616

1717
async function removeWithRetry(
1818
targetPath: string,
@@ -216,6 +216,27 @@ describe("codex-cli sync", () => {
216216
}
217217
});
218218

219+
it("clamps NaN activeIndex to 0 and reports changed", async () => {
220+
const current: AccountStorageV3 = {
221+
version: 3,
222+
accounts: [
223+
{
224+
accountId: "acc_a",
225+
email: "a@example.com",
226+
refreshToken: "refresh-a",
227+
addedAt: 1,
228+
lastUsed: 1,
229+
},
230+
],
231+
activeIndex: Number.NaN,
232+
activeIndexByFamily: {},
233+
};
234+
235+
const result = await syncAccountStorageFromCodexCli(current);
236+
expect(result.changed).toBe(true);
237+
expect(result.storage?.activeIndex).toBe(0);
238+
});
239+
219240
it("serializes concurrent active-selection writes to keep accounts/auth aligned", async () => {
220241
await writeFile(
221242
accountsPath,

0 commit comments

Comments
 (0)