Skip to content

fix(web): stop embedding the full catalog in the compare page shell - #106

Merged
okisdev merged 1 commit into
mainfrom
fix/compare-fallback-size
Aug 31, 2026
Merged

fix(web): stop embedding the full catalog in the compare page shell#106
okisdev merged 1 commit into
mainfrom
fix/compare-fallback-size

Conversation

@okisdev

@okisdev okisdev commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator

problem

/compare serves 502 FALLBACK_BODY_TOO_LARGE on every cache MISS (crawlers walking unique ?a= params hit it constantly; ~100 x 502 in 6h, driving the Axiom "Vercel long-tail 5xx" monitor). the prerendered shell embedded the full catalog: every model object spread whole into client props, each row carrying its provider's entire inline SVG. the built compare.html weighed 23.2MB, past Vercel's fallback body limit.

root cause

the compare view only ever needs full data for the two selected models, but the page shipped all ~8000 models' full projections (plus 8000 duplicated provider SVGs) inside the static flight payload.

change

  • the page now ships only what the pickers need: {id, name, provider} per model plus the alias map; provider names and icons resolve client-side via the already-bundled getProvider.
  • selected models fetch their full compare projection at runtime from a new same-origin /api/compare-models?ids= route handler (same pattern as /api/search, same build = zero data drift), edge-cached with s-maxage=3600.
  • ModelCompare resolves selections from fetched state with a loading message; unknown ids degrade to the picker hint.

compare.html drops 23.2MB → 0.95MB (-96%).

verification

pnpm --filter web build green (route table: /compare static, /api/compare-models dynamic); artifact sizes measured before/after; next start smoke: page 200, API returns both projections; browser pass on /compare?a=xai/grok-4.6&b=openai/gpt-5.2 renders the full comparison table with icons, pricing, and capability rows.

Track in Rupic

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
modelpedia-web Ready Ready Preview Aug 31, 2026 5:53am

@rupic-app

rupic-app Bot commented Aug 31, 2026

Copy link
Copy Markdown

Comment Reviewed in 6m 53s · Round 1 · comment · a11f1db

Merge as is — The diff removes full catalog records while preserving comparison data

The compare page now sends only picker metadata and fetches the two selected canonical records through a bounded same-origin route; the route preserves the fields consumed by the table, and the existing cross-app compare endpoint is a different response surface. No blocking correctness or safety issue is present. A failed request is cached as null and therefore is not retried for the same selection, and no automated coverage was added for the new route or fetch states; I could not execute the reported build, size, or browser checks.

Worth noting, not blocking

  • apps/web/components/shared/model-compare.tsx:258 — The failure handler caches each requested key as null, while the effect retries only keys whose value is undefined, so a transient request failure cannot be retried for the same selection without reloading.
  • The four-file diff adds route lookup, client loading, and failed-response branches without automated coverage. The web package exposes build, start, and development scripts but no test script.

Merge state: The PR is open and marked mergeable. Vercel Preview Comments is successful and Vercel Agent Review is neutral; the listed build, lint, validation, and Workers checks are null, while approvals and unresolved-thread status are unknown.

Evidence · 4 verified · 1 not verified

Verified

  • The compare page no longer serializes full model records into the client props.
    The page replaces the previous full object projection with picker metadata.
  • The client resolves alias selections to canonical keys and requests at most the two missing selections from the same-origin route.
    The source code shows same-origin fetching, alias normalization, and the two-key route bound.
  • The new route sets one-hour shared caching with stale-while-revalidate.
    The cache header is present in the route; actual edge behavior was not executed.
  • The repository already has a separate compare API endpoint.
    That endpoint is in apps/api, validates a different response contract, and returns raw model data rather than the web route's focused projection.

Not verified

  • The PR reduces compare.html from 23.2MB to 0.95MB and passes build, start, and browser smoke verification.
    I could not execute the build or browser smoke flow in this review.

Read all four changed files plus the existing web search route, data layer, provider icon, markdown route, configuration, and cross-app compare surface. No code was executed; the reported artifact sizes, build, and browser smoke remain unverified. No prior review threads or review ledger were supplied.

Round Commit Verdict Took When
1 a11f1db comment 6m 53s 2026-08-31 05:59 UTC

Comment @rupic-app stop reviewing to stop reviewing this PR.

Review by Rupic.

@rupic-app rupic-app Bot added stage/needs-review No reviews yet; waiting for a maintainer app/web Changes an app under apps/ R1 Actionable, normal priority type/bugfix Bug fix size/M 50–199 lines changed labels Aug 31, 2026
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
modelpedia-api a11f1db Commit Preview URL

Branch Preview URL
Aug 31 2026, 05:52 AM

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

1 inline comment below, on apps/web/components/shared/model-compare.tsx.

Full review: #106 (comment)

Comment thread apps/web/components/shared/model-compare.tsx
@rupic-app rupic-app Bot added stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed and removed stage/needs-review No reviews yet; waiting for a maintainer labels Aug 31, 2026
@okisdev
okisdev merged commit b770ea5 into main Aug 31, 2026
11 checks passed
@okisdev
okisdev deleted the fix/compare-fallback-size branch August 31, 2026 06:04
@rupic-app rupic-app Bot added stage/merged Merged into the default branch and removed stage/awaiting-reviewer Has reviews but not approved; reviewer follow-up needed R1 Actionable, normal priority labels Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app/web Changes an app under apps/ size/M 50–199 lines changed stage/merged Merged into the default branch type/bugfix Bug fix

Development

Successfully merging this pull request may close these issues.

1 participant