refactor: extract statusline settings panel#169
refactor: extract statusline settings panel#169ndycode wants to merge 3 commits intorefactor/pr2-dashboard-display-splitfrom
Conversation
📝 WalkthroughWalkthroughrefactored Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes some flags to check:
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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 `@lib/codex-manager/statusline-settings-panel.ts`:
- Around line 51-55: Add focused vitest unit tests for
promptStatuslineSettingsPanel to cover the non-tty short-circuit, the hotkey
parsing branch, and the reset/reorder/toggle/save branches including the
"last-field" guard; specifically, write tests that (1) simulate input/output not
being TTY to assert null return, (2) feed the hotkey sequences exercised in the
existing parsing logic to verify expected state transitions, and (3) drive the
interactive control flow for reset, reorder, toggle, and save actions (including
attempting to remove the final visible field to trigger the last-field guard) to
assert final DashboardDisplaySettings outcomes and no regressions in
promptStatuslineSettingsPanel behavior.
🪄 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: f53e81f6-d1f0-4081-8f86-62b5eabe0681
📒 Files selected for processing (2)
lib/codex-manager/settings-hub.tslib/codex-manager/statusline-settings-panel.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 (1)
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/statusline-settings-panel.tslib/codex-manager/settings-hub.ts
🔇 Additional comments (1)
lib/codex-manager/settings-hub.ts (1)
1352-1362: clean extraction boundary.
lib/codex-manager/settings-hub.ts:1352-1362stays as a thin adapter, and the windows write retry / queue paths remain untouched inlib/codex-manager/settings-hub.ts:639-791. that keeps this refactor out of the ebusy/429 and concurrency-sensitive code. As per coding guidelines, "focus on auth rotation, windows filesystem IO, and concurrency".
Summary
settings-hub.tsinto a dedicated panel moduleWhat Changed
lib/codex-manager/statusline-settings-panel.tscontaining the statusline panel prompt flow and its local action modellib/codex-manager/settings-hub.tssopromptStatuslineSettings(...)delegates to the extracted panel moduleValidation
npm run test -- test/codex-manager-cli.test.tsnpm run lintnpm run typechecknpm run buildRisk and Rollback
f63e949to restore the inline statusline panel implementation insettings-hub.tsAdditional Notes
note: 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 the statusline settings panel from
settings-hub.tsinto a dedicatedlib/codex-manager/statusline-settings-panel.tsmodule, continuing the incremental settings-hub split. the logic is a faithful one-to-one port — preview, toggle, reorder, reset, save, and cancel behaviour are all preserved — with full dependency injection viaStatuslineSettingsPanelDepsso the panel is decoupled from the hub's internal helpers.key changes:
StatuslineConfigActiontype andStatuslineFieldOptioninterface are now exported from the new panel module rather than kept private insettings-hub.tspromptStatuslineSettingsinsettings-hub.tsis reduced to a thin delegation call, passing all required helpers and constants throughdepsminor gap: the tty-guard test only exercises the both-streams-false path; the single-stream OR branch is not covered. additionally, no dedicated
test/statusline-settings-panel.test.tsfile exists — the new module's public api is only tested through the hub delegation path, which may reduce isolation if the hub wiring changes later.Confidence Score: 4/5
statusline-settings-panel.tsis a real gap — especially given the injected-deps design makes direct unit tests straightforward to write as a follow-up.Important Files Changed
Sequence Diagram
sequenceDiagram participant SH as settings-hub.ts participant Panel as statusline-settings-panel.ts participant Select as ui/select.ts SH->>Panel: promptStatuslineSettingsPanel(initial, deps) Panel-->>Panel: TTY guard check Panel-->>Panel: cloneDashboardSettings(initial) loop while true Panel->>Panel: buildAccountListPreview(draft, ui, focusKey) Panel->>Panel: build MenuItem list Panel->>Select: select(items, options) Select-->>Panel: StatuslineConfigAction alt cancel / null Panel-->>SH: null else save Panel-->>SH: draft else reset Panel->>Panel: applyDashboardDefaultsForKeys(draft, STATUSLINE_PANEL_KEYS) else move-up / move-down Panel->>Panel: reorderField(fields, key, ±1) else toggle Panel->>Panel: toggle field in menuStatuslineFields end endPrompt To Fix All With AI
Reviews (3): Last reviewed commit: "test: cover statusline panel hotkeys" | Re-trigger Greptile