Skip to content

fix(release): harden package verification and release manifests (#80 follow-up) - #84

Merged
haywolf merged 4 commits into
masterfrom
fix/80-followup-release-hardening
Nov 5, 2026
Merged

haywolf merged 4 commits into
masterfrom
fix/80-followup-release-hardening

Conversation

@haywolf

@haywolf haywolf commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #80 review (low-severity points):

  1. release.yml: per-arch exact manifest filenames uploaded with if-no-files-found: error, validated before publishing installer assets (a glob could match builder-debug.yml and hide a missing manifest); removed obsolete filter step.
  2. package-load-check.cjs: cleanup (rmSync with retries, $disconnect) wrapped so it never masks the original error.
  3. verify-package-arch.mjs: isEntryPoint() compares realpathSync of both sides (symlinked invocation no longer silently passes).
  4. verify-package-arch.mjs: error message includes the terminating signal.
  5. release matrix: fail-fast: false.

Tests: scripts/tests 38 passed (new tests fail against old scripts); tsc app/node clean; electron-vite build OK. release.yml changes not exercised until the next RC.

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

AI Code Review Summary

PR: #84 (fix(release): harden package verification and release manifests (#80 follow-up))
Preferred language: English

Overall Assessment

No blocking issue was detected in the reviewed diff; keep focused regression testing before merge.

Major Findings by Severity

No major issues identified from the reviewed diff.

Actionable Suggestions

  • Address the highest severity findings first and add targeted tests for changed logic.

Potential Risks

  • Potential hidden risks remain in edge cases not covered by the current diff context.

Test Suggestions

  • Add happy-path + boundary + failure-path tests for touched modules.

File-Level Coverage Notes

No file-level notes.

Inline Downgraded Items (processed but not inline)

  • None

Coverage Status

  • Target files: 0
  • Covered files: 0
  • Uncovered files: 0
  • No-patch/binary covered as file-level: 0
  • Findings with unknown confidence (N/A): 0

Uncovered list:

  • None

No-patch covered list:

  • None

Runtime/Budget

  • Rounds used: 0/4
  • Planned batches: 0
  • Executed batches: 0
  • Sub-agent runs: 0
  • Planner calls: 0
  • Reviewer calls: 0
  • Model calls: 0/64
  • Structured-output summary-only degradation: NO

@github-actions github-actions 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.

Automated PR review completed.

  • Findings kept: 0
  • Findings with unknown confidence: 0
  • Inline comments attempted: 0
  • Target files: 0
  • Covered files: 0
  • Uncovered files: 0
    See the summary comment for detailed analysis and coverage details.

@haywolf

haywolf commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

一、审查结论

不通过。 e4da262 这次 merge 本身没有问题,PR 自身 diff 也没变;但它还不能合入当前 master(fbdf636)。

  • 文本冲突: package-load-check.cjs 有冲突,解决后要保留 cleanUp、删除 checkSharp。
  • 隐性语义冲突: PR 新增的测试没有文本冲突,但只解决文本冲突后,5 个用例会失败 3 个,npm run test:unit 变红。
  • 待修缺陷: master 新增的 rmSync(emptyCwd) 没有受保护,违背 PR 的清理约定。修好 fake 后它仍会让 1 个用例失败。

这三处改完后,相关的 4 个测试文件 56 个用例全部通过(见场景 C)。

二、审查明细

行号标注说明:

  • “冲突态”指 git merge-tree 输出的带冲突标记的文件。
  • “解决后”指按建议解决文本冲突后的文件。
缺陷评级 文件:行号 缺陷类型 带来的影响 建议方案
高 scripts/package-load-check.cjs:20-37(冲突态) 文本合并冲突 PR 无法合入。PR 在此处新增 cleanUp,master 删除了相邻的 checkSharp(已移除 sharp)。整段取 master 一侧时,finally 抛 cleanUp is not defined,每个包都被判失败,真实引擎错误也被掩盖(有复现)。整段取 PR 一侧时,会留下引用已移除 sharp 的死代码 checkSharp;它不在 checks 中,运行时不报错。 保留 cleanUp(:21-28),删除 checkSharp(:30-34)。其余部分已自动合并,无需改动:头部 require、appDir、checkCanvas、checkPdfRendering,以及 checkPrisma 的 return loadedPrismaEngine() 加 cleanUp。
高 scripts/__tests__/package-load-check.test.mjs:10-14,58-61 语义冲突:测试 fake 过时,git 无提示 该文件只在 PR 侧存在,合并时不报冲突。master 的 checkCanvas 要用 encode、loadImage、fillRect,还新增了 dist/main/pdf-page-renderer.js 检查,旧 fake 都不满足。结果 3/5 失败(都是 expected 1 to be 0),CI ci.yml:80 变红(有复现)。 删除 FAKE_SHARP 及其 putModule。FAKE_CANVAS 补上 encode、loadImage、fillRect、drawImage、getImageData。新增假的 app.asar/dist/main/pdf-page-renderer.js,让 renderPdfPages 返回 5 页。
中 scripts/package-load-check.cjs:122(解决后;master 为 :110) 逻辑缺陷:清理失败未受保护 这是 master 新增的代码,但与 PR 的 cleanUp 约定(清理失败不得导致检查失败)冲突。删除 emptyCwd 失败时,三项检查都已通过,进程仍以未捕获异常退出 1,发布门禁被误判失败。仅修 fake 后,only warns when the temp directory cannot be removed 仍失败(有复现)。实际触发概率不高,主要风险在 Windows,但不应靠放宽测试绕过。 改用 cleanUp(代码见下)。
低 .github/workflows/release.yml:102(合并后 :106) 上轮遗留,未处理 manifest 制品仍在安装包之前上传,也未设置 overwrite。重跑时可能取到旧同名制品,与重新构建的安装包 sha512 不一致。 按上轮建议设置 overwrite: true 或核对 sha512。
建议 .github/workflows/release.yml:17,100-101(合并后 :17,:104-105) 上轮遗留,注释不准确,未处理 fail-fast: false 下其他架构照常发布,“before any asset is published” 与实际不符。 改为 “before this job publishes its assets”。
建议 scripts/verify-package-distros.mjs:115,60(master 新文件) 同类隐患,非本 PR 引入 :115 用的正是 PR 已在 verify-package-arch.mjs 修掉的入口判断,经符号链接启动时 main() 被跳过,门禁以 0 退出(有复现)。CI 的直接路径调用不受影响。:60 在进程被信号杀死时只报 exit code null,仍判失败,仅提示不准(读代码,未复现)。 为控制本 PR 范围,可另开 PR:导出并复用 isEntryPoint 和 loadCheckProblems。

中级项的修改方式:

await cleanUp(`remove ${emptyCwd}`, () =>
  fs.rmSync(emptyCwd, { recursive: true, force: true, maxRetries: 5, retryDelay: 200 }),
);

任务 1:merge 增量

核对项 结果
merge 解决是否正确 正确:e4da262 与 merge-tree a01d4f7 dbd58fb 的 tree 都是 cba3d516,--remerge-diff 为空
merge 引入的改动 共 14 个文件,与 master 侧的改动统计一致,都来自 #79、#81、#82、#83,与 PR 的 5 个文件无交集
PR 自身 diff 是否改变 未改变:a01d4f7^1..a01d4f7 与 merge-base..e4da262 逐字节相同,patch-id 都是 ea4cf7b4…

任务 2:与 origin/master 的其他语义检查

文件或接口 结果
release.yml 自动合并正确。顺序为 verify → distros(仅 Linux)→ 公证 → manifest → 上传,distros 失败会挡住该 job 的发布;builder-debug 过滤步骤已按 PR 意图移除
verify-package-arch.mjs 自动合并正确。PR 的 realpathSync、loadCheckProblems、isEntryPoint 与 master 的 linuxEngineTargets 共存;resolvePackageLayout 仍导出,distros 脚本导入它时不会误触发 main()
verify-package-arch.test.mjs 自动合并后 37 个用例全部通过,只有上面的 load-check 测试失效
npm scripts、改名或删除的接口 verify:package、verify:package:distros 都在。除 load-check 的 fake 和 checkSharp 外,脚本中没有其他 sharp 残留,也没有发现断掉的引用
checkPrisma 与 distros 的配合 引擎名在 finally 之前取得;cleanUp 的警告走 stderr,checkDistroResult 只读 stdout,互不干扰(读代码确认)

任务 3:上轮遗留项

两项都未处理:a01d4f7 之后没有新的 PR 提交,release.yml 的 PR diff 也完全没变。

三、测试及结果

以下测试都在 /tmp 副本中用 vitest 2.1.9 和最小配置运行(Node 24),没有重跑失败项,也没有跑全量。

场景 内容 结果 复现证据
A 只按建议解决文本冲突,测试不动,跑 scripts/__tests__ 下 4 个文件 53 通过,3 失败,失败全在 package-load-check.test.mjs 有,对应第 2 个高级项
B A 加上更新 fake,只跑 package-load-check.test.mjs 4 通过,1 失败;三项检查都 load ok,进程仍因未捕获的 rmSync 错误退出 1 有,对应中级项
C B 加上 emptyCwd 走 cleanUp,跑 4 个文件 56 全部通过 证明建议方案可行
D 冲突块取 master 一侧,直接运行脚本 退出 1,报 cleanUp is not defined;注入引擎错误时报同样信息,真实错误被掩盖 有,对应第 1 个高级项
E 直接运行与经符号链接运行入口脚本,传非法参数 distros:直接运行退出 1,符号链接退出 0;arch(PR 已修):符号链接退出 1 有,对应最后一个建议项

未验证的部分:

  • 没有运行真实的 Electron、Docker、Prisma 引擎,也没有运行 GitHub Actions。
  • load-check 的场景都用 fake 模块;工作流相关结论来自读代码,distros 的 Docker 流程只跑了它的单元测试。
  • 第 1 个低级项的重跑行为沿用上轮结论,本轮只确认代码未变,没有实测。

仓库状态: 工作区仍干净,HEAD 仍是 e4da262,没有提交、推送或评论。我执行过 git fetch 和 git merge-tree --write-tree,只影响 .git 内的远程跟踪引用和松散对象。探针副本留在 /tmp/pr84-probe/{a,b,c,d},vitest 环境在 /tmp/pr84-vt,可用来复现。

…ease-hardening

# Conflicts:
#	scripts/package-load-check.cjs
Route the emptyCwd removal added on master through cleanUp, with retries.
Update the load check's test fakes for the master changes (canvas re-encode,
PDF rendering, sharp removal). Replace the manifest artifact on a re-run, and
correct the comment on what a missing manifest stops under fail-fast: false.
@haywolf
haywolf merged commit ed7e9e8 into master Nov 5, 2026
2 checks passed
@haywolf
haywolf deleted the fix/80-followup-release-hardening branch November 5, 2026 06:21
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.

1 participant