Skip to content

refactor(shared): use canonical profile provider identifiers#1019

Open
WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:feat/956-canonical-profile-provider-identifiers
Open

refactor(shared): use canonical profile provider identifiers#1019
WebMad wants to merge 1 commit into
Zoo-Code-Org:mainfrom
WebMad:feat/956-canonical-profile-provider-identifiers

Conversation

@WebMad

@WebMad WebMad commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace raw provider-name literals in profile model resolution with canonical providerIdentifiers values
  • preserve every existing provider-to-model-field mapping and fallback behavior
  • add focused registry-driven coverage for provider-specific model fields and missing-model fallback behavior

TDD

Implemented with iterative red-green triangulation:

  1. Added an OpenAI canonical-identifier regression test and confirmed it failed.
  2. Migrated the OpenAI case minimally and confirmed it passed.
  3. Triangulated across apiModelId, OpenRouter, and VS Code LM mappings and confirmed the tests failed before migrating those cases.
  4. Triangulated the remaining provider-specific mappings, then completed the canonical migration.
  5. Covered fallback behavior for profiles without a model ID, including provider-level allowAll.

Verification

  • cd src && npx vitest run shared/__tests__/ProfileValidator.spec.ts — 50 passed
  • cd src && npx vitest run shared — 410 passed
  • focused ESLint — passed
  • cd src && npm run check-types — passed
  • repository pre-commit lint — passed
  • repository pre-push type checks — passed
  • git diff --check — passed

Closes #956

Summary by CodeRabbit

  • Bug Fixes

    • Improved profile validation across supported AI providers by using consistent provider identifiers.
    • Preserved fallback behavior for unknown providers and configurations without model lists.
  • Tests

    • Added coverage for provider-specific model resolution and fallback scenarios.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 09c06a73-7a7a-4777-bea7-699a35858fce

📥 Commits

Reviewing files that changed from the base of the PR and between e479b7e and cab2d53.

📒 Files selected for processing (2)
  • src/shared/ProfileValidator.ts
  • src/shared/__tests__/ProfileValidator.spec.ts

📝 Walkthrough

Walkthrough

ProfileValidator.getModelIdFromProfile now uses shared providerIdentifiers constants instead of provider string literals. Tests add parameterized coverage for canonical identifier resolution and provider-level fallback behavior.

Changes

Profile provider resolution

Layer / File(s) Summary
Canonical provider resolution
src/shared/ProfileValidator.ts
Imports providerIdentifiers and replaces hard-coded provider cases while preserving model selection and the undefined fallback.
Canonical resolution tests
src/shared/__tests__/ProfileValidator.spec.ts
Adds parameterized tests for canonical identifiers, provider allowAll settings, and optional model lists.

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

Possibly related issues

  • Issue 954 — Similar migration from raw provider literals to canonical providerIdentifiers.
  • Issue 960 — Covers canonical provider identifiers in production provider comparisons and tests.

Possibly related PRs

Suggested labels: awaiting-review

Suggested reviewers: edelauna, navedmerchant, taltas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change to canonical provider identifiers.
Description check ✅ Passed It includes the linked issue, change summary, and test/verification details, though several template sections are omitted.
Linked Issues check ✅ Passed The code uses canonical provider identifiers, preserves mappings and fallback behavior, and adds the targeted tests required by #956.
Out of Scope Changes check ✅ Passed Changes stay limited to ProfileValidator and its tests, matching the linked issue scope.
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

✅ 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 Jul 25, 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 profile model resolution to canonical provider identifiers

1 participant