Warm pinned card variants or stop advertising them

未关闭
#5 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
backend, web-dev

调研方向

Start by reading the cache key builder in app/api/card-image/[username]/route.tsx (lines 28-33) and the write path in app/api/cache-image/route.ts (lines 18-19); the mismatch between them is the bug. Then follow components/WarmOnView.tsx (lines 47-55) and app/[username]/page.tsx (line 316) to see where country and team are dropped before the warm request. Factor the key into one helper both routes call, thread the query values through, and add route tests asserting default and pinned variants each return 200 with bytes and that the plain key survives.

由索引模型根据 Issue 内容生成。

描述

bug help wanted

Current behavior

The README advertises pinned card variants with ?country= and ?team=, but those variants are never warmed. The plain card is served from R2; a pinned variant returns 404 from the empty cache path.

Live probes:

torvalds.png                 200   x-og-cache: r2-hit
torvalds.png?country=nl      404   x-og-cache: miss-empty
torvalds.png?team=ferrari    404   x-og-cache: miss-empty

Cause

app/api/card-image/[username]/route.tsx:28-33 builds the cache key from the lowercased login plus the country and team query values. app/api/cache-image/route.ts:18-19 accepts only a login and writes cardpng:v10:${login}::, with empty variant fields. components/WarmOnView.tsx:47-55 sends only kind=card&login=...; app/[username]/page.tsx:316 does not pass the current country or team.

The browser does render the correct variant on the page. The bytes simply never reach the key the image route reads.

Expected behavior

Warm the exact variant currently displayed, or stop advertising variants that cannot be cached. If the variant is supported, pass country and team through WarmOnView and cache-image, build the same key in both places, and keep the plain key for the default view.

Scope

  • components/WarmOnView.tsx
  • app/api/cache-image/route.ts
  • app/[username]/page.tsx
  • app/api/card-image/[username]/route.tsx key helper
  • a route test for default and pinned variants

Acceptance

  • A page opened with ?country=nl or ?team=ferrari warms the matching variant.
  • The variant URL returns 200 with real bytes after the warm write.
  • The plain URL keeps its own object and is not evicted by a variant.
  • Tests cover both keys and the default fallback.
主要语言
TypeScript
星标
7
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

LangerSword/gitone 的其他 Issue

查看 LangerSword/gitone 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。