`corepack pnpm dev` did not boot. Plain `vite` serves `public/release-manifest.json` verbatim, and that hand-maintained fixture still declared `"packages": []` after the first real contract contribution was registered. `verifyContractSet` runs unconditionally at boot — before any adapter is chosen, so in the default `MOCK` mode as much as in `HTTP` — saw the build had compiled `@tech-log/studio-contract` and failed closed with `CONTRACT_SET_PACKAGE_MISSING`. Production builds were never affected: `scripts/generate-build-manifest.ts` derives `dist/release-manifest.json`'s block from the same composed set. Editing the fixture by hand is not the fix — it had already gone stale twice, once when the package first appeared and once when the contract moved 2.0.0 -> 3.0.0, because every regeneration changes the package digest. So `generate:tech-log-contract` now refreshes the block itself, as its last step and through a dynamic import so it reads the canonical source it just wrote. `generate:dev-release-manifest` does the same refresh on its own. The composed set can also change without the contract being regenerated — a contribution added to or removed from `installed-contract-contributions.ts` moves it. Tying the refresh to contract generation is therefore necessary but not sufficient; the CI gate that follows is what closes that half. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/**
|
|
* Gate: the hand-maintained dev fixture `public/release-manifest.json` must
|
|
* declare the same `contractSet` the build compiles.
|
|
*
|
|
* `corepack pnpm dev` serves that file verbatim, and `verifyContractSet` runs
|
|
* unconditionally at boot, so a stale fixture is a hard boot failure of
|
|
* `pnpm dev` in the default `MOCK` mode — not an `HTTP`-mode caveat. Nothing
|
|
* else in the gate set reads `public/*.json`, which is how a completely broken
|
|
* `pnpm dev` shipped with every static check green.
|
|
*
|
|
* `--write` refreshes the block instead of failing; that is what
|
|
* `corepack pnpm generate:tech-log-contract` calls.
|
|
*/
|
|
import process from "node:process";
|
|
|
|
import {
|
|
DEV_RELEASE_MANIFEST_PATH,
|
|
checkDevReleaseManifestContractSet,
|
|
refreshDevReleaseManifestContractSet,
|
|
} from "./lib/dev-release-manifest.ts";
|
|
|
|
const write = process.argv.includes("--write");
|
|
|
|
if (write) {
|
|
const { changed, contractSet } = await refreshDevReleaseManifestContractSet();
|
|
process.stdout.write(
|
|
`${changed ? "Updated" : "Already in sync"}: ${DEV_RELEASE_MANIFEST_PATH} contractSet ` +
|
|
`(${contractSet.packages.length} package(s), ${contractSet.setDigest})\n`,
|
|
);
|
|
} else {
|
|
const failures = await checkDevReleaseManifestContractSet();
|
|
if (failures.length > 0) {
|
|
process.stderr.write(
|
|
`dev release manifest drift:\n- ${failures.join("\n- ")}\n` +
|
|
`Run: corepack pnpm generate:dev-release-manifest\n`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
process.stdout.write(
|
|
`${DEV_RELEASE_MANIFEST_PATH} contractSet matches the compiled contract set.\n`,
|
|
);
|
|
}
|