mirror of
https://github.com/vercel/workflow.git
synced 2026-09-14 19:59:43 +08:00
22386916c5
quickjs-wasi's JSValueHandle.toString() routes through JS_ToCString, which is NUL-terminated: guest strings containing U+0000 came back silently truncated (e2e nullByteWorkflow), and host-string key enumeration (getOwnPropertyKeys / propertyIsEnumerable) dropped NUL-bearing object keys from serialization entirely. - guestString(): fast-path toString() validated against the guest string's own .length (no guest code; truncation strictly shortens), falling back to a boot-captured JSON.stringify round-trip whose output escapes control characters. Routed through primitiveOf, chainedString/ownString, and RegExp source extraction. - shapeOf(): string keys now enumerated inside the VM via boot-captured Object.keys (same set/order as the host-side iteration it replaces) and read through guestString; symbol-key detection unchanged. - Verified against quickjs-wasi 3.3.0: newString (host→VM) and getOwnPropertyDescriptor(string) are length-safe and need no counterpart; parity tests cover NUL in values, object keys, and RegExp sources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>