Repository navigation
feat: rename maintenance.discoverRoots to maintenance.managedFolders - #6647
Merged
Merged
Conversation
A machine config value under the old name still counts while the new one is unset, and stim settings takes the old name. A write through either name stores the new key and removes the old one. Closes #6644.
Unsetting the old name removes only the old key, doctor names that command as the fix for a shadowed old key, the published machine schema accepts the old key, and an invalid old value is reported under the old name.
janicduplessis
marked this pull request as ready for review
November 28, 2026 18:05
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.
Description
maintenance.discoverRootsnames the folders the person chose for Stim to manage, the explicit counterpart ofmaintenance.autoDiscover, but the name reads like part of automatic discovery. This renames it tomaintenance.managedFolders. The old key shipped in 2.0.0 and sits in real machine configs; dropping it would make Stim ignore those folders and silently stop cleaning them, so the old name keeps working.Maintainer decision on #6644: "Yes for 1-3 hold on for 2", 2026-11-28, answering "1. Rename: should maintenance.discoverRoots become maintenance.managedFolders, in a separate PR with the old name still working?"
Solution
The registry entry gets a
formerlykey (compat C35, permanent, 37 lines):machineSettingValueand thestim settingslayer read use the new key, or the old one while the new one is unset in that layer. Every consumer (discovery, doctor, the census, the stimd trigger,stim gc) reads through one of those two paths. An invalid value read from the old key is reported under the old key's name.stim settingsand by doctor, whose fix isstim settings unset maintenance.discoverRoots --scope machine; while the old key is the only one, it is not reported. The old key in a.stim.jsonor a project or repo settings block is not read there and gets the ordinary inert note.stim settings getandsettake the old name as the new one and report the new name. Asetthrough either name storesmaintenance.managedFoldersand removesmaintenance.discoverRootsin the same locked config write, so it never leaves a shadowed value behind.unset maintenance.managedFoldersclears both keys;unset maintenance.discoverRootsremoves only the old key, so it never clears the list that wins. Stim Desktop writes settings by the keys in thestim settings --jsonpayload, so it picks up the new name with no change.$defs.machineschema acceptsmaintenance.discoverRoots(marked deprecated, with nox-stimentry), so an editor does not reject a 2.0.0 config and Stim Desktop does not list it as a second setting.maintenance.managedFoldersinert. The key is deliberately not mirrored; LLP 0004 and the maintenance page say to update every Stim that shares the home.There is no environment variable for this setting, so none is added. Internal identifiers (
DISCOVER_ROOTS_KEY,DiscoverRootsValue,canonicalDiscoverRootsand friends) and JSON payload fields (censusroots, discovered origin'root',rootsChangedSinceCensus) keep their names: they are not user-facing and renaming them would churn the census file and payloads for no user benefit. The constants' values now hold the new key.Messages, guides, the setting descriptions (including the
maintenance.cleanAutoDiscoveredDependenciestext from #6639), LLP 0004 and the website use the new name. The maintenance and migration pages say the 2.0.0 name is still read.docs/releases/2.0.0.mdand the word-for-word maintainer quotes in LLP 0004 are left as written. The settings and cleanup guide budgets rise by 83 and 11 bytes for the longer name and the one-line note.Decisions the maintainer did not state, recorded in LLP 0004: the new key wins when both are set, a write moves the value to the new key without mirroring it, unsetting the old name removes only the old key, and the compatibility row is permanent rather than ending at a release.
Test plan
state-config.test.ts:machineSettingValuereads the old key alone, prefers the new key when both are set, treats an empty new list as set, and namesmaintenance.discoverRootsin the error for an invalid old value.settings-schema.test.ts:$defs.machineaccepts a config with only the old key, still rejects a misspelled key, and has nox-stimentry for the old key.doctor-config.test.ts: no finding with only the old key; with both in the machine config, an inert note whose fix is the machine-scopeunsetof the old name; the old key in a.stim.jsongets the plain remove-from-file note even while the machine config sets the new key.settings-command.test.ts: with only the old key,stim settings --jsonshows the value under the new key with originmachineand lists no unknown key, andgetby the old name prints it; with both, the new value wins and the old key is listed as unknown;unsetby the old name keepsmanagedFolderswhen both are set and clears an old-only config;setby the old name writes onlymanagedFolders;unsetof the new name clears an old-only config.managedFolders; the 22 changed test files pass (1024 tests).STIM_HOME, worktree build: a config with onlymaintenance.discoverRootspointing at a folder holding an Expo app.stim gc --dry-runlists the app asdiscovered root ... from <folder>(and does not without the setting);stim settingsshows it undermaintenance.managedFolders (machine); doctor reports no inert key. AddingmanagedFoldersmakes doctor andstim settingsreport the old key as not read.stim settings set maintenance.discoverRoots ...left onlymanagedFoldersin config.json. With both keys set,stim settings unset maintenance.discoverRootsleft{"managedFolders":["/tmp/x-new"]}, and doctor reported an invalid old-key value asInvalid maintenance.discoverRoots value ["relative"].Fixes #6644