Ensure and enforce that configs are loaded before options are accesse…#8
Open
MitchLewis930 wants to merge 1 commit intopr_058_beforefrom
Open
Ensure and enforce that configs are loaded before options are accesse…#8MitchLewis930 wants to merge 1 commit intopr_058_beforefrom
MitchLewis930 wants to merge 1 commit intopr_058_beforefrom
Conversation
Greptile OverviewGreptile SummaryThis PR enforces a stricter configuration lifecycle by introducing state guards that ensure
All tests were updated to call Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Configuration
participant DSL
participant Launcher
participant Binder
User->>Configuration: new(user_options, default_options)
Configuration->>Configuration: Initialize @_options, @loaded=false, @clamped=false
Configuration->>DSL: new(@_options.user_options)
Configuration->>DSL: new(@_options.file_options)
Configuration->>DSL: new(@_options.default_options)
alt User configures via DSL
User->>DSL: before_fork {block}
DSL->>Configuration: hooks[:before_fork] = "before_fork"
DSL->>DSL: Store {block: block, cluster_only: true}
end
User->>Configuration: clamp()
Configuration->>Configuration: load() if !@loaded
Configuration->>Configuration: @loaded = true, @clamped = true
Configuration->>Configuration: options.finalize_values()
Configuration->>Configuration: warn_hooks()
alt Worker count is 0 and cluster_only hooks exist
Configuration->>Configuration: Log warning for cluster_only hooks
end
User->>Configuration: options
alt @clamped == false
Configuration-->>User: raise NotClampedError
else @clamped == true
Configuration-->>User: return @_options
end
User->>Launcher: new(conf, launcher_args)
Launcher->>Configuration: clamp()
Launcher->>Configuration: options
Configuration-->>Launcher: @_options
Launcher->>Binder: new(log_writer, options)
Binder->>Binder: Store @options instead of @conf
|
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.
PR_058