refactor(webview): use canonical provider identifiers - #1023
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughWebview model selection and configuration validation now use shared ChangesWebview provider identifier migration
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related issues
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
87080d6 to
607df7f
Compare
607df7f to
5b1c51a
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
webview-ui/src/components/ui/hooks/useSelectedModel.ts (1)
421-422: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFinish converting internal provider comparisons to
providerIdentifiers.The switch labels are canonical now, but this hook still uses literal equality checks at Lines 63–65, 80–82, 108, and 430. That leaves readiness and fallback dispatch on a separate contract from
getSelectedModel; useproviderIdentifiers.*for internal comparisons while retaining serialized/router-map literals where required.Proposed fix
- provider === "anthropic" && + provider === providerIdentifiers.anthropic &&🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@webview-ui/src/components/ui/hooks/useSelectedModel.ts` around lines 421 - 422, Replace the remaining literal provider equality checks in useSelectedModel at the readiness, fallback-dispatch, and related branches (including the checks around lines 63–65, 80–82, 108, and 430) with the corresponding providerIdentifiers.* constants. Keep serialized values and router-map keys as literals where their external contract requires them, and preserve the existing switch behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@webview-ui/src/components/ui/hooks/useSelectedModel.ts`:
- Around line 421-422: Replace the remaining literal provider equality checks in
useSelectedModel at the readiness, fallback-dispatch, and related branches
(including the checks around lines 63–65, 80–82, 108, and 430) with the
corresponding providerIdentifiers.* constants. Keep serialized values and
router-map keys as literals where their external contract requires them, and
preserve the existing switch behavior.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 4c9baa5b-47db-4ebc-add6-8c5cce143a56
📒 Files selected for processing (3)
webview-ui/src/components/ui/hooks/useSelectedModel.tswebview-ui/src/utils/__tests__/validate.spec.tswebview-ui/src/utils/validate.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@webview-ui/src/components/ui/hooks/useSelectedModel.ts`:
- Around line 421-423: Update the Anthropic-only condition within the grouped
branch of useSelectedModel to compare provider against
providerIdentifiers.anthropic rather than the hardcoded "anthropic" string,
preserving the 1M-context tier override when the registry identifier changes.
🪄 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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 996ce2b7-1d39-454f-b5da-46ffffa37b85
📒 Files selected for processing (2)
webview-ui/src/components/ui/hooks/__tests__/useSelectedModel.spec.tswebview-ui/src/components/ui/hooks/useSelectedModel.ts
edelauna
left a comment
There was a problem hiding this comment.
Looks good - had a comment on preventing returning undefined, and if we should up date some other locations?
b7a20db to
650c515
Compare
Summary
providerIdentifierssembleandopenai-compatibleunchangedTDD
Verification
npx vitest run src/utils/__tests__/validate.spec.ts src/components/ui/hooks/__tests__/useSelectedModel.spec.ts— 76 passednpx vitest run src/components/settings src/components/ui/hooks src/utils— 53 files, 654 passednpm run check-types— passedCloses #959.
Summary by CodeRabbit