# merged-flow-test result Implemented the bounded offline integration-test deliverable. **The production payment-to-report goal is not certified complete. No live payment was made.** No private key, backend signer, site payment contract, extra transfer, dependency or configuration change was introduced. ## Files changed | File | Why | | --- | --- | | `web/tests/native-merged.test.mjs` | Bundles and runs the real native body/payment/orders/client/policy/view, Swarm report reader and pages.ReportView together; 29 cases including two executable defect TODOs. | | `web/tests/fixtures/native-merged/games.json` | Two explicit synthetic selected events, NBA and NHL, with distinct participants and starts. | | `web/tests/fixtures/native-merged/api.json` | Offline Intake, admission, job, result, completion, 404 and 429 response shapes. | | `web/tests/fixtures/native-merged/edges.mjs` | EIP-1193 wallet provider, Ethereum JSON-RPC answers, HTTP artifact transport and in-memory browser storage. Wallet/RPC answers use the real ABI and actual calldata produced by the real payment module. Unexpected requests fail the harness. | | `web/tests/fixtures/native-merged/report.md` | Synthetic research prose, each game's prediction/probabilities, counterarguments and citation links. | | `web/tests/fixtures/native-merged/report.json` | Matching complete schema-3 bundle with per-event probabilities/intervals, research, five synthetic citations per game and explicitly simulated participation. | | `artifacts/goal/batches/native-mend/items/merged-flow-test/result.md` | This required result; left untracked. | Caches, build outputs and temporary scaffolding are not delivered. Package files and lockfiles are unchanged. ## What the new suite establishes The real modules run together; a metafile assertion excludes earlier peer fixtures. The only alias selects real ReactDOM browser SSR. The real release policy is enabled only in the test bundle. The happy path checks selected games, native body/output/selection identity, current quote, exact approval and one Intake request, with no extra wallet writes. The hash/body/amount are saved. Pending/unmined, insufficient confirmations, indexing and unpaid entries cannot establish payment. A confirmed matched paid entry does; admission saves request/job IDs. Completion requires the matching confirmed Completed log, complete result, snapshot Keccak-256 and SHA-256/length-checked report.md/report.json. Hashes are computed from fixture bytes in the test. NativeStatus invokes the real ReportView; markup assertions check both games' predictions, all probabilities, research prose and citation hrefs. Negative cases cover mismatched request IDs/amounts/log indexes, missing/changed Requested events, missing/extra payment transfers, refused/failed outcomes, API 404/429, wrong job/result/snapshot/route IDs, missing completion evidence/depth/complete result, same-length artifact tampering, snapshot tampering, and report.json absent from the manifest or returning 404. Partial verified Markdown stays readable but incomplete. Reload uses fresh module state and persisted orders without another write. Changed chain evidence during artifact download prevents stale success. Explicit retry scheduling avoids wall-clock waits. Unexpected network/wallet calls fail the fixture harness. ## Final checks | Check | Exit | Counts/result | | --- | --- | --- | | New suite | 0 | 29 tests: **27 pass, 0 fail, 2 TODO**, 0 skipped/cancelled. Both TODO bodies execute and fail their intended assertions. | | Full test glob | 1 | 176 tests: **173 pass, 1 fail, 2 TODO**, 0 skipped/cancelled. The single failure is the pre-existing native-ui bundle error below. Baseline was 146 pass / 1 fail / 147 tests. | | Typecheck | 0 | 0 TypeScript diagnostics; one successful typecheck. | | i18n check with scratch TMPDIR | 1 | 605 strings checked across 9 non-English languages; **126 missing entries**, 14 in each language; no successful language coverage check. | | Scratch production build | 0 | 1,366 modules transformed; successful Vite build. Existing >500 kB chunk warning (main JS 1,187.49 kB). Output is only in scratch. | | i18n --list | 0 | Diagnostic mode explicitly exits 0 despite missing entries; not counted as a passing coverage check. | | Scope/delivery verification | 0 | Source paths restricted; JSON/whitespace checked; result <=16,000 bytes and untracked. | ## Defects outside scope, left unfixed 1. **Admission is not saved until the result endpoint succeeds.** `web/src/native/client.ts:227` awaits both job/result reads before assigning `snapshot.jobId` at line 232. The real tracker only persists mappings when that ID exists (`web/src/native/view.tsx:83`, save at 85). Reproduce the TODO named “loses the admitted job id”: submit the fixture, return matched paid/admitted Intake and a valid executing job, but return 404 from /jobs/:id/result. Tracking stays paid/pending with awaiting-index, and the saved order's jobId is undefined despite explicit admission. The desired assertion requires the admitted ID to be saved. This is not evidence of an observed live API response. 2. **A confirmed refusal after admission remains pending.** `web/src/native/client.ts:212` rejects `admitted.kind === "job"` while processing a refusal, throwing admission-refusal-disagreement at line 214. Reproduce the second TODO: retained job admission, matched paid entry state refused, confirmed Completed status 1, and matching refused job/result. The expected terminal refused phase is instead pending, and retries continue. The corresponding completed failure status 2 case passes. This describes the simulated response combination; its live occurrence is unproven. 3. **Existing native-ui test cannot bundle its peer fixture over the real export.** `web/tests/native-ui.test.mjs:27` appends a second fetchNativeReport export to `web/src/swarm.ts`, which already exports the function at `web/src/swarm.ts:789`. Reproduce with the full glob (or that existing test alone). esbuild reports “Multiple exports with the same name fetchNativeReport”; Node reports the file failure at `web/tests/native-ui.test.mjs:1:1`. It failed identically in the pre-change baseline. 4. **Missing checkout translations.** Reproduce with `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node scripts/i18n-check.mjs` from web; `--list` prints all keys. All fourteen below are missing in fr, es, ru, ja, zh, pt, it, th, pcm (126 total). Locations are in `web/src/checkout.tsx`: | Line | Missing key | | --- | --- | | 180 | Research checkout | | 185 | Swarm research fee | | 185 | Unavailable | | 189 | Earlier requests from this wallet | | 192 | Open request {x} | | 197 | An earlier order exists for this selection. | | 197 | Open earlier order | | 201 | New research purchases are paused. | | 205 | Select 1 to 14 events that are still open for research. | | 211 | Your wallet has insufficient IMD. | | 212 | Your wallet has insufficient ETH for estimated gas. | | 218 | Your wallet will first ask you to approve the quoted IMD amount. | | 220 | Checking Ethereum and waiting for your wallet… | | 221 | Pay {p} IMD and start research | The first i18n attempt failed before coverage at `web/scripts/i18n-check.mjs:45` (mkdtemp ENOENT); setting scratch TMPDIR corrected setup. Initial test drafts failed on relative input paths, decoded-address checksum casing (historical test lines 148/97), and wrong-job fixture routing (historical line 244). These harness defects were repaired. ## What remains unproven Unproven: deployed bytecode/price and mainnet/fork execution, live API schemas, historical replay, free body validation, real Swarm research/agent count, source accuracy, hosting/CORS, mounted-browser interactions/reconnect and deployment. Schedule/freshness callbacks are supplied as successful inputs. SSR and invalid-domain synthetic citations prove rendering only. The owner still needs an authorized fresh Intake payment-to-report run on the intended production origin, working public API/artifact access, and hosting/publication authorization. Exactly 1,999 agents is unproven. The TODOs, existing test failure and translation failures need their owning items. These offline checks are not production release approval. **No live payment was made.** ## Command ledger Commands beginning npm/npx, TMPDIR= or node scripts ran in `web/`; inspection/setup commands ran at repository root. Redirections retain the exact command used. N/A means no test counts apply. Polling tool calls only collected these processes' exits; they did not launch additional shell commands. 1. `pwd && git status --short && rg --files web/tests web/src/native web/src | head -100` — exit 0; N/A. 2. `cat web/src/native/{body,client,orders,payment,policy}.ts web/src/native/view.tsx` — exit 0; N/A. 3. `cat web/tests/native-{body,client,checkout,report,ui}.test.mjs web/package.json` — exit 0; N/A. 4. `cat web/src/swarm.ts web/src/pages.tsx docs/IMD_NATIVE_FLOW.md` — exit 0; N/A. 5. `sed -n '220,400p' web/src/native/client.ts && cat web/src/native/payment.ts web/src/native/orders.ts` — exit 0; N/A. 6. `cat web/src/native/view.tsx web/src/native/policy.ts && cat web/tests/native-ui.test.mjs` — exit 0; N/A. 7. `cat web/tests/native-checkout.test.mjs` — exit 0; N/A. 8. `cat web/tests/native-report.test.mjs` — exit 0; N/A. 9. `cat web/src/native/view.tsx web/src/native/orders.ts web/src/native/policy.ts` — exit 0; N/A. 10. `cat web/tests/native-client.test.mjs web/tests/fixtures/native-client/scenario.mjs` — exit 0; N/A. 11. `sed -n '1,155p' web/tests/native-ui.test.mjs && sed -n '1,160p' web/tests/native-checkout.test.mjs && cat web/package.json && sed -n '1,170p' web/src/config.ts` — exit 0; N/A. 12. `rg -n 'eventsOf|selectionIdOfBody|function jobBody|findOnchainDuplicate|scanChunks|fetchNativeReport|ReportView|ReportV3|function V3' web/src/{swarm.ts,orders.ts,pages.tsx} && sed -n '1,170p' web/src/orders.ts && sed -n '1,120p' web/src/swarm.ts && sed -n '550,810p' web/src/swarm.ts` — exit 0; N/A. 13. `sed -n '305,435p' web/src/pages.tsx && sed -n '510,545p' web/src/swarm.ts && sed -n '810,900p' web/src/swarm.ts` — exit 0; N/A. 14. `sed -n '1,170p' web/src/i18n.ts && cat web/tests/fixtures/native-body/games.mjs && rg -n 'function chunks|function useSlip|const useSlip|localStorage|document\.|window\.|navigator\.' web/src/{games.tsx,wallet.tsx,prefs.ts,charts.tsx,insight.ts,predict.ts}` — exit 0; N/A. 15. `sed -n '355,398p' web/src/swarm.ts && sed -n '195,225p' web/src/native/client.ts && rg -n 'export function legacyFromV3|supporting|mostLikely|verdict' web/src/engine/report.ts | tail -30 && ls web/node_modules/.bin/{tsc,vite} && rg --files scripts | rg i18n` — exit 2; N/A. 16. `rg --files -g 'package-lock.json' -g 'package.json' -g '*i18n-check*' -g 'vite.config.*' -g 'tsconfig.json' && node --version && npm --version && mkdir -p test/scratch/native-merged/tmp test/scratch/native-merged/npm-cache` — exit 0; N/A. 17. `sed -n '1,65p' web/src/wallet.tsx && sed -n '1,120p' web/src/engine/report.ts && sed -n '805,835p' web/src/swarm.ts && cat web/tests/fixtures/native-body/report.json` — exit 0; N/A. 18. `npm ci --cache ../test/scratch/native-merged/npm-cache --no-audit --no-fund` — exit 0; N/A. 19. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/*.test.mjs > ../test/scratch/native-merged/baseline-tests.log 2>&1` — exit 1; 146 pass, 1 fail, 147 tests. 20. `tail -16 test/scratch/native-merged/baseline-tests.log && rg -n -A 22 '^not ok' test/scratch/native-merged/baseline-tests.log` — exit 0; N/A. 21. `tail -70 test/scratch/native-merged/merged-first.log` — exit 0; N/A. 22. `sed -n '710,770p' test/scratch/native-merged/baseline-tests.log && git status --short` — exit 0; N/A. 23. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/native-merged.test.mjs > ../test/scratch/native-merged/merged-first.log 2>&1` — exit 1; 0 pass, 22 fail (new harness assertions repaired below). 24. `head -70 test/scratch/native-merged/merged-first.log` — exit 0; N/A. 25. `tail -16 test/scratch/native-merged/merged-second.log && rg -n -A 35 '^not ok' test/scratch/native-merged/merged-second.log | head -200` — exit 0; N/A. 26. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/native-merged.test.mjs > ../test/scratch/native-merged/merged-second.log 2>&1` — exit 1; 21 pass, 1 fail (fixture HTTP routing repaired below). 27. `tail -16 test/scratch/native-merged/merged-third.log && rg -n -A 28 '^not ok' test/scratch/native-merged/merged-third.log && cat test/scratch/native-merged/{typecheck,i18n,build}.log && nl -ba web/src/native/client.ts | sed -n '202,245p' && nl -ba web/tests/native-ui.test.mjs | sed -n '29,40p'` — exit 0; N/A. 28. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/native-merged.test.mjs > ../test/scratch/native-merged/merged-third.log 2>&1` — exit 0; 23 pass, 0 fail, 2 TODO, 25 tests. 29. `npx --no-install tsc --noEmit > ../test/scratch/native-merged/typecheck.log 2>&1` — exit 0; typecheck: 1 pass, 0 fail. 30. `node scripts/i18n-check.mjs > ../test/scratch/native-merged/i18n.log 2>&1` — exit 1; 0 completed checks; 1 setup failure (TMPDIR unset; retry follows). 31. `npx --no-install vite build --outDir ../test/scratch/native-merged/dist > ../test/scratch/native-merged/build.log 2>&1` — exit 0; build: 1 pass, 0 fail; 1,366 modules; existing chunk-size warning. 32. `tail -16 test/scratch/native-merged/final-tests.log && cat test/scratch/native-merged/i18n-final.log && rg -n -A 16 '^not ok' test/scratch/native-merged/final-tests.log && nl -ba web/tests/native-ui.test.mjs | sed -n '21,28p' && git diff --stat && git status --short` — exit 0; N/A. 33. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/*.test.mjs > ../test/scratch/native-merged/final-tests.log 2>&1` — exit 1; 173 pass, 1 fail, 2 TODO, 176 tests. 34. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node scripts/i18n-check.mjs > ../test/scratch/native-merged/i18n-final.log 2>&1` — exit 1; 605 strings × 9 non-English languages; 126 missing entries (14/language); 9 failed language checks, 0 passed. 35. `cat web/scripts/i18n-check.mjs && nl -ba web/src/checkout.tsx | sed -n '170,230p' && nl -ba web/src/native/view.tsx | sed -n '78,91p' && git diff --check && wc -c web/tests/native-merged.test.mjs web/tests/fixtures/native-merged/*` — exit 0; N/A. 36. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node --test tests/native-merged.test.mjs > ../test/scratch/native-merged/merged-final.log 2>&1` — exit 0; 27 pass, 0 fail, 2 TODO, 29 tests. 37. `TMPDIR="$PWD/../test/scratch/native-merged/tmp" node scripts/i18n-check.mjs --list > ../test/scratch/native-merged/i18n-missing.json` — exit 0; --list diagnostic mode: exit 0; 126 missing entries across 9 languages; not a passing coverage check. 38. `node -e 'const fs = require("node:fs"); const x = JSON.parse(fs.readFileSync("test/scratch/native-merged/i18n-missing.json")); console.log(JSON.stringify({languages:Object.keys(x),missing:x.fr},null,2));' && tail -12 test/scratch/native-merged/merged-final.log` — exit 0; N/A. 39. `python3 test/scratch/native-merged/verify-deliverable.py` — exit 0; scope/result verification: 1 pass, 0 fail.