Improve execution preflight diagnostics
Some checks failed
M6 deployable RC / quick (push) Has been cancelled
M6 deployable RC / chromium (push) Has been cancelled
M6 deployable RC / release (push) Has been cancelled

This commit is contained in:
mes123456
2026-08-24 17:04:16 -04:00
parent 5c8cfd1a8c
commit 603a5a92f2
6 changed files with 240 additions and 3 deletions

View File

@@ -4,13 +4,21 @@ import path from "node:path";
import { fileURLToPath } from "node:url";
import crypto from "node:crypto";
import { spawnSync } from "node:child_process";
import factory from "../../web/app/src/vendor/blender/web_engine.js";
import { readIndexedTask, verifyTaskIndex } from "./task-context-lib.mjs";
import { collectGeneratedGapPreflight, formatGeneratedGapPreflight } from "./generated-gap-preflight.mjs";
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
const task = process.argv[process.argv.indexOf("--task") + 1];
const taskArgument = process.argv.indexOf("--task");
const task = taskArgument >= 0 ? process.argv[taskArgument + 1] : undefined;
verifyTaskIndex();
const entry = readIndexedTask(task); assert.ok(entry); assert.ok(["active", "completed"].includes(entry.state));
const entry = readIndexedTask(task);
const preflightIssues = collectGeneratedGapPreflight({ root, task, entry });
if (preflightIssues.length !== 0) {
process.stderr.write(`${formatGeneratedGapPreflight(task, preflightIssues)}\n`);
process.exitCode = 2;
process.exit();
}
const wasmBinary = fs.readFileSync(path.join(root, "web/app/src/vendor/blender/web_engine.wasm"));
const factory = async (options) => (await import("../../web/app/src/vendor/blender/web_engine.js")).default(options);
const open = (engine, handle, input) => { const pointer = engine._malloc(input.byteLength); engine.HEAPU8.set(input, pointer); try { assert.equal(engine._web_engine_open_blend(handle, pointer, input.byteLength), 0, engine.UTF8ToString(engine._web_engine_last_error_message())); } finally { engine._free(pointer); } };
const output = (engine, handle, fn, owned = false) => { const data = engine._malloc(4); const length = engine._malloc(4); try { assert.equal(fn(handle, data, length), 0, engine.UTF8ToString(engine._web_engine_last_error_message())); const pointer = engine.HEAPU32[data >>> 2]; const size = engine.HEAPU32[length >>> 2]; const result = engine.HEAPU8.slice(pointer, pointer + size); if (owned) engine._web_engine_free_buffer(pointer); return result; } finally { engine._free(data); engine._free(length); } };
const snapshot = (engine, handle) => JSON.parse(new TextDecoder().decode(output(engine, handle, engine._web_engine_get_scene_snapshot)));