-
Notifications
You must be signed in to change notification settings - Fork 339
WIP: Support Blueprints v2 in the browser #2586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
fca1cda
to
94388e6
Compare
This WASM crash is blocking here: ![]() Similarly, @mho22 had to disable
I wonder if that's related to the file locking work 🤔 cc @brandonpayton. Perhaps the |
@adamziel, is the SuspendError occurring during the E2E tests? If so, I wouldn't expect the error specifically to file-locking code because that should only be applied for Node.js environments. BUT, we did add Maybe there is a clue here? |
@brandonpayton This solved it for me: # Both imports and exports are required for inter-module communication with wrapped methods, e.g., wasm_recv.
export JSPI_ADD_IMPORTS=""; \
export JSPI_ADD_EXPORTS=""; \
if [ "$EMSCRIPTEN_ENVIRONMENT" = "node" ]; then \
export JSPI_ADD_IMPORTS=",fd_close"; \
export JSPI_ADD_EXPORTS=",fd_close"; \
fi; \
export ASYNCIFY_FLAGS=" -s ASYNCIFY=2 -sSUPPORT_LONGJMP=wasm -fwasm-exceptions -sJSPI_IMPORTS=js_open_process,js_fd_read,js_waitpid,js_process_status,js_create_input_device,wasm_setsockopt,wasm_shutdown,wasm_close,wasm_recv,__syscall_fcntl64,js_flock,js_release_file_locks,js_waitpid$JSPI_ADD_IMPORTS -sJSPI_EXPORTS=php_wasm_init,wasm_sleep,wasm_read,emscripten_sleep,wasm_sapi_handle_request,wasm_sapi_request_shutdown,wasm_poll_socket,wrap_select,__wrap_select,select,php_pollfd_for,fflush,wasm_popen,wasm_read,wasm_php_exec,run_cli,wasm_recv$JSPI_ADD_EXPORTS -s EXTRA_EXPORTED_RUNTIME_METHODS=ccall,PROXYFS,wasmExports,_malloc,setErrNo "; \ My theory is it works in Node because fd_close returns a promise there, but not in the browser because fd_close is synchronous there. It seems like we should not mark non-asynchronous functions as JSPI_IMPORTS or JSPI_EXPORTS. I wonder if we should make any other functions conditional. |
@adamziel This should probably also solve my issue in
Right? |
@mho22 potentially yes 🤞 🤞 🤞 |
Closing in! Failures summary:
|
## Motivation for the change, related issues Solves WASM error that came up in #2586: ``` trying to suspend JS frames SuspendError: trying to suspend JS frames at php.wasm.close (php.wasm-0836494a) at php.wasm. rand_pool_cleanup (php.wasm-0836494a) ``` ## Implementation details Stop marking `fd_close` as JSPI import/export for the web builds. Only do it for Node.js builds. My theory is it works in Node because `fd_close` returns a promise there, but not in the browser where `fd_close` is synchronous. It seems like we should not mark non-asynchronous functions as JSPI_IMPORTS or JSPI_EXPORTS. ## Testing Instructions (or ideally a Blueprint) CI
2b39020
to
550186f
Compare
## Motivation for the change, related issues The `onBeforeBlueprint` is unused in this repo and downstream dependencies that I know of. This PR removes it – it adds complexity to [Blueprints v2 integration on playground.wordpress.net](#2586) ## Testing Instructions (or ideally a Blueprint) CI
🚧 Work in progress 🚧
Adds support for Blueprints v2 PHP runner in the web version of Playground. Supersedes #2487
CleanShot.2025-09-02.at.20.18.14.mp4
Implementation
Blueprints v2 Runner Integration
experimentalBlueprintsV2Runner
option tostartPlaygroundWeb
. When used, v2 runner is used for Blueprint execution. The progress bar is updated using progress details sourced from that runner.runBlueprintV2Web
function – a counterpart of therunBlueprintV2
function we have in CLI. There's an ample opportunity for code reuse before merging this PR.Infrastructure and Messaging Enhancements
onMessage
support on Playground API client. It was broken since we've introducedPHPProcessManager
– the listeners were only registered on the primary PHP instance.Remaining work
createSiteMetadata
does a bunch of parsing and even callscompileBlueprint
. Let's treat Blueprint as a blackbox that only the runner can peek into.Follow-up work
Testing Instructions (or ideally a Blueprint)
TBD