Host type checking
SA
17d ago+773+773+012345678901234567890123456789-54-54-01234567890123456789
Summary by cubic
Adds a host-type-checking feature to monty-proto so a worker can serve type-checked sessions without linking ty. Instead of checking locally, the worker parks each feed and sends a host-internal WorkerEvent.host_type_check carrying everything the check needs; the host runs ty elsewhere and answers with ClientRequest.host_type_check_result, after which the worker either runs the snippet or ends the turn with the typed diagnostics.
- New Features
monty-wasm-runtimeexposeshost-type-checkingfor size-sensitive hosts that build with--no-default-features.monty-type-checkingmoves ty and its dependencies behind an optional, default-oncheckerfeature soscan_importsis available alone.
- Both messages are host-internal and never reach a client, so only a host able to answer them may build this way;
type-checkingwins when both features are enabled. - Every
host_type_checkfield is untrusted worker output, so the host must bound the check itself (nesting depth, memory, time); the worker's nesting check and allocator ceiling don't cover it. - The wasm component retires on a fatal event, so a worker parked on a
HostTypeCheckthat a typed export can't answer isn't reused. - The new test suite (
cargo test -p monty-proto --features host-type-checking --test host_type_checking) plays the answering host, covering stubs, module stubs, dumps, aborts, and protocol violations, and is wired into CI coverage andtestcov.