fix: declare the compiled contract set in the dev release manifest
`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>
This commit is contained in:
co-authored by
Claude Opus 5
parent
d84b57bb3f
commit
b75c9d0956
@@ -121,3 +121,21 @@ writeFileSync(SOURCE_RECORD, `${JSON.stringify(record, null, 2)}\n`);
|
||||
console.log(
|
||||
`Generated from ${record.packageId}@${record.version} (${record.sourceRevision}), ${record.operationIds.length} operations.`,
|
||||
);
|
||||
|
||||
// 재생성은 매번 package digest를 바꾼다. `pnpm dev`가 그대로 서빙하는
|
||||
// `public/release-manifest.json`은 build가 컴파일한 contract set을 그대로
|
||||
// 선언해야 하고(§5.5, `verifyContractSet`는 MOCK 모드에서도 무조건 돈다),
|
||||
// 그러지 않으면 dev 부팅이 CONTRACT_SET_PACKAGE_MISSING으로 닫힌다.
|
||||
// 방금 쓴 canonical-source.json을 읽어야 하므로 정적 import가 아닌 동적
|
||||
// import로 불러온다.
|
||||
const { refreshDevReleaseManifestContractSet, DEV_RELEASE_MANIFEST_PATH } =
|
||||
await import("./lib/dev-release-manifest.ts");
|
||||
const refreshed = await refreshDevReleaseManifestContractSet();
|
||||
console.log(
|
||||
`${refreshed.changed ? "Updated" : "Already in sync"}: ${DEV_RELEASE_MANIFEST_PATH} contractSet ` +
|
||||
`(${refreshed.contractSet.packages.length} package(s), ${refreshed.contractSet.setDigest})`,
|
||||
);
|
||||
|
||||
// contract를 다시 만들지 않아도 구성된 set은 바뀔 수 있다
|
||||
// (`installed-contract-contributions.ts`에 기여가 추가/제거되는 경우).
|
||||
// 그 경로는 여기서 못 잡으므로 `check:dev-release-manifest` 게이트가 잡는다.
|
||||
|
||||
Reference in New Issue
Block a user