Repository navigation
feat(lib): make MODELS_DEV_SYNC_ENABLED actually control the sync - #9483
Merged
diegosouzapw merged 5 commits intoAug 7, 2026
Conversation
The docblock on modelsDevSync.ts has always said "Opt-in via MODELS_DEV_SYNC_ENABLED=true", but nothing read that variable. Its single appearance in the tree was that one comment line: initModelsDevSync consulted the stored modelsDevSyncEnabled setting and nothing else, so an operator who followed the documentation got no response whichever value they set. Give the variable the behaviour the comment promised, and describe it in .env.example and the environment reference, where it was also missing. An explicit value decides in either direction; only an unset or empty one defers to the setting. Pinning the sync OFF from a compose file or unit is the case that motivates it, since the stored setting can already say on and a container has no way to reach the dashboard before boot. That makes this a third resolution shape rather than a reuse of an existing one, which is worth stating rather than glossing. resolveFeatureFlag puts the DB override above the environment, so a deployment cannot override a stored choice. getCcAliasGlobalState reads only "1" and "true" and forces a flag on, letting every other value fall through to the DB. Neither can turn a dashboard-enabled switch off from the environment, so either one would leave this variable unable to do the thing it is here for. The reasoning is recorded next to the code. Five tests cover the resulting matrix: env on with the setting off, the setting alone with no env var, the accepted spellings and their rejection of everything else, env off against a stored on, and unset still deferring to a stored on.
diegosouzapw
merged commit Aug 7, 2026
765fd71
into
cheaper-inference:release/v3.8.50
4 of 5 checks passed
muhamadgalihsaputra
pushed a commit
to niyatna/NiyatnaRoute
that referenced
this pull request
Sep 27, 2026
…eaper-inference#9483) Merge-train validated (tip 6ce4effef8). Vitest failures confirmed as base-red (cheaper-inference#9679).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The docblock on
src/lib/modelsDevSync.tssays "Opt-in viaMODELS_DEV_SYNC_ENABLED=true(default: false)", and nothing reads that variable. Its only appearance anywhere in the tree is that comment line:initModelsDevSyncconsults the storedmodelsDevSyncEnabledsetting and nothing else, so an operator who follows the documentation gets no response whichever value they set.This gives the variable the behaviour the comment promised, and describes it in
.env.exampleanddocs/reference/ENVIRONMENT.md, where it was also missing.The precedence, and why it is a third shape
An explicit value decides in either direction; only an unset or empty one defers to the setting. Pinning the sync off from a compose file or unit is the case that motivates it: the stored setting can already say on, and a container has no way to reach the dashboard before boot.
That makes this a third resolution shape rather than a reuse of an existing one, which seems better stated than glossed over:
src/shared/utils/featureFlags.ts::resolveFeatureFlagputs the DB override above the environment, so a deployment cannot override an operator's stored choice at all.src/lib/db/ccDiscoveryAliases.ts::getCcAliasGlobalStatereads only"1"and"true"and can force a flag on, letting every other value including"false"fall through to the DB.Neither can turn a dashboard-enabled switch off from the environment, so following either one would leave this variable unable to do the thing it is being added for. The reasoning is recorded next to the code, not only here. If you would rather it match
ccDiscoveryAliasesexactly and stay force-on-only, that is a small change and I am happy to make it.Verification
Five new tests cover the matrix: env on with the setting off, the setting alone with no env var, the accepted spellings and their rejection of everything else, env off against a stored on, and unset still deferring to a stored on. The last one is there so the change cannot quietly turn the variable into a hard switch and kill the dashboard toggle.
To confirm the tests actually detect the old behaviour,
initModelsDevSyncwas reverted to the setting-only check and the same command re-run:Green again on revert.
Note on the base
npm run lintexits 1 on this branch, and identically on an unrelated branch of mine whose diff shares no files with this one. Both report the same two errors:Neither file is touched here. Both arrived with #9407 and #9320 on 2026-08-04 and are absent from
config/quality/eslint-suppressions.json, sorelease/v3.8.50fails that gate on its own and every PR against it inherits the failure. Happy to send a separate PR adding the two entries if that is the fix you want.