feat(desktop): enable community rail by default (#1902)

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Wes
2026-07-15 08:36:47 -07:00
committed by GitHub
co-authored by Pinky
parent abfe78aafb
commit 55a46b063e
6 changed files with 21 additions and 4 deletions
+1
View File
@@ -13,6 +13,7 @@ const FeatureDefinitionSchema = z.object({
id: z.string().min(1),
name: z.string().min(1),
description: z.string(),
defaultEnabled: z.boolean().optional(),
platforms: z.array(FeaturePlatformSchema).optional(),
});
@@ -12,6 +12,17 @@ describe("resolveEnabled (preview-only)", () => {
assert.equal(resolveEnabled("workflows", { workflows: true }), true);
});
it("uses an enabled manifest default when no override exists", () => {
assert.equal(resolveEnabled("workspaceRail", {}, true), true);
});
it("lets an explicit opt-out override an enabled default", () => {
assert.equal(
resolveEnabled("workspaceRail", { workspaceRail: false }, true),
false,
);
});
it("returns false when user explicitly opts out", () => {
assert.equal(resolveEnabled("workflows", { workflows: false }), false);
});
@@ -7,11 +7,13 @@
* (see `useFeatureEnabled`). Once you're inside `resolveEnabled`, the
* feature IS in the manifest — preview by definition.
*
* Returns true only if the user has explicitly opted in via overrides.
* An explicit user override wins; otherwise the feature's manifest default is
* used (false when omitted).
*/
export function resolveEnabled(
featureId: string,
overrides: Record<string, boolean>,
defaultEnabled = false,
): boolean {
return overrides[featureId] === true;
return overrides[featureId] ?? defaultEnabled;
}
+2
View File
@@ -12,6 +12,8 @@ export interface FeatureDefinition {
id: string;
name: string;
description: string;
/** Whether the preview is enabled when the user has not chosen an override */
defaultEnabled?: boolean;
/** If omitted, feature is available on all platforms */
platforms?: FeaturePlatform[];
}
@@ -82,7 +82,7 @@ export function useFeatureSnapshot(): Record<string, boolean> {
*
* The manifest (`preview-features.json`) lists ONLY preview features:
*
* - in manifest (preview): true only if the user opted in via overrides
* - in manifest (preview): explicit user override, then manifest default (off if omitted)
* - NOT in manifest (stable): always true (fail-open)
*
* Membership in the manifest signals "this needs gating"; absence means
@@ -102,7 +102,7 @@ export function useFeatureEnabled(featureId: string): boolean {
return true;
}
return resolveEnabled(featureId, overrides);
return resolveEnabled(featureId, overrides, feature.defaultEnabled);
}
/**
+1
View File
@@ -28,6 +28,7 @@
{
"id": "workspaceRail",
"name": "Community Rail",
"defaultEnabled": true,
"description": "Far-left rail for switching communities with cross-community unread indicators",
"platforms": [
"desktop"