Skip to content

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

Open
WebMad wants to merge 4 commits 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 4 commits 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 resolving provider/model identifiers consistently.
    • Preserved existing fallback behavior for unknown providers and configurations where model lists are missing.
  • Tests

    • Expanded automated coverage for provider-specific model resolution.
    • Added scenarios to verify correct “missing-model” handling when provider permissions are toggled and model lists are undefined.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@WebMad, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 6 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f5ce79e1-f803-47a0-894e-389357e8218b

📥 Commits

Reviewing files that changed from the base of the PR and between 965cea6 and 48687d6.

📒 Files selected for processing (3)
  • src/eslint-suppressions.json
  • 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, fallback behavior, and provider-specific model extraction.

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 validation and fallback tests, and updates provider-specific extraction cases to use canonical identifiers.

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

Possibly related issues

Possibly related PRs

Suggested labels: awaiting-review

Suggested reviewers: taltas, navedmerchant, hannesrudolph, jamesrobert20

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: switching profile model resolution to canonical provider identifiers.
Description check ✅ Passed It includes the linked issue, change summary, testing details, and checklist context, though it uses custom headings instead of the exact template.
Linked Issues check ✅ Passed The PR migrates profile model resolution to canonical identifiers while preserving mappings, compatibility, and the requested tests for #956.
Out of Scope Changes check ✅ Passed Changes are confined to ProfileValidator and its tests, with no unrelated behavior or files beyond the issue's 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

@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, had some feedback around test quality, but otherwise looks good.

Comment thread src/shared/__tests__/ProfileValidator.spec.ts Outdated
Comment thread src/shared/__tests__/ProfileValidator.spec.ts Outdated
Comment thread src/shared/__tests__/ProfileValidator.spec.ts
@github-actions github-actions Bot added awaiting-author PR is waiting for the author to address requested changes and removed awaiting-review PR changes are ready and waiting for maintainer re-review labels Jul 26, 2026
@WebMad

WebMad commented Jul 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, had some feedback around test quality, but otherwise looks good.

Thank you! I’m still learning how to write good tests, so your feedback is very helpful to me. I may make mistakes or repeat them sometimes, partly because of the language barrier, but I’ll do my best to improve

Comment thread src/shared/__tests__/ProfileValidator.spec.ts Outdated
Comment thread src/shared/__tests__/ProfileValidator.spec.ts Outdated
Comment thread src/shared/__tests__/ProfileValidator.spec.ts Outdated
Comment thread src/shared/__tests__/ProfileValidator.spec.ts
@WebMad
WebMad force-pushed the feat/956-canonical-profile-provider-identifiers branch from 6166007 to 48687d6 Compare July 26, 2026 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author PR is waiting for the author to address requested changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ENHANCEMENT] Migrate profile model resolution to canonical provider identifiers

2 participants