Skip to content

Commit 227cf6b

Browse files
committed
test(accounts): reconcile behavioral expectations with canonical dedupe rules
1 parent a1eb834 commit 227cf6b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ all notable changes to this project. dates are ISO format (YYYY-MM-DD).
2121

2222
### fixed
2323

24+
- **organization-scoped account preservation**: org-different variants sharing a refresh token now preserve distinct identity entries during storage collision resolution.
25+
- **no-org duplicate collapse alignment**: fallback no-org duplicates now collapse consistently across storage, authorize, and prune operations.
26+
- **active-index remap stability**: index remapping during collision pruning/dedupe maintains stable active-index selection after account deduplication.
2427
- **non-interactive command guidance**: optional-index commands provide explicit usage guidance when interactive menus are unavailable.
2528
- **doctor safe-fix edge path**: `codex-doctor fix` now reports a clear non-crashing message when no eligible account is available for auto-switch.
2629
- **first-time import flow**: `codex-import` no longer fails with `No accounts to export` when storage is empty; pre-import backup is skipped cleanly in zero-account setups.

test/accounts.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ describe("AccountManager", () => {
432432
});
433433

434434
describe("removeAccount", () => {
435+
// Note: Tests in this block cover in-memory manager behavior.
436+
// Canonical persistence dedupes no-org entries; org-different entries are preserved.
435437
it("removes an account and updates indices", () => {
436438
const now = Date.now();
437439
const stored = {
@@ -506,7 +508,8 @@ describe("AccountManager", () => {
506508
expect(manager.getCurrentAccount()).toBe(null);
507509
});
508510

509-
it("removes only targeted workspace when email/token are shared", () => {
511+
it("removes only targeted workspace when email/token are shared (manager-level, no orgId)", () => {
512+
// Note: In-memory manager can hold multiple entries; canonical dedupe would collapse no-org duplicates
510513
const now = Date.now();
511514
const stored = {
512515
version: 3 as const,
@@ -932,6 +935,8 @@ describe("AccountManager", () => {
932935
});
933936

934937
describe("setActiveIndex", () => {
938+
// Note: Tests in this block cover in-memory manager behavior.
939+
// Canonical persistence dedupes no-org entries; org-different entries are preserved.
935940
it("sets active index and returns account", () => {
936941
const now = Date.now();
937942
const stored = {
@@ -967,7 +972,8 @@ describe("AccountManager", () => {
967972
expect(manager.setActiveIndex(Infinity)).toBeNull();
968973
});
969974

970-
it("switches between distinct workspace accounts sharing email and token", () => {
975+
it("switches between distinct workspace accounts sharing email and token (manager-level, no orgId)", () => {
976+
// Note: In-memory manager can hold multiple entries; canonical dedupe would collapse no-org duplicates
971977
const now = Date.now();
972978
const stored = {
973979
version: 3 as const,

0 commit comments

Comments
 (0)