refactor: extract account manager cache entry wrapper#291
refactor: extract account manager cache entry wrapper#291ndycode wants to merge 1 commit intorefactor/pr4-runtime-ui-runtime-bridgefrom
Conversation
|
Important Review skippedAuto reviews are limited based on label configuration. 🚫 Review skipped — only excluded labels are configured. (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
index.tsValidation
npm run typechecknpm run lint -- index.ts lib/runtime/account-manager-cache-entry.ts test/account-manager-cache-entry.test.tsnpm run test -- test/account-manager-cache-entry.test.tsnote: greptile review for oc-chatgpt-multi-auth. cite files like
lib/foo.ts:123. confirm regression tests + windows concurrency/token redaction coverage.Greptile Summary
this pr extracts two inline closures from
index.ts(invalidateAccountManagerCacheandreloadAccountManagerFromDisk) into a dedicatedlib/runtime/account-manager-cache-entry.tsmodule and adds a focused vitest suite. the refactoring is behaviorally identical to the original:setReloadInFlightis still called synchronously (noawaitprecedes it inside the entry wrapper), so the concurrency-criticalaccountReloadInFlightassignment timing is unchanged.reloadAccountManagerFromDiskEntryis markedasyncdespite having noawait, which adds an unnecessary microtask wrap (P2)authFallbackforwarding, and rejection propagation are not tested — worth adding to maintain the 80% threshold as the suite growsConfidence Score: 4/5
asynckeyword and missing vitest coverage for the dedup/error/authFallback paths.Important Files Changed
asynconreloadAccountManagerFromDiskEntry(noawaitpresent)Sequence Diagram
sequenceDiagram participant C as caller participant IDX as index.ts (reloadAccountManagerFromDisk) participant E as account-manager-cache-entry.ts (reloadAccountManagerFromDiskEntry) participant S as account-manager-cache.ts (reloadAccountManagerFromDiskState) participant D as AccountManager.loadFromDisk C->>IDX: reloadAccountManagerFromDisk(authFallback?) IDX->>E: reloadAccountManagerFromDiskEntry({currentReloadInFlight, ...}) E->>S: reloadAccountManagerFromDiskState({currentReloadInFlight, loadFromDisk, authFallback, onLoaded, onSettled}) alt currentReloadInFlight is non-null (dedup) S-->>E: existing Promise<TManager> else no in-flight reload S->>D: loadFromDisk(authFallback?) D-->>S: AccountManager S->>S: onLoaded(manager) → cachedAccountManager=manager S->>S: onSettled() → accountReloadInFlight=null S-->>E: new Promise<TManager> end E->>IDX: setReloadInFlight(inFlight) → accountReloadInFlight=inFlight E-->>IDX: Promise<TManager> IDX-->>C: Promise<AccountManager>Prompt To Fix All With AI
Last reviewed commit: "refactor: extract ac..."