A Moodle Playground Scenario is an explicit blueprint embedded directly in a Moodle Tracker issue description. When the Open in Moodle Playground userscript finds one on an issue page, it adds a button that boots the playground preconfigured with the exact context needed to reproduce the issue — the course, users, enrolments, and activities the bug requires are already in place before the reviewer clicks anything. The scenario is machine-readable JSON. Free-text “Steps to reproduce” prose is not interpreted: converting arbitrary human-written steps into a deterministic Moodle setup would be unreliable, so the format is explicit and deterministic instead.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ateeducacion/moodle-playground/llms.txt
Use this file to discover all available pages before exploring further.
Writing a scenario
The payload is an ordinary blueprint JSON object — the same format as any Moodle Playground blueprint. Asteps array is required; landingPage, preferredVersions, runtime, constants, and resources are optional. See the blueprint reference for every supported step type.
Two placements inside the issue description are supported.
Form A — fenced code block
Use a fenced code block with themoodle-playground language tag. This is the canonical form for markdown contexts and for tracker descriptions that preserve backticks as literal text:
Form B — marker phrase + code block
The Tracker’s rich-text editor sometimes converts markdown fences into generic code blocks and drops the language tag, so the fence marker can get lost during rendering. In that case, place the marker phraseMoodle Playground Scenario (for example as a heading) immediately before a code block containing the JSON:
Detection rules
Detection is text-based and fully deterministic — no natural-language inference is performed:- First marker wins. The parser scans for a
```moodle-playgroundfenced code block opener, or the phraseMoodle Playground Scenario(case-insensitive, any amount of whitespace between words). The first match in the issue text is used. - First balanced JSON object after the marker is the scenario. The parser finds the first
{after the marker and scans forward to the matching}, correctly skipping braces inside JSON string values and escaped characters. The extracted text is parsed withJSON.parse— never executed — and must be a JSON object containing astepsarray. - Marker with no JSON after it is a mention, not a scenario. If the marker phrase appears in the text but there is no
{character after it, the issue is treated as having no scenario block and no error is shown. - Marker with broken JSON shows a warning badge. If the marker is present and a balanced
{ ... }block follows it, but the content is not valid JSON, or the JSON is not an object, or the object has nostepsarray, a non-clickable warning badge is shown on the issue. The exact parse or validation error appears in the badge’s tooltip so the author can fix it.
What the tracker button does
Onmoodle.atlassian.net/browse/<KEY> pages the userscript adds one floating button at the bottom-right corner of the page:
| Issue description | Button shown |
|---|---|
| Valid scenario block | ▶ Open issue scenario in Moodle Playground — opens the playground with the scenario encoded inline as ?blueprint=<base64url> |
| No scenario block | ▶ Open in Moodle Playground (starter site) — opens the starter scenario (can be disabled by setting STARTER_SCENARIO = false in the userscript) |
| Broken scenario block | ⚠ Moodle Playground: invalid scenario block — a non-clickable grey badge; hover it to read the exact error message |
The starter scenario
When an issue has no scenario block, the starter button loads the bundledtracker-starter blueprint — a generic reproduction environment proposed in issue #166. It provisions:
- One course: Reproduction course (
REPRO), topics format, 3 sections - Three users:
admin/password(site administrator)teacher/password(enrolled inREPROaseditingteacher)student/password(enrolled inREPROasstudent)
- Sample activities: a forum, an assignment, a quiz, and a page in the course
- Landing page: the
REPROcourse page, logged in asadmin
Limitations
- Free-text steps are not converted. Only the explicit scenario block (Form A or Form B) is read. Ordinary “Steps to reproduce” prose in the issue description is ignored entirely.
- Only supported blueprint steps are provisioned. Unknown step types fail blueprint validation inside the playground with a clear error message. See the blueprint reference for the full list of supported steps.
- Quiz questions cannot be created via blueprint. The
addModulestep creates the quiz activity structure only. Questions must be added manually inside Moodle after the playground boots. - No Moosh. Provisioning uses the playground’s own blueprint engine running inside the WASM runtime, not Moosh or any external CLI tool.
- URL length. The scenario blueprint travels inline in the URL, encoded as base64url. Typical scenarios are a few hundred bytes and well within browser URL length limits. For very large setups, consider hosting the blueprint as a file and linking it with
?blueprint-url=instead (see the URL parameters reference).
See also
Browser Userscripts
Installing the userscript that detects scenario blocks and shows the tracker button.
PR Previews
Automated preview buttons for plugin and theme pull requests.