Skip to content

🐛 fix(blog): reject empty resumes and repair article links - #82

Draft
zrr1999 wants to merge 3 commits into
mainfrom
codex/website-validation-20261003
Draft

zrr1999 wants to merge 3 commits into
mainfrom
codex/website-validation-20261003

Conversation

@zrr1999

@zrr1999 zrr1999 commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

动机

Egglog 系列第二、三篇的前篇链接使用相对路径,部署后会进入不存在的嵌套文章 URL。简历的 Typst 编译失败时,astro-typst 会返回空字符串,构建仍成功并生成 0 字节的 /resume/index.html。

解决方案

  • 将两处前篇链接改为实际的 /posts/<slug>/ 路由。
  • 在 Typst 的 SVG 后处理边界拒绝空输出,保留编译诊断并令构建失败。
  • 新增包含静态资源子模块的完整网站构建 CI,覆盖主页、博客和幻灯片。

验证:锁定依赖安装、vp check --fix、vp run build、prek run --all-files 和提交钩子均通过。向简历临时注入未定义变量时,原版本返回 0 且页面为 0 字节;修复后返回 1,并明确报告缺少 SVG。恢复源文件后完整构建通过,浏览器确认两处链接可访问、简历实际渲染 925 个字形引用,且没有页面脚本异常。

说明

Stack 基线:main;后续为 #83(TypeScript 兼容约束)、#84(离线 OG 字体)、#85(共享规范与 Astro 检查)。CI 对所有 PR 基线分支运行,覆盖上层 stack PR。本地云端验证时已从官方源预热固定版本的 Typst 包缓存;远端完整构建也通过。

保留 TypeScript 6.x 和现有依赖版本。负例注入内容在验证后已恢复;简历正文和显示样式保持原样。

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 3, 2026 •

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
zrr-website-blog 7a6f319 Commit Preview URL

Branch Preview URL
Oct 10 2026, 03:53 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 3, 2026 •

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
zrr-website-slides 7a6f319 Commit Preview URL

Branch Preview URL
Oct 10 2026, 03:52 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 3, 2026 •

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
zrr-website-root 7a6f319 Commit Preview URL

Branch Preview URL
Oct 10 2026, 03:54 AM

@morirun morirun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已审阅 #82 至 ac31780。

阻塞项:

  • 无。

非阻塞:

  • astro.config.mjs 的错误信息使用 source.mainFilePath;通过内联内容渲染时 astro-typst 只传 mainFileContent,信息会显示为 undefined,见行内评论。
  • 本分支落后 main 4 个提交(#81、#87、#88、#89),合入前建议 rebase 后让 CI 重新跑一次。

核对:

  • 对照 astro-typst 0.12.4 源码:cheerio.postprocess 只在 SVG 渲染路径调用,编译失败时 renderToSVGString_ 返回空字符串,此处检查能拦住空简历,不影响 /data/ 下走 HTML 目标的文章。
  • 将 #82、#83 合并到当前 main 后本地执行 vp run build:三个站点均通过,博客 109 页;/resume/index.html 为 731 KB 并含 SVG;两处前篇链接分别渲染为 /posts/egglog-quickstart-01/ 和 /posts/egglog-quickstart-02/。
  • 去掉各 CI 的 pull_request.branches: [main] 是为了让 stack 中的上层 PR 也能跑校验,符合本 stack 的意图。
  • CI 全绿,PR 正文符合模板。

结论:

  • Approve。

postprocess($, source) {
if ($("svg").length === 0) {
throw new Error(
`Typst produced no SVG for ${source.mainFilePath}. Check the compiler diagnostics above.`

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

非阻塞:astro-typst 的 prepareSource 对字符串输入只生成 { mainFileContent },此时 mainFilePath 为 undefined。可改为 source.mainFilePath ?? "inline Typst content",让报错信息总能指向具体来源。

@gitar-bot

gitar-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Rejecting Typst output without SVG makes invalid resumes fail builds, while the new all-sites workflow may block PRs on build errors.

Fixes broken article links in the Egglog series by correcting relative paths to absolute routes, and adds validation to reject empty resume output when Typst compilation fails, ensuring the build fails rather than generating a zero-byte file. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Counting what did not apply, without listing it.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Important

Your trial ends in 3 days — upgrade now to keep code review, CI analysis, auto-apply, custom automations, and more.

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

with:
submodules: recursive

- uses: j178/prek-action@v3.0.0
with:
install-only: true

- uses: voidzero-dev/setup-vp@v1

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants