Skip to content

Add Claude Fable model tier#131

Open
alexesprit wants to merge 1 commit into
ohong:mainfrom
alexesprit:add-claude-fable-title-tier
Open

Add Claude Fable model tier#131
alexesprit wants to merge 1 commit into
ohong:mainfrom
alexesprit:add-claude-fable-title-tier

Conversation

@alexesprit

@alexesprit alexesprit commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add Claude Fable labeling for claude-fable model slugs
  • Treat Fable as the highest Claude tier in auto-generated usage titles
  • Relax Opus matching to claude-opus slugs without pinning to a version

Summary by CodeRabbit

  • New Features

    • Added support for Claude Fable model variants in auto-title generation and model display labels
  • Bug Fixes

    • Enhanced model name recognition to properly identify and display Claude Fable and Claude Opus model variants
    • Improved model string normalization logic for more robust and consistent model type detection
  • Tests

    • Expanded test coverage for model prettification and auto-title generation functionality

@vercel

vercel Bot commented Jun 12, 2026

Copy link
Copy Markdown

@alexesprit is attempting to deploy a commit to the Pacific Systems Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends Claude model recognition across the codebase to support Fable variants. Core model prettification functions now use case-insensitive regex matching for Fable and Opus models, the usage submit endpoint has a dedicated auto-title resolution helper, and tests cover the new variants at both unit and integration levels.

Changes

Claude Fable Model Support

Layer / File(s) Summary
Shared model prettification updates
packages/shared/src/models.ts
prettifyModel and getShareModelLabel now recognize claude-fable and claude-opus variants via case-insensitive regex patterns instead of narrowly-scoped claude-opus-4 substring checks.
Prettify-model unit tests
apps/web/__tests__/unit/prettify-model.test.ts
Test coverage expanded to assert claude-fable-5 variants prettify to "Claude Fable", claude-opus-5 to "Claude Opus", and legacy fallback trimming handles fable-variant inputs.
Usage submit auto-title resolution
apps/web/app/api/usage/submit/route.ts
New resolveClaudeTitleLabel helper normalizes model strings and returns Claude labels in priority order (Fable → Opus → Gemini → other). Usage endpoint uses this helper instead of inline checks; hasClaude now relies on computed label or presence of "claude" substring.
Usage submit integration test
apps/web/__tests__/api/usage-submit.test.ts
Integration test mocks a device with both claude-fable-5 and claude-opus-4-20250505 models, verifies the auto-generated post title includes "Claude Fable" and excludes "Claude Opus".

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • ohong/straude#30: Both PRs extend prettifyModel and apps/web/__tests__/unit/prettify-model.test.ts to support Claude Fable and Opus model variants with case-insensitive matching.

Poem

🐰 A Fable most fine, now prettified with care,
Model labels bloom brighter, Fable takes the air,
From shared code to tests, the logic flows so true,
Another Claude variant, beautiful and new! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Claude Fable model tier' is directly related to the main changes: adding Claude Fable model labeling, treating it as the highest Claude tier, and updating model normalization logic across multiple files.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@apps/web/app/api/usage/submit/route.ts`:
- Around line 339-344: The current slug-to-Claude-tier mapping (in
resolveClaudeTitleLabel) labels any slug containing
"fable","opus","sonnet","haiku" as Claude; change it so you only map those
substrings when the same slug also indicates a Claude/Anthropic namespace (e.g.,
contains "claude" or "anthropic"); update the logic that builds slugs
(models.map(...)) and the subsequent checks to require both the namespace check
and the tier substring check per slug before returning "Claude
Fable/Opus/Sonnet/Haiku", otherwise return null.
🪄 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

Run ID: 6bd6bcc1-ff0e-424e-8a30-bf6cd81843cc

📥 Commits

Reviewing files that changed from the base of the PR and between f62d7bd and a734ef2.

📒 Files selected for processing (4)
  • apps/web/__tests__/api/usage-submit.test.ts
  • apps/web/__tests__/unit/prettify-model.test.ts
  • apps/web/app/api/usage/submit/route.ts
  • packages/shared/src/models.ts

Comment thread apps/web/app/api/usage/submit/route.ts
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