From edf44a2253fe487ae3573a48dd1fadf32f37794d Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Sat, 26 Sep 2026 00:05:06 +0900 Subject: [PATCH] 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 --- README.md | 4 ++-- scripts/test-sample-removal.ts | 22 ++++++++++------------ tests/unit/deployment-admission.test.ts | 7 +++++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index ba496cf9..afa71002 100644 --- a/README.md +++ b/README.md @@ -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 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 -`BUILD_ID: local-build` and `RELEASE_ID: local-release`; nothing checks that -yet. +`BUILD_ID: local-build` and `RELEASE_ID: local-release`; +`tests/unit/deployment-admission.test.ts` fails when the two differ. Build and deploy variables, lowest precedence first: diff --git a/scripts/test-sample-removal.ts b/scripts/test-sample-removal.ts index 8113f6c1..55d6c10d 100644 --- a/scripts/test-sample-removal.ts +++ b/scripts/test-sample-removal.ts @@ -244,18 +244,16 @@ try { // Runtime profiles are product configuration. Once the feature is physically // removed, its override key must disappear too or the built config still - // advertises a source capability that no longer exists. - for (const profile of [ - "local", - "development", - "staging", - "production", - ] as const) { - const profilePath = path.join( - fixtureRoot, - "config/runtime", - `${profile}.json`, - ); + // advertises a source capability that no longer exists. public/config.json + // is the local profile `dev` serves and has to stay equal to it (F-5). + for (const configPath of [ + "config/runtime/local.json", + "config/runtime/development.json", + "config/runtime/staging.json", + "config/runtime/production.json", + "public/config.json", + ]) { + const profilePath = path.join(fixtureRoot, configPath); const runtimeConfig = JSON.parse( await readFile(profilePath, "utf8"), ) as { diff --git a/tests/unit/deployment-admission.test.ts b/tests/unit/deployment-admission.test.ts index 2d3c57cb..4cff7b37 100644 --- a/tests/unit/deployment-admission.test.ts +++ b/tests/unit/deployment-admission.test.ts @@ -204,6 +204,13 @@ describe("runtime config profiles", () => { ).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 // variables. A staging profile left in place for a production release has to // stop the release, whatever the built document happens to say.