android: drive the runs list and run detail from server pushes
Replace the Android app's one-second run poll with the server's workspace-scoped run_event pushes. The runs list, each pipeline row's last-run line, the run header and the run detail (status, timeline, stages, artifacts) now advance from the socket instead of polling or a manual refresh. - Wire: Message.kt mirrors internal/protocol/runevents.go (subscribe, unsubscribe, run_event; RunEventFrame/RunStepDelta). The frames are unsolicited and already arrive on the client's events stream; PipelinesRepository.subscribeRuns/unsubscribeRuns add the typed command, sent via a new PipelinesClient.sendOnly that does not hold the send lock waiting for the running server's unreliable subscribe ack. - One pure fold: ui/RunEvents.kt folds a frame into the list (in place, order preserved) and the open detail with one shared status ladder and one shared run-field merge. It is monotonic (a stale or duplicate delta is dropped whole), reports needsResync for a run the list does not hold instead of inventing a row, and only requests a full get_run for a settled step or terminal run. - Wiring: AppViewModel subscribes once per (re)connect and workspace; every (re)subscribe re-reads the list and open detail once, because the deployed server's subscribe snapshot is partial, then folds the pushes on top. Re-reads are push-driven, coalesced and keyed so no push is dropped and no timer remains. LiveBadge (RunStream.kt RunStreamState) shows honestly live/reconnecting/not live, confirmed by the ack, a push or a successful read and dropped when a read fails. - ui/RunEventsTest.kt pins the delta sequence as pure cases: created run not in the list, step started, step finished, run finished, unknown run, duplicate/out-of-order deltas, and a reconnect resync. - android/README.md records the change, the wire mapping and the observed limitation of the running server (partial snapshot, no ack within 30s), which the client tolerates without inventing a stream. Checked where the change belongs: android/README.md gained this entry; docs/cli.md described the Android app as still polling, which this makes stale, so that sentence now says the app consumes the pushes while the TUI still polls. The packaged TUI pipeline templates (internal/tui) do not touch run-state refresh and need no change, and the packaged authoring skill references (internal/author/skill/references) document the authoring workflow, not the Android client's run updates, so none of them needs updating. Reviewed and approved by the run's review stage (build, unit tests, Kotlin compile and lint in android/README.md); no merge/rebase/cherry-pick was in progress and no conflict was present.
This commit is contained in:
+2
-1
@@ -396,7 +396,8 @@ count and timestamps, and, when a single step changed, that step's sequence, sta
|
||||
status, outcome, target and diagnostic. It is a delta, never the whole run, and
|
||||
rapid changes are coalesced to at most a few frames per second per run.
|
||||
`unsubscribe` or disconnecting stops the frames. This lets a client drop the
|
||||
once-per-second poll; the TUI and Android app still poll in this release.
|
||||
once-per-second poll: the Android app consumes these pushes instead, while the
|
||||
TUI still polls in this release.
|
||||
|
||||
In the run inspector, `n`/`p` select the next/previous recorded execution visit,
|
||||
including repeated visits in loops, from any pane. Selection stops at the last
|
||||
|
||||
Reference in New Issue
Block a user