fix(config): keep public/config.json equal to the local profile (F-5, 13-15)

public/config.json is the copy dev serves and nothing compared it with
config/runtime/local.json. A unit test now requires it to equal what a local
build writes, and sample removal drops the feature override from it too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DongHyeonka
2026-09-26 00:05:06 +09:00
co-authored by Claude Opus 5.5
parent 4d17259037
commit edf44a2253
3 changed files with 19 additions and 14 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ build` writes `dist/config.json` from the selected profile
(`scripts/generate-runtime-config.ts`). `public/config.json` is only the local (`scripts/generate-runtime-config.ts`). `public/config.json` is only the local
profile for `corepack pnpm dev`; the build replaces it, so settings put there profile for `corepack pnpm dev`; the build replaces it, so settings put there
never reach a deployment. Keep it equal to `config/runtime/local.json` plus never reach a deployment. Keep it equal to `config/runtime/local.json` plus
`BUILD_ID: local-build` and `RELEASE_ID: local-release`; nothing checks that `BUILD_ID: local-build` and `RELEASE_ID: local-release`;
yet. `tests/unit/deployment-admission.test.ts` fails when the two differ.
Build and deploy variables, lowest precedence first: Build and deploy variables, lowest precedence first:
+10 -12
View File
@@ -244,18 +244,16 @@ try {
// Runtime profiles are product configuration. Once the feature is physically // Runtime profiles are product configuration. Once the feature is physically
// removed, its override key must disappear too or the built config still // removed, its override key must disappear too or the built config still
// advertises a source capability that no longer exists. // advertises a source capability that no longer exists. public/config.json
for (const profile of [ // is the local profile `dev` serves and has to stay equal to it (F-5).
"local", for (const configPath of [
"development", "config/runtime/local.json",
"staging", "config/runtime/development.json",
"production", "config/runtime/staging.json",
] as const) { "config/runtime/production.json",
const profilePath = path.join( "public/config.json",
fixtureRoot, ]) {
"config/runtime", const profilePath = path.join(fixtureRoot, configPath);
`${profile}.json`,
);
const runtimeConfig = JSON.parse( const runtimeConfig = JSON.parse(
await readFile(profilePath, "utf8"), await readFile(profilePath, "utf8"),
) as { ) as {
+7
View File
@@ -204,6 +204,13 @@ describe("runtime config profiles", () => {
).toBeGreaterThan(0); ).toBeGreaterThan(0);
}); });
// F-5 (13-15). `corepack pnpm dev` serves public/config.json while every
// build writes the local profile instead, so the two copies must not drift.
it("keeps public/config.json equal to what a local build writes", async () => {
const served: unknown = JSON.parse(await readFile("public/config.json", "utf8"));
expect(served).toEqual(await generateRuntimeConfig("local", {}));
});
// 13-01: the build profile and the admission target are two repository // 13-01: the build profile and the admission target are two repository
// variables. A staging profile left in place for a production release has to // variables. A staging profile left in place for a production release has to
// stop the release, whatever the built document happens to say. // stop the release, whatever the built document happens to say.