Skip to content

config: use prefer_modify: true to adjust edit preferences#51510

Merged
becker33 merged 2 commits intodevelopfrom
config-prefer-modify
Nov 6, 2025
Merged

config: use prefer_modify: true to adjust edit preferences#51510
becker33 merged 2 commits intodevelopfrom
config-prefer-modify

Conversation

@tgamblin
Copy link
Copy Markdown
Member

@tgamblin tgamblin commented Nov 5, 2025

#51162 allows users to specify configuration scopes as configuration, but it also changes the spack scope to be the default edit scope. This can be extremely confusing to users, as it causes spack compiler find, spack external find, spack config add, etc. to be written into the spack instance by default instead of into ~/.spack.

~/.spack is a better choice if it's configured, as we do not know if the user actually owns the spack instance. It's also what people are used to, and it's going to cause a lot of consternation if we switch this default up on people.

This PR introduces a new prefer_modify: true option on include: that allows the including scope to hand off edit precedence to an included scope. The including scope is still modifiable if specified explicitly by name (e.g., --scope spack) but if it is selected by default, we'll edit its prefer_modify scope instead.

  • Add prefer_modify: option to include:
  • Make the default spack scope specify the user scope as prefer_modify:.
  • Add documentation and update include: docs with versionadded directives.
  • make the user scope prefer_modify: in $spack/etc/spack/include.yaml

@tgamblin tgamblin changed the title concur: use prefer_modify: true to adjust edit preferences config: use prefer_modify: true to adjust edit preferences Nov 5, 2025
#51162 allows users to specify configuration scopes as configuration, but it also
changes the `spack` scope to be the default edit scope. This can be extremely confusing
to users, as it causes `spack compiler find`, `spack external find`, `spack config add`,
etc. to be written into the spack instance by default instead of into `~/.spack`.

`~/.spack` is a better choice if it's configured, as we do not know if the user
actually owns the spack instance. It's also what people are used to, and it's going
to cause a lot of consternation if we switch this default up on people.

This PR introduces a new `prefer_modify: true` option on `include:` that allows the
including scope to hand off edit precedence to an included scope. The including scope
is still modifiable if specified explicitly by name (e.g., `--scope spack`) but if it
is selected by default, we'll edit its `prefer_modify` scope instead.

- [x] Add `prefer_modify:` option to `include:`
- [x] Make the default `spack` scope specify the user scope as `prefer_modify:`.
- [x] Add documentation and update `include:` docs with `versionadded` directives.
- [x] make the `user` scope `prefer_modify:` in `$spack/etc/spack/include.yaml`

Signed-off-by: Todd Gamblin <[email protected]>
@tgamblin tgamblin force-pushed the config-prefer-modify branch from 97c2ffe to d98563b Compare November 5, 2025 08:18
@tgamblin tgamblin requested review from alalazo and haampie November 5, 2025 08:19
@tgamblin tgamblin added this to the v1.1.0 milestone Nov 5, 2025
alecbcs
alecbcs previously approved these changes Nov 5, 2025
Copy link
Copy Markdown
Member

@alecbcs alecbcs left a comment

Choose a reason for hiding this comment

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

Looks good to me. I like that this restores the previous user scope behavior while maintaining the additional flexibility of the new system.

Copy link
Copy Markdown
Contributor

@psakievich psakievich left a comment

Choose a reason for hiding this comment

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

Overall, I think this is the best option for preserving default behavior while still adding the spack scope. I could see a long term use for the new config option, but overall I'm not in love with it. I feel like the option may rot as soon as people realize they don't need to go to such great lengths to avoid the user scope. I would advocate for a minor release in this state to socialize the intended change then set it to false.

becker33
becker33 previously approved these changes Nov 5, 2025
@tgamblin tgamblin dismissed stale reviews from becker33 and alecbcs via 339ad1a November 6, 2025 00:02
@becker33 becker33 enabled auto-merge (squash) November 6, 2025 00:06
@becker33 becker33 merged commit 54fed68 into develop Nov 6, 2025
31 of 32 checks passed
@becker33 becker33 deleted the config-prefer-modify branch November 6, 2025 01:14
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.

4 participants