Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/opencode/src/tests/accounts-store.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,15 @@ describe('mutateAccounts (authoritative structural edits)', () => {
// proving the deletion was authoritative, not just an in-memory filter.
const cfg = JSON.parse(readFileSync(cfgPath, 'utf8'))
expect(cfg.accounts.map((a: { id: string }) => a.id)).toEqual(['a', 'c'])

// The state file is rebuilt from the authoritative account set, so the
// removed account's per-account secrets must not linger at rest — a stale
// access/refresh token for a deleted account is a credential leak.
const stateRaw = readFileSync(statePath, 'utf8')
const state = JSON.parse(stateRaw)
expect(Object.keys(state.accounts ?? {}).sort()).toEqual(['a', 'c'])
expect(stateRaw).not.toContain('acc-b')
expect(stateRaw).not.toContain('ref-b')
})

it('reordering persists (union-merge would have ignored it)', async () => {
Expand Down