[CI, Tools] (android-plugin): log each shard case's settings, record and transport lines

- The monolith lane fails when the library log shows a split transport
This commit is contained in:
2026-11-15 18:38:03 -04:00
parent d41563fb8d
commit 8d3d3d13a7
4 changed files with 764 additions and 32 deletions
+71 -3
View File
@@ -79,8 +79,8 @@ adb shell run-as top.mobilegl.plugin.espryt.trace cat files/trace-replay/output/
The APK workflow replays its cases through `trace-replay-shard.sh`: one emulator boot, one APK
install, then an ordered list of cases for one lane, transport and backend. Each case still runs
through `trace-replay-ci.sh`, with the same arguments, environment and transport proof as a
one-case job.
through `trace-replay-ci.sh`, with the arguments and environment of a one-case job and the
transport proof of its lane (see [Transport proofs](#transport-proofs)).
```sh
sh android-plugin/trace-replay-shard.sh \
@@ -136,5 +136,73 @@ A failing case does not stop the shard. Every case ends with `<case>-<backend>/c
a verdict is missing. `--finalize` writes the summary inputs and a `not-run` verdict for every
case without one, without a device; the workflow runs it after the replay step whatever happened.
### Transport proofs
Every lane passes `trace-replay-ci.sh` the flag that requires the proof of its transport. The
check runs after a replay that passed, reads the library's own log (`mobilegl.log`, the client
role's log followed by the server role's), writes `transport-proof.json` and prints one
`Android retrace: ...` line. A case whose proof fails is a failed case.
| transport | flag | what the library log must show |
| --- | --- | --- |
| monolith | `--require-monolith` | nothing a split transport writes: neither `Config: MOBILEGL_TRANSPORT=... - the MGPipe record stream` sentence, no `Config: IPC` line, no `spawn ARMED` line, no library line in a server role log |
| inproc | `--require-inproc` | the inproc transport sentence, `strict=1`, `role-split-state=1` and `run-ahead=1` on every `Config: IPC` line, no `Fatal{` record |
| spawn | `--require-spawn` | the spawn transport sentence, `spawn ARMED - the server role runs in pid N`, the same settings on the client's `Config: IPC` line, no `Fatal{` record |
The monolith proof is one of absence. The library logs a transport sentence only when it
resolves inproc or spawn, and a library built without the split transports has no such code, so
the check fails only on what a split run writes. Its line says how much the log proves:
- `Android retrace: monolith confirmed: ...` when the log shows the configuration load
(`Config loaded`), during which the transport sentence and the `Config: IPC` line are
written, and nothing of the table row above.
- `Android retrace: monolith not confirmed (...)` when the log is missing or lacks the load. A
lost log says nothing about the transport, so the case still passes; its
`transport-proof.json` has `"confirmed": false` and the reason.
The check reads a split APK run with `MOBILEGL_TRANSPORT=monolith` and an APK built without
the split transports alike. That build writes one log, `mobilegl.log` itself, which the script
pulls whenever no role log arrived.
### What the job log holds
The workflow deletes the result artifacts of a green run, so the job log repeats what the
result files say. The shard starts with one `trace-replay-shard: every run: {...}` line, and
each case's group holds:
```text
trace-replay-shard: run <case>: {"arguments": [...], "case": "<case>", "environment": {...}, "timeout": N}
(the output of trace-replay-ci.sh, ending with its "Android retrace: ..." proof line)
trace-replay-shard: library-log <case>: mobilegl.log: <a line of the library log>
trace-replay-shard: phases <case>: {"fixture-pushed": 2.5, "apk-installed": 0.0, ...}
trace-replay-shard: record <case>: {"attempts": 1, "case": "<case>", "exit_codes": [0], ...}
trace-replay-shard: emulator boots after <case>: 1
trace-replay-shard: <case>: passed
```
- `every run` is the replay command, the environment the runner adds to every case, and
under `inherited` each further variable `trace-replay-ci.sh` reads (`ADB`, `PYTHON`,
`MOBILEGL_RETRACE_USE_PBUFFER`, `MOBILEGL_TRACE_ENV`) with the value it has in the runner's
own environment, which a replay inherits, or `null` when it is not set there.
- `run` is the line `--dry-run` prints for the case: the argument list `trace-replay-ci.sh` is
started with, the case's replay environment and its time budget. The same object starts the
replay, so the two cannot differ.
- `library-log` quotes the lines of the pulled library log that say which transport ran: the
backend and `Config loaded` lines, every line naming `MOBILEGL_TRANSPORT`, the `Config: IPC`
and `spawn ARMED` lines, and `Fatal{` records. At most 12 lines are quoted per case, each cut
to 1000 characters with characters outside ASCII escaped, and a further line says how many
were left out. The log is that of the attempt that counts. A failed case is quoted too, and
a case whose replay script ended before its own pulls is quoted from the logs the runner
pulls: the two role logs, or the one log of a build without the split transports.
- `phases` is the seconds between one mark of `phase-timings.txt` and the next, named by the
later mark, for the attempt that counts.
- `record` is `case-status.json`: status, reason, attempts, exit codes, seconds and notes.
- The verdict line is the last line of the group.
The shard ends with `trace-replay-shard: shard-status: {...}`, the content of
`shard-status.json`, and then the tally line. `--finalize` prints the same line for the file as
it leaves it.
`python3 android-plugin/test_trace_replay_shard.py` drives the runner with a fake adb, replay
script and AVD script.
script and AVD script, and runs `trace-replay-ci.sh` itself against an adb that serves a host
directory.