Skip to content

fix access priorities of each level in LeveledOptions (#1118)#6

Open
MitchLewis930 wants to merge 1 commit intopr_056_beforefrom
pr_056_after
Open

fix access priorities of each level in LeveledOptions (#1118)#6
MitchLewis930 wants to merge 1 commit intopr_056_beforefrom
pr_056_after

Conversation

@MitchLewis930
Copy link

PR_056

@MitchLewis930 MitchLewis930 requested a review from Copilot January 31, 2026 01:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 in LeveledOptions to use reverse_each instead of each
  • 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.

Comment on lines +66 to +68
assert_equal conf.options[:workers], 3
conf.options[:workers] += 1
assert_equal conf.options[:workers], 4
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

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].

Suggested change
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]

Copilot uses AI. Check for mistakes.
Comment on lines +66 to +68
assert_equal conf.options[:workers], 3
conf.options[:workers] += 1
assert_equal conf.options[:workers], 4
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

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].

Suggested change
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]

Copilot uses AI. Check for mistakes.
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.

3 participants