




























@@ -184,6 +184,85 @@ describe("resolveCliAuthEpoch", () => {
184184expect(second).toBe(first);
185185});
186186187+it("keeps oauth auth-profile epochs stable across profile id aliases for the same account", async () => {
188+const store: AuthProfileStore = {
189+version: 1,
190+profiles: {
191+"anthropic:work": {
192+type: "oauth",
193+provider: "anthropic",
194+access: "access-a",
195+refresh: "refresh-a",
196+expires: 1,
197+email: "user@example.com",
198+},
199+"anthropic:work-alias": {
200+type: "oauth",
201+provider: "anthropic",
202+access: "access-b",
203+refresh: "refresh-b",
204+expires: 2,
205+email: "user@example.com",
206+},
207+},
208+};
209+setCliAuthEpochTestDeps({
210+readGeminiCliCredentialsCached: () => null,
211+loadAuthProfileStoreForRuntime: () => store,
212+});
213+214+const first = await resolveCliAuthEpoch({
215+provider: "google-gemini-cli",
216+authProfileId: "anthropic:work",
217+});
218+const second = await resolveCliAuthEpoch({
219+provider: "google-gemini-cli",
220+authProfileId: "anthropic:work-alias",
221+});
222+223+expect(first).toBeDefined();
224+expect(second).toBe(first);
225+});
226+227+it("keeps identity-less oauth auth-profile epochs scoped to the profile id", async () => {
228+const store: AuthProfileStore = {
229+version: 1,
230+profiles: {
231+"anthropic:work": {
232+type: "oauth",
233+provider: "anthropic",
234+access: "access-a",
235+refresh: "refresh-a",
236+expires: 1,
237+},
238+"anthropic:personal": {
239+type: "oauth",
240+provider: "anthropic",
241+access: "access-b",
242+refresh: "refresh-b",
243+expires: 2,
244+},
245+},
246+};
247+setCliAuthEpochTestDeps({
248+readGeminiCliCredentialsCached: () => null,
249+loadAuthProfileStoreForRuntime: () => store,
250+});
251+252+const first = await resolveCliAuthEpoch({
253+provider: "google-gemini-cli",
254+authProfileId: "anthropic:work",
255+});
256+const second = await resolveCliAuthEpoch({
257+provider: "google-gemini-cli",
258+authProfileId: "anthropic:personal",
259+});
260+261+expect(first).toBeDefined();
262+expect(second).toBeDefined();
263+expect(second).not.toBe(first);
264+});
265+187266it("changes oauth auth-profile epochs when the account identity changes", async () => {
188267let store: AuthProfileStore = {
189268version: 1,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。