# Independent setup, gate and engine audit Audited P = `79f068cef81dadee171531f3381e207c193c959a`. Only this result is delivered; no tracked source, test, configuration or bank was edited. Runtime state and the diagnostic copy are under `scratch/`. Engine seeds are screening-only. No claim is made about other wave items. Commands below ran from the repository root. Each audited command used a scratch Python subprocess logger with a 460-second timeout, separate stdout/stderr files, and `time.monotonic()` wall timing. Each test file was invoked separately. Independent checks overlapped, so timings are elapsed audit costs, not isolated throughput measurements. No command timed out. Fresh setup destinations contained no prior installation; the cold cache was empty. ## 1. Setup variants and environment transition | Command | Exit | Seconds | |---|---:|---:| | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch/engine-cold" --smoke` | 0 | 16.608 | | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch"` | 0 | 8.786 | | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch/engine-offline" --offline` | 0 | 8.934 | | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch/replica" --replica-only` | 0 | 8.185 | | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch/deadline-one" --offline --deadline 1` | 75 | 1.118 | | `bash setup_fast.sh --platform linux-x86_64 --cache "$PWD/scratch/cache" --scratch "$PWD/scratch/deadline-zero" --offline --fetch-only --deadline 0` | 75 | 0.032 | | `. scratch/env.sh; test -n "${IMD_AMM_ENGINE+x}" && test -n "${IMD_AMM_HARNESS+x}" && test -n "${SOLCX_BINARY_PATH+x}" || exit 1; . scratch/replica/env.sh; test -z "${IMD_AMM_ENGINE+x}" && test -z "${IMD_AMM_HARNESS+x}" && test -z "${SOLCX_BINARY_PATH+x}" || exit 1; echo "PASS: three engine settings set before, all unset after replica sourcing"` | 0 | 0.004 | | `. scratch/env.sh; python3 -B reference/materialize.py --out scratch/reference` | 0 | 0.265 | All four installations succeeded. Cold setup downloaded all 16 pinned inputs; the next two engine installations reused all 16 downloads, and replica installation reused its four inputs. Cold smoke: synthetic replica loop finite/reproducible; engine VanillaStrategy seed 9700000 passed, 48 config-field comparisons, 11,970 afterSwap calls, peak gas 22,592, zero callback errors. The synthetic loop is not a replica2 policy parity benchmark. Materialization verified 35 originals. Environment transition assertions test only the three settings generated by this task: `IMD_AMM_ENGINE`, `IMD_AMM_HARNESS`, `SOLCX_BINARY_PATH`; all were set after engine sourcing and unset after replica sourcing. No setting values were captured. Exact setup timing/deadline lines: ```text setup_fast: OK platform=linux-x86_64 mode=engine setup=cold downloads=16 download_bytes=135768787 cache_hits=0 install=fresh fetch_s=4.336 install_s=5.561 verify_s=2.591 smoke_s=4.036 total_s=16.541 deadline_s=420 setup_fast: OK platform=linux-x86_64 mode=engine setup=cached downloads=0 download_bytes=0 cache_hits=16 install=fresh fetch_s=0.556 install_s=5.574 verify_s=2.601 smoke_s=0.000 total_s=8.746 deadline_s=420 setup_fast: OK platform=linux-x86_64 mode=engine setup=cached downloads=0 download_bytes=0 cache_hits=16 install=fresh fetch_s=0.551 install_s=5.733 verify_s=2.604 smoke_s=0.000 total_s=8.902 deadline_s=420 setup_fast: OK platform=linux-x86_64 mode=replica setup=cached downloads=0 download_bytes=0 cache_hits=4 install=fresh fetch_s=0.353 install_s=5.414 verify_s=2.352 smoke_s=0.000 total_s=8.132 deadline_s=420 setup_fast: deadline of 1s reached during: interpreter extraction (after 1.019s). Verified downloads and finished steps stay; nothing was marked complete. setup_fast: resume: rerun the same command. setup_fast: deadline of 0s reached during: start (after 0.005s). Verified downloads and finished steps stay; nothing was marked complete. setup_fast: resume: rerun the same command. ``` Both deadline exits were the required 75, with no success summary. ## 2. Gate P | Command | Exit | Seconds | |---|---:|---:| | `. scratch/env.sh; python3 -B gatep.py --reference scratch/reference/taylor --cache scratch/audit/gate-cache` | 0 | 14.232 | | `. scratch/env.sh; python3 -B gatep.py --reference scratch/reference/taylor --cache scratch/audit/gate-cache` | 0 | 0.218 | | `cmp scratch/audit/gate-fresh.out scratch/audit/gate-hit.out` | 0 | 0.004 | Fresh execution verified the Taylor inputs and ran gates.py. Second execution reported a verified cache hit; `cmp` confirmed exactly identical stdout. Cache is isolated under scratch and keyed by the implementation’s commit/Python/input identity. Output: ```text seed perfect-info gaussian+plain gaussian+qm lattice+qm 10000 448.261189 443.455598 443.522608 443.663520 10001 576.779199 571.463409 571.623551 571.977293 10002 531.886497 525.168028 525.865859 526.411631 gatep: PASS (executed gates.py) gatep: PASS (verified cache hit) ``` ## 3. Every tests/ file | Command | Exit | Seconds | |---|---:|---:| | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_ammfast.py -v` | 0 | 46.720 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_engine_eval.py -v` | 0 | 0.415 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_gatep.py -v` | 0 | 39.576 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_ha.py -v` | 0 | 10.246 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_replica_banks.py -v` | 0 | 108.354 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_score.py -v` | 0 | 0.365 | | `. scratch/env.sh; IMD_SCORE_ENGINE=1 python3 -B -m unittest discover -s tests -p test_score_integration.py -v` | 0 | 97.634 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_setup_deadline.py -v` | 0 | 15.376 | | `. scratch/env.sh; IMD_TEST_PLATFORM=linux-x86_64 python3 -B -m unittest discover -s tests -p test_setup_fast.py -v` | 0 | 47.300 | | `. scratch/env.sh; python3 -B -m unittest discover -s tests -p test_validate_kit.py -v` | 0 | 29.684 | | File | Tests reported | Passed | Skipped | Failures/errors | unittest seconds | |---|---:|---:|---:|---:|---:| | tests/test_ammfast.py | 23 | 23 | 0 | 0 | 45.452 | | tests/test_engine_eval.py | 16 | 16 | 0 | 0 | 0.074 | | tests/test_gatep.py | 24 | 24 | 0 | 0 | 39.231 | | tests/test_ha.py | 15 | 15 | 0 | 0 | 10.070 | | tests/test_replica_banks.py | 14 | 14 | 0 | 0 | 107.608 | | tests/test_score.py | 35 | 35 | 0 | 0 | 0.043 | | tests/test_score_integration.py | 3 | 3 | 0 | 0 | 97.053 | | tests/test_setup_deadline.py | 13 | 13 | 0 | 0 | 15.137 | | tests/test_setup_fast.py | 28 | 27 | 1 | 0 | 47.119 | | tests/test_validate_kit.py | 57 | 57 | 0 | 0 | 29.286 | Total: 228 reported, 227 passed, 1 skipped. Skips verbatim: `test_replica_only_setup_and_numba (test_setup_fast.MacIntegration.test_replica_only_setup_and_numba) ... skipped 'real macOS setup runs only with IMD_TEST_PLATFORM=macos-arm64 (explicit test input)'` The suite intentionally tests invalid seeds and mocked failures; those are rejection tests, not out-of-window native simulations. macOS artifacts were downloaded and checked by the setup test; real macOS execution was skipped. Live engine integration actually ran its 128-seed early-stop test (not skipped): VanillaStrategy screening seeds 9700001..9700128 stopped after one round, with no later native calls. Its benchmark projected 189.381 seconds for 128 runs. Round output and stop status: ```json {"n": 128, "mean_diff": -181.07580014978117, "se": 3.9162517263946226, "worst5": [{"seed": 9700076, "diff": -369.5485796539232}, {"seed": 9700077, "diff": -288.0111378034469}, {"seed": 9700097, "diff": -286.6769764135044}, {"seed": 9700002, "diff": -268.67410777034377}, {"seed": 9700085, "diff": -261.79649966628983}]} {"status": {"reason": "worse", "n": 128, "available": 511}} ``` ## 4. Engine validator and HA check | Command | Exit | Seconds | |---|---:|---:| | `. scratch/env.sh; python -B baselines/engine/validate.py --output scratch/engine-validation.json` | 0 | 63.313 | | `. scratch/env.sh; python3 -B baselines/ha/export.py --source scratch/reference/taylor/calib_out_2048.json --check baselines/ha/HA-10000-12047.json` | 0 | 0.420 | Engine validator passed: 512 bank/audit rows, 25 installed upstream source files checked against the archive, 48 config fields compared, worker argument 8, all callback/gas counters valid. Five independent exact edge/gas reruns passed: 9700000, 9700128, 9700256, 9700383, 9700511. No failed seed attempts recorded. Output went to scratch, preserving the committed validation.json. HA check output: ```text HA: 2048 rows, seeds 10000..12047, sha256=09719da22be28598e9c1d0bb1eb935d7b0b4eeafef3321e0fabe4f3ec9e2b7a9 ``` This checked the canonical import, not a new HA simulation. The `--source` path uses the already materialized identical pinned calibration; only check mode was invoked, not the documentation’s export-to-tracked-bank command. ## 5. Independent spread reruns | Command | Exit | Seconds | |---|---:|---:| | `. scratch/env.sh; python3 -B scratch/audit/rerun.py benchmark` | 0 | 19.405 | | `. scratch/env.sh; python3 -B scratch/audit/spread.py 0 1` | 0 | 0.114 | | `. scratch/env.sh; python3 -B scratch/audit/spread.py 1 9` | 0 | 84.307 | | `. scratch/env.sh; python3 -B scratch/audit/spread.py 9 17` | 0 | 65.705 | | `. scratch/env.sh; python3 -B scratch/audit/spread.py 17 24` | 0 | 58.096 | Verified qt1 source SHA256 `c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca` before evaluation. Benchmark: `engine_eval.run_batch([9700000], 'scratch/reference/qt1/Strategy.sol')`, 19.241825s including compilation/import. Conservative 24x projection 461.804s motivated splitting the remaining 23 into 8/8/7 seeds, with each invocation capped by the 460-second logger. The benchmark row is included once in the 24-row comparison; `spread-benchmark` only compares that saved row. Selection is `[9700000 + round(i*511/23) for i in range(24)]`, including both endpoints. Each chunk calls `engine_eval.run_batch(seeds, source)`. Raw row equality includes the exact unrounded float and after_swap_peak_gas. Rounded row equality uses `dict(row, edge=format(row["edge"], ".6f"))` against the bank. Helpers assert the source digest and fail on any unequal row; no tolerances or changed pins. Passed/total: **24/24**. Each mismatch: none. | Seed | Unrounded edge | after_swap_peak_gas | Raw and .6f bank | |---:|---:|---:|---| | 9700000 | 505.9568443502717 | 206569 | PASS | | 9700022 | 508.1630753536296 | 191495 | PASS | | 9700044 | 532.8399292976048 | 189085 | PASS | | 9700067 | 535.9029507959093 | 191831 | PASS | | 9700089 | 529.298483293443 | 203634 | PASS | | 9700111 | 554.0705986400814 | 194457 | PASS | | 9700133 | 576.3495526703939 | 191693 | PASS | | 9700156 | 461.5281961689241 | 193333 | PASS | | 9700178 | 614.4451758175525 | 188821 | PASS | | 9700200 | 508.0699581172939 | 195121 | PASS | | 9700222 | 641.435756412441 | 194541 | PASS | | 9700244 | 605.2377267666923 | 191950 | PASS | | 9700267 | 599.8450070898192 | 186545 | PASS | | 9700289 | 483.0136403616707 | 193550 | PASS | | 9700311 | 577.1717669695041 | 187729 | PASS | | 9700333 | 439.76875564292754 | 208927 | PASS | | 9700355 | 612.3292756617543 | 197055 | PASS | | 9700378 | 535.3728428398848 | 182591 | PASS | | 9700400 | 430.45840108679243 | 203486 | PASS | | 9700422 | 540.7534695159693 | 193554 | PASS | | 9700444 | 576.0733164948891 | 204957 | PASS | | 9700467 | 558.5610767268103 | 185797 | PASS | | 9700489 | 444.9808220801448 | 200291 | PASS | | 9700511 | 517.437785286847 | 191550 | PASS | ## 6. Whole-kit validator before and diagnostic scratch change | Command | Exit | Seconds | |---|---:|---:| | `python3 -B validate_kit.py` | 1 | 0.715 | | `python3 -B -c "import subprocess,pathlib; root=pathlib.Path('scratch/audit/tree'); files=subprocess.check_output(['git','ls-files','-z']).split(b'\0'); [( (root/p.decode()).parent.mkdir(parents=True,exist_ok=True), (root/p.decode()).write_bytes(pathlib.Path(p.decode()).read_bytes())) for p in files if p and pathlib.Path(p.decode()).is_file()]; f=root/'validate_kit.py'; s=f.read_text(); assert s.count(\"val.get('gates')\")==1 and s.count(\"val.get('spots')\")==1; f.write_text(s.replace(\"val.get('gates')\",\"val.get('gates384')\").replace(\"val.get('spots')\",\"val.get('spots576')\"))"` | 0 | 0.114 | | `python3 -B scratch/audit/tree/validate_kit.py` | 0 | 0.716 | Scratch copy was made from every regular file named by `git ls-files -z`. The only content changes in that copy were `val.get('gates')` → `val.get('gates384')` at validate_kit.py:600 and `val.get('spots')` → `val.get('spots576')` at :601. Each old expression was asserted to occur exactly once. Original source was not edited. validator-before: FAIL, coverage 2560/14848. Findings verbatim: ```json [ { "part": "replica", "kind": "invalid", "code": "bad-validation", "path": "baselines/replica/validation.json", "detail": "gates must be a list" } ] ``` validator-after: PASS, coverage 14848/14848. Findings verbatim: ```json [] ``` Before: engine 512 and HA 2,048 rows verified; all 12,288 replica rows were well formed but excluded from verified coverage because their part failed. Other five parts passed. After: all six parts pass—35 reference envelopes, 3 kit files, 4 ammfast sources, 512 engine rows/audits and 5 recorded reruns, 2,048 HA rows selected from 8,192 source rows, 9 replica banks with 384 gates and 576 spots. Worst recorded gate and spot absolute error both 1.1937117960769683e-11. These validator checks inspect committed evidence; they do not independently rerun that entire parity set. Failure JSON provides a path but no line; source reads are located above. ## 7. Final tree status and limits | Command | Exit | Seconds | |---|---:|---:| | `git status --short` | 0 | 0.032 | Final `git status --short` output: ```text ``` No documented command modified a tracked file. No production repair was applied. Only this untracked report is delivered; scratch files are not submitted. Initial `git rev-parse HEAD` returned P and initial `git status --short` was empty (both exit 0). Read-only `rg`, `cat`, `sed` and scratch-log reads were used to inspect CLI usage, test behavior and findings; no host inspection was used. Not covered: macOS runtime execution, Windows, a fresh full 512-seed qt1 bank regeneration, a fresh full 384-gate/576-spot CPython parity sweep, full replica-bank regeneration, HA regeneration/simulation, isolated per-core policy throughput, seeds outside the authorized engine screening window, or other workers’ changes. The test suite’s selected real replica parity and live scoring tests ran as reported above. Synthetic bootstrap throughput is not claimed as policy performance. This audit does not certify behavior beyond its stated checks.