Skip to content

refactor(core): use canonical provider identifiers#1022

Open
WebMad wants to merge 6 commits into
Zoo-Code-Org:mainfrom
WebMad:issue-958-canonical-extension-provider-identifiers
Open

refactor(core): use canonical provider identifiers#1022
WebMad wants to merge 6 commits into
Zoo-Code-Org:mainfrom
WebMad:issue-958-canonical-extension-provider-identifiers

Conversation

@WebMad

@WebMad WebMad commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • migrate extension-side LM Studio, Zoo Gateway, and Gemini comparisons to the canonical providerIdentifiers registry
  • preserve serialized provider values, webview payloads, config/import-export guards, and code-index provider identifiers
  • add focused mutation-based regression tests for LM Studio preparation, Zoo Gateway sign-out/profile filtering, and Gemini allowed-function-name behavior

Test plan

  • cd src && npx vitest run core/task/__tests__/Task.spec.ts core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/webviewMessageHandler.spec.ts — 228 passed
  • cd src && npm run lint -- --no-error-on-unmatched-pattern core/task/Task.ts core/task/__tests__/Task.spec.ts core/webview/ClineProvider.ts core/webview/webviewMessageHandler.ts core/webview/__tests__/ClineProvider.spec.ts core/webview/__tests__/webviewMessageHandler.spec.ts
  • cd src && npm run check-types
  • repository pre-commit lint and pre-push type checks passed

Closes #958

Summary by CodeRabbit

  • Bug Fixes
    • Improved provider detection consistency across Gemini, LM Studio, and Zoo Gateway using shared provider identifiers.
    • Ensured Gemini requests include tool restriction metadata with non-empty tools and matching allowed function names.
    • Fixed Zoo Gateway sign-out handling to identify the active provider and clear tokens for the correct profiles.
    • Improved LM Studio preparation to load full model details only when needed.
  • Tests
    • Added unit coverage for Gemini tool restriction metadata propagation and LM Studio full model preloading behavior.
    • Strengthened type-safe assertions and test setup in task and provider suites.
  • Chores
    • Adjusted ESLint suppression counts.

@coderabbitai

coderabbitai Bot commented Jul 25, 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
📝 Walkthrough

Walkthrough

Core task and webview provider comparisons now use shared providerIdentifiers values for Gemini, LM Studio, and Zoo Gateway. Tests cover Gemini tool metadata, LM Studio model-detail loading, Zoo Gateway sign-out matching, and stricter test typing.

Changes

Provider identifier migration

Layer / File(s) Summary
Task provider capability and test typing
src/core/task/Task.ts, src/core/task/__tests__/Task.spec.ts, src/eslint-suppressions.json
Gemini tool restriction detection uses providerIdentifiers.gemini; task tests add typed accessors, defined-value guards, canonical provider constants, and request metadata coverage.
Webview provider workflows
src/core/webview/ClineProvider.ts, src/core/webview/__tests__/ClineProvider.spec.ts
LM Studio preparation and Zoo Gateway profile or callback handling use shared provider identifiers; LM Studio detail loading is tested.
Zoo Gateway sign-out matching
src/core/webview/webviewMessageHandler.ts, src/core/webview/__tests__/webviewMessageHandler.spec.ts
Zoo Gateway sign-out uses the shared identifier for active-profile and profile filtering checks, and the test title uses the canonical display name.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested labels: awaiting-review

Suggested reviewers: navedmerchant

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: migrating to canonical provider identifiers.
Description check ✅ Passed The PR description covers the linked issue, implementation summary, and test plan, with only minor template drift.
Linked Issues check ✅ Passed The changes match #958 by switching extension-side provider comparisons to canonical identifiers and adding regression tests.
Out of Scope Changes check ✅ Passed The diff stays focused on provider-identifier migration and related tests; no clear unrelated changes stand out.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/core/webview/webviewMessageHandler.ts 50.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@WebMad
WebMad marked this pull request as ready for review July 25, 2026 20:43
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 25, 2026

@edelauna edelauna 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.

Thanks for this, had a couple comments related to test coverage.

Comment thread src/core/task/__tests__/Task.spec.ts Outdated
Comment thread src/core/webview/__tests__/ClineProvider.spec.ts

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/core/webview/__tests__/ClineProvider.spec.ts (1)

1480-1480: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Remove the explicit any cast from the test setup.

ESLint reports this cast, and it disables type checking around taskRegistry. Prefer a typed test seam or factory instead of bypassing the provider’s type contract.

🤖 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 `@src/core/webview/__tests__/ClineProvider.spec.ts` at line 1480, Remove the
`(provider as any)` cast in the ClineProvider test setup and assign taskRegistry
through a typed test seam or factory that preserves the provider’s type
contract. Keep the TaskRegistry initialization behavior unchanged while ensuring
the test remains type-safe and ESLint-compliant.

Source: Linters/SAST tools

🤖 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.

Outside diff comments:
In `@src/core/webview/__tests__/ClineProvider.spec.ts`:
- Line 1480: Remove the `(provider as any)` cast in the ClineProvider test setup
and assign taskRegistry through a typed test seam or factory that preserves the
provider’s type contract. Keep the TaskRegistry initialization behavior
unchanged while ensuring the test remains type-safe and ESLint-compliant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9bfbaefe-a41d-4351-bd53-fcdc1175825e

📥 Commits

Reviewing files that changed from the base of the PR and between 76574a4 and 55edc17.

📒 Files selected for processing (2)
  • src/core/webview/ClineProvider.ts
  • src/core/webview/__tests__/ClineProvider.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/webview/ClineProvider.ts

@github-actions github-actions Bot removed the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 26, 2026
Comment thread src/core/task/__tests__/Task.spec.ts Outdated
Comment thread src/core/task/__tests__/Task.spec.ts Outdated
Comment thread src/core/task/__tests__/Task.spec.ts Outdated
@WebMad
WebMad force-pushed the issue-958-canonical-extension-provider-identifiers branch from 55edc17 to 1038c38 Compare July 26, 2026 17:54
Comment thread src/core/task/__tests__/Task.spec.ts Outdated
@WebMad
WebMad requested a review from edelauna July 26, 2026 18:27
@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Migrate extension-side provider comparisons to canonical identifiers

2 participants