Skip to content

refactor(webview): use provider identifiers in ApiOptions - #1146

Open
WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:refactor/api-options-provider-identifiers
Open

refactor(webview): use provider identifiers in ApiOptions#1146
WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:refactor/api-options-provider-identifiers

Conversation

@WebMad

@WebMad WebMad commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • extract the ApiOptions provider identifier migration from refactor(webview): complete provider identifier migration #1141
  • replace raw provider string comparisons with centralized providerIdentifiers
  • add focused interaction coverage for dynamic model refresh, validation, provider routing, Bedrock custom ARN behavior, and advanced settings

Test plan

  • cd webview-ui && npx vitest run src/components/settings/__tests__/ApiOptions.interactions.spec.tsx (39 tests)
  • cd webview-ui && pnpm exec eslint --prune-suppressions --max-warnings=0 src/components/settings/ApiOptions.tsx src/components/settings/__tests__/ApiOptions.interactions.spec.tsx
  • repository pre-commit lint and type checks

Extracted from #1141.

Summary by CodeRabbit

  • Bug Fixes

    • Improved provider-specific settings behavior, including model refreshes, URL handling, validation clearing, routing, and custom model configuration.
    • Standardized provider handling for more consistent model selection and advanced settings updates.
    • Preserved custom Bedrock model settings and reset invalid model selections appropriately.
  • Tests

    • Added comprehensive coverage for dynamic provider interactions, model switching, validation, custom endpoints, provider-specific settings, and advanced configuration updates.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e83cc55-11f9-4579-a9eb-5f1926ca8cb6

📥 Commits

Reviewing files that changed from the base of the PR and between d0af4c0 and 9dcd2c0.

📒 Files selected for processing (2)
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/__tests__/ApiOptions.interactions.spec.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/tests/ApiOptions.interactions.spec.tsx

📝 Walkthrough

Walkthrough

ApiOptions now uses centralized provider identifiers for model loading, validation, provider rendering, routing, and advanced settings. New interaction tests cover dynamic and static providers, Bedrock models, validation, routing, and settings updates.

Changes

ApiOptions provider migration

Layer / File(s) Summary
Provider identifier routing
webview-ui/src/components/settings/ApiOptions.tsx
The component uses providerIdentifiers for model fetching, Zoo Gateway validation handling, Bedrock model preservation, provider rendering, OpenRouter routing, advanced settings, and custom ARN controls.
Provider behavior coverage
webview-ui/src/components/settings/__tests__/ApiOptions.interactions.spec.tsx
Tests cover mocked provider rendering, debounced model refreshes, static-provider behavior, canonical provider branches, validation clearing, and OpenRouter routing.
Bedrock and advanced settings coverage
webview-ui/src/components/settings/__tests__/ApiOptions.interactions.spec.tsx
Tests cover Bedrock model switching, custom ARN visibility, the consecutive mistake limit, and Poe base URL updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: taltas

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description summarizes the refactor and lists tests, but it omits the required issue link, checklist, and several template sections. Add the required Closes issue reference, complete the pre-submission checklist, and include the template sections for documentation, snapshots, videos, and additional notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main refactor to use centralized provider identifiers in ApiOptions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

webview-ui/src/components/settings/ApiOptions.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

webview-ui/src/components/settings/__tests__/ApiOptions.interactions.spec.tsx

ESLint skipped: the ESLint configuration for this file references a package that is not available in the sandbox.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/settings/__tests__/ApiOptions.interactions.spec.tsx`:
- Around line 9-11: Update useOpenRouterModelProvidersMock to explicitly return
a query-result shape compatible with useOpenRouterModelProviders, including data
typed as Record<string, OpenRouterModelProvider> so mockReturnValue({ data: {
preferred: {} } }) type-checks. Then run the required ESLint command for
ApiOptions.interactions.spec.tsx.
🪄 Autofix

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: 8f8bc3ff-e28f-4016-b91c-e2672b7e0d46

📥 Commits

Reviewing files that changed from the base of the PR and between 7918f6b and 63cd8b3.

📒 Files selected for processing (2)
  • webview-ui/src/components/settings/ApiOptions.tsx
  • webview-ui/src/components/settings/__tests__/ApiOptions.interactions.spec.tsx

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 5, 2026
@WebMad
WebMad force-pushed the refactor/api-options-provider-identifiers branch from bf3f914 to 9dcd2c0 Compare August 5, 2026 12:25
@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@github-actions github-actions Bot removed the awaiting-review PR changes are ready and waiting for maintainer re-review label Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant