# A mutated input can rewrite the reference answer

A correctness harness needs to preserve the task it is checking. This original standard-library example shows what happens when a candidate and its reference share a mutable input.

The task is elementwise `x + 1`. For `[2, -3, 0, 7]`, the required output is `[3, -2, 1, 8]`. Return a separate integer list and leave the supplied input unchanged.

Now consider this deliberately faulty order:

```python
actual = candidate(x)
expected = reference(x)
```

The candidate zeros `x` and returns a new list `[1, 1, 1, 1]`. The reference runs afterward and sees the zeros too. Its answer is also four ones. Output equality passes, although positions 0, 1 and 3 are wrong for the original input.

## Freeze the answer's input, then keep two verdicts

The corrected toy freezes the original integers, gives the reference and candidate independent lists, and computes the expected answer before calling the candidate. It checks exact output length, integer types and separate-object return, then records output equality and post-return input equality separately.

All four authored functions are retained under both harnesses:

| Function | Shared check | Output correct for original | Input unchanged | Original-bound check |
| --- | --- | --- | --- | --- |
| Correct separate output | Accept | Yes | Yes | Accept |
| Wrong, no mutation | Reject | No | Yes | Reject |
| Zero input, return ones | Accept | No | No | Reject |
| Correct output, then zero input | Reject | Yes | No | Reject |

The last row matters. Its output is correct; rejection comes from the input-state breach. A single pass/fail bit can hide that distinction.

## State equality has a boundary

A separate function mutates the list, restores it, and returns the correct answer. It passes the post-return check. Final-value equality cannot prove that no writes occurred. This small checker is not a sandbox for arbitrary candidate code.

The one original CPU invocation retained all eight main slots, thirteen authored checks and that additional restore boundary. Wrong-length, same-sum permutation, bool, non-list and same-object cases are included. These are designed checks, not a measured benchmark failure rate.

[Python's copy documentation](https://docs.python.org/3.14/library/copy.html) distinguishes a new binding from a copy and explains why shallow copies still share nested objects. The fixture therefore uses only flat built-in integers. [PyTorch detach](https://docs.pytorch.org/docs/2.15/generated/torch.Tensor.detach.html) shares storage; [clone](https://docs.pytorch.org/docs/2.15/generated/torch.clone.html) returns a copy but can change some layouts. Those are API references, not implementations tested by this example.

## What the download contains

The original Nodus example is MIT licensed. The package includes full values, verdicts, source, a public protocol and provenance. Its saved result is exact output from the original run. To remove private local provenance, the public protocol is a projection and the source changes only its protocol-hash constant. That adapted pair has not been executed; both original and public hashes are disclosed. No result was regenerated for release.

This is a narrow input-custody counterexample, not a report of a bug in an existing benchmark or a security, GPU performance or training-benefit result.

[Original Nodus research note and proof download](https://data.nodus-compute.ai/blog/a-mutated-input-can-rewrite-the-reference-answer?utm_source=hashnode&utm_medium=research&utm_campaign=kernel_rl_benchmarks).
