Skip to content

perf(packaging): drop go build -a, keep JS deps between builds, no Metro in release mobile builds (untested on build machine) - #29764

Merged
chrisnojima merged 4 commits into
nojima/HOTPOT-packaging-libfrom
nojima/HOTPOT-packaging-speed
Oct 15, 2026
Merged

chrisnojima merged 4 commits into
nojima/HOTPOT-packaging-libfrom
nojima/HOTPOT-packaging-speed

Conversation

@chrisnojima

@chrisnojima chrisnojima commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Not yet tested on a build machine. Hold this PR until test builds pass on macOS, iOS and Android.

What

Makes the release builds faster. Stacked on #29761.

  • Go: drop -a. prerelease/build_keybase.sh, build_kbfs.sh, build_updater.sh and windows/build_prerelease.cmd no longer force a full rebuild, standard library included.
    • The build cache doesn't account for SDK headers in cgo code, so a new kb_guard_go_cache in lib.sh runs go clean -cache on macOS when the SDK version or build, the clang version, or MACOSX_DEPLOYMENT_TARGET changes.
  • JS: stop clearing dependencies every build. The clearing was there because the build machines run low on disk.
    • Yarn cache: kb_prune_yarn_cache runs yarn cache clean only when the volume holding the cache has less than KB_MIN_FREE_GB free (default 30), and logs the free space either way.
    • node_modules: kb_yarn_modules keeps it and wipes it only when the stamp changes. The stamp covers yarn.lock, package.json, the patch names and contents, and the Node and yarn versions. It's deleted before each install, so a failed install is never reused.
    • Builds still run yarn modules, so postinstall, patch-package and the rnmodules sync still happen.
    • Android also deletes the native modules' node_modules/*/android/.cxx CMake caches.
  • CLEAN_CACHES=1 forces a from-scratch build. When the bot sets it, kb_prune_yarn_cache always runs yarn cache clean, kb_yarn_modules always deletes node_modules, and kb_guard_go_cache always runs go clean -cache. The next build without the flag goes back to reusing the caches.
  • Mobile: no Metro in release builds. The release variants bundle their own JS. manage_react_native_packager.sh is deleted, and nothing else in this repo or keybase/slackbot called it.
    • Android: shared/android/app/build.gradle:20-39 leaves debuggableVariants at its default of debug and debugOptimized, so release bundles. The script runs publishReleaseBundle.
    • iOS: the scheme's archive uses the Release configuration (Keybase.xcscheme:113-114). react-native-xcode.sh skips bundling only for Debug, and the bundle phase is at project.pbxproj:568-587.
    • Removed with it: shared/react-native/packageAndBuild.sh and the yarn rn:start:legacy script. Their only caller was the packager script, and the Jenkins Shellcheck stage and the README no longer list them.

Building the two macOS architectures in parallel (4.4 in the plan) is left out.

Tested locally

Stub tests with a fake yarn on PATH. The real cache wasn't touched.

Helper Case Result
kb_prune_yarn_cache free space above the threshold keeps the cache
free space below the threshold cleans it
clean fails non-fatal
kb_yarn_modules first run wipes and installs
unchanged inputs reuses node_modules
lockfile, patch content or patch name changed wipes
install fails returns non-zero, no stamp
run after a failed install wipes
CLEAN_CACHES=1 all three helpers, with warm caches each one clears its cache
the next run without it reuses the caches again
kb_guard_go_cache (scratch GOCACHE) first run clears and stamps
same toolchain keeps the cache
changed toolchain clears

The test build must confirm

  • macOS:
    • The log shows "…GB free (>= 30GB); keeping the yarn cache".
    • The second run logs "Dependencies unchanged; reusing node_modules", and the packaged app works.
    • The Go build is faster, and keybase version -S and kbfs -version are correct.
  • iOS and Android:
    • The builds complete with no Metro running, and the installed TestFlight and Play internal builds launch with the embedded JS.
    • No expo start process is left behind.
  • Patch change: after a change to shared/patches, the next build wipes node_modules and patch-package applies cleanly.
  • Windows: build_prerelease.cmd builds without -a.

@chrisnojima
chrisnojima added this pull request to stack #29759 October 12, 2026 19:16
@chrisnojima chrisnojima changed the title nojima/HOTPOT packaging speed perf(packaging): drop go build -a, keep JS deps between builds, no Metro in release mobile builds (untested on build machine) Oct 12, 2026
@chrisnojima
chrisnojima requested a balanced review from Copilot October 12, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The multi-platform release pipeline changes still require the stated macOS, iOS, Android, and Windows build-machine validation.

0 open findings

What changed in this PR

Optimizes multi-platform release packaging by reusing Go/JS caches and removing unnecessary Metro processes.

Changes:

  • Reuses node_modules and conditionally prunes Yarn caches.
  • Drops forced Go rebuilds while guarding macOS cache validity.
  • Relies on native release bundling for Android and iOS.
File Description
.github/​workflows/​shellcheck.yml Removes deleted script from ShellCheck.
packaging/​README.md Documents caching and mobile bundling.
packaging/​android/​build_and_publish.sh Reuses dependencies and removes Metro startup.
packaging/​build_darwin.sh Conditionally prunes the Yarn cache.
packaging/​desktop/​package_darwin.sh Reuses unchanged JS dependencies.
packaging/​ios/​build_and_publish.sh Reuses dependencies and removes Metro startup.
packaging/​lib.sh Adds Yarn and Go cache helpers.
packaging/​manage_react_native_packager.sh Deletes obsolete Metro management.
packaging/​prerelease/​build_app.sh Guards the macOS Go cache.
packaging/​prerelease/​build_kbfs.sh Removes forced Go rebuilds.
packaging/​prerelease/​build_keybase.sh Removes forced Go rebuilds.
packaging/​prerelease/​build_updater.sh Removes forced Go rebuilds.
packaging/​windows/​build_prerelease.cmd Removes forced Windows Go rebuilds.
shared/​package.json Removes the legacy Metro command.
shared/​react-native/​packageAndBuild.sh Deletes the obsolete bundler launcher.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packaging/README.md
@chrisnojima
chrisnojima marked this pull request as ready for review October 14, 2026 13:51
@chrisnojima
chrisnojima force-pushed the nojima/HOTPOT-packaging-speed branch from 968dacd to ce377ff Compare October 14, 2026 14:01
@chrisnojima
chrisnojima force-pushed the nojima/HOTPOT-packaging-speed branch from c24b89d to 24ecdff Compare October 14, 2026 17:42
…no Metro in release mobile builds

- prerelease/build_*.sh and windows/build_prerelease.cmd no longer pass -a;
  the Go build cache is safe to reuse.
- lib.sh: kb_prune_yarn_cache cleans the yarn cache only when free disk is
  under KB_MIN_FREE_GB (default 30); kb_yarn_modules keeps node_modules unless
  yarn.lock, package.json or a patch changed.
- iOS and Android release builds bundle their own JS (Release config /
  non-debuggable variant), so the Metro packager and
  manage_react_native_packager.sh are gone.
@chrisnojima
chrisnojima force-pushed the nojima/HOTPOT-packaging-speed branch from 24ecdff to 2fc5bbd Compare October 15, 2026 15:57
@chrisnojima
chrisnojima merged commit c7d737c into master Oct 15, 2026
1 check passed
@chrisnojima
chrisnojima deleted the nojima/HOTPOT-packaging-speed branch October 15, 2026 18:36
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