Skip to content

Commit cfd8e44

Browse files
committed
mobile: land handoff, logging, and CI updates
1 parent 058baee commit cfd8e44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+4290
-3845
lines changed

.github/workflows/android-play-release.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ jobs:
1717
SCCACHE_REGION: auto
1818
SCCACHE_S3_USE_SSL: "true"
1919
SCCACHE_S3_KEY_PREFIX: ci/android-release-prep
20+
SCCACHE_LOG: info
2021
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
2122
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
2223

@@ -92,6 +93,7 @@ jobs:
9293
SCCACHE_S3_USE_SSL: "true"
9394
SCCACHE_S3_KEY_PREFIX: ci/android
9495
SCCACHE_LOG: info
96+
SCCACHE_ERROR_LOG: ${{ runner.temp }}/sccache-android.log
9597
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
9698
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
9799

@@ -152,7 +154,6 @@ jobs:
152154

153155
- name: Prime sccache
154156
run: |
155-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-android.log"
156157
rm -f "$SCCACHE_ERROR_LOG"
157158
sccache --stop-server || true
158159
sccache --start-server
@@ -212,6 +213,8 @@ jobs:
212213
JAVA_HOME: ${{ env.JAVA_HOME }}
213214
ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }}
214215
ANDROID_NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/30.0.14904198
216+
CARGO_BUILD_JOBS: "2"
217+
GRADLE_MAX_WORKERS: "2"
215218
RUSTC_WRAPPER: sccache
216219
LITTER_UPLOAD_STORE_FILE: ${{ env.LITTER_UPLOAD_STORE_FILE }}
217220
LITTER_UPLOAD_STORE_PASSWORD: ${{ secrets.LITTER_UPLOAD_STORE_PASSWORD }}
@@ -222,7 +225,6 @@ jobs:
222225
LITTER_VERSION_CODE_OVERRIDE: ${{ env.LITTER_VERSION_CODE_OVERRIDE }}
223226
run: |
224227
set -euo pipefail
225-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-android.log"
226228
trap 'status=$?; echo "==> sccache stats"; sccache --show-stats || true; if [ -f "$SCCACHE_ERROR_LOG" ]; then echo "==> sccache error log"; tail -200 "$SCCACHE_ERROR_LOG" || true; fi; exit $status' EXIT
227229
make play-release
228230

.github/workflows/ios-testflight.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
SCCACHE_S3_USE_SSL: "true"
3131
SCCACHE_S3_KEY_PREFIX: ci/ios
3232
SCCACHE_LOG: info
33+
SCCACHE_ERROR_LOG: ${{ runner.temp }}/sccache-ios.log
3334
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
3435
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
3536

@@ -86,7 +87,6 @@ jobs:
8687

8788
- name: Prime sccache
8889
run: |
89-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-ios.log"
9090
rm -f "$SCCACHE_ERROR_LOG"
9191
sccache --stop-server || true
9292
sccache --start-server
@@ -162,6 +162,7 @@ jobs:
162162
163163
- name: Upload to TestFlight
164164
env:
165+
CARGO_BUILD_JOBS: "2"
165166
RUSTC_WRAPPER: sccache
166167
SCHEME: ${{ env.SCHEME }}
167168
APP_BUNDLE_ID: ${{ env.APP_BUNDLE_ID }}
@@ -176,6 +177,5 @@ jobs:
176177
WAIT_FOR_PROCESSING: ${{ env.WAIT_FOR_PROCESSING }}
177178
run: |
178179
set -euo pipefail
179-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-ios.log"
180180
trap 'status=$?; echo "==> sccache stats"; sccache --show-stats || true; if [ -f "$SCCACHE_ERROR_LOG" ]; then echo "==> sccache error log"; tail -200 "$SCCACHE_ERROR_LOG" || true; fi; exit $status' EXIT
181181
make testflight

.github/workflows/mobile-ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,8 @@ jobs:
249249
fi
250250
251251
tar -xzf "$SHARED_PREP_ROOT/generated-mobile-sources.tgz" -C .
252+
mkdir -p .build-stamps
253+
touch .build-stamps/sync .build-stamps/bindings-swift
252254
253255
- name: Build Rust for iOS simulator
254256
env:

.github/workflows/mobile-release.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ jobs:
8686
SCCACHE_REGION: auto
8787
SCCACHE_S3_USE_SSL: "true"
8888
SCCACHE_S3_KEY_PREFIX: ci/mobile-release-prep
89+
SCCACHE_LOG: info
8990
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
9091
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
9192

@@ -198,6 +199,7 @@ jobs:
198199
SCCACHE_S3_USE_SSL: "true"
199200
SCCACHE_S3_KEY_PREFIX: ci/android
200201
SCCACHE_LOG: info
202+
SCCACHE_ERROR_LOG: ${{ runner.temp }}/sccache-android.log
201203
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
202204
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
203205

@@ -258,7 +260,6 @@ jobs:
258260

259261
- name: Prime sccache
260262
run: |
261-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-android.log"
262263
rm -f "$SCCACHE_ERROR_LOG"
263264
sccache --stop-server || true
264265
sccache --start-server
@@ -318,6 +319,8 @@ jobs:
318319
JAVA_HOME: ${{ env.JAVA_HOME }}
319320
ANDROID_SDK_ROOT: ${{ env.ANDROID_HOME }}
320321
ANDROID_NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/30.0.14904198
322+
CARGO_BUILD_JOBS: "2"
323+
GRADLE_MAX_WORKERS: "2"
321324
RUSTC_WRAPPER: sccache
322325
LITTER_UPLOAD_STORE_FILE: ${{ env.LITTER_UPLOAD_STORE_FILE }}
323326
LITTER_UPLOAD_STORE_PASSWORD: ${{ secrets.LITTER_UPLOAD_STORE_PASSWORD }}
@@ -328,7 +331,6 @@ jobs:
328331
LITTER_VERSION_CODE_OVERRIDE: ${{ env.LITTER_VERSION_CODE_OVERRIDE }}
329332
run: |
330333
set -euo pipefail
331-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-android.log"
332334
trap 'status=$?; echo "==> sccache stats"; sccache --show-stats || true; if [ -f "$SCCACHE_ERROR_LOG" ]; then echo "==> sccache error log"; tail -200 "$SCCACHE_ERROR_LOG" || true; fi; exit $status' EXIT
333335
make play-release
334336
@@ -365,6 +367,7 @@ jobs:
365367
SCCACHE_S3_USE_SSL: "true"
366368
SCCACHE_S3_KEY_PREFIX: ci/ios
367369
SCCACHE_LOG: info
370+
SCCACHE_ERROR_LOG: ${{ runner.temp }}/sccache-ios.log
368371
AWS_ACCESS_KEY_ID: ${{ secrets.SCCACHE_R2_ACCESS_KEY_ID }}
369372
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_R2_SECRET_ACCESS_KEY }}
370373

@@ -421,7 +424,6 @@ jobs:
421424

422425
- name: Prime sccache
423426
run: |
424-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-ios.log"
425427
rm -f "$SCCACHE_ERROR_LOG"
426428
sccache --stop-server || true
427429
sccache --start-server
@@ -441,6 +443,8 @@ jobs:
441443
fi
442444
443445
tar -xzf "$SHARED_PREP_ROOT/generated-mobile-sources.tgz" -C .
446+
mkdir -p .build-stamps
447+
touch .build-stamps/sync .build-stamps/bindings-swift
444448
445449
- name: Decode App Store Connect API key
446450
env:
@@ -502,6 +506,7 @@ jobs:
502506
503507
- name: Upload to TestFlight
504508
env:
509+
CARGO_BUILD_JOBS: "2"
505510
RUSTC_WRAPPER: sccache
506511
SCHEME: ${{ env.SCHEME }}
507512
APP_BUNDLE_ID: ${{ env.APP_BUNDLE_ID }}
@@ -516,6 +521,5 @@ jobs:
516521
WAIT_FOR_PROCESSING: ${{ env.WAIT_FOR_PROCESSING }}
517522
run: |
518523
set -euo pipefail
519-
export SCCACHE_ERROR_LOG="$RUNNER_TEMP/sccache-ios.log"
520524
trap 'status=$?; echo "==> sccache stats"; sccache --show-stats || true; if [ -f "$SCCACHE_ERROR_LOG" ]; then echo "==> sccache error log"; tail -200 "$SCCACHE_ERROR_LOG" || true; fi; exit $status' EXIT
521525
make testflight

AGENTS.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,7 @@ Incremental policy:
170170
- For Xcode project regeneration, use `make xcgen` or `./apps/ios/scripts/regenerate-project.sh`. Do not run `xcodegen generate --spec project.yml --project Litter.xcodeproj` from inside `apps/ios`; that produces a nested `apps/ios/Litter.xcodeproj/Litter.xcodeproj`.
171171
- For Android emulator debugging, build with `make android-emulator-fast`, install with `adb -e install -r apps/android/app/build/outputs/apk/debug/app-debug.apk`, then launch with `adb -e shell am start -n com.sigkitten.litter.android/com.litter.android.MainActivity`.
172172
- Keep both runtimes available when validating shared Rust changes: boot a simulator with `xcrun simctl boot <device>` or through Simulator.app, and verify an emulator is visible with `adb devices -l`.
173-
- Start the collector with `cargo run --manifest-path shared/rust-bridge/Cargo.toml -p mobile-log-collector -- serve --bind 0.0.0.0:8585 --data-dir /tmp/mobile-log-collector-e2e`.
174-
- Query stored logs with either raw HTTP or the CLI: `curl 'http://127.0.0.1:8585/v1/query?limit=20'` or `cargo run --manifest-path shared/rust-bridge/Cargo.toml -p mobile-log-collector -- query --base-url http://127.0.0.1:8585 --device-id <id> --pretty`.
175-
- iOS simulator log config lives under the app container at `.../Library/Application Support/codex/log-spool/config.json`; use `xcrun simctl get_app_container booted com.sigkitten.litter data` to find the current container, then write the config there.
176-
- Android log config lives at `files/codex-home/log-spool/config.json` inside the app sandbox; write it with `adb shell run-as com.sigkitten.litter.android ...`. When the collector runs on the host machine, use `http://10.0.2.2:8585` from the Android emulator and `http://127.0.0.1:8585` from the iOS simulator.
177-
- A minimal debug config should set `enabled: true`, `collector_url`, `min_level: "DEBUG"`, and stable `device_id` / `device_name` fields so batches can be filtered reliably.
178-
- After launch, verify upload by checking that `log-spool/pending` drains, then query the collector for the target `device_id`. If you need direct storage inspection, query `/tmp/mobile-log-collector-e2e/collector.sqlite3` and decompress batch files under `/tmp/mobile-log-collector-e2e/batches/...`.
173+
- Mobile logs now stay local: use Xcode/device console for iOS, Logcat for Android, and normal Rust `tracing` output instead of a collector or spool directory.
179174

180175
## Coding Style & Naming Conventions
181176
- Swift style follows standard Xcode defaults: 4-space indentation, `UpperCamelCase` for types, `lowerCamelCase` for properties/functions.

Makefile

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ ANDROID_RUST_PROFILE ?= android-dev
2828
ANDROID_RELEASE_ABIS ?= arm64-v8a,x86_64
2929
HOST_ARCH := $(shell uname -m)
3030
ANDROID_EMULATOR_ABIS ?= $(if $(filter arm64 aarch64,$(HOST_ARCH)),arm64-v8a,x86_64)
31-
LOG_COLLECTOR_BIND ?= 0.0.0.0:8585
32-
LOG_COLLECTOR_DATA_DIR ?= /tmp/mobile-log-collector-e2e
3331

3432
# Auto-detect Android SDK/NDK/JDK paths (macOS defaults, overridable via env)
3533
ANDROID_SDK_ROOT ?= $(or $(ANDROID_HOME),$(wildcard $(HOME)/Library/Android/sdk))
@@ -52,11 +50,6 @@ endif
5250

5351
PACKAGE_CARGO_ENV := CARGO_INCREMENTAL=0
5452

55-
# Forward log collector env vars to xcodebuild as build settings
56-
XCODE_EXTRA_SETTINGS :=
57-
ifdef LOG_COLLECTOR_URL
58-
XCODE_EXTRA_SETTINGS += LOG_COLLECTOR_URL='$(LOG_COLLECTOR_URL)'
59-
endif
6053
DEV_CARGO_ENV := env -u CARGO_INCREMENTAL
6154

6255
PATCH_FILES := \
@@ -96,7 +89,6 @@ $(shell mkdir -p $(STAMPS))
9689
android android-fast android-emulator-fast android-emulator-run android-device-run android-release android-debug android-install android-emulator-install \
9790
rust-ios rust-ios-package rust-ios-device-fast rust-ios-sim-fast rust-android rust-check rust-test rust-host-dev \
9891
bindings bindings-swift bindings-kotlin \
99-
log-collector \
10092
sync patch unpatch xcgen ios-frameworks \
10193
ios-build ios-build-sim ios-build-sim-fast ios-build-device ios-build-device-fast \
10294
test test-rust test-ios test-android \
@@ -153,7 +145,7 @@ android-emulator-run: android-emulator-fast
153145
adb -s "$$EMU" shell am start -n $(ANDROID_PACKAGE)/$(ANDROID_ACTIVITY)
154146
android-device-run: android-fast
155147
@echo "==> Installing and launching on connected device..."
156-
@DEVICE=$${ANDROID_DEVICE_SERIAL:-$$(adb devices | awk 'NR>1 && $$2=="device" && $$1 !~ /^emulator-/ {print $$1; exit}')} && \
148+
@DEVICE=$${ANDROID_DEVICE_SERIAL:-$$(adb devices | awk -F'\t' 'NR>1 && $$2=="device" && $$1 !~ /^emulator-/ {print $$1; exit}')} && \
157149
if [ -z "$$DEVICE" ]; then echo "ERROR: no connected Android device found (set ANDROID_DEVICE_SERIAL=<serial> to override)"; exit 1; fi && \
158150
echo "==> Using device $$DEVICE..." && \
159151
INSTALL_OUTPUT=$$(adb -s "$$DEVICE" install -r $(ANDROID_APK) 2>&1) && \
@@ -205,11 +197,6 @@ rust-test:
205197

206198
rust-host-dev: rust-check rust-test
207199

208-
log-collector:
209-
@echo "==> Starting local mobile log collector on $(LOG_COLLECTOR_BIND)..."
210-
@echo "==> Web tail UI will be available at /tail on that server."
211-
@cd $(ROOT) && cargo run --manifest-path $(RUST_DIR)/Cargo.toml -p mobile-log-collector -- serve --bind $(LOG_COLLECTOR_BIND) --data-dir $(LOG_COLLECTOR_DATA_DIR)
212-
213200
rust-android: $(STAMP_RUST_ANDROID)
214201
$(STAMP_RUST_ANDROID): $(STAMP_SYNC) $(STAMP_BINDINGS_K) $(ANDROID_RUST_SOURCES) tools/scripts/build-android-rust.sh Makefile
215202
@echo "==> Building Rust for Android..."
@@ -231,7 +218,6 @@ help:
231218
'make android-emulator-run fast emulator build + install + launch on emulator' \
232219
'make android-device-run fast Android dev build + install + launch on connected device (override ANDROID_DEVICE_SERIAL; set ANDROID_REINSTALL_ON_SIGNATURE_MISMATCH=0 to keep installed app)' \
233220
'make android-release Android build using release Rust profile and multi-ABI output' \
234-
'make log-collector start local log collector + web tail UI (override LOG_COLLECTOR_BIND / LOG_COLLECTOR_DATA_DIR)' \
235221
'make rust-check host cargo check for shared crates' \
236222
'make rust-test host cargo test for shared crates'
237223

@@ -304,31 +290,31 @@ ios-build-sim: verify-ios-project
304290
-scheme $(IOS_SCHEME) \
305291
-configuration $(XCODE_CONFIG) \
306292
-destination 'platform=iOS Simulator,name=$(IOS_SIM_DEVICE)' \
307-
$(XCODE_EXTRA_SETTINGS) build
293+
build
308294

309295
ios-build-sim-fast: verify-ios-project
310296
@echo "==> Building iOS ($(XCODE_CONFIG), fast simulator)..."
311297
@xcodebuild -project $(IOS_DIR)/Litter.xcodeproj \
312298
-scheme $(IOS_SCHEME) \
313299
-configuration $(XCODE_CONFIG) \
314300
-destination 'platform=iOS Simulator,name=$(IOS_SIM_DEVICE)' \
315-
$(XCODE_EXTRA_SETTINGS) build
301+
build
316302

317303
ios-build-device: verify-ios-project
318304
@echo "==> Building iOS ($(XCODE_CONFIG), device)..."
319305
@xcodebuild -project $(IOS_DIR)/Litter.xcodeproj \
320306
-scheme $(IOS_SCHEME) \
321307
-configuration $(XCODE_CONFIG) \
322308
-destination 'generic/platform=iOS' \
323-
$(XCODE_EXTRA_SETTINGS) build
309+
build
324310

325311
ios-build-device-fast: verify-ios-project
326312
@echo "==> Building iOS ($(XCODE_CONFIG), fast device)..."
327313
@xcodebuild -project $(IOS_DIR)/Litter.xcodeproj \
328314
-scheme $(IOS_SCHEME) \
329315
-configuration $(XCODE_CONFIG) \
330316
-destination 'generic/platform=iOS' \
331-
$(XCODE_EXTRA_SETTINGS) build
317+
build
332318

333319
ios-build: ios-build-sim
334320

@@ -338,7 +324,7 @@ android-debug:
338324

339325
android-install: android-debug
340326
@echo "==> Installing APK to device..."
341-
@DEVICE=$${ANDROID_DEVICE_SERIAL:-$$(adb devices | awk 'NR>1 && $$2=="device" && $$1 !~ /^emulator-/ {print $$1; exit}')} && \
327+
@DEVICE=$${ANDROID_DEVICE_SERIAL:-$$(adb devices | awk -F'\t' 'NR>1 && $$2=="device" && $$1 !~ /^emulator-/ {print $$1; exit}')} && \
342328
if [ -z "$$DEVICE" ]; then echo "ERROR: no connected Android device found (set ANDROID_DEVICE_SERIAL=<serial> to override)"; exit 1; fi && \
343329
echo "==> Using device $$DEVICE..." && \
344330
INSTALL_OUTPUT=$$(adb -s "$$DEVICE" install -r $(ANDROID_DIR)/app/build/outputs/apk/debug/app-debug.apk 2>&1) && \

apps/android/app/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ android {
2929
buildConfigField("boolean", "ENABLE_ON_DEVICE_BRIDGE", "true")
3030
buildConfigField("String", "RUNTIME_STARTUP_MODE", "\"hybrid\"")
3131
buildConfigField("String", "APP_RUNTIME_TRANSPORT", "\"app_bridge_rpc_transport\"")
32-
buildConfigField("String", "LOG_COLLECTOR_URL", "\"${System.getenv("LOG_COLLECTOR_URL") ?: ""}\"")
3332
manifestPlaceholders["runtimeStartupMode"] = "hybrid"
3433
manifestPlaceholders["enableOnDeviceBridge"] = "true"
3534
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

apps/android/app/src/main/java/com/litter/android/MainActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ class MainActivity : ComponentActivity() {
133133
archived = false, cwd = null, searchTerm = null,
134134
),
135135
)
136-
appModel.refreshSnapshot()
137136
LLog.i("MainActivity", "Local in-process server connected")
138137
} catch (e: Exception) {
139138
LLog.w("MainActivity", "Local server failed", fields = mapOf("error" to e.message))

0 commit comments

Comments
 (0)