From 294cedfbff7eff9edc96b032aec8b96256221de9 Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 18 Sep 2026 17:51:11 -0400 Subject: [PATCH 1/2] android-ci: echo the artifact digests and the deflated native-lib sizes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 412 (PR #113) proved the cuprated APK builds and carries the daemon, but the log only ever printed `sha256sum -c ...: OK` — neither digest — and `unzip -l`, which shows the uncompressed size of every .so and not the deflated one the download pays for. Both are what a reader of the run needs to identify the artifact, and neither can be recovered from the tree afterwards. Also fills the two remaining cells of CUPRATE_DAEMON.md's CI-cost table from that run (APK 34,445,514 B / AAR 15,728,039 B, 11m12s job, 5.6 G target volume), and records that the first feature-on build is the 44-minute one while later builds settle at +2 minutes over the feature-off baseline. --- .forgejo/workflows/android-ci.yml | 11 +++++++ android/CUPRATE_DAEMON.md | 48 +++++++++++++++++++------------ 2 files changed, 40 insertions(+), 19 deletions(-) diff --git a/.forgejo/workflows/android-ci.yml b/.forgejo/workflows/android-ci.yml index bed8806..58df49d 100644 --- a/.forgejo/workflows/android-ci.yml +++ b/.forgejo/workflows/android-ci.yml @@ -174,6 +174,12 @@ jobs: echo "=== unzip lib ===" unzip -l "$apk" | grep -E 'lib/.+\.so' || true unzip -l "$apk" | grep "lib/$abi/libonionwire_sdk.so" + # `unzip -l` shows the uncompressed size only; the *deflated* entry is + # what the download actually costs, and it is not visible anywhere else + # (v0.7.0's SDK lib was 33,481,336 B raw / 12,210,154 B deflated, which + # is the ratio a reader wants when this one grows). + echo "=== native lib entries (length / method / deflated) ===" + unzip -v "$apk" | grep -E 'lib/.+\.so$' echo "=== in-process chain daemon (cuprate-daemon) is IN this APK ===" # The build log's "features=cuprate-daemon" line says the feature was # *requested*; this says it is *in the artifact*. `target_max_memory` is @@ -197,6 +203,11 @@ jobs: echo "=== classes.dex + Compose entrypoints ===" unzip -l "$apk" | grep -E 'classes[0-9]*\.dex' | head -n3 echo "=== sha256 ===" + # `sha256sum -c` proves each artifact matches the digest the build + # recorded, but prints neither number. The digest *is* the artifact's + # identity, and an APK is not byte-reproducible across machines, so it + # cannot be derived from the tree afterwards — echo both. + cat "dist/onionwire-$version-android-$abi.apk.sha256" "dist/onionwire-sdk-$version.aar.sha256" ( cd dist && sha256sum -c "onionwire-$version-android-$abi.apk.sha256" "onionwire-sdk-$version.aar.sha256" ) echo "=== apksigner (expect debug cert: this is a verification build) ===" apksigner verify --print-certs "$apk" | sed -n '1,6p' diff --git a/android/CUPRATE_DAEMON.md b/android/CUPRATE_DAEMON.md index bd66299..d45b411 100644 --- a/android/CUPRATE_DAEMON.md +++ b/android/CUPRATE_DAEMON.md @@ -149,31 +149,41 @@ above is the other half of the proof — request and artifact, separately checka ## What it costs in CI -The Android job runs on the `docker-amd64` runner with `CARGO_BUILD_JOBS=1` and a -warm named volume at `/cargo-target` (it is **not** the Raspberry Pi runner), so -the numbers below are one runner, one volume, built twice: once with the feature -off (the current `main` build, run 402) and once with it on (run 406, this branch). +The Android job runs on the `docker-amd64` runner (it is **not** the Raspberry Pi +runner) with `CARGO_BUILD_JOBS=1` and a warm named volume at `/cargo-target`, so +the numbers below are one runner and one volume: `main` with the feature off, and +the feature on. There are two feature-on regimes, and the second is the one a PR +author feels — the first build after the feature lands compiles the whole cuprated +graph, every later build is incremental against the same volume. -| | feature off — `main` 773dacb, run 402 | feature on — this branch, run 406 | +| | feature off — `main` 773dacb, run 402 | feature on — PR #113 head 3860c3d (merged as 8626da2), run 412 | |---|---|---| -| Gradle | `BUILD SUCCESSFUL in 6m 10s` | `BUILD SUCCESSFUL in 44m 7s` | -| job wall clock | 484 s for the build step | 47m 45s job (20:10:02 → 20:57:46) | -| `/cargo-target` **before** the build | 3.1 G | 3.3 G | +| Gradle | `BUILD SUCCESSFUL in 6m 10s` | `BUILD SUCCESSFUL in 7m 14s` | +| job | 8m 21s | 11m 12s | +| build step | 484 s | 653 s | +| `/cargo-target` | 3.1 G before the build | 5.6 G after (2.7 G of it `aarch64-linux-android/release`) | | `libonionwire_sdk.so` in the APK | 33,533,264 B | 55,438,112 B | | `librandomx_rs-.so` | absent | 1,122,296 B | -| APK / AAR | 28,038,401 B / 10,377,416 B | see PR #113 | +| APK | 28,038,401 B | 34,445,514 B | +| AAR | 10,377,416 B | 15,728,039 B | -The feature multiplies the Gradle build by roughly **7×** (~6 min → ~44 min): the -cuprated graph is ~152 crates plus a C++ RandomX cross-build, and the runner has a -single cargo job. What it does *not* blow is anything else: the job's -`timeout-minutes` is 120, so 44 minutes fits with room to spare, and the extra -target-directory volume is a gigabyte-scale number, not a partition. **No -mitigation was needed** — the feature stays on the release path, and the job was -not made slower or conditional to accommodate it. +The **first** feature-on build is the expensive one: run 406, against a volume that +did not yet hold the cuprated graph, took `BUILD SUCCESSFUL in 44m 7s` and a +47m 44s job — the ~152-crate graph plus the C++ RandomX cross-build, with a single +cargo job on the runner. After that it settles to roughly **+2 minutes over the +feature-off build** (7m 14s vs 6m 10s), because only this repo's own crates +recompile. -`android-ci.yml` prints `du -sh /cargo-target` after the build and the workflow -echoes `build_wall_clock_seconds`, so the next person changing this graph reads -the cost from the run log instead of re-deriving it. +Nothing needed mitigating: the job's `timeout-minutes` is 120, so even the 44-minute +first build fits with room to spare, and the volume grows to 5.6 G on a runner +filesystem with 37 G free (the `df -h` in the run log). The feature is **not** gated +on a build variant, a label or a manual dispatch — the release path builds exactly +what CI verifies. + +`android-ci.yml` prints `du -sh /cargo-target`, the length/method/deflated size of +every native lib, and both artifact digests, and the workflow echoes +`build_wall_clock_seconds`: the next person changing this graph reads the cost and +the artifact's identity out of the run log rather than re-deriving either. ## Not verified From c5e2cae6943f6b8fc6bfe3a766f853d91c8e46b3 Mon Sep 17 00:00:00 2001 From: agent Date: Fri, 18 Sep 2026 18:15:52 -0400 Subject: [PATCH 2/2] android-ci: 2 GB of Gradle heap for the cuprated release packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run 414 (PR #114) died in `:app:packageRelease` after a clean build: Execution failed for task ':app:packageRelease'. > A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable with no `Caused by` line and nothing else in the log — and it is not reproducible on the same content: runs 412 and 413 (this tree, 1 GB heap) packaged fine. The one budget in this build that got tight when cuprate came in is the single-use Gradle daemon's heap, which now compresses a 55 MB SDK lib (plus RandomX's 1.1 MB) in-process; the runner has 15 GB and the job's peak RSS is ~3 GB, so 2 GB of heap costs nothing and removes the most likely mechanism. android-release.yml gets the same number: it packages the same APK. --- .forgejo/workflows/android-ci.yml | 9 ++++++++- .forgejo/workflows/android-release.yml | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/android-ci.yml b/.forgejo/workflows/android-ci.yml index 58df49d..1262a87 100644 --- a/.forgejo/workflows/android-ci.yml +++ b/.forgejo/workflows/android-ci.yml @@ -230,6 +230,13 @@ jobs: docker volume create "$GRADLE_VOLUME" >/dev/null docker rm -f "$BUILD_CONTAINER" >/dev/null 2>&1 || true docker pull "$ANDROID_IMAGE" + # 2 GB of Gradle heap, not 1: the only budget in this build that is close + # is the single-use daemon's heap, which now has to package a 55 MB SDK + # lib (plus RandomX's 1.1 MB) through AGP's in-daemon packaging. Run 414 + # died in `:app:packageRelease` with the cause hidden inside + # `PackageAndroidArtifact$IncrementalSplitterRunnable` — no "Caused by" + # line, nothing in the log — so give it room instead of guessing again. + # The runner has 15 GB and the job's peak RSS is ~3 GB. docker create --name "$BUILD_CONTAINER" -i \ -e CARGO_TERM_COLOR=never \ -e CARGO_BUILD_JOBS="$CARGO_BUILD_JOBS" \ @@ -243,7 +250,7 @@ jobs: -e ONIONWIRE_REQUIRE_RELEASE_KEY=false \ -e RUST_TOOLCHAIN="$RUST_TOOLCHAIN" \ -e ANDROID_CMDLINE_TOOLS_URL="$ANDROID_CMDLINE_TOOLS_URL" \ - -e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=384m -Dfile.encoding=UTF-8" \ + -e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8" \ -v "$SDK_VOLUME":/opt/android-sdk \ -v "$CARGO_VOLUME":/cargo \ -v "$TARGET_VOLUME":/cargo-target \ diff --git a/.forgejo/workflows/android-release.yml b/.forgejo/workflows/android-release.yml index a1d2874..f725ddd 100644 --- a/.forgejo/workflows/android-release.yml +++ b/.forgejo/workflows/android-release.yml @@ -299,6 +299,13 @@ jobs: docker volume create "$GRADLE_VOLUME" >/dev/null docker rm -f "$BUILD_CONTAINER" >/dev/null 2>&1 || true docker pull "$ANDROID_IMAGE" + # 2 GB of Gradle heap, not 1: the only budget in this build that is close + # is the single-use daemon's heap, which now has to package a 55 MB SDK + # lib (plus RandomX's 1.1 MB) through AGP's in-daemon packaging. Run 414 + # died in `:app:packageRelease` with the cause hidden inside + # `PackageAndroidArtifact$IncrementalSplitterRunnable` — no "Caused by" + # line, nothing in the log — so give it room instead of guessing again. + # The runner has 15 GB and the job's peak RSS is ~3 GB. docker create --name "$BUILD_CONTAINER" -i \ -e CARGO_TERM_COLOR=never \ -e CARGO_BUILD_JOBS="$CARGO_BUILD_JOBS" \ @@ -314,7 +321,7 @@ jobs: -e ONIONWIRE_VERSION="$VERSION" \ -e RUST_TOOLCHAIN="$RUST_TOOLCHAIN" \ -e ANDROID_CMDLINE_TOOLS_URL="$ANDROID_CMDLINE_TOOLS_URL" \ - -e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx1024m -XX:MaxMetaspaceSize=384m -Dfile.encoding=UTF-8" \ + -e GRADLE_OPTS="-Dorg.gradle.daemon=false -Dorg.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8" \ -v "$SDK_VOLUME":/opt/android-sdk \ -v "$CARGO_VOLUME":/cargo \ -v "$TARGET_VOLUME":/cargo-target \