android-ci: fix the cuprate marker gate failing its own green build
Some checks failed
android-ci / android (pull_request) Has been cancelled
ci / test (pull_request) Successful in 5m7s
ci / sdk (pull_request) Successful in 1m4s
ci / fuzz (pull_request) Successful in 4m55s

Run 406 built the APK successfully (BUILD SUCCESSFUL in 44m 7s) and the gate then
reported "the cuprate-daemon feature is NOT in this APK" while the line above it
printed `target_max_memory` **5** times. The bug is the classic one:

    strings -a x.so | grep -q pattern     # under `set -o pipefail`

`grep -q` exits at the first match and closes the pipe; `strings` takes SIGPIPE
(141) and pipefail makes the pipeline status non-zero, so `if ! ...` ran. The count
is captured into a variable now (grep -c reads the whole stream, no SIGPIPE) and the
gate fails on `< 1`, which is what it always meant.
This commit is contained in:
sirius 2026-09-18 17:04:35 -04:00 • committed by agent
commit 9afa22a0bf
No known key found for this signature in database

View file

@ -184,8 +184,13 @@ jobs:
# claims to. A missing marker fails the job: an APK whose on-device node
# can only fail is the regression this gate exists to catch.
unzip -p "$apk" "lib/$abi/libonionwire_sdk.so" > /tmp/libonionwire_sdk.so
strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true
if ! strings -a /tmp/libonionwire_sdk.so | grep -q 'target_max_memory'; then
# `grep -c`, deliberately not `grep -q`: under `set -o pipefail` a `-q`
# match closes the pipe early, `strings` dies on SIGPIPE (141), and the
# pipeline then reports failure even though the marker was there — this
# gate failed its own green build once that way.
marker="$(strings -a /tmp/libonionwire_sdk.so | grep -c 'target_max_memory' || true)"
echo "target_max_memory occurrences: ${marker:-0}"
if [ "${marker:-0}" -lt 1 ]; then
echo "lib/$abi/libonionwire_sdk.so carries no cuprated config string: the cuprate-daemon feature is NOT in this APK" >&2
exit 1
fi