Skip to content

feat: direct system-defaults apply path, fix found issues in the existing system-defaults defs#406

Open
Scott McMaster (scottmcmaster) wants to merge 2 commits into
06-12-scott-real-defaults-on-untracked-tabfrom
06-12-scott-defaults-direct-edits
Open

feat: direct system-defaults apply path, fix found issues in the existing system-defaults defs#406
Scott McMaster (scottmcmaster) wants to merge 2 commits into
06-12-scott-real-defaults-on-untracked-tabfrom
06-12-scott-defaults-direct-edits

Conversation

@scottmcmaster

@scottmcmaster Scott McMaster (scottmcmaster) commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

The main business purpose of this change is to wire the system defaults edits up directly rather than applying them through the agent prompt. That wiring was actually more straightforward than I expected from the existing code. But when I started trying to build some actual changes based on this, I ran into other issues I had to fix:

  • One option value is exposed by defaults as an int but defined as a string in nix-darwin. So I added a new ValType for mappings and updated the KeyDefs as appropriate.
  • This got me thinking, so I added a flag you can change in the code that will force nixmac to detect "drift" on ALL the available defaults. And when I did that, sure enough:
  • Several other things would not nix-eval properly. Mostly things defined as int's that were really supposed to be nullable bool's. So I fixed all those.

As of right now, then, everything is at least plausible enough to pass through nix-eval, although I think we need to have more discussion about how we maintain this code. I'll open that up separately.

Test Plan

Some minor unit test changes, and lots of manual testing including the aforementioned new code-based way to make sure that every option is typed correctly in the KeyDefs.

  • No test plan needed

Docs

  • Docs updated (companion PR in darkmatter/nixmac-web: #___)
  • No docs update needed

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • automerge - adds this PR to the back of the merge queue
  • urgent - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@scottmcmaster Scott McMaster (scottmcmaster) changed the title scott-defaults-direct-edits feat: direct system-defaults apply path, fix found issues in the existing system-defaults defs Jun 12, 2026
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

📋 PR Overview

Lines changed 414 (+359 / -55)
Files 0 added, 6 modified, 0 deleted
Draft / WIP no
Has Test Plan yes
No Test Plan Needed no
New UI components no
New Storybook stories no
New Rust modules no
New TS source files no
New tests no
package.json touched no
Cargo.toml touched no
Infra / CI touched no

🔬 Coverage

Report Lines Statements Functions Branches
apps/native/coverage/coverage-summary.json 25.8% 26.0% 25.0% 18.9%

Generated by 🚫 dangerJS against 63056fd

Copilot AI 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.

Pull request overview

This PR wires “system defaults” untracked items into a direct managed-edit apply flow (similar to Homebrew), rather than routing through prompt seeding, and hardens the macOS defaults scanner so its generated Nix matches nix-darwin option types (including null defaults and int→string mappings).

Changes:

  • Added a refreshable useSystemDefaultsScan hook and used it to re-scan after applying defaults.
  • Extended the Filesystem “Untracked” UI to support a direct “track/apply” path for system defaults candidates.
  • Updated the Rust system-defaults scanner typing/comparison and Nix generation (null sentinel + int→string mapping support), plus unit tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
apps/native/src/hooks/use-system-defaults-scan.ts Adds a memoized refresh() API and exposes it to callers.
apps/native/src/components/widget/filesystem/untracked-card.tsx Routes “Track” actions to system-defaults direct apply when applicable, otherwise falls back to prompt seeding.
apps/native/src/components/widget/filesystem/filesystem-step.tsx Implements onTrackSystemDefaults (direct apply) and refreshes the scan after applying.
apps/native/src/components/widget/filesystem/file-list.tsx Plumbs the new system-defaults tracking handler through the file list.
apps/native/src/components/widget/filesystem/data.ts Adds a helper to detect the system-defaults candidate section.
apps/native/src-tauri/src/system/scanner.rs Adds NULL_FLAG, StringFromIntMap, updated comparison logic, and Nix generation enhancements with tests.
Comments suppressed due to low confidence (1)

apps/native/src-tauri/src/system/scanner.rs:1617

  • default_value is sent to the frontend as-is. When the factory default is NULL_FLAG, this leaks the internal sentinel string ("NULL") into UI strings like "default: …" and any previewed Nix snippet metadata. Consider translating the sentinel to something user-facing (e.g. "null") before returning it.
                defaults.push(SystemDefault {
                    nix_key: def.nix_key.to_string(),
                    label: def.label.to_string(),
                    category: def.category.to_string(),
                    current_value: current.to_string(),
                    default_value: def.factory_default.to_string(),
                });

Comment thread apps/native/src/components/widget/filesystem/filesystem-step.tsx
Comment thread apps/native/src-tauri/src/system/scanner.rs
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.

3 participants