Skip to content

chore(package): ship only the HDiffPatch / lzma files the builds compile - #670

Merged
sunnylqm merged 2 commits into
masterfrom
claude/package-cleanup
Oct 15, 2026
Merged

sunnylqm merged 2 commits into
masterfrom
claude/package-cleanup

Conversation

@sunnylqm

@sunnylqm sunnylqm commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

架构审查里的打包项:npm 包把两个子模块整棵目录都发了出去。

改了什么

  • files 改为精确清单。 以前整个 android/jni 都会打进包,910 个文件里有 751 个来自 HDiffPatch 和 lzma 子模块,包括测试、其他压缩算法、文档以及 Java/C# 移植版。消费者不会构建 android/jni,Android 用的是预编译的 .so;只有 podspec 和鸿蒙的 CMakeLists.txt 会从中编译 4 个 C 源文件。现在只发这 4 个文件、它们的头文件闭包(用 cc -M 算出),外加两个子模块的许可证。包的文件数从 910 降到 176。
  • check-packlist --compile: 先打出真实的 tarball 并解压,再只用包内文件对子模块源码、cpp/hpatch 和 patch 内核做语法编译。e2e 构建复制的是源码树,所以清单漏了某个头文件时,它们发现不了,问题只会在用户执行 pod install 时暴露。这项检查加在 test.yml 的 C++ job 里,该 job 现在也会被 package.json 的改动触发。

验证

  • node scripts/check-packlist.js --compile 通过。反向验证过:从清单里拿掉 Precomp.h 后,检查失败,并明确报出 LzmaDec.c 找不到这个头文件。
  • 用占位 HAR 跑 --release 也通过,确认发版的必需文件清单里包含两份许可证。
  • bun lint 通过,bun test 全部通过。

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

Summary by CodeRabbit

  • Chores
    • Refined the files included in package releases, including selected native sources and their license files.
    • Added checks that verify native sources in the packaged release can compile. These checks also run when package contents or their validation rules change.

package.json `files` shipped the whole android/jni tree, so 751 of the 910
packed files were the two submodules (tests, other codecs, docs, Java/C#
ports). Consumers never build android/jni (Android uses the prebuilt .so);
the podspec and Harmony's CMakeLists.txt compile four C sources from it.

`files` now lists those sources, their include closure (computed with
`cc -M`) and the two licenses: 910 -> 176 files.

Because a header missing from that list would only show up in a consumer's
pod install (the e2e builds copy the source tree), check-packlist gains
--compile: it packs the real tarball, unpacks it and syntax-checks the
submodule sources, cpp/hpatch and the patch core using only the packed files.
test.yml's C++ job runs it, and now also triggers on package.json.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 50854fb4-a48b-464e-b66c-3d29629550c1
📥 Commits

Reviewing files that changed from the base of the PR and between 63f67c3 and 6d5480f.

📒 Files selected for processing: 1
  • package.json

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

📝 Walkthrough

The package file list now specifies selected native sources and build files. The C++ test workflow runs a pack-list check that compiles C and C++ sources from the packed package.

Changes: Packed Native Source Validation

Layer / File(s) Summary
Package contents and release files
package.json, scripts/check-packlist.js
The package file list specifies selected JNI, HDiffPatch, and LZMA files. Release checks also require the HDiffPatch and LZMA license files.
Packed-source compilation check
scripts/check-packlist.js, .github/workflows/test.yml
The script adds a --compile option that packs and extracts the package, then syntax-checks packed C sources with cc and C++ sources with C++17. The C++ test workflow runs the check. The success message reports when compilation passes.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant CppWorkflow as C++ test workflow
  participant CheckPacklist as check-packlist.js
  participant Npm as npm pack
  participant CC as cc
  participant CXX as c++
  CppWorkflow->>CheckPacklist: Run with --compile
  CheckPacklist->>Npm: Pack and extract package
  CheckPacklist->>CC: Syntax-check packed C sources
  CheckPacklist->>CXX: Syntax-check packed C++ sources with C++17
Loading

Suggested reviewers: claude

Merge Risk: ⚪ Minimal · up to 6d548

The narrowed package selection retains the inspected Android build inputs and licenses, and the C++ job checks the packed archive. No concrete packaging or build failure is established, so no merge-blocking risk remains beyond normal checks.

Pre-merge checks: Passed 5
Passed Passed checks: 5 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: limiting packaged HDiffPatch and LZMA files to those required by the builds.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
🛠️ Fix failing CI checks: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sunnylqm
sunnylqm merged commit 544914b into master Oct 15, 2026
18 of 19 checks passed
@sunnylqm sunnylqm mentioned this pull request Oct 16, 2026
sunnylqm added a commit that referenced this pull request Oct 17, 2026
Bump package.json and harmony/pushy/oh-package.json5 together, with the
bilingual release notes. Ships everything since 10.60.0: the shared native
round engine (#673-#681), the cross-platform alignment and fixes (#664,
#666, #671, #687, #688), the JS client fixes and split (#667, #684, #685),
the bounded host prepareBundle (#669), the generated cross-platform contract
(#683, #686) and the trimmed npm package (#670).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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