qemu: drive a flow override step through the UI test hook #29

Merged
noah merged 1 commits from rb/ln-hook-override into rebuild 2026-10-27 18:13:15 -06:00
Owner

Rig driver half of flare-edge #2054: a flow's compiled override TOPIC DOC|null line now runs on the QEMU rig. The UI half (warden-ui answering override on test/req/ui) is flare-edge #2055.

What changes

  • qemu/tests/qmp.py: override verb. The args JSON {"topic","doc"} goes to the control bridge in @hookdoc / @hookdoc+ pieces of 2000 bytes (the ctl port is a cooked tty that cuts a line at 4095 bytes; a document may be 16 KiB), then @hook override. ok:true is ok, ok:false is a fail with the hook's err, anything else (a bridge: line, no JSON, no ok member) is fatal. A malformed line (wildcard or empty topic level, a document that is not JSON, an object, an array or null) is fatal and sends nothing.
  • qemu/rootfs/etc/warden-lib.sh: the bridge answers @hookdoc, @hookdoc+ and @hook WORDS itself: it runs the payload's wthctl (flare-edge tools/wthctl.c) on the rig bus as user testhook with the joined args (used once, then removed), and answers its reply; client exit 2 (no bus, no reply) and a missing client answer one bridge: line. Only words of [A-Za-z0-9_ -] reach the client. The rig bus now writes a testhook credential.
  • qemu/tests/ctl-bridge-test.sh: 7 new checks with a fake client; the test now also runs under busybox sh (CI step updated). qemu/tests/test_qmp_drive.py: 6 new tests (OverrideVerb). README updated.

Still needed in flare-edge for a flow to use it end to end: wthctl built for armhf and placed in the rig payload, a test-flavor warden-ui in the rig payload, wthctl's 8 KiB request buffer raised to fit a 16 KiB document, and the submodule pin bump.

Local gate (bfe-mpc-0056 via lane-remote)

lane-remote LN <worktree> -- bash qemu/tests/ctl-bridge-test.sh            -> ctl-bridge tests: OK (14 checks)
WARDEN_TEST_SH="busybox sh" bash qemu/tests/ctl-bridge-test.sh             -> ctl-bridge tests: OK (14 checks)
bash qemu/tests/init-rig-bus-test.sh (sh and busybox sh)                     -> PASS: rig bus (twice)
python3 qemu/tests/test_qmp_drive.py                                         -> Ran 70 tests, OK
shellcheck -x qemu/tests/ctl-bridge-test.sh qemu/rootfs/etc/warden-lib.sh    -> clean (workstation)

Mutants (each caught): args file reused, word filter loosened, client exit 2 read as an answer, @hookdoc+ truncating, piece size over the tty limit, ok:false passing, a bridge line judged fail instead of fatal.

Refs flare-edge #2054.

Generated with Claude Code
https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG

Rig driver half of flare-edge #2054: a flow's compiled `override TOPIC DOC|null` line now runs on the QEMU rig. The UI half (warden-ui answering `override` on test/req/ui) is flare-edge #2055. ## What changes - `qemu/tests/qmp.py`: `override` verb. The args JSON `{"topic","doc"}` goes to the control bridge in `@hookdoc` / `@hookdoc+` pieces of 2000 bytes (the ctl port is a cooked tty that cuts a line at 4095 bytes; a document may be 16 KiB), then `@hook override`. ok:true is ok, ok:false is a fail with the hook's err, anything else (a `bridge:` line, no JSON, no `ok` member) is fatal. A malformed line (wildcard or empty topic level, a document that is not JSON, an object, an array or null) is fatal and sends nothing. - `qemu/rootfs/etc/warden-lib.sh`: the bridge answers `@hookdoc`, `@hookdoc+` and `@hook WORDS` itself: it runs the payload's `wthctl` (flare-edge tools/wthctl.c) on the rig bus as user `testhook` with the joined args (used once, then removed), and answers its reply; client exit 2 (no bus, no reply) and a missing client answer one `bridge:` line. Only words of `[A-Za-z0-9_ -]` reach the client. The rig bus now writes a `testhook` credential. - `qemu/tests/ctl-bridge-test.sh`: 7 new checks with a fake client; the test now also runs under busybox `sh` (CI step updated). `qemu/tests/test_qmp_drive.py`: 6 new tests (OverrideVerb). README updated. Still needed in flare-edge for a flow to use it end to end: wthctl built for armhf and placed in the rig payload, a test-flavor warden-ui in the rig payload, wthctl's 8 KiB request buffer raised to fit a 16 KiB document, and the submodule pin bump. ## Local gate (bfe-mpc-0056 via lane-remote) ``` lane-remote LN <worktree> -- bash qemu/tests/ctl-bridge-test.sh -> ctl-bridge tests: OK (14 checks) WARDEN_TEST_SH="busybox sh" bash qemu/tests/ctl-bridge-test.sh -> ctl-bridge tests: OK (14 checks) bash qemu/tests/init-rig-bus-test.sh (sh and busybox sh) -> PASS: rig bus (twice) python3 qemu/tests/test_qmp_drive.py -> Ran 70 tests, OK shellcheck -x qemu/tests/ctl-bridge-test.sh qemu/rootfs/etc/warden-lib.sh -> clean (workstation) ``` Mutants (each caught): args file reused, word filter loosened, client exit 2 read as an answer, `@hookdoc+` truncating, piece size over the tty limit, ok:false passing, a bridge line judged fail instead of fatal. Refs flare-edge #2054. Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah added 1 commit 2026-10-27 13:46:22 -06:00
qemu: drive a flow's override step through the UI test hook
ci / kernel-build (push) Skipped
ci / patches-apply (push) Successful in 59s
ci / test (pull_request) Successful in 29s
ci / bench (pull_request) Successful in 5s
ci / bench (push) Successful in 13s
ci / qemu-tools (push) Successful in 1m56s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / patches-apply (pull_request) Successful in 1m5s
ci / kernel-symbols (push) Successful in 4m0s
ci / quality (pull_request) Successful in 1m51s
ci / test (push) Successful in 15s
ci / mcdc (push) Successful in 30s
ci / prune-artifacts (push) Skipped
ci / mcdc (pull_request) Successful in 30s
ci / qemu-tools (pull_request) Successful in 1m18s
ci / badges (pull_request) Skipped
ci / quality (push) Successful in 2m5s
ci / badges (push) Skipped
ci / kernel-symbols (pull_request) Successful in 5m14s
dd15eac1a8
flowc compiles a flow's `override` action to `override TOPIC DOC|null`,
and a test-flavor warden-ui answers the override verb on test/req/ui, but
the rig driver had no such verb and the control bridge only reached the
UI's old FIFO, so a flow using it failed with an unknown command
(flare-edge #2054).

qmp.py `override` sends the request through the control bridge: the args
JSON in `@hookdoc` / `@hookdoc+` pieces of 2000 bytes (the ctl port is a
cooked tty that cuts a line at 4095 bytes; a document may be 16 KiB),
then `@hook override`. The bridge runs the payload's wthctl as bus user
testhook and answers its reply. ok:true passes, ok:false fails with the
hook's err, and a request that never reached the hook (no client, no
bus, no reply, a reply that is not a hook envelope) is fatal. The rig bus
writes a testhook credential. Only plain words reach the client.

ctl-bridge-test.sh covers the pieces, single use of the args, the word
filter, ok:false, no reply and no client, now also under busybox sh in
CI; test_qmp_drive.py covers the verb's ok, fail and fatal rows.

Refs flare-edge #2054.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah merged commit bd4eb5c201 into rebuild 2026-10-27 18:13:15 -06: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: blueflare/bfe-core1106-sdk#29