Android "Send logs to host": the logcat-teed ring uploads over the client's own mTLS #339

Merged
enricobuehler merged 1 commits from worktree-console-ui-sendlogs-android into main 2026-08-19 16:28:28 +00:00
Owner

WP5b of punktfunk-planning/design/console-ui-sweep-2026-08-19.md — the sweep's last open item, following up #333.

  • pf-client-core: logring's ring half (note/render/wallclock — std only) is Android-enabled; send_to_host stays desktop-gated with the rest of the ureq fetches. wallclock moves in from the session's ring_layer so every ring feeder stamps lines identically.
  • Android native: JNI_OnLoad installs a RingTee — every log record reaches logcat AND the ring, in the desktop ring_layer's line shape (the tracing→log bridge means core transport warnings land too). New nativeRenderLogs(header) hands Kotlin the rendered bundle.
  • Kotlin: SkiaConsole.sendLogs replaces the "isn't available on this device yet" stub — renders the ring and POSTs it to /api/v1/client-logs over mtlsHttpClient (the library/art path), with the desktop console's notice wording. The upload deliberately stays Kotlin-side: OkHttp already owns HTTPS-to-the-pinned-host on Android, and pulling ureq+rustls into the .so for one POST would be a dependency change, not a feature. (This corrects the plan's D4 assumption that send_to_host was portable — the ring is; its ureq agent is not.)
  • console-ui: the host menu's "Send logs" desktop-only gate is removed — paired-and-reachable is the whole condition again; the pinning test flips to assert the row on both platforms.

Gates run: cargo fmt (all edited crates); :app:testDebugUnitTest green — full Android-target Rust stack for all 3 ABIs, check-android-jni-imports clean at the API-28 floor, unit tests pass. Desktop side (logring gate split, ring_layer dedupe, options.rs) rides this PR's CI.

WP5b of `punktfunk-planning/design/console-ui-sweep-2026-08-19.md` — the sweep's last open item, following up #333. - **pf-client-core**: `logring`'s ring half (`note`/`render`/`wallclock` — std only) is Android-enabled; `send_to_host` stays desktop-gated with the rest of the ureq fetches. `wallclock` moves in from the session's `ring_layer` so every ring feeder stamps lines identically. - **Android native**: `JNI_OnLoad` installs a `RingTee` — every `log` record reaches logcat AND the ring, in the desktop `ring_layer`'s line shape (the tracing→log bridge means core transport warnings land too). New `nativeRenderLogs(header)` hands Kotlin the rendered bundle. - **Kotlin**: `SkiaConsole.sendLogs` replaces the "isn't available on this device yet" stub — renders the ring and POSTs it to `/api/v1/client-logs` over `mtlsHttpClient` (the library/art path), with the desktop console's notice wording. The upload deliberately stays Kotlin-side: OkHttp already owns HTTPS-to-the-pinned-host on Android, and pulling ureq+rustls into the `.so` for one POST would be a dependency change, not a feature. (This corrects the plan's D4 assumption that `send_to_host` was portable — the ring is; its ureq agent is not.) - **console-ui**: the host menu's "Send logs" desktop-only gate is removed — paired-and-reachable is the whole condition again; the pinning test flips to assert the row on both platforms. Gates run: `cargo fmt` (all edited crates); `:app:testDebugUnitTest` green — full Android-target Rust stack for all 3 ABIs, `check-android-jni-imports` clean at the API-28 floor, unit tests pass. Desktop side (logring gate split, ring_layer dedupe, options.rs) rides this PR's CI.
enricobuehler added 1 commit 2026-08-19 16:26:32 +00:00
feat(android): "Send logs to host" works from the console — the ring, teed from logcat, uploads over the client's own mTLS
ci / bun-nix (pull_request) Successful in 40s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m36s
ci / web (pull_request) Successful in 1m38s
ci / docs-site (pull_request) Successful in 1m40s
ci / rust-arm64 (pull_request) Successful in 3m54s
ci / rust (pull_request) Successful in 6m42s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m40s
android / android (pull_request) Successful in 9m5s
f584eebb92
WP5b of punktfunk-planning design/console-ui-sweep-2026-08-19.md (the last open item):

- pf-client-core: the logring's RING half (note/render/wallclock — std only) is
  Android-enabled; `send_to_host` stays desktop-gated with the rest of the ureq
  fetches. `wallclock` moves in from the session's ring_layer so every ring feeder
  stamps lines the same way.
- Android native: JNI_OnLoad installs a RingTee — every `log` record goes to logcat
  AND into the ring, in the desktop ring_layer's line shape. `nativeRenderLogs(header)`
  hands Kotlin the rendered bundle.
- Kotlin: `SkiaConsole.sendLogs` replaces the not-available stub — renders the ring
  and POSTs it to /api/v1/client-logs over `mtlsHttpClient` (the library/art path),
  noticing the desktop wording on success/failure. The upload deliberately stays on
  the Kotlin side: OkHttp already owns HTTPS-to-the-pinned-host on this platform,
  and pulling ureq+rustls into the .so for one POST would be a dependency change,
  not a feature.
- console-ui: the host menu's "Send logs" desktop-only gate is gone — paired and
  reachable is the whole condition again; the pinning test flips to assert both
  platforms offer it.
enricobuehler merged commit 6d82716598 into main 2026-08-19 16:28:28 +00:00
enricobuehler deleted branch worktree-console-ui-sendlogs-android 2026-08-19 16:28:29 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unom/punktfunk#339