[2.x] fix: Relax non-delegation for settings on shell#8751
Merged
eed3si9n merged 3 commits intosbt:developfrom Feb 18, 2026
Merged
[2.x] fix: Relax non-delegation for settings on shell#8751eed3si9n merged 3 commits intosbt:developfrom
eed3si9n merged 3 commits intosbt:developfrom
Conversation
a2abdc1 to
cc88f1b
Compare
eed3si9n
requested changes
Feb 17, 2026
Member
eed3si9n
left a comment
There was a problem hiding this comment.
I don't think this feature is needed in sbt 2.x since we already implement caching for tasks by default.
Allow settings to delegate when the user specifies an explicit scope (config or task axis), so that e.g. Compile/console/fork resolves when console/fork is defined in a delegated scope. Tasks continue to not delegate (getDirect only) so non-existent scopes like Compile/update still fail as in 2.0.0.
7d905ba to
0479d71
Compare
eed3si9n
reviewed
Feb 17, 2026
Member
eed3si9n
left a comment
There was a problem hiding this comment.
Could you add a scripted test for this please?
Contributor
Author
I added it. Would you mind reviewing it again? |
eed3si9n
approved these changes
Feb 18, 2026
Member
eed3si9n
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
EndlessLucky
pushed a commit
to EndlessLucky/sbt
that referenced
this pull request
Mar 27, 2026
Allow settings to delegate when the user specifies an explicit scope (config or task axis), so that e.g. Compile/console/fork resolves when console/fork is defined in a delegated scope. Tasks continue to not delegate (getDirect only) so non-existent scopes like Compile/update still fail as in 2.0.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #8757
Problem
After the change in #8539, the shell stopped delegating for any scoped key. So when you run something like
Compile/console/fork, you get "No such setting/task" even whenconsole/forkis defined in a delegated scope (e.g. the default config). That’s annoying for settings, where delegation is usually what you want.Solution
We keep the current behaviour for tasks: if you type a task with an explicit scope and it isn’t defined in that exact scope, it still fails (so typos like
Compile/updatedon’t silently run something else). For settings we allow delegation again: if the key isn’t found in the requested scope, we follow the normal scope delegation and use the value from a delegate scope. SoCompile/console/forkworks whenconsole/forkis defined in a more general scope.The change is in
Act.getValue: when the user has specified an explicit config or task scope we still try a direct lookup first; if that returns nothing and the key is a setting (viakey.key.tag.isSetting), we fall back todata.get(key)so delegation applies. Task keys never use that fallback.