Skip to content

Commit ded343a

Browse files
committed
fix(webapp): lock the per-organisation snapshot dial on the global flags page
The per-organisation dial is read from the organisation blob only, and a global save refuses it outright, but the global page still rendered an editable control for it. The only outcome of using that control was a rejected save. It now renders read-only, matching every other organisation-scoped flag.
1 parent 41b883a commit ded343a

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

apps/webapp/app/v3/featureFlags.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ export const GLOBAL_LOCKED_FLAGS: FeatureFlagKey[] = [
181181
FEATURE_FLAG.runOpsMintKindFlippedAt,
182182
FEATURE_FLAG.runOpsMintShardSetPrev,
183183
FEATURE_FLAG.runOpsMintShardSetFlippedAt,
184+
// Read from the org blob only, and refused outright on a global save, so an editable control here
185+
// would offer a setting whose only outcome is a 400.
186+
FEATURE_FLAG.snapshotStoreOrgMode,
184187
];
185188

186189
// Flags that are read-only on the org-level dialog.

apps/webapp/test/snapshotStoreFlagGuard.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
globalOnlySnapshotStoreFlagError,
44
snapshotStoreFlagSaveError,
55
} from "~/v3/snapshotStoreFlagGuard.server";
6+
import { FEATURE_FLAG, GLOBAL_LOCKED_FLAGS } from "~/v3/featureFlags";
67

78
describe("snapshotStoreFlagSaveError", () => {
89
it("refuses a flip past off when no host is configured", () => {
@@ -80,3 +81,19 @@ describe("globalOnlySnapshotStoreFlagError", () => {
8081
expect(globalOnlySnapshotStoreFlagError({ runOpsMintKind: "cuid" })).toBeUndefined();
8182
});
8283
});
84+
85+
describe("the global page and the save guard agree", () => {
86+
it("locks every flag the global save path refuses", () => {
87+
// A flag the guard rejects but the page leaves editable renders a control whose only outcome is
88+
// a 400. The convention above GLOBAL_LOCKED_FLAGS states this; the assertion enforces it.
89+
for (const key of [FEATURE_FLAG.snapshotStoreOrgMode] as const) {
90+
expect(globalOnlySnapshotStoreFlagError({ [key]: "dual-write" })).toBeDefined();
91+
expect(GLOBAL_LOCKED_FLAGS).toContain(key);
92+
}
93+
});
94+
95+
it("leaves the deployment-wide dial editable on the global page", () => {
96+
expect(globalOnlySnapshotStoreFlagError({ snapshotStoreMode: "dual-write" })).toBeUndefined();
97+
expect(GLOBAL_LOCKED_FLAGS).not.toContain(FEATURE_FLAG.snapshotStoreMode);
98+
});
99+
});

0 commit comments

Comments
 (0)