Bind the result to the requested revision
A candidate file changes, all three tests pass, and the new revision still has not been tested. In this original controlled Python example, the second import returns the module already loaded under that name. Its old function produces the passing outputs. The result belongs to the retained callable, while the file on disk now contains a different candidate.[3][4]
The contract is deliberately small: return the exact built-in integer x + 1 for inputs -2, 0 and 7. The correct source returns x + 1. The replacement returns x - 1. Both complete source strings, their hashes and every output are included in the download. There is no hidden task, model or performance objective.[3][4]
- Bind the result to its artifact: The file on disk and the callable already in memory can represent different revisions.
Keep the import arms and outputs together
We first import the correct source under a unique module name. We record the file hash immediately before import, check that its bytes are unchanged afterward, and associate that hash with the observed module object. Repeating the same import without editing the file is a positive control: the module and callable identities stay the same, the source binding matches, and every output is correct.[3][4]
Next we overwrite only the owned source file with the wrong revision and import the same name again. The requested file hash changes, but the returned module and callable remain identical to the initial ones. Their outputs are still -1, 1 and 8. Output correctness alone passes; the requested-revision check fails because the new file hash differs from the original load record.[4][1]
The fresh-name arm checks the replacement independently. Its wrong source file is created before any import, under a second unique name, and bytecode writing is disabled. It has no earlier module or bytecode artifact to reuse. That import returns a different module and function, which produce -3, -1 and 6. Its source binding matches the requested wrong revision, but all three outputs fail the contract.[4][3]
These are two separate checks. Correct outputs do not establish which requested artifact was represented by the test. A matching source record does not make a wrong function correct. Under this demonstration's declared rule, a requested revision qualifies only when the complete output check and the recorded source binding both pass.[4][3]
All four ordered arms and all twelve task outputs. The expected vector is [-1,1,8].
| Arm | Requested file | Loaded marker | All outputs | Output check | Source record | Revision qualifies |
|---|---|---|---|---|---|---|
| Initial correct import | correct v1 | correct_v1 | -1, 1, 8 | pass | match | yes |
| Unchanged same name | correct v1 | correct_v1 | -1, 1, 8 | pass | match | yes |
| Changed file, same name | wrong v2 | correct_v1 | -1, 1, 8 | pass | mismatch | no |
| Wrong revision, fresh name | wrong v2 | wrong_v2 | -3, -1, 6 | fail | match | no |
- The changed-file arm returns the same module and callable as the initial correct import.
- The load-source SHA is captured harness bookkeeping, not cryptographic execution attestation.
Separate the mechanism from the observation
The Python Software Foundation documentation explains the mechanism: an import checks sys.modules by module name and can return its existing module object. Its reload documentation also describes retained module dictionaries and external references that are not rebound. We do not test reload or present it as a universal fix. The documentation supports the mechanism and caveats; it does not validate our fixture or imply a defect in a real benchmark.[1][2]
The original standard-library program ran once on CPython 3.9.6. It retained four ordered arms and twelve task rows, with four checks of those main outcomes and twelve separate boundary checks. The latter cover malformed or incomplete records, wrong task identity, altered fixture source, source-hash mismatch and boolean or floating outputs that compare numerically equal to an expected integer. All sixteen selected checks passed; they are not exhaustive validation.[3][4]
- Keep both decisions: Check complete outputs and the requested source binding separately. Neither substitutes for the other.
Retain the limits of the source record
The recorded load hash is trusted harness bookkeeping, not cryptographic execution attestation. It was captured before the first known import and retained with that module object. It does not prove arbitrary loader behavior, dependency identity, concurrent changes or security against a malicious process. The fresh-name control isolates this pair of simple modules; it does not reset every kind of application state.[3][5]
For a benchmark or candidate-reward report, retain the requested artifact, the load record and the actual output decision together. Do not attach a passing result to a newly edited file solely because its pathname is unchanged. The MIT package includes the exact executed source, full fixture, protocol and saved output. No real grader defect, prevalence, speedup, training gain or measured reward improvement is claimed.[3][5]
- Bind each candidate decision to the requested source revision and retain the complete output record.
Sources
- Python language reference — The module cache docs.python.org
- Python importlib — import_module and reload docs.python.org
- MIT proof and complete saved output data.nodus-compute.ai
- Saved result JSON data.nodus-compute.ai
- Source and saved-result provenance data.nodus-compute.ai
- Vector figure data.nodus-compute.ai
