# body-precheck — IMDPicks native job bodies through IMD.fun's free `/requests/check` **Verdict: all 6 required cases passed the precheck.** Each got HTTP 200, `blockers: []`, `suggestions: []`, and a single planned stage `research-report`. **A 200 with no blockers is a precheck, not a paid admission.** No payment was sent, no job was opened, nothing was published, and no production system was written to. No defect turned up in `web/src/native/body.ts` within what this test covers (see §5). - Repository: https://github.com/identity-md-launches/goal-3534-imdpicks-critical-payment - **Commit tested: `40669c610dc527649625874cc0bca769ae6b1b2e`**, unmodified. It was cloned into a scratch directory, `npm ci` was run in `web/`, and nothing in the repo was edited. - Run date: 2026-11-29T07:45:01.051Z (the schedule load time). Node v24.22.1. - Game source: the site's own `loadGames()` from `web/src/games.tsx`, bundled and run in Node against ESPN's public scoreboard (`https://site.api.espn.com/apis/site/v2/sports//scoreboard?dates=…&limit=300`). It returned 181 upcoming games, with failed leagues = []. - Check endpoint: `POST https://api.imd.fun/requests/check`, sent from Node `fetch` on the server side. No `Origin` header was set; Node's fetch does not add one. **Nothing is simulated.** The ESPN feed, the body builder, the site's validators and the IMD.fun check all ran for real. The one artificial input is the case set itself: the follow-up question was written by the tester, and the feedback history was empty (`""`) because no saved backtest existed in a server-side run. ## 1. How the cases were built - **Pool.** Upcoming games from `loadGames()` that start more than 30 h after the run. That margin keeps every slip well clear of the site's delivery-lead cutoff. The pool was taken round-robin across leagues so that 5 and 14 games mix sports. The 1-game case is the first pool game, the 5-game case the first 5, and the 14-game case the first 14. - **Builder.** For each N in {1, 5, 14}: `nativeJobBody(games, "", "", "en")`, then `nativeJobBody(games, Q, "", "ja")`. Q is the Japanese follow-up question `日曜日のNFLの試合で、最も信頼できる勝敗予想はどれですか?けが人の情報も考慮してください。` - **Site checks.** Every body was also passed through the checks checkout.tsx runs before payment: - `validateNativeBody` (from `native/payment.ts`), which returns the byte length - `selectionIdOfBody(body) === jobBody(...).slipId` - `liveSlip`, which reports how many games are still eligible - **Request.** `{"action":"job.open","input":JSON.parse(body)}` was sent. For every case I confirmed that the bytes sent equal `{"action":"job.open","input":` + the exact body string + `}`. So the `input` is byte-for-byte the string that `payment.ts` would put on-chain via `stringToHex(body)`. - **Character counts.** "Objective chars" is the UTF-16 length (`String.length`), the unit both `body.ts` and the API's 8,000 limit use. For every case it equals the code-point count, because all the non-ASCII text is in the BMP. ### 14-game selection (the first 1 and first 5 are subsets) | # | key | league | label | start (UTC) | odds in feed | |---|---|---|---|---|---| | 1 | 1:401892825:401892825 | NHL | Ottawa Senators at Nashville Predators | 2026-11-30T18:00Z | no | | 2 | 6:401882792:401882792 | LaLiga | Getafe at Espanyol | 2026-11-30T20:00Z | yes | | 3 | 3:401910061:401910061 | NBA | Washington Wizards at Charlotte Hornets | 2026-12-01T00:00Z | no | | 4 | 2:401873094:401873094 | NFL | Carolina Panthers at Tampa Bay Buccaneers | 2026-12-01T01:15Z | yes | | 5 | 5:401879221:401879221 | Premier League | Ipswich Town at Coventry City | 2026-12-01T20:00Z | yes | | 6 | 8:401933719:401933719 | MLS | Philadelphia Union at New England Revolution | 2026-12-03T00:00Z | no | | 7 | 0:600062700:401936473 | UFC | Mateusz Rębecki vs Elves Brener | 2026-12-05T15:00Z | no | | 8 | 1:401892826:401892826 | NHL | Carolina Hurricanes at New York Rangers | 2026-12-01T00:00Z | no | | 9 | 6:401882698:401882698 | LaLiga | Real Madrid at Real Sociedad | 2026-12-02T18:00Z | yes | | 10 | 3:401910062:401910062 | NBA | Denver Nuggets at Detroit Pistons | 2026-12-01T00:00Z | no | | 11 | 2:401873096:401873096 | NFL | Kansas City Chiefs at Los Angeles Rams | 2026-12-04T01:15Z | yes | | 12 | 5:401879222:401879222 | Premier League | Crystal Palace at Chelsea | 2026-12-02T19:30Z | yes | | 13 | 8:401933716:401933716 | MLS | Portland Timbers at FC Dallas | 2026-12-03T01:00Z | no | | 14 | 0:600062700:401936244 | UFC | Gabriel Santos vs Luke Riley | 2026-12-05T15:00Z | no | ## 2. Observed results — the 6 required cases Column notes: - *body SHA-256* is the hash of the `nativeJobBody` string. - *sent SHA-256* is the hash of the exact UTF-8 request body POSTed. - *site checks* are validateNativeBody bytes / selectionId match / liveSlip eligible. | case | games | language | objective chars | body UTF-8 bytes | sent bytes | body SHA-256 | sent SHA-256 | HTTP | blockers | suggestions | facts | planned stages | declared outputs | site checks | result | |---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---| | n1-en | 1 | en | 3487 | 3815 | 3845 | `4bfc226cc2d7228338b2da6a2da54a0835012d1a8b441ea564416225be9c76f6` | `886ca06c11b1c7780fd526f3a07f39468e1bf7424985ed9908ef4aff596c1bf4` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=unknown | stage 0: research-report ("Research and write the report, with sources") | report, report-json | 3815 / true / 1 of 1 | **pass** (precheck only) | | n1-ja | 1 | ja + question | 3989 | 4488 | 4518 | `a453d55c3e26c0e1d482806fd4862533536d4aefc17da8a83ae71d3a53da9e60` | `9cfe010fff385e969883a0fea5a5b83b2e83687d38efa18b237f6898ab87b0e7` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=stated | stage 0: research-report ("Research and write the report, with sources") | report, report-json, report-en | 4488 / true / 1 of 1 | **pass** (precheck only) | | n5-en | 5 | en | 4518 | 4914 | 4944 | `12d9ea5a94e1d7d1fa87d3a8e827b00dbde52033ebe24c88ccc76d0e718caea2` | `cd66c30abd044020ec007359b2ccb2991a8181e3006bae2189fa8c60f03fbe64` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=stated | stage 0: research-report ("Research and write the report, with sources") | report, report-json | 4914 / true / 5 of 5 | **pass** (precheck only) | | n5-ja | 5 | ja + question | 5020 | 5587 | 5617 | `91cd14c21270a60a4785b1c04443ce2b005b38490e3a1906b16e895c3571721f` | `8230cbf6db9475d019b13aa4bc697d645b985922195586047a6a06d360ea6657` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=stated | stage 0: research-report ("Research and write the report, with sources") | report, report-json, report-en | 5587 / true / 5 of 5 | **pass** (precheck only) | | n14-en | 14 | en | 6520 | 7055 | 7085 | `3183868a68ccbf4f5a443c0850e4dc49eefd55f58955f86e8c9c64d2ece6bf0f` | `36e1143858b867ff8aacb5de83069be4a892a7f14f9fa59716c8ea7c2298654c` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=stated | stage 0: research-report ("Research and write the report, with sources") | report, report-json | 7055 / true / 14 of 14 | **pass** (precheck only) | | n14-ja | 14 | ja + question | 7022 | 7728 | 7758 | `f54fda9a5e690cedb7ec4ba5fd601ff5d3dfa3e25ff65c2badc4eba54627515d` | `52476602ba5e3866ca108f4ffde0c2556cd02c1bb5b7fe8ee51be87f5ef946ee` | 200 | [] | [] | report_question=stated, report_period=unknown, report_sources=stated, report_format=stated | stage 0: research-report ("Research and write the report, with sources") | report, report-json, report-en | 7728 / true / 14 of 14 | **pass** (precheck only) | **Fields and outputs.** Every body carried `skill:"research-report"`, `minCitations:5` and `github:false`. - The English bodies declared `report` → `artifacts/report.md` (text/markdown) and `report-json` → `artifacts/report.json` (application/json). - The Japanese bodies also declared `report-en` → `artifacts/report.en.md` (text/markdown). - The check raised no objection to any of these: no 400, no blocker, no suggestion. **There is no objection to quote.** - The negative controls in §3 show what "accepted" means here. The check *does* validate output paths and names, the type of `minCitations` and the objective length. But it also returns 200 for `github:true` and for an unknown field. So a 200 shows that `github:false` is schema-valid; it does not show that IMD.fun honours it. **Facts are judged, not deterministic.** `report_period` came back `unknown` everywhere, with no suggestion attached; the body gives event start times but no explicit "period". `report_format` was `unknown` for n1-en and `stated` for the other five, even though every body names the same output files. The judge appears to be non-deterministic or wording-sensitive. Since it is `required:false` and raised no blocker, this is not a defect. **Extra stress case (not required).** 14 games, `ja`, and a 280-character question (`"けが"×140`, exactly QUESTION_MAX): - Result: objective 7114 chars, body 8308 B, sent SHA-256 `b9844615ff2530248059aa5c1c23fd0b27eb44413203d993e87159838b0c4761`, HTTP 200, blockers [], suggestions [] → **pass**. - A 281-character question is rejected locally with `Follow-up question exceeds 280 characters; shorten it and try again.` (as designed). - Headroom left: about 886 chars under the 8,000-char objective cap and about 8 KB under the 16,384-byte body cap. The 14-game selection used here was `pool.slice(0,14)`, a different 14 games from the table above. ## 3. Negative controls (not required; show what the check enforces) Each control altered the n1-en body. All were sent to the same free check. | control | HTTP | sent SHA-256 | response | |---|---|---|---| | badOutputPath | 400 | `10e448f59455ac324756cfc7322d16505d58628e25bc30110bd891677f727152` | `{"error":"invalid_request","detail":"outputs.0.path: must be a normalized relative path"}` | | dupOutputName | 200 | `a46d2b68109885d8179fec041710ebd201eeb52bf49e9209f518a056a4f132f7` | blockers [{"code":"invalid_artifacts","detail":"output names and paths must be unique"}]; plan none; kind report | | minCitationsString | 400 | `16ee62028665033899835782b9478cba4dc50d77771706f800deb385e46f19f0` | `{"error":"invalid_request","detail":"minCitations: Invalid input: expected number, received string"}` | | githubTrue | 200 | `70b63ac5fc87a86791d5144b88f0b97ff1832246885ee390b1cf2c14967b2e24` | blockers []; plan stage 0: research-report ("Research and write the report, with sources"); kind report | | unknownField | 200 | `5e1c574e327097ba16e2a5ad929136aa2b9b5c17734f4191a4d1246e5826785a` | blockers []; plan stage 0: research-report ("Research and write the report, with sources"); kind report | | noSkill | 200 | `6d7c523a62c8ac792151f2b96b3f5bdab1b4b1899b6a5ed4a2a0a00de9daf480` | blockers [{"code":"missing_plan","detail":"say what to build: a skill (\"build-website\" for a website, \"research-report\" for a written report), a template (\"research\" or \"audit\"), steps, or the Solidity contracts to write in \"contracts\""}]; plan none; kind other | | objectiveTooLong | 400 | `0c90839b428334e05d39081b445eb74734da5803e31f81869edf525be948b208` | `{"error":"invalid_request","detail":"objective: Too big: expected string to have <=8000 characters"}` | ## 4. Commands to repeat ```bash mkdir -p test/scratch && cd test/scratch git clone https://github.com/identity-md-launches/goal-3534-imdpicks-critical-payment repo cd repo && git checkout 40669c610dc527649625874cc0bca769ae6b1b2e && cd web && npm ci && cd ../.. mkdir h # put entry.ts, run.mjs, stress.mjs (below) here cd repo/web && npx esbuild ../../h/entry.ts --bundle --platform=node --format=esm --outfile=../../h/bundle.mjs \ --loader:.css=empty --loader:.woff2=empty --loader:.woff=empty --loader:.ttf=empty && cd ../../h NODE_USE_ENV_PROXY=1 node run.mjs out # NODE_USE_ENV_PROXY only needed behind an HTTP proxy NODE_USE_ENV_PROXY=1 node stress.mjs # optional stress case; reads out/schedule.json ``` `entry.ts`: ```ts export { nativeJobBody } from "../repo/web/src/native/body"; export { loadGames, LEAGUES, liveSlip } from "../repo/web/src/games"; export { validateNativeBody } from "../repo/web/src/native/payment"; export { selectionIdOfBody, jobBody } from "../repo/web/src/orders"; export { recheck } from "../repo/web/src/engine/deadline"; ``` `run.mjs`: ```js // Usage: NODE_USE_ENV_PROXY=1 node run.mjs import { createHash } from "node:crypto"; import { writeFileSync, mkdirSync } from "node:fs"; import * as m from "./bundle.mjs"; const out = process.argv[2] || "out"; mkdirSync(out, { recursive: true }); const sha = (s) => createHash("sha256").update(Buffer.from(s, "utf8")).digest("hex"); const ac = new AbortController(); const sched = await m.loadGames(ac.signal); writeFileSync(`${out}/schedule.json`, JSON.stringify(sched, null, 1)); console.log("loaded", sched.events.length, "upcoming; failed leagues:", sched.failed, "at", new Date(sched.at).toISOString()); // Pool: upcoming games starting >= 30 h from now (well past any delivery lead), distinct keys, spread across leagues. const pool = sched.events.filter((g) => Date.parse(g.start) - Date.now() > 30 * 3600e3); const byLeague = {}; for (const g of pool) (byLeague[g.league.name] ??= []).push(g); const rr = []; const lists = Object.values(byLeague); for (let i = 0; rr.length < 14 && lists.some((l) => l[i]); i++) for (const l of lists) if (l[i] && rr.length < 14) rr.push(l[i]); const QUESTION_JA = "日曜日のNFLの試合で、最も信頼できる勝敗予想はどれですか?けが人の情報も考慮してください。"; const cases = []; for (const n of [1, 5, 14]) for (const [lang, q] of [["en", ""], ["ja", QUESTION_JA]]) cases.push({ id: `n${n}-${lang}`, n, lang, q }); const results = []; async function check(input) { const sent = JSON.stringify({ action: "job.open", input }); const r = await fetch("https://api.imd.fun/requests/check", { method: "POST", headers: { "content-type": "application/json" }, body: sent }); const text = await r.text(); let json = null; try { json = JSON.parse(text); } catch {} return { sent, sentSha256: sha(sent), sentBytes: Buffer.byteLength(sent), status: r.status, text, json }; } for (const c of cases) { const games = rr.slice(0, c.n); const res = { ...c, games: games.map((g) => ({ key: g.key, league: g.league.name, label: g.label, start: g.start, odds: !!g.odds })) }; try { res.eligible = m.liveSlip(games).length; const body = m.nativeJobBody(games, c.q, "", c.lang); res.validateNativeBody = m.validateNativeBody(body); res.selectionIdMatches = m.selectionIdOfBody(body) === m.jobBody(games, c.q, "", c.lang).slipId; const input = JSON.parse(body); Object.assign(res, { objectiveChars: input.objective.length, objectiveCodePoints: [...input.objective].length, bodyBytes: Buffer.byteLength(body), bodySha256: sha(body), outputs: input.outputs, skill: input.skill, minCitations: input.minCitations, github: input.github }); writeFileSync(`${out}/${c.id}.body.json`, body); const ck = await check(input); writeFileSync(`${out}/${c.id}.sent.json`, ck.sent); writeFileSync(`${out}/${c.id}.response.json`, ck.text); Object.assign(res, { sentSha256: ck.sentSha256, sentBytes: ck.sentBytes, status: ck.status, response: ck.json ?? ck.text }); } catch (e) { res.error = String(e?.stack || e); } results.push(res); console.log(c.id, res.status, res.objectiveChars, res.bodyBytes, res.sentSha256, "blockers:", JSON.stringify(res.response?.blockers), res.error ?? ""); } // Negative controls: does the check judge outputs/fields at all? const base = JSON.parse(m.nativeJobBody(rr.slice(0, 1), "", "", "en")); const controls = { badOutputPath: { ...base, outputs: [{ name: "report", path: "../etc/passwd", mediaType: "text/markdown" }] }, dupOutputName: { ...base, outputs: [base.outputs[0], { ...base.outputs[1], name: "report" }] }, minCitationsString: { ...base, minCitations: "five" }, githubTrue: { ...base, github: true }, unknownField: { ...base, zzzUnknown: 1 }, noSkill: { objective: base.objective, outputs: base.outputs }, objectiveTooLong: { ...base, objective: base.objective + " x".repeat(5000) }, }; for (const [k, input] of Object.entries(controls)) { const ck = await check(input); writeFileSync(`${out}/control-${k}.response.json`, ck.text); results.push({ id: `control-${k}`, sentSha256: ck.sentSha256, sentBytes: ck.sentBytes, status: ck.status, response: ck.json ?? ck.text }); console.log("control", k, ck.status, ck.text.slice(0, 400)); } writeFileSync(`${out}/results.json`, JSON.stringify(results, null, 1)); ``` `stress.mjs`: ```js import { createHash } from "node:crypto"; import { readFileSync, writeFileSync } from "node:fs"; import * as m from "./bundle.mjs"; const sched = JSON.parse(readFileSync("out/schedule.json","utf8")); const pool = sched.events.filter((g) => Date.parse(g.start) - Date.now() > 30 * 3600e3); const games = pool.slice(0, 14); const q = "けが".repeat(140); // 280 UTF-16 units = QUESTION_MAX const body = m.nativeJobBody(games, q, "", "ja"); const input = JSON.parse(body); const sent = JSON.stringify({ action: "job.open", input }); const r = await fetch("https://api.imd.fun/requests/check", { method: "POST", headers: { "content-type": "application/json" }, body: sent }); const t = await r.text(); writeFileSync("out/stress.response.json", t); console.log("stress", input.objective.length, Buffer.byteLength(body), createHash("sha256").update(sent).digest("hex"), r.status, t.slice(0,300)); try { m.nativeJobBody(games, q + "x", "", "ja"); } catch (e) { console.log("281 chars:", e.message); } ``` **Results will differ on a re-run.** ESPN's schedule, odds and the 30 h window change over time, so a re-run will select different games and produce different hashes. The per-case body/sent/response files are written to `out/`. ## 5. Defects found **None in `web/src/native/body.ts` or the call path exercised.** Every body: - was produced without an exception - passed `validateNativeBody`, with byte counts equal to the computed UTF-8 length - round-tripped `selectionIdOfBody` to the legacy `jobBody` slip id - kept every selected event (`liveSlip` eligible = N) - passed IMD.fun's check with no blockers or suggestions Three observations are not defects in this code: - **`report_format` is judged inconsistently.** It was `unknown` for n1-en but `stated` for an otherwise identically worded n5-en (§2). That is IMD.fun's judge, not the site. - **The check does not confirm `github:false`.** It accepts `github:true` and unknown fields with 200, so it cannot confirm that `github:false` is honoured downstream. Only the admitted job would show that. - **Feedback history can still trip the length limit.** `body.ts` lines 91–98 throw rather than truncate when the objective exceeds 8,000 chars or the body exceeds 16,384 B. Feedback history (`getFeedback()`, `body.ts` line 63) is included whole and was empty in this test. A long saved history could therefore make a 14-game slip unbuyable, with a clear error. This is by design (the comment on line 55 says "text is never truncated"), but it was not exercised. ## 6. What this test does not prove - **No paid admission.** It does not show that the Intake on Ethereum Mainnet (`0xa43e6f75ee006411f79ac1c84120606c2330de82`, action `job.open@job-1`, IMD `0xD34a99Bc0f67aE1bbd63C660e6d0b0dd03E263B7`) would admit these bodies when paid. No approve, `request`, signature or transaction was made, no price or allowance was read, and no job id exists for any case. - **No job run.** It does not show that a Swarm job runs, produces `report.md`/`report.json`/`report.en.md`, meets `minCitations: 5`, or that the site later finds, validates or displays those outputs. - **Not the browser path.** It does not show that the browser sends the same bytes. Origin/CORS behaviour, wallet encoding and the in-app question box (`setQuestion` slices to 280) were not exercised; only the shared builder and validators were run in Node. - **Only one game sample.** Other leagues, tennis or other individual-sport events, odds details containing unusual characters, or non-empty feedback were not covered. The selection came from one ESPN snapshot. - **Only one language besides English.** Japanese was the only non-English report language tested; the other entries in `REPORT_LANGS` were not. - **Not stable over time.** The check's judgement (facts, suggestions) is server-side and may change; results are as of 2026-11-29T07:45:01.051Z.