Repository navigation
Replies: 2 comments 7 replies
|
It would make sense to run these right in the pipeline to prevent new syntax error being merged into the master |
|
The CI validation part looks useful independently of the Run button. I would make the unit of validation an explicitly classified example, though, rather than treating every PHP fence as a standalone program. Laravel docs contain complete programs, method bodies, configuration fragments, diffs and examples whose variables were introduced in the surrounding text. A failure report needs to distinguish invalid PHP from “requires a fixture/context” and from “valid example but unsupported by the browser runtime.” Otherwise maintainers can end up rewriting good explanatory fragments just to satisfy the runner. A useful first CI contract would record the docs commit, page/heading, stable snippet identifier, PHP/framework versions, fixture and expected outcome. Start with changed snippets, allow intentional expected failures, and report infrastructure failures separately from example failures. Two adjacent examples should not accidentally share database or static state unless they are explicitly one scenario. For the browser runner, I would additionally bound execution time and output, isolate runs, and make required extensions/network services visible before execution. A code block that demonstrates queues or an external database should not show a green “works” solely because a stub let it parse. I haven't run the linked PoC or rechecked the reported 50 fixes; these are proposed acceptance criteria for moving its validation into official CI. An initial opt-in set of complete examples would make false-positive rates measurable before expanding coverage. |
Uh oh!
There was an error while loading. Please reload this page.
I built a proof of concept where every PHP code block in the 13.x documentation runs directly in the browser: : Laravel Snippets. The laravel/docs markdown sources sync daily, so it tracks the official docs.
A side effect turned out to be valuable on its own : a weekly sweep runs every snippet through Playwright and records which ones complete : The report. That sweep surfaced the 50 syntax errors fixed in laravel/docs#11364.
Proposal
Would there be interest in bringing either of these to the official documentation?
code block → web worker [ PHP 8.5 via
@php-wasm/web] → output rendered inlineSince laravel.com is closed source, I can't contribute this as a PR. I'd be glad to help integrate it, extract the runner as a package, or adapt whichever part is useful.
All reactions