π€ β feat: extend global config directive to accept name/pattern specifiers#1035
Draft
juniper-shopify wants to merge 1 commit into
Draft
π€ β feat: extend global config directive to accept name/pattern specifiers#1035juniper-shopify wants to merge 1 commit into
juniper-shopify wants to merge 1 commit into
Conversation
Allow `global(:step_name)` and `global(/pattern/)` in Roast config blocks,
mirroring the existing name/pattern specifier support in cog-type blocks
(agent, chat, cmd, etc.).
This enables targeted cross-cutting configuration like:
global(:my_step) { async! }
global(/^api_/) { abort_on_failure! }
The merge cascade expands from 4 tiers to 7:
1. global (bare)
2. global (regexp match)
3. global (exact name)
4. cog-type general
5. cog-type regexp match
6. cog-type exact name
7. inline YAML
Also cleans up a vestigial `instance_variable_get(:@values)` call
to use the public `.values` accessor instead.
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.
π€ β Extend the
globalconfig directive to accept optional name/pattern specifiers, mirroring the existing support in cog-type blocks (agent,chat,cmd, etc.).Motivation
Currently,
global { ... }applies configuration to every cog unconditionally. There's no way to target a cross-cutting config at a specific step (or set of steps) without knowing the cog type. This feature enables:Implementation
Approach: Structural Mimicry β mirrors the proven 3-variable pattern already used by cog-type blocks.
Storage
Adds two new instance variables alongside the existing
@global_config:@global_configCog::Configglobal { }(unchanged)@global_regexp_configsHash{Regexp => Cog::Config}global(/pattern/) { }@global_name_configsHash{Symbol => Cog::Config}global(:name) { }Merge Cascade (7 tiers)
The
config_for(type, name)method now resolves configuration in this priority order (lowest β highest):global { }global(/pattern/) { }global(:step_name) { }agent { }agent(/pattern/) { }agent(:step_name) { }This preserves the invariant that cog-specific blocks always override globals.
Files Changed
lib/roast/config_manager.rbβ new storage, expandedbind_global/on_global, updatedconfig_forsorbet/rbi/shims/lib/roast/config_context.rbiβ updated type signature + docs forglobaltest/roast/config_manager_test.rbβ 8 new tests covering all specifier combinationsDrive-by
Replaced a vestigial
instance_variable_get(:@values)with the public.valuesaccessor.Test Plan
All 1188 existing tests pass. 8 new tests cover:
global(:name)exact matchglobal(/regexp/)pattern matchglobal(:name)skipped when name is nilglobal(:name)accumulationglobal(:name)blocks