import test from "node:test"; import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import { createHash } from "node:crypto"; import { readOnnxMetadata } from "../src/platform/loader/metadata.js"; const root = new URL("../public/robots/apollo/", import.meta.url); test("Apollo v0.6 pins upright v3 model_9999 and matches its pose/action contract", async () => { const config = JSON.parse(await readFile(new URL("robot.json", root))); const manifest = JSON.parse( await readFile(new URL("source-manifest.json", root)), ); const policy = await readFile(new URL("policies/walk.onnx", root)); const meta = readOnnxMetadata(policy); assert.ok( manifest.checkpoint.endsWith( "/apollo_flat_upright_v3/2026-11-02_17-39-21_apollo_upright_v3/model_9999.pt", ), ); assert.equal( createHash("sha256").update(policy).digest("hex"), manifest.files.find((f) => f.file === "policies/walk.onnx").sha256, ); assert.deepEqual(config.joints.groups.policy, meta.joint_names.split(",")); assert.equal(config.joints.groups.policy.length, 32); assert.deepEqual( config.actions.map((a) => a.scale), meta.action_scale.split(",").map(Number), ); meta.default_joint_pos .split(",") .map(Number) .forEach((value, i) => { assert.ok( Math.abs( config.joints.defaults[config.joints.groups.policy[i]] - value, ) <= 0.000501, ); }); assert.equal(config.joints.defaults.l_knee_fe, 0.35); assert.equal(config.joints.defaults.r_knee_fe, 0.35); assert.ok(Math.abs(config.base.spawn.pos[2] - 1.1008385) < 1e-7); assert.equal(config.termination.min_height, 0.98); assert.deepEqual(config.sim, { timestep: 0.005, decimation: 4 }); });