# Protocol: change

The `change` commands a program sends to a running game, as the engine describes them: what each takes, what it answers and what it does. Back to [all commands](../protocol-commands.md).

## change.test

`change.test {says: [text], against?: text, folder?: text, copy?: text, with?: [record], before?: record} -> {passes: value, said: [record], differs: record, shots: [record], game: text, line: text, warnings: [text], stages: [record], steps: integer, on: record, hands: [record], ms: number}` · read, read-only

Holds a change to what it said it changes, as `frost test --says` does: the game's files on disk are played beside the same game at a commit, on the recorded input, step by step, and may differ only in the parts said, each from its step on, and in no shot but where a said part differs. With folder, no commit and no repository: the folder's files, read over the served game's files (a file it lacks is the game's), are played beside the game's own; with, folders of changes both sides have under it; before, a folder holding the whole game unchanged, played in place of the game's own files, which are then the changed side. With copy, a copy's changes (copy.make), played as such a folder; a hand in a copy that gives no folder tests its own. For an editor's landing line and an agent's report without a shell: the same answer either way. It reads the files, not the running game (a script.reload not saved is not in it), plays the reference and changed recordings beside each other, and changes nothing. With with, a first differing component field also reports each change alone and a five-step value history (differs.comparison); each returned run is replayed only after that difference is known, only to that step and without pictures. A folder that cannot be one of these is refused in words (E0472).

| Parameters | Type | Meaning |
| --- | --- | --- |
| `says` | [text] | What the change changes: parts as world.checksum names them (Transform.x, state:ball.luau, entities, or one thing's, ball.Transform.x), each as PART or PART@STEP, from its step on. With folder or before it may be empty: the change says it changes nothing the run shows. |
| `against?` | text | The commit to hold the change against. Left out: HEAD. Not with folder or before. |
| `folder?` | text | A folder of changed files, each at its path from the project file's folder (scripts/go.luau): the change, tested against the game as served with no repository. |
| `copy?` | text | A copy of the game (copy.list names them): its changes, every file it changed or added since it was made, played over the game as served, as a folder would be, and every file it took away taken away; the copy then keeps what it said and what the test came to (copy.list's says and test). Not with folder or before. Left out by a hand in a copy that gives neither folder nor before: its own copy. Another copy than its own is refused (E0474). |
| `with?` | [record] | Changes the test plays on both sides, under folder (or the copy): each {folder: PATH} or {copy: NAME}, a copy's changes, each on top of the ones before it. To ask whether two changes that pass alone pass together. |
| `before?` | record | {folder: PATH}: the game unchanged, whole, with its project file, played as the unchanged side in place of the game's files on disk (an editor's game as last kept). |

| Result | Type | Meaning |
| --- | --- | --- |
| `passes` | value | Whether the game differs only where it said. |
| `said` | [record] | One {part, from, first_differs} per part said: first_differs the first step it differed at, null when it never did (a warning: the change did less than it said). |
| `differs` | record | The first difference where nothing was said: {step, entity, component, field, value, was, writer}, or null. For a component field with with, adds comparison: {window: 5, from, to, alone, together, extra_steps}. from = max(0, step - 4), to = step; each run has {present, value, writer, samples, error}, samples at most five {step, present, value, writer} in step order, including step 0 when in range. Scalars have the same JSON types as world.get; writer is blame.value's structured writer, or null when unknown or absent. present false means the thing, component or field is absent; null with error means that standalone run could not load or reach the step, or its own replay ends earlier (samples empty). alone is in hands order, each with folder or copy and who, each on its OWN recording; with changes alone use before when supplied, otherwise the served game; the final hand uses the served game plus folder; together is the changed test run. These observations do not certify that an alone test passes: read its own change.test verdict. was remains the test reference, never a substitute for alone. Passing tests take no field snapshots. After a field difference, each returned run is replayed once through to with writer tracking, sampling only that field in the window; extra_steps counts all attempted comparison steps, at most (hands + 1) * to. At most five samples and one final value/writer per returned run are retained; one replay session is live at a time. No history is cached across requests. No comparison for non-field differences, a passing test or a test without with. |
| `shots` | [record] | One {name, step, changed, passes} per shot taken beside the commit's. |
| `game` | text | The project file, as `frost test` names it. |
| `line` | text | The line `frost test --says` prints: "differs from the game as committed only where it said: ..." or what failed; of a folder, "differs from the game as served ...". |
| `warnings` | [text] | Its warnings: a part said that never differed. |
| `stages` | [record] | Of folders only (a test against a commit does not answer it): {name, passes, line} for loads (the changed files load), plays (no step of the change fails), said (it differs only where it said) and pictures (each shot as said), in that order; passes null for a stage the test did not reach. |
| `steps` | integer | Of folders only (a test against a commit does not answer it): the steps of the recording played. |
| `on` | record | Of folders only (a test against a commit does not answer it): {landing, with}: what the change was played on top of, with the folders of with as given and a copy by its name; landing the number of the game's last landing (0 before any; copy.landed). |
| `hands` | [record] | Of folders only (a test against a commit does not answer it): {folder, lines: [{path, from, to}]} for each of with and then folder (or the copy), or {copy, who, lines} for a copy, who its hand's name: the lines each changed, by its file's lines against the files under it (from and to null for a file that is not text; a file a copy took away is {path, from: null, to: null, gone: true}). With before and no folder, the game's own files against before. |
| `ms` | number | Of folders only (a test against a commit does not answer it): how long the test took in the engine. |
