Repository navigation
Conversation
- FF-17: resolve sakura asset through BASE_URL in both main thread and worker - FF-21: reuse the single render() result instead of running the pipeline twice per post - FF-35: recompute all 2x2 LQIP placeholders on each generation run - FF-37: include content and runtime locale text in the font-subset charset scan - FF-46: derive plantuml and GitHub card ids deterministically
👷 Deploy request for demo-firefly pending review.Visit the deploys page to approve it
|
审阅者指南数据结构审阅 LQIP 映射的更新:现在会重新计算每张图片,同时在处理失败时保留先前的值,并移除过时的键。
实现检查为 GitHub 卡片和 PlantUML 图表新增的确定性树级标识符及冲突处理。
审阅字体子集字符扫描是否将内容和区域设置源文本与构建后的 HTML 一并纳入。
确认文章渲染在处理页面内容和 frontmatter 元数据时复用了同一个渲染结果。
配置检查 Sakura 图片加载的两条路径是否都通过配置的基础 URL 解析纹理,以支持子路径部署。
提示和命令与 Sourcery 交互
自定义使用体验访问你的控制面板,即可:
获取帮助Original review guide in EnglishReviewer's GuideData structuresReview the LQIP map update, which now recomputes every image while preserving prior values on processing failures and removing stale keys.
ImplementationCheck the deterministic per-tree identifiers and collision handling added for GitHub cards and PlantUML diagrams.
Review the font-subset character scan’s inclusion of content and locale source text alongside built HTML.
Verify post rendering reuses one render result for page content and frontmatter metadata.
ConfigurationCheck that both Sakura image-loading paths resolve the texture through the configured base URL for subpath deployments.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嘿——我发现了 5 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/generate-lqips.ts" line_range="79" />
<code_context>
-
- const lqips: LqipMap = { ...existingLqips };
+ // 每次全量重算:仅 2×2 缩放,代价很小;避免原位换图后沿用旧占位色
+ const lqips: LqipMap = {};
let processed = 0;
-
</code_context>
<issue_to_address>
**Existing image placeholders disappear**
When an image with an existing LQIP entry fails processing during regeneration, `processImage()` returns `null`, so the newly empty `lqips` map omits the image and replaces the previous JSON entry; the image loses its usable LQIP placeholder.
Preserve the existing entry when processing fails, or fail generation instead of writing an incomplete map.
Also at `scripts/generate-lqips.ts:85-86`.
</issue_to_address>
### Comment 2
<location path="src/plugins/rehype-component-github-card.mjs" line_range="31" />
<code_context>
const repo = properties.repo;
- const cardUuid = `GC${Math.random().toString(36).slice(-6)}`; // Collisions are not important
+ const cardUuid = `GC${createHash("sha256").update(repo).digest("hex").slice(0, 6)}`;
const data = githubCardData[repo.toLowerCase()] ?? null;
const hasData = data !== null;
</code_context>
<issue_to_address>
**Repeated cards have ambiguous targets**
When the same repository card is rendered more than once on a page, `cardUuid` hashes only `repo`, so repeated cards emit duplicate IDs for their cards and child elements; fragment links and ID-based lookups cannot reliably target the intended card.
Generate a distinct ID for each rendered card and use it for that card's child elements.
</issue_to_address>
### Comment 3
<location path="scripts/subset-fonts.ts" line_range="23" />
<code_context>
+// 静态 HTML 之外可能只在工作表中出现的文本(memos、七种语言文案等)
+const RUNTIME_TEXT_GLOBS = [
+ "src/content/**/*.{md,mdx,json}",
+ "src/i18n/languages/*.ts",
+];
</code_context>
<issue_to_address>
**Runtime memo text loses glyphs**
When memos is enabled and its API returns characters absent from the files and static HTML scanned for font subsetting, `collectChars()` omits those runtime characters, so `subset-fonts.ts` produces a font without their glyphs and memo text renders with a fallback font or missing characters.
Include runtime memo characters in the subset character set or ensure memo text uses a font that contains them.
</issue_to_address>
### Comment 4
<location path="src/plugins/rehype-plantuml.mjs" line_range="62" />
<code_context>
}
- const diagramId = generateId();
+ const diagramId = `plantuml-${diagramIndex++}`;
const img = h("img", {
</code_context>
<issue_to_address>
**Diagram IDs collide with headings**
When a heading slug matches a generated `plantuml-N` ID, `rehypePlantuml` assigns the same ID to the diagram and heading, so fragment and table-of-contents links can target the wrong element.
Assign diagram IDs that are unique within the document and do not collide with heading IDs.
Also at `src/plugins/rehype-plantuml.mjs:71`.
</issue_to_address>
### Comment 5
<location path="scripts/generate-lqips.ts" line_range="79" />
<code_context>
-
- const lqips: LqipMap = { ...existingLqips };
+ // 每次全量重算:仅 2×2 缩放,代价很小;避免原位换图后沿用旧占位色
+ const lqips: LqipMap = {};
let processed = 0;
-
</code_context>
<issue_to_address>
**Older generation overwrites newer gradients**
When two generation jobs overlap while an image is replaced, and the job that processed the old pixels finishes last, the earlier job can finish after the newer job and write a map computed from the old image pixels, overwriting the newer map; subsequent builds then use stale gradients.
Serialize generation jobs or verify that the source inputs are still current before committing the generated map.
</issue_to_address>Sourcery 评估
待批准。 请先处理 5 项发现。
阻塞性问题:scripts/generate-lqips.ts:79、src/plugins/rehype-component-github-card.mjs:31、scripts/subset-fonts.ts:23、src/plugins/rehype-plantuml.mjs:62、scripts/generate-lqips.ts:79
Original comment in English
Hey - I've found 5 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="scripts/generate-lqips.ts" line_range="79" />
<code_context>
-
- const lqips: LqipMap = { ...existingLqips };
+ // 每次全量重算:仅 2×2 缩放,代价很小;避免原位换图后沿用旧占位色
+ const lqips: LqipMap = {};
let processed = 0;
-
</code_context>
<issue_to_address>
**Existing image placeholders disappear**
When an image with an existing LQIP entry fails processing during regeneration, `processImage()` returns `null`, so the newly empty `lqips` map omits the image and replaces the previous JSON entry; the image loses its usable LQIP placeholder.
Preserve the existing entry when processing fails, or fail generation instead of writing an incomplete map.
Also at `scripts/generate-lqips.ts:85-86`.
</issue_to_address>
### Comment 2
<location path="src/plugins/rehype-component-github-card.mjs" line_range="31" />
<code_context>
const repo = properties.repo;
- const cardUuid = `GC${Math.random().toString(36).slice(-6)}`; // Collisions are not important
+ const cardUuid = `GC${createHash("sha256").update(repo).digest("hex").slice(0, 6)}`;
const data = githubCardData[repo.toLowerCase()] ?? null;
const hasData = data !== null;
</code_context>
<issue_to_address>
**Repeated cards have ambiguous targets**
When the same repository card is rendered more than once on a page, `cardUuid` hashes only `repo`, so repeated cards emit duplicate IDs for their cards and child elements; fragment links and ID-based lookups cannot reliably target the intended card.
Generate a distinct ID for each rendered card and use it for that card's child elements.
</issue_to_address>
### Comment 3
<location path="scripts/subset-fonts.ts" line_range="23" />
<code_context>
+// 静态 HTML 之外可能只在工作表中出现的文本(memos、七种语言文案等)
+const RUNTIME_TEXT_GLOBS = [
+ "src/content/**/*.{md,mdx,json}",
+ "src/i18n/languages/*.ts",
+];
</code_context>
<issue_to_address>
**Runtime memo text loses glyphs**
When memos is enabled and its API returns characters absent from the files and static HTML scanned for font subsetting, `collectChars()` omits those runtime characters, so `subset-fonts.ts` produces a font without their glyphs and memo text renders with a fallback font or missing characters.
Include runtime memo characters in the subset character set or ensure memo text uses a font that contains them.
</issue_to_address>
### Comment 4
<location path="src/plugins/rehype-plantuml.mjs" line_range="62" />
<code_context>
}
- const diagramId = generateId();
+ const diagramId = `plantuml-${diagramIndex++}`;
const img = h("img", {
</code_context>
<issue_to_address>
**Diagram IDs collide with headings**
When a heading slug matches a generated `plantuml-N` ID, `rehypePlantuml` assigns the same ID to the diagram and heading, so fragment and table-of-contents links can target the wrong element.
Assign diagram IDs that are unique within the document and do not collide with heading IDs.
Also at `src/plugins/rehype-plantuml.mjs:71`.
</issue_to_address>
### Comment 5
<location path="scripts/generate-lqips.ts" line_range="79" />
<code_context>
-
- const lqips: LqipMap = { ...existingLqips };
+ // 每次全量重算:仅 2×2 缩放,代价很小;避免原位换图后沿用旧占位色
+ const lqips: LqipMap = {};
let processed = 0;
-
</code_context>
<issue_to_address>
**Older generation overwrites newer gradients**
When two generation jobs overlap while an image is replaced, and the job that processed the old pixels finishes last, the earlier job can finish after the newer job and write a map computed from the old image pixels, overwriting the newer map; subsequent builds then use stale gradients.
Serialize generation jobs or verify that the source inputs are still current before committing the generated map.
</issue_to_address>Sourcery assessment
Approval pending. 5 findings to address first.
Blocking findings: scripts/generate-lqips.ts:79, src/plugins/rehype-component-github-card.mjs:31, scripts/subset-fonts.ts:23, src/plugins/rehype-plantuml.mjs:62, scripts/generate-lqips.ts:79
|
|
||
| // 静态 HTML 之外可能只在工作表中出现的文本(memos、七种语言文案等) | ||
| const RUNTIME_TEXT_GLOBS = [ | ||
| "src/content/**/*.{md,mdx,json}", |
There was a problem hiding this comment.
🟡 Medium · 运行时备忘录文本缺少字形
启用备忘录功能后,如果其 API 返回的字符不在字体子集化扫描的文件和静态 HTML 中,collectChars() 就会遗漏这些运行时字符,导致 subset-fonts.ts 生成的字体不包含相应字形,备忘录文本因而会使用后备字体渲染,或显示为缺失字符。
将运行时备忘录字符纳入子集字符集,或者确保备忘录文本使用包含这些字符的字体。
面向 AI 代理的提示
在 `scripts/subset-fonts.ts` 第 23 行:
**运行时备忘录文本缺少字形**
启用备忘录功能后,如果其 API 返回的字符不在字体子集化扫描的文件和静态 HTML 中,`collectChars()` 就会遗漏这些运行时字符,导致 `subset-fonts.ts` 生成的字体不包含相应字形,备忘录文本因而会使用后备字体渲染,或显示为缺失字符。
将运行时备忘录字符纳入子集字符集,或者确保备忘录文本使用包含这些字符的字体。Original comment in English
🟡 Medium · Runtime memo text loses glyphs
When memos is enabled and its API returns characters absent from the files and static HTML scanned for font subsetting, collectChars() omits those runtime characters, so subset-fonts.ts produces a font without their glyphs and memo text renders with a fallback font or missing characters.
Include runtime memo characters in the subset character set or ensure memo text uses a font that contains them.
Prompt for AI agents
In `scripts/subset-fonts.ts` at line 23:
**Runtime memo text loses glyphs**
When memos is enabled and its API returns characters absent from the files and static HTML scanned for font subsetting, `collectChars()` omits those runtime characters, so `subset-fonts.ts` produces a font without their glyphs and memo text renders with a fallback font or missing characters.
Include runtime memo characters in the subset character set or ensure memo text uses a font that contains them.There was a problem hiding this comment.
这一点在当前仓库结构下不能靠扩大静态 glob 解决:src/utils/memos-adapter.ts 从 /api/v1/memos 取运行时数据,memo.content 的字符在构建期不可知,而 scripts/subset-fonts.ts 必须离线生成子集。真正修复需要产品层面的取舍(运行时加载完整字体、放弃子集,或限制 Memos 字符集),超出 FF-17/21/35/37/46 的构建确定性修复范围。保留给 maintainer 决定,暂不 resolve。
- Seed LQIP recomputation from the existing map so a failed image keeps its placeholder. - Add per-tree occurrence to GitHub card IDs so repeated repos stay unique. - Skip authored IDs when assigning PlantUML diagram IDs.
- Compare image size and mtime before and after generation so an overlapping run cannot overwrite a newer gradient map.
Summary
import.meta.env.BASE_URLin both the DOM image and the OffscreenCanvas worker, so subpath deployments load the effect instead of 404-ing.render(entry)result for content andremarkPluginFrontmatter; the previous second call reran the full remark/rehype pipeline (including Mermaid SSR and wiki-link metadata collection) for every post.dist/**/*.htmlto content and locale sources; runtime/memo text that never appears in a static page no longer risks missing glyphs.Math.random()ids with a per-tree diagram counter and a SHA-256-derived GitHub card id, making rebuild output stable.Verification
pnpm exec biome checkon the 7 changed source files: no diagnostics (only the pre-existing biome schema-version notice).pnpm run check: 0 errors, 0 warnings, 0 hints.pnpm run build: completed, 40 pages, all post-build scripts included.plantuml-0…8and stableGC862bb9-*ids; noMath.random()remains in either plugin; no unexpandedimport.meta.env.BASE_URLremains in built JS.src/constants/lqips.jsonkeeps the same 36 values (only ordering changed) and the discovery of previously stale entries.Sourcery 摘要
稳定资源生成与构建输出,同时避免重复渲染文章。
错误修复:
增强功能:
构建:
Original summary in English
Sourcery 摘要
稳定构建资源生成和渲染输出,同时消除冗余的文章处理。
错误修复:
增强功能:
构建:
Original summary in English
Sourcery 摘要
稳定生成的资源和构建产物,同时避免重复渲染文章。
错误修复:
改进:
构建:
Original summary in English
Summary by Sourcery
Stabilize generated assets and build output while eliminating redundant article rendering.
Bug Fixes:
Enhancements:
Build: