Complete worker ABI and validation coverage

- Align shared-buffer layouts and native worker declarations.
- Complete runtime link and worker lifecycle contracts.
- Check fixture baselines before running parity suites.
This commit is contained in:
Chris Tate
2026-10-07 18:33:27 -05:00
parent 1643856e33
commit 0c3a3204ca
27 changed files with 303 additions and 59 deletions
+19
View File
@@ -4,9 +4,28 @@ import { readdirSync, readFileSync } from "node:fs";
import { dirname, relative, resolve } from "node:path";
import { fileURLToPath } from "node:url";
import { spawnSync } from "node:child_process";
import { allOrderEntries } from "./ts7-order-fixtures.mjs";
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..");
const baseline = JSON.parse(
readFileSync(resolve(repoRoot, "packages/compiler/test/ts7/baselines/order-parity.json"), "utf8"),
);
const missingBaselines = allOrderEntries(repoRoot)
.map((path) => relative(repoRoot, path).replaceAll("\\", "/"))
.filter((path) => !Object.hasOwn(baseline.entries, `<repo>/${path}`));
if (missingBaselines.length > 0) {
console.error(`Missing TypeScript preflight/order baselines:\n${missingBaselines.join("\n")}`);
console.error(
"Record the new fixtures with SCRIPTC_UPDATE_BASELINES=1 pnpm exec vitest run packages/compiler/test/ts7/order-parity.test.ts, review the diff, then run the affected parity batches before opening a PR.",
);
process.exit(1);
}
if (process.argv.includes("--baselines-only")) {
console.log("Every TypeScript preflight/order fixture has a recorded baseline.");
process.exit(0);
}
const ALLOWED_TYPESCRIPT5_IMPORTS = new Set([
"packages/compiler/src/frontend/comptime-node.ts",
"packages/compiler/src/frontend/ts7/world-check.ts",
+21
View File
@@ -0,0 +1,21 @@
import { globSync } from "node:fs";
import { join } from "node:path";
export function orderEntriesUnder(repoRoot, dir) {
return ["ts", "js", "mjs", "cjs"]
.flatMap((ext) => [
...globSync(join(repoRoot, dir, `*.${ext}`)),
...globSync(join(repoRoot, dir, `*/main.${ext}`)),
])
.sort();
}
export function allOrderEntries(repoRoot) {
return [
...orderEntriesUnder(repoRoot, "tests/corpus"),
...orderEntriesUnder(repoRoot, "tests/diagnostics"),
...orderEntriesUnder(repoRoot, "tests/fixtures/npm/cases"),
...globSync(join(repoRoot, "tests/fixtures/strictness/*/main.ts")).sort(),
...globSync(join(repoRoot, "tests/fixtures/node-types/*.ts")).sort(),
];
}