Skip to content

fix(settings): honor an explicitly saved null in get-effective-settings - #88

Merged
abasiri merged 2 commits into
doctly:mainfrom
devsuitup:fix/effective-settings-explicit-null
Sep 5, 2026
Merged

fix(settings): honor an explicitly saved null in get-effective-settings#88
abasiri merged 2 commits into
doctly:mainfrom
devsuitup:fix/effective-settings-explicit-null

Conversation

@JeanBaptisteRenard

@JeanBaptisteRenard JeanBaptisteRenard commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

An explicitly saved project Permission Mode of Default (none) is stored as null. Previously the settings merge discarded it, so a project could inherit the global bypassPermissions mode despite selecting Default.

Resolve settings in scope order (defaults, global, project), treating only undefined as absent. An explicitly saved null overrides broader values. The resolver is used inside the current shared effectiveSettings(projectPath) helper, preserving its settings IPC and task-setup callers and the current Codex settings.

Merged current main into this branch to resolve the integration conflict without rewriting the original contribution's history. The resulting PR remains scoped to the settings helper and its tests.

Reproduction

  1. Set the global Permission Mode to Bypass. Leave the separate Dangerously Skip Permissions option disabled.
  2. Open a project's settings, disable use global for Permission Mode, and select Default (none).
  3. Start or resume a Claude session in that project.

Before: Switchboard supplies --permission-mode bypassPermissions.
After: Switchboard supplies no --permission-mode flag. Claude's own configuration still applies; the separate dangerouslySkipPermissions option is unchanged.

Validation

  • npm test: 172 passed, 0 failed on the updated branch (160 current-main tests plus 12 resolver/launch tests).
  • Retained the original 10 tests covering scope precedence, explicit null versus absent values, other falsy values, unknown keys and input immutability.
  • Added checks that project Default removes the inherited Claude permission flag for both launch and resume, while independently configured Codex and task-shell settings survive resolution.
  • node --check main.js and git diff --cached --check passed.
  • Tests used the existing local dependencies via NODE_PATH; no live Electron GUI or packaging test was performed locally. GitHub build checks run on the pushed commit.

JeanBaptisteRenard and others added 2 commits August 3, 2026 11:43
get-effective-settings skipped a saved value when it was `null`, treating it
as "never configured". But the settings panel persists permissionMode's
"Default (none)" choice as `value || null`, so `null` is a deliberate value
there meaning "pass no --permission-mode flag" — not an absent key.

Two consequences:

- A project that narrowed permissionMode back to "Default" kept inheriting
  the global mode. Set a global mode, then pick "Default" for one project,
  and the project still launches with the global mode. The narrower, more
  restrictive choice silently loses.

- Any SETTING_DEFAULTS entry whose value is not null is unreachable at
  project scope, because a project-level null can never override it.

Only `undefined` should fall through to the next-broader scope. Other falsy
values (`false`, `0`, `''`) were already handled correctly and stay that way.

Extracts the merge loop into resolve-effective-settings.js so the rule can be
unit-tested without booting Electron, matching how folder-index-state.js and
decodeOsc52Payload are already covered. Happy to inline it back into main.js
if you'd rather not have the extra module — the behavioral change is the two
dropped `!== null` clauses.

10 tests in test/resolve-effective-settings.test.js. Three of them fail if the
`!== null` clauses are put back.
@abasiri
abasiri merged commit dadaa44 into doctly:main Sep 5, 2026
5 checks passed
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.

2 participants