Skip to content

feat(bootstrap): add friendly macos defaults#10398

Merged
jdx merged 5 commits into
mainfrom
codex/friendly-macos-defaults
Jun 13, 2026
Merged

feat(bootstrap): add friendly macos defaults#10398
jdx merged 5 commits into
mainfrom
codex/friendly-macos-defaults

Conversation

@jdx

@jdx jdx commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • add friendly [bootstrap.macos.dock], [bootstrap.macos.finder], [bootstrap.macos.keyboard], and [bootstrap.macos.trackpad] sections
  • compile friendly keys into existing macOS defaults requests so status/apply keep using the current backend
  • document the curated keys and extend macOS defaults e2e coverage

Tests

  • cargo test -q macos_defaults
  • cargo test -q test_bootstrap_macos_defaults
  • mise run test:e2e cli/test_system_defaults

This PR was generated by an AI coding assistant.


Note

Low Risk
Experimental bootstrap/macOS defaults only; no auth or data-path changes. Main risk is surprising override behavior when mixing friendly and raw defaults in layered configs.

Overview
Introduces friendly macOS bootstrap sections so common Dock, Finder, keyboard, and trackpad preferences can be declared with short keys (e.g. show_all_files, tap_to_click) instead of raw defaults domains.

Those sections are compiled into the same DefaultsRequest pipeline used by mise bootstrap macos-defaults status/apply; the apply backend is unchanged. Merge rules: within one config file, [bootstrap.macos.defaults] wins over the (domain, key) produced by a friendly key; across files, usual global→local precedence still applies. Invalid friendly keys, enum values, or types warn and are skipped.

Docs and schema/mise.json document supported keys; OCI build now counts friendly entries via macos_defaults_entry_count and rejects any [bootstrap.macos.*] defaults in project configs.

Reviewed by Cursor Bugbot for commit fac98df. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Added curated macOS preference sections for Dock, Finder, Keyboard, and Trackpad, while preserving raw defaults override.
  • Documentation

    • Updated examples, guides, and “What Goes Where” to show friendly sections, raw defaults placement, supported keys/enums, and warning behavior.
  • Tests

    • Expanded coverage for parsing, status output, validation warnings, and precedence between friendly and raw defaults.
  • Schema

    • Extended macOS bootstrap schema to declare the new curated preference sections.
  • Bug Fixes

    • Improved counting/validation of macOS defaults to ensure unsupported entries are detected.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds structured macOS "friendly" TOML tables (dock, finder, keyboard, trackpad) that map to raw macOS defaults, validate types/enums, and merge with raw defaults where raw values override friendly-derived ones. Tests and docs updated.

Changes

Friendly macOS Defaults Feature

Layer / File(s) Summary
Schema: Friendly config sections
src/system/mod.rs, schema/mise.json
BootstrapMacosTomlConfig adds dock, finder, keyboard, trackpad as IndexMap<String, toml::Value> and schema exposes those objects.
Defaults aggregation refactor
src/system/mod.rs
defaults_from_config constructs friendly-derived and raw (domain,key)->value maps and merges them with raw precedence; adds macos_defaults_entry_count.
Friendly validation and mapping helpers
src/system/mod.rs
Private helpers translate friendly keys to macOS domains/keys, enforce types/enums, and emit warnings for unknown/invalid entries across Dock, Finder, Keyboard, and Trackpad.
Unit tests & test helper
src/system/mod.rs
Adds tv() helper and tests for mapping, validation (invalid/unknown produce no derived output), precedence semantics, and local-vs-global precedence.
Config file parsing tests
src/config/config_file/mise_toml.rs
test_bootstrap_macos_defaults fixture and assertions extended to include dock, finder, keyboard, and trackpad parsing.
End-to-end CLI test coverage
e2e/cli/test_system_defaults
E2E fixture updated to include friendly sections; status output assertions expanded; adds validation scenario asserting warnings for invalid enums and unknown keys.
Documentation examples and guides
docs/bootstrap.md, docs/bootstrap/macos-defaults.md, docs/tips-and-tricks.md
Docs updated with examples using friendly sections, "Friendly sections" guidance, and clarifications on raw defaults vs curated sections.
CLI unsupported-count integration
src/cli/oci/common.rs
reject_unsupported_system_defaults now uses macos_defaults_entry_count(...) to compute unsupported-entry counts.

Sequence Diagram

sequenceDiagram
  participant UserConfig as User Config
  participant Agg as defaults_from_config
  participant Mapper as Friendly Mapper
  participant Raw as Raw Defaults Parser
  participant Merge as Merge Handler
  participant Result as Final Defaults Map

  UserConfig->>Agg: provide TOML with friendly sections + raw defaults
  Agg->>Mapper: parse dock/finder/keyboard/trackpad entries
  Mapper->>Mapper: validate keys/types and map to (domain,key)->value
  Agg->>Raw: collect entries from [bootstrap.macos.defaults]
  Mapper->>Merge: emit friendly-derived entries
  Raw->>Merge: emit raw entries
  Merge->>Result: merge with raw overriding friendly
  Result->>UserConfig: return final defaults map
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • jdx/mise#10373: Modifies reject_unsupported_system_defaults logic and touches the same CLI unsupported-entry handling.

Poem

🐰 I nibble keys in dock and finder light,
I map friendly names from morning to night,
Raw values hop over the garden bed,
Warnings chirp when types go wrong instead,
A neat defaults harvest, all tucked in tight.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 61.90% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(bootstrap): add friendly macos defaults' directly and clearly summarizes the main change—adding friendly/curated macOS defaults sections to the bootstrap configuration system.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread src/system/mod.rs
@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds curated [bootstrap.macos.dock], .finder, .keyboard, and .trackpad config sections that compile into the existing raw (domain, key) defaults machinery, so status/apply behavior is unchanged. Invalid keys, enum values, and value types warn and are skipped; OCI rejection is broadened to cover the new friendly entries.

  • Per-file merge semantics (src/system/mod.rs): friendly and raw entries are reconciled inside the config-file loop (raw wins within the same file; more-local files still override more-global ones), addressing the cross-file precedence issue that affected the pre-PR approach.
  • Multi-domain keys (tap_to_click, three_finger_drag): insert_friendly_multi_domain_default validates the value once and emits a single warning on failure, then inserts the value across both trackpad domains — no duplicate warnings.
  • OCI guard (src/cli/oci/common.rs): delegated to macos_defaults_entry_count, which counts distinct merged (domain, key) pairs (friendly + raw) plus malformed domain entries, keeping the count accurate and deduplicated.

Confidence Score: 5/5

Safe to merge — the friendly sections are purely additive, all compilation and merge logic is well-tested, and the existing raw defaults path is unchanged.

The per-file merge loop correctly resolves raw-over-friendly within a file and local-over-global across files. Multi-domain trackpad keys emit only one warning. The OCI entry count is deduplicated. Unit and e2e tests cover the happy path, invalid enum/type values, unknown keys, and the local-friendly-overrides-global-raw precedence scenario.

No files require special attention.

Important Files Changed

Filename Overview
src/system/mod.rs Core implementation: adds 4 new friendly-section fields, per-file friendly+raw merge (local wins over global), macos_defaults_entry_count helper, and all section dispatch functions with type/enum validation
src/cli/oci/common.rs Simplified OCI defaults rejection to use the shared macos_defaults_entry_count helper, broadening coverage to include friendly sections
src/config/config_file/mise_toml.rs Extended parsing unit test to assert all four friendly sections deserialize correctly into IndexMap fields
schema/mise.json Added dock/finder/keyboard/trackpad objects with typed properties and additionalProperties:false under the macos bootstrap schema
e2e/cli/test_system_defaults Extended e2e test with friendly section entries, status output assertions for compiled keys, and validation warning assertions for bad enum/type values and unknown keys
docs/bootstrap/macos-defaults.md Comprehensive documentation for all four friendly sections, key tables with raw mappings, enum constraints, and precedence rules
docs/bootstrap.md Updated overview example to use friendly sections and added bootstrap.macos.* row to the What Goes Where table
docs/tips-and-tricks.md Updated the quick-start snippet from raw defaults to the friendly dock/finder sections

Reviews (6): Last reviewed commit: "fix(oci): reject friendly macos defaults" | Re-trigger Greptile

Comment thread src/system/mod.rs
Comment thread src/system/mod.rs
Comment thread src/system/mod.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/system/mod.rs (1)

236-257: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve config-layer precedence when applying raw-over-friendly merge.

The current flow aggregates all friendly entries and all raw entries across all files, then overlays raw once at the end. That allows a global raw value to override a more-local friendly value for the same (domain, key), which breaks the stated global→local precedence behavior in this function.

Suggested fix (merge per config file, then apply global→local override)
 pub fn defaults_from_config(config: &Config) -> Vec<DefaultsRequest> {
-    let mut friendly: IndexMap<(String, String), toml::Value> = IndexMap::new();
-    let mut raw: IndexMap<(String, String), toml::Value> = IndexMap::new();
+    let mut merged: IndexMap<(String, String), toml::Value> = IndexMap::new();
     // config_files is ordered local -> global; reverse for global -> local
     for cf in config.config_files.values().rev() {
         if let Some(sys) = cf.bootstrap_config() {
-            merge_friendly_macos_defaults(&mut friendly, &sys.macos);
+            let mut friendly: IndexMap<(String, String), toml::Value> = IndexMap::new();
+            let mut raw: IndexMap<(String, String), toml::Value> = IndexMap::new();
+
+            merge_friendly_macos_defaults(&mut friendly, &sys.macos);
             for (domain, entries) in sys.macos.defaults {
                 match entries {
                     toml::Value::Table(entries) => {
                         for (key, value) in entries {
                             raw.insert((domain.clone(), key), value);
                         }
                     }
                     _ => warn!(
                         "[bootstrap.macos.defaults]: expected a table of key/value pairs for domain '{domain}'"
                     ),
                 }
             }
+
+            for (key, value) in merge_raw_over_friendly_macos_defaults(friendly, raw) {
+                merged.insert(key, value);
+            }
         }
     }
-    let merged = merge_raw_over_friendly_macos_defaults(friendly, raw);
     let mut out = vec![];
     for ((domain, key), value) in merged {

Also applies to: 270-278

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/system/mod.rs` around lines 236 - 257, The code currently collects all
friendly and raw macOS defaults across files then applies raw-over-friendly
once, which lets a global raw override a more-local friendly; instead, inside
the loop over config.config_files.values().rev() you should merge per-file: call
merge_friendly_macos_defaults(&mut friendly, &sys.macos) and then immediately
incorporate that file's raw entries into friendly (i.e., apply the raw overlay
for that file before continuing) rather than accumulating raw separately;
concretely, stop building the separate raw IndexMap and instead for each
sys.macos.defaults entry insert into a local raw map and call
merge_raw_over_friendly_macos_defaults (or perform the same overlay logic
inline) to update friendly before the next config file, preserving global→local
precedence for (domain,key) pairs while keeping existing functions
merge_friendly_macos_defaults and merge_raw_over_friendly_macos_defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/system/mod.rs`:
- Around line 236-257: The code currently collects all friendly and raw macOS
defaults across files then applies raw-over-friendly once, which lets a global
raw override a more-local friendly; instead, inside the loop over
config.config_files.values().rev() you should merge per-file: call
merge_friendly_macos_defaults(&mut friendly, &sys.macos) and then immediately
incorporate that file's raw entries into friendly (i.e., apply the raw overlay
for that file before continuing) rather than accumulating raw separately;
concretely, stop building the separate raw IndexMap and instead for each
sys.macos.defaults entry insert into a local raw map and call
merge_raw_over_friendly_macos_defaults (or perform the same overlay logic
inline) to update friendly before the next config file, preserving global→local
precedence for (domain,key) pairs while keeping existing functions
merge_friendly_macos_defaults and merge_raw_over_friendly_macos_defaults.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b1ff676-ccaf-4f4f-a680-b12d6f7777e7

📥 Commits

Reviewing files that changed from the base of the PR and between db6bd8f and 459ca9b.

📒 Files selected for processing (6)
  • docs/bootstrap.md
  • docs/bootstrap/macos-defaults.md
  • docs/tips-and-tricks.md
  • e2e/cli/test_system_defaults
  • src/config/config_file/mise_toml.rs
  • src/system/mod.rs

@github-actions

github-actions Bot commented Jun 13, 2026

Copy link
Copy Markdown

Hyperfine Performance

mise x -- echo

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.6 x -- echo 18.0 ± 0.7 16.5 21.8 1.00
mise x -- echo 18.5 ± 1.9 17.0 55.9 1.03 ± 0.11

mise env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.6 env 18.0 ± 0.8 16.3 20.9 1.00
mise env 18.4 ± 0.8 17.0 24.0 1.02 ± 0.06

mise hook-env

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.6 hook-env 18.5 ± 0.8 16.9 23.7 1.00
mise hook-env 19.0 ± 0.7 17.3 22.2 1.03 ± 0.06

mise ls

Command Mean [ms] Min [ms] Max [ms] Relative
mise-2026.6.6 ls 14.9 ± 0.6 13.6 19.2 1.00
mise ls 15.7 ± 0.7 14.2 20.5 1.05 ± 0.07

xtasks/test/perf

Command mise-2026.6.6 mise Variance
install (cached) 130ms 134ms -2%
ls (cached) 57ms 58ms -1%
bin-paths (cached) 62ms 65ms -4%
task-ls (cached) 124ms 125ms +0%

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
docs/bootstrap/macos-defaults.md (1)

36-36: 💤 Low value

Hyphenate the compound noun "raw-default" for clarity.

The phrase "a global raw default" should use a hyphen to clarify it is a compound noun: "a global raw-default". This improves readability and grammatical precision, especially since "raw-defaults" is used as a section/domain term elsewhere in the document.

✏️ Proposed fix
-override a global raw default for the same pair.
+override a global raw-default for the same pair.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/bootstrap/macos-defaults.md` at line 36, Change the phrase "a global raw
default" to the hyphenated compound "a global raw-default" in the sentence shown
(to match the term "raw-defaults" used elsewhere); replace the unhyphenated
instance so the document consistently uses the compound noun "raw-default".

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@docs/bootstrap/macos-defaults.md`:
- Line 36: Change the phrase "a global raw default" to the hyphenated compound
"a global raw-default" in the sentence shown (to match the term "raw-defaults"
used elsewhere); replace the unhyphenated instance so the document consistently
uses the compound noun "raw-default".

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a8d6e422-2909-4399-96bb-4eb5211659d5

📥 Commits

Reviewing files that changed from the base of the PR and between dd7d855 and 98c934d.

📒 Files selected for processing (2)
  • docs/bootstrap/macos-defaults.md
  • src/system/mod.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/system/mod.rs

@jdx jdx enabled auto-merge (squash) June 13, 2026 14:24
@jdx jdx disabled auto-merge June 13, 2026 14:25

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4148c1f. Configure here.

Comment thread src/system/mod.rs
@jdx jdx force-pushed the codex/friendly-macos-defaults branch from 11771e5 to fac98df Compare June 13, 2026 15:19
@jdx jdx enabled auto-merge (squash) June 13, 2026 15:29
@jdx jdx merged commit f8ca012 into main Jun 13, 2026
35 checks passed
@jdx jdx deleted the codex/friendly-macos-defaults branch June 13, 2026 15:33
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.

1 participant