Repository navigation
Backlog
Labels
acceptedA maintainer accepted this. Ready for a pull request.help wantedMaintainers would welcome help with this.
Description
Why
Anyone can build Hermit from the tag a preview APK came from, but the result doesn't match the published APK byte for byte, and nothing checks it. The PRD lists the reproducible APK as open (SL-45 and NFR-15 in docs/prd/hermit-prd.md). A rebuild that matches, apart from the signature, is how people can trust that the APK is the code they read.
What to do
- Make the recipe complete. Before it builds,
.github/workflows/release-apk.ymlwrites the version from the tag, and aversionCodeequal to the workflow's run number, intoapps/mobile/app.json. Put the same step in the recipe in docs/devices.md ("Or build it yourself"), and print theversionCodein the release notes so a rebuild can use it. - Build twice from the same tag, on two machines or two clean clones, following docs/devices.md. Compare the APKs with the signature left out: unzip both and compare every file except
META-INF/, or usediffoscope. - Find and remove each source of difference, such as timestamps, file order, absolute paths, the JavaScript bundle or the native builds. List what you find in the pull request, even the parts you couldn't fix.
- When two builds match, add a script or a CI job that checks it, and put the recipe in the release notes.
Done when
- Two builds from the same tag give APKs that match apart from the signature, and a script or a CI job shows it.
- docs/devices.md and the site's download page say so, and the release notes carry the recipe.
How to check
Build twice as docs/devices.md says, then compare the unzipped APKs without META-INF/.
Keep in mind
- Compare unsigned contents. Never ask for the preview key, and never commit a keystore or a password.
- The app gains no network call. Build-time downloads are fine when their versions are pinned.
Metadata
Metadata
Assignees
Labels
acceptedA maintainer accepted this. Ready for a pull request.help wantedMaintainers would welcome help with this.
Activity
saurabhbhoir456 commentedon Dec 6, 2026
I'll take this one, step by step. Step 1 first: the same version/versionCode step
.github/workflows/release-apk.ymlruns, written into the "Or build it yourself" recipe indocs/devices.md, and theversionCodeprinted in the release notes so a rebuild can use it. Steps 2-4 (build twice, compare apart from the signature, remove each source of difference, then a check) need a JDK 17 + Android SDK/NDK toolchain installed here first; I'll report what the comparison finds, including anything that stays unfixed.saurabhbhoir456 commentedon Dec 6, 2026
Steps 2-3 findings: two builds compared, and a same-path rebuild
Built the tag
v0.1.0-preview.1(5cc0e9f) twice from clean copies on this machine (WSL2 Linux, matching the release workflow's OS), at two different absolute paths (~/baand~/hermit-build-b), with the version/versionCode step from #289 applied identically (0.1.0-preview.1/412), then a third time back at the first path. Toolchain: Node 24.11.0, Temurin 17.0.21.1, pnpm 10.15.1 (lockfile), Android SDK platform 37, build-tools 37.0.0, NDK 29.0.14206865, CMake 3.22.1, Gradle 9.4.1 (the wrapper's version; fetched from a mirror with a verified SHA-256 becauserelease-assets.githubusercontent.comis unreachable from this machine). Signing was the local debug key (no preview key involved); comparison excludesMETA-INF/throughout.Different paths (A vs B): 971 of 984 entries identical
Same entry names, same order, and zero timestamp differences across all 984 non-
META-INFentries. 13 entries differ:assets/index.android.bundle(+192 bytes in the longer path): the QVAC worker bundle embeds absolutefile://imports for@qvac/sdksubpaths. That is@qvac/sdk'screateSdkImportResolver(dist/src/commands/bundle/resolve-sdk-import.js:54), which rewrites@qvac/sdk/...specifiers topathToFileURL(realpath)on purpose (so bare-* resolution anchors next to the SDK's deps under pnpm). Bare-pack embeds those URLs verbatim (8 occurrences; +12 chars x 8 x 2 bytes UTF-16 = the exact +192). The bundle manifest's contentiddiffers as a consequence.libreact_codegen_rnscreens.so) also retains clone paths in its debug strings in the shipped library.Same path (A vs C): 984 of 984 identical
A third build, from a fresh copy placed back at A's exact path, matches A apart from
META-INF/: same names, order, timestamps, sizes, CRCs and compression on every entry. So the build is otherwise deterministic, and the absolute clone path is the only source of difference found. (The wallet worklet bundle is also byte-size identical across both Linux paths; a Windows build differed — different OS/toolchain, out of scope here.)Windows-only findings (not needed for the Linux comparison)
Building on Windows needed clone-local adaptations, worth knowing before anyone follows
docs/devices.mdthere: Node 26 refuses.cmdspawns without a shell (worklets/wallet/build.mjsspawnsnpm), the Bare binary isbare.exe,link.mjsderives its folder fromURL(import.meta.url).pathnameand doubles the drive prefix (\\?\C:\C:\...),scripts/qvac-bundle.mjspasses Windows paths to dynamicimport()(needspathToFileURL), the Windows NDK clang ships no default-target config so CMake's link line (no--target=) falls back to the host target and itslldrejects the ELF flags inflags.cmake(aclang++.cfgwith--target=aarch64-linux-android24next to the binary fixes it), and deepTemp\opencode\...clone paths exceed CMake's 250-char object limit (short root paths work). The Gradle wrapper download also cannot reachrelease-assets.githubusercontent.comfrom this machine.Proposed step 4
Build in a container at one fixed absolute path (for example
/build/hermit) with the workflow's pinned toolchain, in both the recipe and eventually the release workflow itself, so the published APK and a rebuild share the same embedded paths. The check script builds twice at that path from clean copies and compares the APKs apart fromMETA-INF/(entry list, order, timestamps, sizes, CRCs), failing on any difference. That is the remaining work; the comparison above is the evidence it needs to pass.