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:
co-authored by
Claude Opus 5.5
parent
4d17259037
commit
edf44a2253
@@ -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:
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user