Commit 795292d
fix(featureFlags): resolve linearToggleEnabled through resolveFlag (Comfy-Org#15135)
## ELI-5
Nightly builds always turned the linear toggle on, no matter what. That
"always on" check ran *before* the code that looks at `?ff=` URL
overrides, `ff:` localStorage overrides, remote config, and the server
flag — so on nightly none of those could ever turn it off. Now nightly
is the *default* value fed into the normal resolution chain, so it stays
on unless something explicitly says otherwise.
## Summary
`linearToggleEnabled` short-circuited with `if (isNightly) return true`
above its `resolveFlag(...)` call, so the session-override and
dev-override layers (which live inside `resolveFlag`) were silently
ignored on nightly builds. Passing `isNightly` as `resolveFlag`'s
default instead keeps nightly on by default while letting every override
layer work.
## Changes
- **What**: `linearToggleEnabled` now resolves through
`resolveFlag(LINEAR_TOGGLE_ENABLED,
remoteConfig.value.linear_toggle_enabled, isNightly)` with no
short-circuit. Tests updated for the new nightly behavior plus three new
cases (remote-config `false`, server-served `false`, session override
`false` over an enabled remote config).
- **Breaking**: none. Off nightly, `isNightly` is `false`, which is
byte-identical to the previous `false` default — production and stable
behavior is unchanged.
## Review Focus
Two intentional behavior deltas, both nightly-only: (1)
`?ff=linear_toggle_enabled:false` and the `ff:` localStorage dev
override now change the flag, so an employee can reproduce the
non-nightly experience; (2) an explicitly-served `false` from remote
config or the server flag now wins over the built-in nightly on. When
nothing is served, `getServerFeature(LINEAR_TOGGLE_ENABLED, true)`
returns the `true` default, so nightly stays on.
The default is deliberately `isNightly` alone, **not** `isNightly ||
import.meta.env.DEV` as in the neighbouring
`nodeLibraryEssentialsEnabled` getter — this flag has never defaulted on
in dev and that is preserved.
Judgment calls: the first existing test asserted
`expect(api.getServerFeature).not.toHaveBeenCalled()`, which pinned the
removed short-circuit; it is rewritten to assert the flag still resolves
`true` and that `getServerFeature` is called with
`(LINEAR_TOGGLE_ENABLED, true)`. `isNightly = false` was added to the
`session override precedence` block's `afterEach` so the new nightly
case there cannot leak into the auth-gated tests that follow.
Verification: all four new/changed tests were confirmed red against the
pre-change getter and green after (41 passed in
`useFeatureFlags.test.ts`, 23 in `useWorkflowActionsMenu.test.ts` — the
only non-test consumer). `pnpm typecheck`, oxfmt and eslint ran clean
via the pre-commit hook.
Co-authored-by: Christian Byrne <cbyrne@comfy.org>1 parent a2603c5 commit 795292d
2 files changed
Lines changed: 50 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
151 | 156 | | |
152 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
153 | 161 | | |
154 | 162 | | |
155 | 163 | | |
156 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
157 | 168 | | |
158 | 169 | | |
159 | 170 | | |
| |||
182 | 193 | | |
183 | 194 | | |
184 | 195 | | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
185 | 220 | | |
186 | 221 | | |
187 | 222 | | |
| |||
595 | 630 | | |
596 | 631 | | |
597 | 632 | | |
| 633 | + | |
598 | 634 | | |
599 | 635 | | |
600 | 636 | | |
| |||
627 | 663 | | |
628 | 664 | | |
629 | 665 | | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
630 | 678 | | |
631 | 679 | | |
632 | 680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | 130 | | |
133 | 131 | | |
134 | 132 | | |
135 | | - | |
| 133 | + | |
136 | 134 | | |
137 | 135 | | |
138 | 136 | | |
| |||
0 commit comments