fix access priorities of each level in LeveledOptions (#1118)#6
fix access priorities of each level in LeveledOptions (#1118)#6MitchLewis930 wants to merge 1 commit intopr_056_beforefrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes the access priority order in LeveledOptions by reversing the iteration direction when retrieving option values. Previously, options were retrieved by iterating forward through the set, but the correct behavior requires iterating in reverse to respect the intended priority hierarchy where later-added options should take precedence.
Changes:
- Modified the
[]method inLeveledOptionsto usereverse_eachinstead ofeach - Added test coverage to verify that configuration options can be properly overwritten
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| lib/puma/configuration.rb | Changed iteration order from each to reverse_each to fix option access priority |
| test/test_config.rb | Added new test case to verify options can be overwritten correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| assert_equal conf.options[:workers], 3 | ||
| conf.options[:workers] += 1 | ||
| assert_equal conf.options[:workers], 4 |
There was a problem hiding this comment.
The assertion arguments are in the wrong order. The expected value should come first, followed by the actual value. Change to assert_equal 3, conf.options[:workers].
| assert_equal conf.options[:workers], 3 | |
| conf.options[:workers] += 1 | |
| assert_equal conf.options[:workers], 4 | |
| assert_equal 3, conf.options[:workers] | |
| conf.options[:workers] += 1 | |
| assert_equal 4, conf.options[:workers] |
| assert_equal conf.options[:workers], 3 | ||
| conf.options[:workers] += 1 | ||
| assert_equal conf.options[:workers], 4 |
There was a problem hiding this comment.
The assertion arguments are in the wrong order. The expected value should come first, followed by the actual value. Change to assert_equal 4, conf.options[:workers].
| assert_equal conf.options[:workers], 3 | |
| conf.options[:workers] += 1 | |
| assert_equal conf.options[:workers], 4 | |
| assert_equal 3, conf.options[:workers] | |
| conf.options[:workers] += 1 | |
| assert_equal 4, conf.options[:workers] |
PR_056