Repository navigation
Conversation
- FF-11: NSFW 标签匹配前 trim + 小写归一,VNDB/MAL/Bangumi 共用同一词表集合 - FF-14: formatDateI18n 对非法日期返回空串,并将连字符语言码归一到下划线映射 - FF-29: VNDB 响应缺少 results 时报错;Bilibili 校验 HTTP 状态与 API code,拉取失败显示独立提示而非静默 0 值,构建日志仅在开发环境输出
👷 Deploy request for demo-firefly pending review.Visit the deploys page to approve it
|
审阅者指南数据结构在所有受支持的区域设置中添加 Bilibili 获取错误键及其翻译,以便页面能够显示本地化的失败状态。
实现在关键词匹配之前,对名称进行去空格和小写化处理,确保 VNDB、MAL 和 Bangumi 中的 NSFW 名称格式一致。
让日期格式化逻辑拒绝无效日期,并将带连字符的语言代码转换为区域设置映射所采用的格式。
拒绝不包含结果数组的 VNDB 响应,并验证 Bilibili 页面请求的 HTTP 状态和 API 代码。
UI跟踪 Bilibili 获取失败的情况,并显示本地化错误提示,而不是空统计数据;同时将页面级诊断日志限制在开发环境中。
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's GuideData structuresAdd the Bilibili fetch-error keys and translations across all supported locales so the page can present a localized failure state.
ImplementationNormalize NSFW names consistently across VNDB, MAL, and Bangumi by trimming and lowercasing before keyword matching.
Make date formatting reject invalid dates and map hyphenated language codes to the locale-map convention.
Reject VNDB responses that do not contain a results array, and validate HTTP status and API codes for Bilibili pages.
UITrack Bilibili fetch failures and render a localized error notice instead of empty statistics, while limiting page-level diagnostic logging to development.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嗨——我发现了 1 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/utils/bilibili-utils.ts" line_range="29" />
<code_context>
const firstRes = await fetch(
`${BILIBILI_API}?type=${type}&vmid=${uid}&pn=1&ps=${PAGE_SIZE}`,
);
+ if (!firstRes.ok) {
+ throw new Error(`[Bilibili] 首页请求失败 (状态码: ${firstRes.status})`);
+ }
</code_context>
<issue_to_address>
**API errors appear as empty results**
When bilibili returns HTTP 200 with a nonzero API code for the first page, `fetchBilibiliByType` returns an empty list instead of throwing, so `fetchBilibiliList` resolves and the page presents zero or partial totals rather than its fetch-error notice.
Throw when the first-page JSON has a nonzero API code, and reserve the empty-list return for successful responses with no items.
Also at `src/utils/bilibili-utils.ts:53`.
</issue_to_address>Sourcery 评估
等待批准。 请先处理 1 项发现。
阻塞性发现:src/utils/bilibili-utils.ts:29
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/utils/bilibili-utils.ts" line_range="29" />
<code_context>
const firstRes = await fetch(
`${BILIBILI_API}?type=${type}&vmid=${uid}&pn=1&ps=${PAGE_SIZE}`,
);
+ if (!firstRes.ok) {
+ throw new Error(`[Bilibili] 首页请求失败 (状态码: ${firstRes.status})`);
+ }
</code_context>
<issue_to_address>
**API errors appear as empty results**
When bilibili returns HTTP 200 with a nonzero API code for the first page, `fetchBilibiliByType` returns an empty list instead of throwing, so `fetchBilibiliList` resolves and the page presents zero or partial totals rather than its fetch-error notice.
Throw when the first-page JSON has a nonzero API code, and reserve the empty-list return for successful responses with no items.
Also at `src/utils/bilibili-utils.ts:53`.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: src/utils/bilibili-utils.ts:29
- Treat a non-zero first-page code as an error instead of an empty list, matching subsequent-page handling.
Summary
External-data cleanup covering three audit findings.
"R18 ") and Bangumi tag fallbacks all use the same normalization; the shared helper has three call sites so they stay in lockstep.formatDateI18nreturns""for invalid input (matchingformatDateToYYYYMMDD) instead of renderingInvalid Date, and normalizeszh-CN-style language codes to thezh_CNkeys used by the locale map.fetchVndbUlistrejects HTTP-200 responses without aresultsarray. Bilibili requests now check HTTP status and APIcode, including subsequent pages. A build-time fetch failure sets an explicit state on the Bilibili page and renders a translated error notice instead of publishing "total 0 / avg 0.0"; per-item fetch logs run only in development. Two new i18n keys were added to all seven locale modules.Files
src/utils/nsfw-utils.ts,src/utils/date-utils.ts,src/utils/vndb-utils.ts,src/utils/bilibili-utils.tssrc/pages/bilibili.astro,src/i18n/i18nKey.ts,src/i18n/languages/*.tsVerification
corepack pnpm run check: 0 errors, 0 warnings, 0 hints.corepack pnpm exec astro build --force: 40 pages built successfully.corepack pnpm exec biome checkon the changed files: no fixes applied.resultsall behave as specified.Sourcery 摘要
加强远程数据处理,并在构建时获取 Bilibili 数据失败时优雅降级。
Bug 修复:
改进:
Original summary in English
Sourcery 摘要
强化外部数据处理,并在构建过程中无法获取 Bilibili 数据时,以本地化错误提示进行妥善处理。
Bug 修复:
改进:
杂项:
Original summary in English
Summary by Sourcery
Harden external-data processing and gracefully surface localized errors when Bilibili data cannot be fetched during builds.
Bug Fixes:
Enhancements:
Chores: