Repository navigation
EN Contribute Mutation Testing
Français · Type: how-to + explanation · Audience: contributor · Context: engine repository · Status: ready · Applies from: 4.3.1
Lines run by a test are not a proof: mutation testing asks whether the tests tell a right result from a wrong one. This page says how quest'n'click does it, and what to do when a mutant survives your change.
A mutation set that passes again after your change: every mutant of its files is killed by a test, or named in
docs/dev/mutants.json with a category, a reason, a proof, an owner and a revisit version.
Each mutant changes one thing in a source file: a comparison or a logical operator swapped (< for <=, && for
||), a negation dropped, a condition forced true or false, a boolean inverted. The tests that judge that file's set
run against it, and one of them must fail. A mutant that survives is a missing test, or an equivalent mutant
that no input can tell from the original.
The tool is tools/mutate.ts, written for the project in 4.1.0 "Clarity": Stryker 10 did not
activate its mutants under Vitest here (739 of 749 survived, an emptied block included), so each mutant is run as plain
source. The file is restored after each mutant, and on exit (Ctrl-C included).
A survivor not named fails the run, whatever the score. There is no threshold: a set passes when every survivor is explained, and an explanation is an exemption with terms (below), never "the score is good enough".
The engine repository. The tool since 4.1.0, the sets and the gate by identity since 4.1.2, sharding and exemption terms since 4.1.20; thirteen gated sets as of 4.4.0.
| Set | Mutates | Gated since |
|---|---|---|
core |
src/engine/core/{cond,save,session-runtime,migrate}.ts |
4.1.2 |
reality |
the engine's receive, the protocol, the client, the HTTP port; the Bridge, its journal store, lock and policy | 4.1.2 |
runs |
the speedrun queue: bridge/src/{runs,runs-store,runs-limiter}.ts
|
4.1.17 |
remix |
a world's seed, compilation, application, categories; the Daily and Mystery tokens | 4.1.17 |
speedrun |
a run's envelope, the recorder, the verifier | 4.1.17 |
connectors-pure (connectors until 4.2) |
the connectors' pure parts: SDK, MIME reader, line editor, virtual disk, badge crypto and fetch | 4.1.18 |
reality-store |
the Bridge's stores in memory, SQL and SQLite, migrations, streams, signing (not the Postgres adapter) | 4.1.18 |
connectors-edge |
configuration and start, the email connector, badge verification, terminal guard and shell, SSH, Telnet (4 shards) | 4.1.20 |
reality-store-postgres |
bridge/src/store-postgres.ts, judged on a real Postgres (BRIDGE_PG_URL) |
4.1.20 |
studio-ops |
the Studio Server's journal, its durable writes and the spans of a game's files | 4.2.1 |
studio-auth |
the Studio Server's gate, OpenID provider, auth routes and store, spans' leases, the game's origin | 4.2.1 |
studio-workshop |
personal undo, health by revision, previews, builds, prepared assets, backup, journal shipped and collection | 4.2.3 |
voices |
voices by value: a line's clip keys, the recording table and its CSV, the validator's check; the solver's sentences | 4.3.1 |
The sets and the test files that judge each one are in tools/mutation-sets.ts
(SETS, TESTS, GATED); MEASURED (sets that report without gating) is empty since 4.2.1. Where each runs is in
Which tests run when: a pull request labelled full-ci, every night (from scratch),
the candidate and the release.
- A prepared repository (Developer setup), and the set's tests green before any mutation: the
tool refuses to start otherwise (
✖ the tests fail before any mutation: fix them first). - For
reality-store-postgres: a Postgres the tests may use, given asBRIDGE_PG_URL(the tool exits 2 without it, since every mutant would survive a test that skips its Postgres cases). - Time: a set takes minutes to hours;
connectors-edgetook 2 h 02 in one job on a runner before it was cut in four shards. Prefer--filelocally, or themutationworkflow.
In the engine repository, on your machine; or on a runner with the mutation workflow, which measures one set on one
ref and keeps the report:
# from any clone with the GitHub CLI
gh workflow run mutation --ref main -f set=remix -f ref=<branch or SHA> [-f file=<path>]The tool writes the source file it mutates: do not edit it while a run is going.
-
Mutate the file you changed, judged by its set's tests:
# in the engine repository npm run test:mutation:core -- --file=src/engine/core/cond.tsIt prints each surviving mutant as
survived <file>:<line> <operator>: <from> → <to>, then each file's score, then✖ not in docs/dev/mutants.json: …for every survivor nobody named.
-
Or run the whole set, as CI does:
# in the engine repository npm run test:mutation:core -- --set=core # the default set npm run test:mutation:reality # the same as --set=reality npm run test:mutation:core -- --set=all # every gated set, one after the other
A report whose inputs are unchanged (
inputHash: the set's sources and tests, everything they import, the two configurations, the tool, the named survivors, the lockfile without its version fields) is reused: the run says so and stops.--freshruns anyway. Reports are written to.cache/mutation/report-<set>.json.
-
Kill the survivor with a test, the usual answer: write the input that tells the mutant from the original, in a
test file the set's
TESTSalready lists (or add the file there). Run step 1 again: the mutant is killed.
-
Or name it, when no input can tell it apart. Add an entry to
docs/dev/mutants.json:{ "file": "src/engine/core/session-runtime.ts", "operator": "condition true", "from": "this.open.length", "to": "true", "context": "return this.open.length ? this.open[this.open.length - 1] : undefined;", "why": "`cur`: with no open entry, `this.open[-1]` is undefined, which is what the condition returned", "category": "equivalent", "proof": "argument", "owner": "@wanoo", "revisit": "4.6.0" }-
category:equivalent,unreachable,instrumentationorout-of-contract. -
why: more than 20 characters that say it. -
proof:argument(the why is the proof; an equivalent mutant only), or a test file undertests/that exists and pins what makes it so. -
owner, andrevisit: the version from which the entry is refused until it is read again. -
context: the trimmed source line, so the entry names that line's mutant only.
Then regenerate the table of
docs/dev/MUTANTS.mdand run the set again:# in the engine repository npm run test:mutation:core -- --doc npm run test:mutation:core -- --set=<set> --fresh
docs/dev/mutants.jsonis a file the maintainer reviews (CODEOWNERS): say in the pull request why each entry is equivalent. -
Limit ·
revisit-dueAn entry whoserevisitversion is reached stops every set, whatever its file: "docs/dev/mutants.json: n entries do not hold … to be read again at x.y.z". As of 4.4.0 all 132 entries sayrevisit: 4.5.0: oncepackage.jsonsays 4.5.0 (its pre-releases included), every mutation run refuses until each entry is read again and itsrevisitmoved.
✔ n/m mutants killed, k survivors explained, 0 not; report in .cache/mutation/…, and exit code 0. In CI, the set's
mutation (<set>) jobs and mutation-merge are green.
| Symptom | Cause | Fix |
|---|---|---|
✖ not in docs/dev/mutants.json: <file>:<line> … |
A survivor nobody named | Kill it with a test (step 3), or name it (step 4) |
⚠ named in docs/dev/mutants.json but killed or gone |
An entry whose mutant no longer survives | Remove the entry |
✖ docs/dev/mutants.json: n entries do not hold |
An entry without its terms, or past its revisit
|
Complete it, or read it again and move revisit
|
✖ --set=… mutates reality-store-postgres, which needs BRIDGE_PG_URL |
No Postgres given | Set BRIDGE_PG_URL, or run another set |
ℹ --set=connectors is --set=connectors-pure since 4.1.19 |
The old name | Use the new one (the alias works until 4.2) |
✖ <set>: … nothing merged, the set is not judged (CI) |
A shard missing, doubled, cancelled or of other inputs | Rerun the set's failed shard jobs, then mutation-merge
|
The tool rewrites the mutated source file while it runs and restores it after each mutant and on exit; it writes its
reports under .cache/mutation/. You change test files, docs/dev/mutants.json and, through --doc,
docs/dev/MUTANTS.md.
If a run was killed without its exit handler (a kill -9, a crash), check git status: a mutated source file shows as
modified; git restore <file> puts it back.
-
docs/dev/MUTANTS.md, the named survivors explained;docs/dev/mutants.json, the list the gate reads. -
tools/mutate.ts,tools/mutation-sets.ts,tools/mutation-shards.ts,vitest.mutation.config.ts. - The coverage ratchet, CI explained.
Generated publication · publication générée — current documentation · documentation courante: quest'n'click 4.4.0 r1, documentation revision · révision de la documentation 8dc717c69acb62c4742b69c54a7e7dfb620f75d8.
Earlier versions and permalinks · versions précédentes et liens permanents: https://wanoo.github.io/quest-n-click/docs/
An edit made in this wiki is overwritten at the next publication · une modification faite dans ce wiki est écrasée à la publication suivante.
Edit the source · Modifier la source · Report an error · Signaler une erreur
Index (6)
Start (6)
Play (9)
Install (17)
- Requirements
- Install from the release archive
- Install from npm, once published
- Install from the repository to work on the engine
- doctor: checking your machine
- Image toolchain
- Audio toolchain: ffmpeg, fluidsynth, Furnace, uv
- Upgrade
- Upgrade notes: 4.4
- Upgrade notes: 4.3
- Upgrade notes: 4.2
- Upgrade notes: 4.1
- Upgrade notes: v3
- Upgrade notes: v2 to v3
- Coming from web-scumm
- Package reference
- Install troubleshooting
Create a game (55)
- Your first game
- Layout of a created project and of the engine repository
- The working loop
- Content principles and the identity contract
- Rooms
- Geometry: placement, walk zones, masks, layers, camera
- Something is visible but unreachable
- Reactions
- Game commands
- Conditions
- Flags, variables and events: which to use
- Custom code
- Characters
- Items and inventory
- World map
- Dialogues
- Scripts and events
- Moving characters: patrols and walks
- Exits
- Chapters and objectives
- State and saves: persistent or temporary, renaming an id, migrations
- Staging: wide rooms and animations
- The stage: lights, particles, floors
- Skin and fonts
- Title and credits
- Heroes: several characters and hero choice
- Built-in minigames
- A custom minigame
- Translations
- Music in stems
- Sound effects
- Voices: per language and per hero
- Images: prompts, cutting sheets, transparency, scale
- Asset provenance
- The storyboard, source of truth
- Puzzle design
- Classic mechanics
- Review pages
- DSL reference
- Checking your game
- What the solver proves
- Solver options
- Playtests
- Remix
- Speedrun for authors
- The sealed ending
- Production template
- Example games
- Working with an AI
- Build and release a game
- Publish on GitHub Pages
- The static game on Clever Cloud
- Other static hosts
- Sub-path, cache and service worker, incomplete deploys, going back
- Testing on a phone over the LAN
Local Studio (24)
- The local Studio: overview and launch
- Edit a room
- Placement and stage
- Preview, apply, undo
- Storyboard
- Assets and cutting
- Check: validator, solver, critical path, heat, health, coverage
- Before and after captures
- Semantic diff
- Play and replay a session
- Rule explainer
- Language and objectives
- Voices and the heroes × languages matrix
- Map
- Notes
- Remix in the Studio
- Music
- The Assistant: bring your own key
- Demo mode and studio-apply
- Local and LAN security
- Studio API
- Local MCP: setting up each client
- MCP tools
- Studio troubleshooting
Team Studio (21)
- What runs where
- Concepts: revision, transaction, span, lease, preview, build
- Starting as an invited dev
- Working together day to day
- Roles and actions: the full matrix
- Invitations
- Managing members
- Write refused on the hosted Studio: stale base revision (409)
- Write refused on the hosted Studio: span locked (423)
- Recovering after a lost lease, a disconnection or a stale preview
- Comments
- Map and semantic diff
- Publishing builds
- Remote MCP
- The game in Git
- Upgrading the engine of a hosted game
- Hosted assets
- The server's command line
- Health and metrics routes
- Trying it locally with compose.yml
- Known limits
Clever Cloud (23)
- Clever Cloud: overview, cost and prerequisites
- Apps and add-ons
- Domains and TLS
- Keycloak
- Generic OIDC and GitLab
- Configuration
- First deployment
- Backups
- RPO and RTO
- Restore the Studio on a fresh installation
- Redeploys
- Upgrading the server and checking state after a migration
- Limits of going back
- Monitoring
- Security
- Rotating keys
- Recovering admin access
- Changing domain or OIDC provider
- Worker, PostgreSQL or Cellar down
- Exporting the game and leaving the installation
- Retention
- Clever Cloud troubleshooting
- Costs and teardown
Reality Bridge and connectors (16)
- The Reality Bridge: what it is
- Quick start
- Guarantees
- Install and run the Bridge
- Backup and restore
- Several tenants
- Signals and the manifest
- The Bridge's command line
- Connectors overview
- Email connector
- Telnet connector
- SSH connector
- Open Badges connector
- The connector SDK
- Security: Biscuit and signatures
- Bridge and connector troubleshooting
Contribute (25)
- Welcome
- Developer setup
- The dev loop
- Before a pull request
- Conventions
- Writing documentation
- Architecture
- Code tour
- Import boundaries
- Which tests run when
- Mutation testing
- The coverage ratchet
- The quality baseline
- CI explained
- Field passes
- Benchmarks
- Releasing
- npm packages
- Decisions and ADRs
- Governance
- Bot pull requests
- Contributing with AI agents
- Security policy
- Code of conduct
- Licences and credits