Repository navigation
Studio: ship the loaded models indicator off by default - #8346
Conversation
It was on unless explicitly disabled, so every install got a corner card and a 5s status poll nobody asked for. Invert it: the key is written on enable and removed on disable, so absent now reads as off. An older explicit "false" still reads as off, so anyone who already turned it down is unaffected. The Playwright suite switches it on in boot() and now covers the default as well.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b26e34867f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else { | ||
| localStorage.setItem(STORAGE_KEY, "false"); | ||
| // Remove rather than store "false" so the default stays off. | ||
| localStorage.removeItem(STORAGE_KEY); |
There was a problem hiding this comment.
Store false when disabling for old clients
When an older Studio tab remains open during an update, or the installation is rolled back, disabling the indicator here does not remain disabled: the previous implementation interprets a missing key as enabled (getItem(STORAGE_KEY) !== "false"). Removing the key therefore makes the old tab re-enable the card and polling after its storage event; persisting "false" would remain off under both the old and new readers while still leaving fresh installs off by default.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, fixed in b19e307.
Confirmed the mechanism rather than taking it on faith: the old reader is getItem(STORAGE_KEY) !== "false", so a missing key is enabled, and subscribe does listen for storage events on this key. A tab still running the old bundle would take the removal and turn the card back on.
Disabling now writes "false" instead of removing:
localStorage.setItem(STORAGE_KEY, show ? "true" : "false");Truth table across the two readers:
| stored | old reader | new reader |
|---|---|---|
| absent | on | off |
"true" |
on | on |
"false" |
off | off |
So every value this code writes is read the same way by both, and only the fresh-install default differs, which is the change this PR is for.
Added a case pinning it, which fails against the previous commit. Also added one for a cleared key, since Reset all local preferences removes it and the default has to survive that.
Disabling removed the key, and the old reader treats a missing key as enabled. A tab still running the old bundle would take the storage event and turn the card back on. Write "false" instead: off under both readers, and absent still means off, so the default is unchanged.
|
I checked this through and found no blockers.
Merging now. |
The loaded models indicator shipped on. It should ship off.
Before
getShowLoadedModelsread "on unless explicitly disabled":An absent key means a fresh install, so every install got the corner card and its 5s status poll without asking for either.
After
The same key, read the other way round, so absent reads as off:
The writer stores both values rather than removing the key on disable:
That matters for a tab still running the old bundle during an update, or for a rollback. The old reader treats a missing key as enabled and there is a
storagelistener on this key, so removing it on disable would let the old tab take the event and turn the card back on."false"is off under both readers. Absent still means off under the new one, so the default is unaffected.Existing installs
The only value the old code ever wrote was
"false", on disable."false" === "true"is false, so anyone who already turned it down stays off and sees no change. Nobody has"true"stored, since the old enable path removed the key rather than writing it, so there is no half-migrated state to handle.The one intended change: an install that left it alone now has it off. That is the point of the PR.
Where the toggle is
Settings > General > Notifications, first row, "Loaded models indicator". Unchanged, and the labels are unchanged.
Testing
tests/loaded-models-dismiss.test.ts, four new cases: the default is off, both toggles store a value the older reader honours, an older explicit"false"still reads as off, and a cleared key falls back to off rather than on. Confirmed the first two fail against the old module, and the second also fails against the first draft of this PR, which removed the key on disable. The other two pass either way, which is the point of them: they are the migration and reset invariants, and they have to hold on both sides.One existing case asserted the old default indirectly ("closing the card does not switch the setting off" read
getShowLoadedModels()as true on a clear store). It now switches the setting on first, so it tests what its name says instead of leaning on the default.tests/studio/playwright_loaded_models_indicator.py:boot()takesshowand seeds the key on by default, so every existing check still exercises the card. The preference section now covers both off paths, the default and an older explicit"false".tsc --noEmitcleannpm test, 1603 passingi18n:check:strictcleannpm run buildcleanpy_compileclean on the smoke suite