refactor: extract settings hub entry wrapper#287
refactor: extract settings hub entry wrapper#287ndycode wants to merge 2 commits intorefactor/pr2-unified-settings-entry-wrapper-2from
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
📝 WalkthroughWalkthroughnew Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Notescouple things to flag:
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 Tip CodeRabbit can use oxc to improve the quality of JavaScript and TypeScript code reviews.Add a configuration file to your project to customize how CodeRabbit runs oxc. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@test/settings-hub-entry.test.ts`:
- Around line 5-36: The test suite is missing a deterministic regression for the
cancel/null path of promptSettingsHubEntry (the implementation at
settings-hub-entry.ts line that returns tAction | null); add a new vitest case
that mocks promptSettingsHubMenu to resolve to null (e.g., vi.fn(async () =>
null)) and call promptSettingsHubEntry with the same dependencies
(isInteractive, getUiRuntimeOptions, buildItems, findInitialCursor, select,
copy) then assert the returned value is null to verify passthrough of the cancel
path. Ensure the test uses vitest mocks (vi.fn) and is deterministic like the
existing case.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b5081ea5-5694-45b9-8908-b14bd9d2d6c5
📒 Files selected for processing (3)
lib/codex-manager/settings-hub-entry.tslib/codex-manager/settings-hub.tstest/settings-hub-entry.test.ts
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Greptile Review
🧰 Additional context used
📓 Path-based instructions (2)
lib/**
⚙️ CodeRabbit configuration file
focus on auth rotation, windows filesystem IO, and concurrency. verify every change cites affected tests (vitest) and that new queues handle EBUSY/429 scenarios. check for logging that leaks tokens or emails.
Files:
lib/codex-manager/settings-hub.tslib/codex-manager/settings-hub-entry.ts
test/**
⚙️ CodeRabbit configuration file
tests must stay deterministic and use vitest. demand regression cases that reproduce concurrency bugs, token refresh races, and windows filesystem behavior. reject changes that mock real secrets or skip assertions.
Files:
test/settings-hub-entry.test.ts
🔇 Additional comments (2)
lib/codex-manager/settings-hub-entry.ts (1)
50-57: clean passthrough wrapper, behavior stays intact.line 50 in
lib/codex-manager/settings-hub-entry.ts:50forwards focus, and lines 51-57 inlib/codex-manager/settings-hub-entry.ts:51-lib/codex-manager/settings-hub-entry.ts:57forward the exact dependency bag without mutation. this matches the new vitest coverage intest/settings-hub-entry.test.ts:24-test/settings-hub-entry.test.ts:35.lib/codex-manager/settings-hub.ts (1)
762-775: wrapper integration is wired correctly.line 762 in
lib/codex-manager/settings-hub.ts:762routes through the new entry helper while preserving the same dependencies at lines 765-774 inlib/codex-manager/settings-hub.ts:765-lib/codex-manager/settings-hub.ts:774. this keeps prompt behavior stable and does not introduce new windows fs, queue, or concurrency risk in this path. covered bytest/settings-hub-entry.test.ts:5-test/settings-hub-entry.test.ts:36.
Summary
promptSettingsHubentry wrapper out ofsettings-hubValidation
npm run typechecknpm run lint -- lib/codex-manager/settings-hub-entry.ts lib/codex-manager/settings-hub.ts test/settings-hub-entry.test.tsnpm run test -- test/settings-hub-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
clean extraction of
promptSettingsHubEntryout of the 2100-linesettings-hub.ts— the new module makespromptSettingsHubMenuinjectable so the entry point can be unit-tested without loading the full settings hub. behavior insettings-hub.tsis unchanged; the call-site diff is minimal and correct.lib/codex-manager/settings-hub-entry.ts— new focused module; function body is correct but declaredasyncwith noawait, which wraps the promise unnecessarilylib/codex-manager/settings-hub.ts— call-site updated to usepromptSettingsHubEntry; all six deps forwarded correctlytest/settings-hub-entry.test.ts— happy-path and null-cancel cases covered; missing a rejection-propagation test and a non-defaultinitialFocuspassthrough assertion (no windows filesystem or token safety exposure in this change)Confidence Score: 5/5
async, missing rejection test) are non-blocking p2 style concerns that don't affect correctness or the primary user pathImportant Files Changed
promptSettingsHubMenuas a dependency — correct forwarding logic, but declaredasyncwith noawait(unnecessary double-promise wrap)promptSettingsHubEntry; all six deps forwarded correctly; behavior unchangedinitialFocuspassthrough assertionSequence Diagram
sequenceDiagram participant Caller participant promptSettingsHub participant promptSettingsHubEntry participant promptSettingsHubMenu Caller->>promptSettingsHub: (initialFocus?) promptSettingsHub->>promptSettingsHubEntry: { initialFocus, promptSettingsHubMenu, ...deps } promptSettingsHubEntry->>promptSettingsHubMenu: (initialFocus, { isInteractive, getUiRuntimeOptions, buildItems, findInitialCursor, select, copy }) promptSettingsHubMenu-->>promptSettingsHubEntry: TAction | null promptSettingsHubEntry-->>promptSettingsHub: TAction | null promptSettingsHub-->>Caller: TAction | nullPrompt To Fix All With AI
Last reviewed commit: "Cover settings hub c..."