Skip to content

feat: rename maintenance.discoverRoots to maintenance.managedFolders - #6647

Merged
janicduplessis merged 3 commits into
mainfrom
feat/6644-managed-folders-setting
Nov 28, 2026
Merged

janicduplessis merged 3 commits into
mainfrom
feat/6644-managed-folders-setting

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Nov 28, 2026 •

Copy link
Copy Markdown
Collaborator

Description

maintenance.discoverRoots names the folders the person chose for Stim to manage, the explicit counterpart of maintenance.autoDiscover, but the name reads like part of automatic discovery. This renames it to maintenance.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 formerly key (compat C35, permanent, 37 lines):

  • Reads. machineSettingValue and the stim settings layer 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.
  • Both keys set. The new key wins. The old one is then reported as not read by stim settings and by doctor, whose fix is stim settings unset maintenance.discoverRoots --scope machine; while the old key is the only one, it is not reported. The old key in a .stim.json or a project or repo settings block is not read there and gets the ordinary inert note.
  • Writes. stim settings get and set take the old name as the new one and report the new name. A set through either name stores maintenance.managedFolders and removes maintenance.discoverRoots in the same locked config write, so it never leaves a shadowed value behind. unset maintenance.managedFolders clears both keys; unset maintenance.discoverRoots removes only the old key, so it never clears the list that wins. Stim Desktop writes settings by the keys in the stim settings --json payload, so it picks up the new name with no change.
  • Schema. The published $defs.machine schema accepts maintenance.discoverRoots (marked deprecated, with no x-stim entry), so an editor does not reject a 2.0.0 config and Stim Desktop does not list it as a second setting.
  • No rewrite on read, no mirroring. A config is only migrated when someone sets the setting. An older engine sharing the home reads only the old key, so after such a write it sees no managed folders and its doctor calls maintenance.managedFolders inert. 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, canonicalDiscoverRoots and friends) and JSON payload fields (census roots, 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.cleanAutoDiscoveredDependencies text 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.md and 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: machineSettingValue reads the old key alone, prefers the new key when both are set, treats an empty new list as set, and names maintenance.discoverRoots in the error for an invalid old value.
  • settings-schema.test.ts: $defs.machine accepts a config with only the old key, still rejects a misspelled key, and has no x-stim entry 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-scope unset of the old name; the old key in a .stim.json gets 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 --json shows the value under the new key with origin machine and lists no unknown key, and get by the old name prints it; with both, the new value wins and the old key is listed as unknown; unset by the old name keeps managedFolders when both are set and clears an old-only config; set by the old name writes only managedFolders; unset of the new name clears an old-only config.
  • Existing discovery, gc, census and doctor tests now configure managedFolders; the 22 changed test files pass (1024 tests).
  • Scratch STIM_HOME, worktree build: a config with only maintenance.discoverRoots pointing at a folder holding an Expo app. stim gc --dry-run lists the app as discovered root ... from <folder> (and does not without the setting); stim settings shows it under maintenance.managedFolders (machine); doctor reports no inert key. Adding managedFolders makes doctor and stim settings report the old key as not read. stim settings set maintenance.discoverRoots ... left only managedFolders in config.json. With both keys set, stim settings unset maintenance.discoverRoots left {"managedFolders":["/tmp/x-new"]}, and doctor reported an invalid old-key value as Invalid maintenance.discoverRoots value ["relative"].

Fixes #6644

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.
@janicduplessis janicduplessis added area: cli packages/stim-cli, including its README and guide area: core packages/core area: website website/ area: docs docs/ and root documents area: repo .github/, scripts/, test/, packaging/, patches/, root config labels Nov 28, 2026
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 janicduplessis added the review: ai-approved A fresh AI review found nothing left to fix label Nov 28, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review November 28, 2026 18:05
@janicduplessis
janicduplessis merged commit eabbe77 into main Nov 28, 2026
61 of 62 checks passed
@janicduplessis
janicduplessis deleted the feat/6644-managed-folders-setting branch November 28, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli packages/stim-cli, including its README and guide area: core packages/core area: docs docs/ and root documents area: repo .github/, scripts/, test/, packaging/, patches/, root config area: website website/ review: ai-approved A fresh AI review found nothing left to fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rename maintenance.discoverRoots to maintenance.managedFolders, keeping the old name working

1 participant