Skip to content

[AI] Improve model catalog metadata and comparison - #33381

Merged
allan-leinwand merged 8 commits into
productionfrom
fix/ai-model-catalog
Sep 11, 2026
Merged

[AI] Improve model catalog metadata and comparison#33381
allan-leinwand merged 8 commits into
productionfrom
fix/ai-model-catalog

Conversation

@allan-leinwand

Copy link
Copy Markdown
Collaborator

Summary

  • Preserve catalog tags and pricing during model imports.
  • Add aligned model facts and accessible three-model comparison.
  • Format token and non-token pricing with explicit billing units.
  • Improve catalog filtering, sorting, and importer concurrency.
  • Add pagination, ordering, failure, and pricing tests.

Related roadmap epic: RM-27401

Validation

  • pnpm run check
  • pnpm run lint
  • pnpm run format:core:check
  • pnpm run format:content:check
  • pnpm run test -- --run (165 tests)
  • pnpm run build (8,983 pages)
  • git diff --check

Documentation checklist

  • Changelog: not applicable; this updates the existing model catalog UI and metadata.
  • The change adheres to the documentation style guide.
  • Related tracking exists in RM-27401.
  • Redirects: not applicable.

- Preserve cached pricing direction.
- Drain concurrent import work before surfacing failures.
- Record transient detail fetch failures.
- Preserve catalog focus and relayout consistency.
Skip corner-mark generation when card position and column count are unchanged.

Behavior-preserving. Full checks, lint, formatting, 165 tests, and build pass.
@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Review

💡 4 suggestions found in commit a3c8032.

👉 Fix in your agent 👈
Fix the following review findings in PR #33381 (https://github.com/cloudflare/cloudflare-docs/pull/33381).

Before making changes, review each finding and present a brief summary table:
- For each finding, state whether you agree, disagree, or need clarification
- If you disagree (e.g. the fix requires disproportionate effort for minimal benefit,
  or the finding is factually incorrect), explain why
- If you need clarification before deciding, ask those questions
- Then share your plan for which issues to tackle and in what order

After triaging, follow this order:
1. Post a comment on this PR for any findings you are skipping, with the finding ID and your reasoning.
2. Then commit the fixes for the legitimate findings.

The comment must come before the commit — the bot reads PR comments when a new
push triggers a review, so skip comments posted after the push will be missed.

---

## Code Review

### Suggestions (4)

#### CR-19acdd1046d8 · Redundant class:list wrapper
- **File:** `src/components/models/ModelCard.astro` line 94
- **Issue:** The anchor's `class:list` contains a single fully-static string with no conditionals (`class:list={[ "group/card ... duration-150 focus-visible:-outline-offset-2", ]}`). The base version used a plain `class` attribute; wrapping one constant string in `class:list` adds no behavior and obscures intent.
- **Fix:** Use a plain `class="..."` string, or add the conditional classes (e.g., pinned state) that would justify `class:list`.

#### CR-6c8820b6e798 · Removed margin leaves cramped badge spacing
- **File:** `src/components/models/ModelCard.astro` line 165
- **Issue:** The description dropped `mb-4` and gained a fixed `h-[4.5rem]` (72px) while `line-clamp-3` at `text-sm leading-relaxed` is only ~68.25px tall. For descriptions that fill 3 lines, `<ModelBadges>` (whose `<ul>` has no top margin) now sits ~4px below the text, whereas 1–2 line descriptions leave up to ~49px of dead space inside the fixed box — spacing between description and badges is now uneven and tight for full-length descriptions.
- **Fix:** Add a small bottom margin/gap between the description and the badges row (or align badges to the bottom of the fixed-height box) so full 3-line descriptions don't crowd the badges.

#### CR-c387546ee908 · Missing vertical gap on wrapping flex list
- **File:** `src/components/models/ModelBadges.astro` line 58
- **Issue:** The list is `flex flex-wrap` with only `gap-x-1.5`; when badges wrap onto multiple rows (a model can carry up to 8 capability badges plus provider/deprecation badges), rows will have zero vertical spacing and the badge pills will touch.
- **Fix:** Consider adding a vertical gap, e.g. use `gap-x-1.5 gap-y-1.5` (or `gap-1.5`), so wrapped badge rows stay visually separated.

#### CR-3d201013ef0e · Invalid HTML content model
- **File:** `src/components/models/ModelCatalog.astro` line 119
- **Issue:** The comparison header row is populated by `renderComparison()` with a corner cell created via `tableCell("td", "")` and appended to the `<thead>`; per the HTML spec, `tr` inside `thead` may only contain `th` elements, so a `td` in the header is non-conforming.
- **Fix:** Create the empty corner cell as `<th scope="col">` (still `aria-hidden="true"`) so the header row conforms to the table content model.

Code Review

This code review is in beta and may not always be helpful — use your judgment.

Suggestions (4)
File Issue
src/components/models/ModelCard.astro line 94 Redundant class:list wrapper — The anchor's class:list contains a single fully-static string with no conditionals (class:list={[ "group/card ... duration-150 focus-visible:-outline-offset-2", ]}). The base version used a plain class attribute; wrapping one constant string in class:list adds no behavior and obscures intent. Fix: Use a plain class="..." string, or add the conditional classes (e.g., pinned state) that would justify class:list.
src/components/models/ModelCard.astro line 165 Removed margin leaves cramped badge spacing — The description dropped mb-4 and gained a fixed h-[4.5rem] (72px) while line-clamp-3 at text-sm leading-relaxed is only ~68.25px tall. For descriptions that fill 3 lines, <ModelBadges> (whose <ul> has no top margin) now sits ~4px below the text, whereas 1–2 line descriptions leave up to ~49px of dead space inside the fixed box — spacing between description and badges is now uneven and tight for full-length descriptions. Fix: Add a small bottom margin/gap between the description and the badges row (or align badges to the bottom of the fixed-height box) so full 3-line descriptions don't crowd the badges.
src/components/models/ModelBadges.astro line 58 Missing vertical gap on wrapping flex list — The list is flex flex-wrap with only gap-x-1.5; when badges wrap onto multiple rows (a model can carry up to 8 capability badges plus provider/deprecation badges), rows will have zero vertical spacing and the badge pills will touch. Fix: Consider adding a vertical gap, e.g. use gap-x-1.5 gap-y-1.5 (or gap-1.5), so wrapped badge rows stay visually separated.
src/components/models/ModelCatalog.astro line 119 Invalid HTML content model — The comparison header row is populated by renderComparison() with a corner cell created via tableCell("td", "") and appended to the <thead>; per the HTML spec, tr inside thead may only contain th elements, so a td in the header is non-conforming. Fix: Create the empty corner cell as <th scope="col"> (still aria-hidden="true") so the header row conforms to the table content model.

Conventions

No convention issues found.

Style Guide Review

No style-guide issues found.

Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.
/disable-auto-review Stops automatic reviews from triggering on future pushes to this PR. Codeowners can still run /review or /full-review manually.
/rebase Rebases the PR branch against production. On conflict, attempts to resolve automatically using AI. Stops with an explanation if confidence is not high enough.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
*.ts @cloudflare/content-engineering
/bin/fetch-catalog-models.ts @abhishekkankani, @ethulia, @kathayl, @kflansburg, @mattrothenberg, @mchenco, @palashgo, @roerohan, @shridhar-cf, @superhighfives, @thebongy, @zeke, @cloudflare/product-owners, @cloudflare/content-engineering
/src/components/models/ @ethulia, @kflansburg, @mchenco, @shridhar-cf, @superhighfives, @cloudflare/product-owners, @cloudflare/content-engineering
/src/util/models/ @ethulia, @kflansburg, @mchenco, @shridhar-cf, @superhighfives, @cloudflare/product-owners, @cloudflare/content-engineering

@allan-leinwand

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 10, 2026

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-ai-model-catalog.previews.developers.cloudflare.com (commit a3c8032)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://edb06aec.previews.developers.cloudflare.com a3c8032 2026-09-11T19:22:43.008Z Visit the dashboard ↗
  • Build: In progress 🔵

View logs ↗
a0d1a16 2026-09-11T18:56:34.430Z View logs ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://395a53b6.previews.developers.cloudflare.com f1171e1 2026-09-10T22:31:21.568Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://f4f5a5f1.previews.developers.cloudflare.com f074c87 2026-09-10T21:00:15.752Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://eebf62c4.previews.developers.cloudflare.com 0906ecc 2026-09-10T18:38:05.078Z Visit the dashboard ↗

@allan-leinwand

Copy link
Copy Markdown
Collaborator Author

Review triage for findings not changing in this pass:

  • CR-ccc2b0fbc173: mapConcurrentOrdered intentionally propagates callback exceptions after draining active workers. Moving the callback outside the catch would still reject the operation while restoring immediate rejection and undrained work.
  • CR-66d52f11cbb2: The legacy collection uses USD exclusively and has no duplicate units within a model. ModelView.pricing intentionally normalizes those supported entries to unit/value pairs consumed by the shared formatter.

@allan-leinwand

Copy link
Copy Markdown
Collaborator Author

Fixed in f074c87922:

  • CR-e8c95da0e370: Invalid token counts now render as Not listed.
  • CR-4e7d4fd5606a: Card facts now use explicit context and maximum-output labels.
  • CR-1e250f330485: Catalog and detail pricing share one USD formatter.
  • CR-bca7804e2727: Legacy pricing normalization now rejects non-numeric, non-finite, and negative prices.
  • CR-6945da186ae6: Catalog pricing now relies on the schema-validated default.

@allan-leinwand

Copy link
Copy Markdown
Collaborator Author

Fixed CR-7e432851cf61 in f1171e197c: comparison token counts now use the catalog-wide en-US locale.

@allan-leinwand
allan-leinwand merged commit 41d4c80 into production Sep 11, 2026
22 checks passed
@allan-leinwand
allan-leinwand deleted the fix/ai-model-catalog branch September 11, 2026 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.