refactor(onboard): extract web search configuration flow#3304
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise 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)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Comment |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
…ard-web-search-config
| } = validation; | ||
|
|
||
| const { | ||
| validateBraveSearchApiKey, |
cjagwani
left a comment
There was a problem hiding this comment.
lgtm — clean dep-injection extraction. five funcs moved 1:1, both call sites at onboard.ts:10898 and :10904 match the new signatures, and the env capture via env = deps.env ?? process.env keeps the live mutation semantics intact.
two nits, neither blocking:
- codeql is right at src/lib/onboard.ts:1874 —
validateBraveSearchApiKeyis destructured but never used locally and not re-exported. dead destructure, drop it (or add to module.exports if you want external consumers later). - web-search-config.ts:188 swapped
isAffirmativeAnswer(enableAnswer)for an inline["y","yes"].includes(...).prompt()always returns a string today so no live bug, but you lost theString(value||"")null guard. either keep the wrap or threadisAffirmativeAnswerthrough deps for parity with the rest of onboard.
test gap worth a follow-up: nothing covers the validation→retry→success path or the non-interactive throw. happy paths are good though.
8bb073b
into
refactor/onboard-web-search-support
Summary
Extract the Brave web-search configuration flow out of the large onboarding module. This continues the onboarding cleanup stack by moving validation, prompting, credential persistence, and configuration selection into a focused helper module with direct coverage.
Changes
src/lib/onboard/web-search-config.tsfor Brave Search validation, recovery prompting, credential setup, and web-search config selection.src/lib/onboard.tsto use the extracted helper factory while preserving existing exports and call sites.Type of Change
Verification
npx prek run --all-filespassesnpm testpassesmake docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com