fix(contracts): fail public builds without VITE_BUILD_ID and record the local default (F-6, 13-15)

ENV_REGISTRY called VITE_BUILD_ID required with no default while every reader
fell back to local-build. Staging and production builds now fail without it;
local builds keep the placeholder, and the registry records that default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-26 00:32:54 +09:00
co-authored by Claude Opus 5.5
parent 9e616d3a06
commit 063375ed04
5 changed files with 47 additions and 3 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ import process from "node:process";
import {
DEPLOYMENT_TARGETS,
isDeploymentTarget,
PUBLIC_TARGETS,
type DeploymentTarget,
} from "../src/contracts/deployment-admission.ts";
import { runtimeConfigV2ArtifactSchema } from "../src/contracts/release-artifacts.ts";
@@ -64,7 +65,12 @@ export async function generateRuntimeConfig(
) {
draft["RELEASE_MANIFEST_URL"] = `${basePath}${manifestUrl.slice(1)}`;
}
const buildId = environment["VITE_BUILD_ID"] ?? "local-build";
// F-6. A public build without its own identity would ship the local
// placeholder; fail here instead of at admission.
if (PUBLIC_TARGETS.has(target) && !environment["VITE_BUILD_ID"]) {
throw new Error(`${profilePath}: a ${target} build requires VITE_BUILD_ID`);
}
const buildId = environment["VITE_BUILD_ID"] || "local-build";
const releaseId = environment["RELEASE_ID"] ?? "local-release";
draft["BUILD_ID"] = buildId;
draft["RELEASE_ID"] = releaseId;