Skip to content

fix(dashboard): keep feature-preview switches on the gateway - #22830

Closed
mbriones98 wants to merge 2 commits into
mainfrom
fix/preview-flags-persist-21396-v8
Closed

mbriones98 wants to merge 2 commits into
mainfrom
fix/preview-flags-persist-21396-v8

Conversation

@mbriones98

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A Feature previews switch (such as Crewmates) stays on once you turn it on, in every browser and in the desktop app that use the same Kiro Crew.

The switches under Settings > Developer > Feature previews were kept only in browser localStorage (mc-preview-*). A new origin or port, the desktop app next to a browser tab, or cleared site data each read the switch as off, so Crewmates and the other previews kept turning themselves off.

Why it matters

Anyone trying a preview has to turn it on again on every surface and after every storage reset. A preview that seems to switch itself off reads as broken.

Not a goal

  • No change to what any preview does once it is on.
  • No new route and no auth change: writes go through the existing owner-only config PATCH.
  • No per-user scope. The switches belong to the gateway, like every other dashboard setting in config.
  • No change to the DURABLE_PREF_KEYS / /api/ui-prefs backup, so there is one source of truth.
  • No configKey / settings-registry entries for the new paths (<SettingRef> deep links). That is a separate navigation feature.

What changed (motivation → approach → change)

Symptom: a switch turned on in one surface is off in another. Root cause: localStorage was the only copy.

#21396 was filed by its owner asking for the switches to sync across surfaces, so moving them from per-device to gateway-wide is the requested behaviour, not a side effect.

Approach: the gateway config keeps each switch, and localStorage stays as a fast cache. Config rather than adding the keys to DURABLE_PREF_KEYS: the uiPrefs backup restores only on a cold profile, so a warm desktop app and a warm browser tab would never pick up each other's change. The config route reaches every open dashboard through the config refresh frame it already receives.

  • Backend (sections_dashboard.py, loader_builders.py, loader.py, sections.py, handlers/core_config_schema.py, handlers/core.py, change_card_catalog.py):
    • One bool per switch under dashboard.feature_previews.<name>, for the 6 live flags: webhooks, artifact_deploy, crew, remote_crew_chat, layout_harness, folder_conductor.
    • The PATCH allowlist accepts only those names, typed bool. The loader drops unknown names and non-bool values.
    • The change card classifies the new paths, and configuration.md and config-baseline.json are updated.
    • The retired mc-preview-instance-sessions key is not kept on the gateway. Its ON is carried up as remote_crew_chat.
  • Dashboard (usePreviewFlagServerSync.ts, mounted in shell/appShell.tsx beside the shell's existing reader of the same config query, so boot order is unchanged):
    • Reconcile: the server value wins over the cache, except for a flag whose write is still in flight.
    • Write order: each toggle is PATCHed, and writes for one flag are sent one after another so the last click is what the gateway keeps. An accepted write is stored in the cached config with the shared setConfigPathValue helper.
    • One-time carry-up: a switch set only in this browser before the gateway kept the switches is carried up once with if_unset, so it never replaces a stored value.
    • Sync marker: afterwards a kc-feature-previews-synced marker makes a cache-only ON read as off, so a key the operator removed stays off. The marker is not set while a toggle is in flight, or after a refused toggle or a refused carry, so a browser-only value is never wiped.
    • Per-switch record: each browser also records which switches it has seen the gateway hold (kc-feature-previews-server-backed, with an in-memory copy for when storage is full). A recorded switch that the gateway no longer holds reads as off even before the browser is marked synced, so another switch's failed carry-up cannot send a removed switch back up.
    • Refused toggle: the switch goes back to the last value the gateway accepted, and the section shows an error notice naming the switch. On a 403 it says only the owner can change feature previews. On any other failure, including a 403 from an expired session, it says the save failed.
    • Refused carry: the notice says the switch is on in this browser only. When the carry is refused as owner-only (403), it says only the owner can save the switch for everyone, with no reload step, since a reload would be refused the same way.
  • Copy:
    • The section description no longer says "per-device". It now says the switches are saved for everyone using this Kiro Crew ({{productName}}), without the word "gateway".
    • Four new notice strings.
    • All 12 translated catalogs are updated, and en-XA is regenerated.

Why this does not use useOptimisticConfigPaths: that hook gives one settings component an in-flight display value per config path and lets saves run side by side. The switches here are shared by every surface outside any one component, so the sync keeps its own small queue. It sends one switch's writes in click order, so the gateway keeps the last click, and when a write is refused it puts the switch back to the last value the gateway accepted, in the cache and in localStorage. The hook does neither of those, so only its path-write helper is reused.

Docs: the Preview-gated surfaces paragraph in docs/system-specs/modules/learn-cron-dashboard.md now says each switch is kept on the gateway under dashboard.feature_previews.<name>, that localStorage is a cache, that writes go through the owner-only config PATCH, and that usePreviewFlagServerSync keeps the two in step.

Overlap: open PR #20420 also edits DURABLE_PREF_KEYS. This PR does not touch that list, so the two do not conflict.

Backwards compatibility

Compatible: the new config fields are optional and default to off, the PATCH allowlist only gains names, and an existing browser-only ON is carried up once instead of being dropped.

The diff takes one thing away: localStorage is no longer the source of truth for a switch. Once synced, a cache-only ON that the gateway does not hold reads as off, and a non-owner's toggle no longer overrides the gateway's stored value.
Reader: website/src/utils/previewFlags.ts:readPreviewFlag -- chat|crew page -- still reads the cache, which reconcile keeps equal to the gateway copy | previewFlagServerSync.test.tsx "lets the server copy win over a stale browser copy"
Reader: website/src/hooks/usePreviewFlag.ts:usePreviewFlag / useRemoteCrewChat -- chat|crew page -- re-renders on the same cache write event | previewFlagServerSync.test.tsx "turns Crewmates on from the server when this browser has no copy"
Reader: website/src/surfaces/registry.ts:surfacePreviewEnabled (nav rail, pagesProvider, appNavHidden, CommandBarOverlay) -- chat|crew page -- reads the cache via readPreviewFlag | previewSurfaces.test.tsx
Reader: website/src/pages/settings/FeaturePreviewsSection.tsx -- crew page -- toggles still write the cache first, then the gateway | previewSurfaces.test.tsx "says why a switch went back when the gateway refuses the write"
Reader: non-owner dashboard session (e.g. a QR session) -- chat|crew page -- intended: config saves are owner-only, so it sees every switch the owner set (the config GET is not owner-gated), its own toggle is refused and switched back with the owner-only notice, and a switch it had already turned on in that browser stays on there | featurePreviewsSectionNotice.test.tsx "names the %s switch when the owner-only write is refused", "names the owner, not a reload, when a one-time carry is refused as owner-only"
Reader: retired mc-preview-instance-sessions -- chat -- carried up as remote_crew_chat, then cleared | previewFlagServerSync.test.tsx "carries the retired Remote crew sessions switch up as Chat on a crew", "never lets the retired key turn Chat on a crew back on after it was turned off"

Tests

  • website/src/test/previewFlagServerSync.test.tsx (33 tests). The repro: Crewmates turns on from the server when localStorage is empty, and it fails with the sync disabled. The other tests cover:

    • writes, in-flight protection, and rapid toggles applied in click order;
    • a refused toggle reverting in synced and unsynced browsers, with no config body, after two or three refused clicks, and behind a refused carry;
    • the notice waiting for the last queued click, and being cleared only by a save of the same switch;
    • a 403 from an expired session reported as a failed save;
    • the one-time if_unset carry-up, not replacing a stored value, a 409 counted as synced, and a refused carry reported and kept on;
    • the sync marker not being set while a toggle is in flight, whether the in-flight read lands from the config read or from another switch's carry;
    • a switch the gateway held and then dropped reads as off when another switch's carry-up failed, also when the per-switch record cannot be stored, and the browser-only switch stays on;
    • an unreadable per-switch record reads as empty;
    • the retired key;
    • parity between PREVIEW_FLAGS and every declared flag constant.
  • I removed each of these lines on a scratch copy, and each removal makes a test fail:

    • the revert itself;
    • the per-flag baseline;
    • the in-flight guards;
    • the pending.size guard;
    • the last-queued-click guard on the notice;
    • the same-switch notice clear;
    • the per-switch record check, and its in-memory copy.
  • website/src/test/previewSurfaces.test.tsx: the section shows the owner-only notice naming the switch when the PATCH returns 403.

  • website/src/test/featurePreviewsSectionNotice.test.tsx (11 tests), with the sync mounted as the shell mounts it:

    • a 403 on each of the 6 switches shows the owner-only notice naming that switch;
    • a 500 shows the "couldn't save" notice;
    • a refused one-time carry says the switch is on in this browser only, and it stays on;
    • a one-time carry refused as owner-only names the owner and has no reload step;
    • the Artifact Deploy and Webhooks links open their pages.

    It lifts FeaturePreviewsSection.tsx above the 80% per-file coverage floor (93.9% of lines locally, across the tests that render it).

  • test/test_feature_previews_config.py (25 tests):

    • the gateway list matches the dashboard flags, and nothing is on by default;
    • the loader keeps only known names with bool values;
    • each switch is writable, and unknown names or non-bools write nothing;
    • if_unset writes an absent switch and never replaces a stored one;
    • a non-owner cannot write a switch.
  • Local runs on this commit:

    • Frontend: 96 test files (1,912 tests) pass on this commit: the preview sync, notice and surfaces tests, every test that mounts the shell, and the whole src/i18n folder including the style/ French U+202F and Korean checks. FeaturePreviewsSection.tsx is at 93.9% of lines and usePreviewFlagServerSync.ts at 100% in that run. tsc (app), eslint src/ --max-warnings 0, check-i18n-strings.mjs, check-i18n-keys.mjs, check-dnt-catalogs.mjs and i18n-check.mjs are clean with I18N_BASE_REF set to the base commit, and the regenerated en-XA has no diff.
    • Backend: the config loader, schema, patch, baseline, change-card, docs-lint, default sidebar folder, facade-mirror and test_feature_previews_config.py tests pass (2,952), with the slowest tree scan well under the 120 s limit. One test_config_loader_default_agent.py test reported a pytest unraisable-hook RecursionError once under the parallel run and passes on its own (3 of 3).
  • Local AI review: GPT (gpt-6.1-sol) and Opus read-only reviews ran over several rounds. Each quoted the commit SHA it read, and I checked those against the worktree. Every Critical/High/Medium finding is fixed in this commit, and the final round on the last code change found none open. On this rebuild, a GPT (gpt-6.1-sol) and an Opus review of the new commit each quoted its SHA, confirmed the diff matches fix(dashboard): keep feature-preview switches on the gateway #22544 apart from keeping both sides next to the default sidebar folder setting, and found nothing Critical or High.

Manual verification

I took screenshots against the built SPA, with /api/config/kirocrew returning crew: true:

  • With empty localStorage, Crewmates shows on.
  • With the PATCH returning 403, flipping Webhooks puts it back and the notice names it.
  • With the PATCH returning 500, flipping Webhooks puts it back and the notice says it couldn't be saved.
  • With a browser-only Webhooks ON and the carry PATCH returning 500, the notice says it is on in this browser only.

Screenshots / video

Synced from the gateway (Crewmates on, empty browser storage):

Feature previews section synced from the gateway

A toggle refused with 403, naming the switch:

Owner-only notice naming Webhooks

A toggle refused with 500 (the same notice shows for an expired session's 403), naming the switch:

Couldn't save notice naming Webhooks

A browser-only switch whose carry-up failed:

On in this browser only notice

A browser-only switch whose carry-up was refused as owner-only (403): the switch stays on, the notice names the owner and has no reload step:

Owner-only carry-up notice, switch still on

Related Issues

Fixes #21396

Related: #16237, #17424, #14232, #9876

Replaces #22544, which conflicted with main after #21999 added the default sidebar folder setting next to this one in loader.py and loader_builders.py, and already had the two commits PR Hygiene allows. This is #22544's two commits as one commit off current main, keeping both settings side by side. Earlier versions: #22298, #22000, #21722, #21624, #21602 and #21569.

Pattern harvest

Rule candidate: review-prompt
Pattern: a user-visible setting persisted only in browser localStorage, when it is meant to hold across surfaces of the same gateway; check whether it should live in gateway config with localStorage as a cache.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

The Feature previews switches lived only in browser localStorage, so a
new origin, the desktop app beside a browser tab, or cleared site data
turned them back off. Each switch is now stored in the gateway config
under dashboard.feature_previews.<name>, written through the existing
owner-only config PATCH, with localStorage kept as a cache. A switch set
only in this browser is carried up once with if_unset; a refused toggle
names the switch that went back and says why. A carry-up refused as
owner-only says the switch stays on in this browser only, with no
reload step. Each browser records
which switches it has seen the gateway hold, so a switch removed there
reads as off even when another switch's carry-up failed. An accepted
save is written into the cached config with the shared
setConfigPathValue helper.

The Preview-gated surfaces paragraph in the dashboard module spec now
says the switch is kept under dashboard.feature_previews.<name>, that
localStorage is a cache, that writes go through the owner-only config
PATCH, and names usePreviewFlagServerSync.

Fixes #21396
@mbriones98
mbriones98 requested review from a team and KiroCrewCaptain as code owners October 21, 2026 17:17
@mbriones98
mbriones98 requested a review from bolichen97 October 21, 2026 17:17
@mbriones98
mbriones98 enabled auto-merge (squash) October 21, 2026 17:17
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🔴 BLOCK

UX-level review of 2a7b76c7d89f9d6ef522126455f9d868fec5c138 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: BLOCK

The new intro copy says previews are "saved for everyone using this Kiro Crew", and that makes the blind reader afraid to turn on the PR's own example preview, Crewmates.

Blockers

The intro copy scares users away from the switches this PR is meant to make reliable
Trigger: someone opens Settings > Developer > Feature previews to turn on Crewmates.
Outcome: the new feature_previews_desc reads "These switches are saved for everyone using this {{productName}}". In a single-user tool this sounds like the switch affects other people. On shot-01 the reader said "'Saved for everyone' makes me nervous about touching any switch." Asked about Crewmates, the main switch on this path, they said: "no. It would change things for other people." Their verdict on Folder conductor was "maybe… it's still for everyone." So the PR keeps the switch on, but its copy stops people from turning it on.
Severity: every visitor to the section reads this intro (high frequency). It stops them from using the feature (task failure), and the copy stays the same on every visit.
Fix: lead with what the user gets and drop "everyone". For example: "Unreleased features and pages. A switch you turn on stays on in every browser and in the desktop app connected to this {{productName}}." The owner-only rule is already explained in the refused-toggle notices.

Notes

  • feature_previews_carry_failed and feature_previews_carry_denied use the red ErrorNotice even when the switch did turn on. The reader said: "I can't tell success-with-a-catch from failure at a glance." Show these two with StatusNotice, or a warning style, instead of the error style.
  • The reader could not tell save_denied (switched back) from carry_denied (stays on). They asked about the same owner message: "one undoes the switch and the other keeps it. I can't tell which will happen to me." Open carry_denied with what happened: "“{{name}}” is on in this browser only. Only the owner can save it for every browser."
  • "Reload the page to try again" in carry_failed reads like a button but is plain text, and the reader asked "if reloading will turn it back off." Add a Reload action to the notice, or say that reloading keeps the switch on.

[UX-REVIEWED] 2a7b76c

Description read

[DESCRIPTION-READ] d9721c63e5ebfd30355b8ff689c45cdd8ba969eacf7454a2a8ee3e5582b66df1

That sha256 names everything this verdict read: the PR description, plus the 8 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 2a7b76c7d89f9d6ef522126455f9d868fec5c138 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks. Keeping the switches in gateway config fixes the root cause (localStorage was the only copy), and it uses the existing owner-only PATCH and refresh-frame paths.

Notes

  • The description says dashboards learn of a change through "the config refresh frame it already receives". The frame for this path is new in config_watch.py (_push_feature_previews). Say in the description that this PR adds it.
  • The client keeps two records, the kc-feature-previews-synced marker and the kc-feature-previews-server-backed per-switch list, and both exist only for the one-time carry-up. Remove them, and the carry-up code, once enough releases have passed, so they don't stay forever.

[DESIGN-REVIEWED] 2a7b76c

Description read

[DESCRIPTION-READ] ad8737b44250d631e12e0b98ef132ef0a690f7007ed7c45b081b69d5821392e3

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 2a7b76c7d89f9d6ef522126455f9d868fec5c138 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

Nothing blocks. The sync hook keeps two localStorage records that both answer "did the gateway drop this switch?", and the description says other dashboards get the refresh frame "already", yet this diff is what adds it.

Notes

  • Item 5 — oversized: PREVIEW_FLAGS_SYNCED_KEY (plus carryFailed/carriesInFlight) and PREVIEW_FLAGS_SERVER_BACKED_KEY (plus documentBacked) both make a cache-only ON read as off. Every accepted toggle or carry already calls markServerBacked, so the per-switch record covers the case the global marker exists for. Subtraction: delete the synced marker and its carry counters, and keep only the per-switch record.
  • Item 8 — undeclared: the description says the change reaches other dashboards "through the config refresh frame it already receives". The diff adds that push in config_watch.py (_push_feature_previews), and it is the only push_refresh("config") subscription. The other dashboard.* keys, read by 47 ['kirocrewConfig'] consumers, still don't refresh other surfaces. This is a point patch, and a general fix is reasonable to defer.

What this change ships

Inventory (9 items) — 7 justified

Intent: a feature-preview switch stays on across every browser and the desktop app on one gateway. FIX.

  1. Preview switches are kept on the gateway, not per browser — justified
  2. A non-owner's toggle is refused and switched back, and they see the owner's switches — justified
  3. A switch that was on in only one browser is carried up once, never overwriting a stored value — justified
  4. New dashboard.feature_previews.<name> config keys (6 bools), also in schema, change card and docs — justified
  5. Two localStorage records (synced marker and per-switch server-backed list) — oversized
  6. Notices for a refused toggle or carry (4 strings, 12 locales) — justified
  7. Section text drops "per-device" and says the switches are saved for everyone — justified
  8. Other open dashboards update without a reload, through a new gateway refresh push — undeclared, symptom-level
  9. The retired Remote crew sessions switch is carried up as Chat on a crew, then cleared — justified

[FIRST-PRINCIPLES-REVIEWED] 2a7b76c

Description read

[DESCRIPTION-READ] 817a1e56a4e2ab5fdbbbf861c1e2ddf7d3f8ea660bcb9f745c1b2a8d7bf5c828

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 2a7b76c7d89f9d6ef522126455f9d868fec5c138 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2a7b76c

Verdict parsed from the review's SHA-scoped output markers for commit 2a7b76c7d89f9d6ef522126455f9d868fec5c138.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 2a7b76c7d89f9d6ef522126455f9d868fec5c138: <one-sentence reason>

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — 🔴 changes requested (blocking)

GPT 6.1 found at least one blocking issue that must be resolved before merging 2a7b76c7d89f9d6ef522126455f9d868fec5c138. Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

This comment is updated in place on each push.

BLOCKING -- website/src/hooks/usePreviewFlagServerSync.ts:273 -- Clear stale carry-up notices when the server supplies a saved value

if (readPreviewFlag(flag) !== server) cachePreviewFlag(flag, server)
Trigger: A non-owner browser’s legacy ON receives a 403 during carry-up; the owner then saves that switch as OFF elsewhere. The config refresh invalidates kirocrewConfig, and usePreviewFlagServerSync calls reconcilePreviewFlags.
Outcome: Reconciliation turns the switch OFF but leaves its carry-up error intact, so FeaturePreviewsSection continues claiming the feature stays ON in this browser only.
Anchor: defect
Fix: Clear the matching carry-up error when reconciliation observes a saved boolean for that flag, without clearing another flag’s error.

[BLOCK-MERGE] 2a7b76c
[GPT-REVIEWED] 2a7b76c

Adjudication (Opus 5.5) — is blocking on each finding proportionate?

F1: LOW harm. A notice is shown that is wrong, but it can be dismissed and the switch itself shows the correct OFF state. I confirmed the conditions in the code. The carry is refused and the error is set at website/src/hooks/usePreviewFlagServerSync.ts:210. Reconcile then applies the server boolean at :273 and never clears that error. The notice keeps rendering the carry text at website/src/pages/settings/FeaturePreviewsSection.tsx:196-199, and the only way it goes away is the manual dismiss at :203 (usePreviewFlagServerSync.ts:89).
The real fix is one guarded line next to :273 that clears the error only when it is a carry error for this same flag. It adds no new state, ordering contract or cross-module coordination. That cost does not exceed even this low harm, so I cannot rule the remedy disproportionate.

[ADJUDICATION] 2a7b76c7d89f9d6ef522126455f9d868fec5c138 total=1 uphold=1 downgrade=0
UPHOLD F1 website/src/hooks/usePreviewFlagServerSync.ts:273 reason=harm-warrants-remedy
[GPT-ADJUDICATED] 2a7b76c7d89f9d6ef522126455f9d868fec5c138

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 2a7b76c7d89f9d6ef522126455f9d868fec5c138: <one-sentence reason>

A Feature previews switch saved from one dashboard did not reach the
other open ones until they reloaded or reconnected: they read the
switches from a config query that never goes stale on its own, and a
config write to dashboard.feature_previews sent no refresh frame. The
gateway's config watcher now pushes a config refresh when that section
changes, so every open dashboard re-reads it.
@mbriones98

Copy link
Copy Markdown
Contributor Author

Re the GPT 6.1 Review blocking finding: fixed in 2a7b76c. The gateway's config watcher now subscribes to dashboard.feature_previews and pushes a config refresh when it changes, so every open dashboard re-reads the shared config query and a switch saved on one surface reaches the others without a reload. A test in test/test_config_live_server_appliers.py covers it. No frontend change.

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs changes: two AI review lanes still block this head, and both findings hold when I read the code.

Head reviewed: 2a7b76c. Bots read: Design PASS, First Principles PASS, UX BLOCK, Opus no findings, GPT BLOCK (upheld by adjudication). Readiness: checking, with 6 checks still pending.

The backend half is sound. The PATCH allowlist accepts only the six known names as bool, the loader drops unknown names and non-bool values, and the new config watcher push is covered by a test.

Two items remain before this can merge:

  1. The GPT finding is not fixed yet. The reply on this PR says it was fixed in this commit, but that change adds the config refresh push. The finding is about a different thing: reconcile never clears a refused carry notice when the server later supplies a value for that switch. See the inline comment on usePreviewFlagServerSync.ts.
  2. The UX lane blocks on the new section intro. "Saved for everyone using this" reads as if the switch changes things for other people. See the inline comment on en.manual.json.

Minor, not blocking: the hook docstring and the PR description both say the config refresh frame "already" reaches other dashboards. This PR is what adds that push in config_watch.py. Please say so in both places.

🔴 0 must-fix, 🟡 2 should-fix. Not repeated: the two localStorage records and the carry-up retirement noted by Design and First Principles.

}
const server = fp[previewFlagName(flag)]
if (typeof server === 'boolean') {
if (readPreviewFlag(flag) !== server) cachePreviewFlag(flag, server)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 A refused carry notice stays up after the server supplies a value for the same switch

A non-owner browser has a legacy ON, and its one-time carry is refused (line 210 sets a carry error). Later the owner saves that switch as OFF on another surface. The refresh runs reconcile, and this line moves the cache to OFF. Nothing clears the carry error, so the section keeps saying the switch "is on in this browser only" while the switch shows OFF.

if (readPreviewFlag(flag) !== server) cachePreviewFlag(flag, server)

Why it matters: the notice states the opposite of what the switch shows. The only way out is the manual dismiss.

Suggestion: in this branch, clear the error only when it is a carry error for this same flag, for example if (writeError?.carry && writeError.flag === flag) setWriteError(null). Add a test: refused carry, then a config body with false for that flag, then expect no notice. This is the GPT lane finding on this head; the refresh push added in this commit does not change it.

"developerPanel": {
"feature_previews": "Feature Previews",
"feature_previews_desc": "Unreleased features and pages. The pages stay hidden from the sidebar and from Search Everywhere until you turn them on here; the switches themselves do show up in Settings search. Unpolished on purpose, and per-device unless a card says otherwise."
"feature_previews_desc": "Unreleased features and pages. These switches are saved for everyone using this {{productName}}, so they stay set in every browser and in the desktop app. The pages stay hidden from the sidebar and from Search Everywhere until you turn them on here; the switches themselves do show up in Settings search. Unpolished on purpose.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 "Saved for everyone" reads as if the switch affects other people

The UX lane blocks on this line. In a tool that one person mostly uses, "saved for everyone using this" suggests that turning on Crewmates changes things for other users. The PR goal is that the switch stays on, and this copy can stop people from turning it on at all.

"feature_previews_desc": "Unreleased features and pages. These switches are saved for everyone using this {{productName}}, so they stay set in every browser and in the desktop app. ..."

Why it matters: every visitor to the section reads this intro, before any switch.

Suggestion: lead with what the user gets and drop "everyone", for example: "Unreleased features and pages. A switch you turn on stays on in every browser and in the desktop app connected to this {{productName}}." The owner-only rule is already in the refused-toggle notices. Update the 12 catalogs and regenerate en-XA. The same word appears in feature_previews_carry_failed and feature_previews_carry_denied; consider the same change there.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 21, 2026
@mbriones98

Copy link
Copy Markdown
Contributor Author

Superseded by #22913, the same change rebuilt as one commit off current main with both review fixes.

@mbriones98 mbriones98 closed this Oct 21, 2026
auto-merge was automatically disabled October 21, 2026 21:46

Pull request was closed

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 21, 2026
@bolichen97
bolichen97 deleted the fix/preview-flags-persist-21396-v8 branch November 6, 2026 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crewmates feature-preview toggle does not persist (stored only in browser localStorage)

2 participants