mirror of
https://github.com/marcoallegretti/WEFT_OS.git
synced 2026-11-22 08:13:59 +00:00
weft-appd marked a session Running and broadcast APP_READY as soon as the runtime printed READY, then started weft-app-shell with its output discarded and never watched it. A session with no UI, a UI host that failed to start, or one that crashed was still reported running. Early failure paths skipped parts of the cleanup: the image mount was not unmounted, the compositor association was not released, and the abort sender leaked on spawn failure. Readiness was any stdout line equal to READY, which a Wasm guest (inherited stdout) or a page (window.alert writes to the app shell's stdout) could print. Now a session becomes Running only after the runtime and then the app shell report readiness, each within 30 s; WEFT_APP_SHELL_BIN is required and checked before anything starts. After that, the runtime exiting, the app shell exiting or a terminate request ends the session. Every exit path goes through one teardown that kills both children, releases the compositor association, unmounts the image, stops the file portal and broadcasts Stopped. Readiness uses a per-session random token passed to both children in WEFT_READY_TOKEN. weft-runtime and weft-app-shell print READY <token>, and appd accepts only a line ending with it; guests receive only the variables the runtime names and pages cannot read the host environment. Child output is read in bounded, lossily decoded lines, so invalid UTF-8 or long lines no longer stop the readers. Compositor notifications use try_send so a disconnected compositor cannot stall teardown, and all children are killed if the supervisor is dropped. The IPC relay is not yet owned by the session, and children are killed without a graceful period. Validation: - cargo test -p weft-appd (43 passed); new tests cover: not ready until the app shell is ready, runtime exit before that, no app shell configured (runtime never starts), app shell exit ending a running session with the runtime process gone, and READY lines without the token; they fail against the previous supervisor - end to end with weft-compositor (nested), weft-appd, weft-runtime (wasmtime-runtime) and weft-app-shell: the Counter demo reaches APP_READY and is on screen; a page that prints a READY line through alert and never loads is stopped after 30 s without APP_READY; terminate leaves no child processes - clippy -D warnings and fmt --check for weft-appd and weft-runtime |
||
|---|---|---|
| .. | ||
| weft-app-shell | ||
| weft-appd | ||
| weft-build-meta | ||
| weft-compositor | ||
| weft-file-portal | ||
| weft-ipc-types | ||
| weft-mount-helper | ||
| weft-pack | ||
| weft-runtime | ||
| weft-servo-shell | ||