Questions, and thoughts... #852
Replies: 10 comments 14 replies
-
P.P.S#526 Might be a great step towards folks like me having a place to step in, learn about what's going on, and improve overall project communication. |
Beta Was this translation helpful? Give feedback.
-
Thank you so much for starting this discussion, @moonmeister! Let me answer in separate comments as best as I can.
Could you elaborate on what do you mean by "that's not part of the core"? I consider |
Beta Was this translation helpful? Give feedback.
-
This is an excellent question! And there isn't a simple answer to that. I think of most APIs that exists today as unstable. While some APIs have proved to be useful in a few projects already and I don't anticipate large changes, I am intentionally not marking them as stable yet. One reason is that major API-related opportunities still come up every month. Just last week I started exploring Stream-based file handling that will speed up the loading time of plugins and enable partial downloads (e.g. just the relevant 5MB from a 300MB zip file). As a result, the That being said, I would like to explore a road to stability at one point in 2024. Since Blueprints are the way to setup Playground sites, I started the Blueprints Maturity issue to track that. I also wonder what will |
Beta Was this translation helpful? Give feedback.
-
As a baseline, I'd like Playground to do reasonably well in these areas:
In addition, I want to have some confidence that Playground implements the right APIs. One way to know that is to ship Playground-based tools like:
These projects are not meant as feature creep, but as ways to test the practical usefulness of the Playground API, identify any roadblocks, push the limits, and gain confidence. Ideally, the public API would be well–tested and well–documented by the time a 1.0 release is announced. I want the Note how nothing here is super specific. It will likely take some months to get there, and that's okay. I'd rather move slowly here and get the API reasonably right. I'm worried that expediting a stable 1.0 release would almost certainly mean missing important use-cases and having difficulties supporting them later. It's all quite similar to the |
Beta Was this translation helpful? Give feedback.
-
That would be a great client feature, would you like to open an issue to track it or perhaps even explore an implementation?
This is indeed challenging. Do you have any ideas on how this could be addressed better than it is now? One idea that comes to my mind is self-hosting, but perhaps there is something that the "official" build could do.
That's a good note and I'd like the documentation to draw the distinction line more clearly. Separating |
Beta Was this translation helpful? Give feedback.
-
php-wasm is distinct and separate from WordPress Playground. The Node.js version can be used by just importing the package and the entire state lives in the process memory. The browser version, however, needs to deal with page reloads – otherwise clicking a link will reload the page and wipe out any in-memory state you might have had there. This is why the docs recommend rendering the PHP output in an iframe – so that you can both use links and keep the same browser tab open with all its state. Is that helpful? I'm happy to discuss more – I know it can be confusing.
Let me flip this question around – why is the presence of an iframe challenging in your case?
These are the same – the package with the name |
Beta Was this translation helpful? Give feedback.
-
I'd love to hear more about this. The documentation may be blurrying the line, but the UI is clearly separated from the |
Beta Was this translation helpful? Give feedback.
-
This discussion, any issues you can create, and anything you can share on the meta-playground channels are all great ways to inform the development here. Thank you so much for taking the time to do that! The Playground team isn't large, but it's slowly growing and this should generate additional momentum in the medium term. Unfortunately, crucial core features like PHP.wasm stability aren't straightforward to start contributing to. What would be extremely useful, though, is improving the documentation and the test coverage – both unit and E2E. Both would have large impact on Playground's success. Other than that, any issue or friction point you identify in Playground when you're working with it is a great opportunity to contribute and help improve Playground for others. |
Beta Was this translation helpful? Give feedback.
-
I think I'm understanding some things after this chat and some more code exploration and why this has all been confusing. I've even got some ideas for simplification if I'm remotely accurate. But also this might be just revealing how little I understand what's happening. So currently Next, remember my comment above about confusion around the client returning itself? I think this is why. I expect my JS client to be doing all the work that the
ConclusionRemember when I said the lines were blurred between Thanks again for reading and responding @adamziel! |
Beta Was this translation helpful? Give feedback.
-
The cool thing about hosting all those static assets separately is we could create a static json file that gets deployed on build with all versions of assets. The client loads that JSON and immediately knows which PHP and WP binaries are available to it and if those are compatible with its consumed API version.
|
Beta Was this translation helpful? Give feedback.
-
Okay, I have lots of questions and thoughts. The thoughts might be misguided due to the number of questions I have, but my goal here is to understand better the state of the project, where it is going, and how I can contribute best. Thanks to @adamziel and all the other folks doing great work on this project so far.
Questions
I think I'm in a little bit of a unique situation. ?Most? everything that is built on top of WP Playground is being done by the same folks who are building WP Playground. I'm in the position of trying to build an interface and experience on top of
remote.html
that's not part of the core and running into some issues. I expected this given the experimental and early nature of this project.I tried to answer this by looking at the Roadmap. This roadmap is broad and it does include "stability" type issues, but it seems to lean towards external features(pull requests, .org plugin/theme demos, etc) built on top of the core WP Playground tech.
Let's get more concrete with our discussion. Because of what I'm building, I needed to build my own UI and tailor it to the needs of our WPGraphQL Community.
Note
For those unfamiliar, I work on https://repl.wpgrpahql.com and the code can be found over at https://github.com/wpdecoupled/wpgraphql-repl. I'll note that much of what requires me to have my own UI is not yet built.
What I've seen from this experience is I can use
remote.html
and the JavaScript Client to control everything. But I'm starting from scratch. If I wanted to enable browser storage or a PHP version switcher I have to implement lots of state and control mechanisms. I have no way to even pull the currently supported PHP or WP versions from the client. I can get TS types but these are dependent on my version of the client from NPM, not what's supported by the Playground as hosted onplayground.wordpress.net
. This leaves me to maintain my own lists of these and to release changes every time a new minor version is released. Not hard, but very fixable. This leads me to the major thought I have right now.Thoughts...
To be clear here, much of the docs seem to treat them separately. But in practice, it seems like these things are tied at the hip and make 3rd party API consumption difficult. I will acknowledge the Coding Standards note on a minimal public API might mean some of my more specific ideas are not in line with this idea. I'm okay with that, but just trying to communicate my current experience and better understand where we want to go and how I can help start that conversation.
Why this matters
Let's step back to the architecture of the Playground, as I understand it at least. As we know
PHP-WASM
is the fundamental technology that enables everything we're doing here. This has its own set of issues, APIs, and problems to be solved. Notably, it has abrowser
andnode
runtime.The next step of the layer for our stack is WordPress. We package this up and ship it off to various instances of the
PHP-WASM
runtime across CLIs, browsers, desktop and mobile apps, etc. As noted in the architecture docs this uses SQLite by default.Next, according to the architecture overview, we have bindings for the browser and node. I'm struggling a bit here, maybe y'all can help. It seems this is the JS API (bindings) to command and control the PHP-WASM implementation. The best I can tell other than
run
orrequest
functions this package has little to no association with the fact that we mount WP to an iframe in Playground. Yet, the docs say these bindings assume and require an iframe. I think this iframe comment might apply to the next level of the stack and not these bindings.Finally, we get to the "Public APIs". So this is where we combined everything. We load the WP bundles into PHP-WASM using the JS bindings for browser/node/etc. This is where
remote.html
seems to assume you have to have an iframe for rendering the site and we can use the Query or JS API to implement the whole stack in various places. In my case specifically, the iframe assumption is not ideal, I could make basic requests to GraphQL (or REST) APIs in WP without ever loading WP in an Iframe but it seems the only way to "start" the playground. Is there a way to get the client and directly send requests without doing this step?I'm trying to stay out of the weeds in this post but to not some....Are there two definitions of client here? I can import the
@wp-playground/client
but then when I executestartPlaygroundWeb
that returns a client....are these the same client or different?Okay, Back to my point. We all see there are a lot of possibilities with this technology for both the immediate WP community and beyond. But as long as the WP Playground UI is tightly coupled to the Public API it feels like everyone else trying to use the API will be second class. If we truly want anyone to build on this technology we need really clear boundaries between the Public APIs and ALL consumers, including the default WP Playground UI.
Conclusion
Okay, this isn't meant as a criticism. The best I can tell y'all have been busy building cool things and making !@#$ work. Nice work and thanks for the hard work. The current state of the project is a needed and expected phase in my estimation. But how do we move forward? This phase is really important for learning the problems and defining the value. But at what point does the project take those learnings, slow down the feature building, and define a really strong public API layer that enables everyone to build on top of it?
This is the question I started with: What's the road map to stability? What does that public API look like? How can we work towards defining a 1.0? Importantly, are we ready to move forward?
There's a reasonable possibility I'm just here too early to this project and y'all haven't finished learning what you need to look towards a 1.0. My question then would shift to, what can I (and others) do to best share our struggles and provide some learnings to inform that future stability phase?
Thanks for reading this far and engaging with me in this conversation. Looking forward to finding ways to help.
P.S.
I do have some specific ideas but have tried to stay out of those weeds here, I wanted to understand where the project is and where it is going instead of injecting my uninformed ideas in without context. I'll share these when apropriate.
@adamziel I did mention this related to testing. Maybe it does less than I originally thought, but a clearer public API definition would make testing boundaries cleaner...in fact, this testing issue might be a good example of the tight coupling I think I'm seeing. Very possible the testing is just a matter of implementing API-specific tests too.
Beta Was this translation helpful? Give feedback.
All reactions