Skip to content

Fix computed dependency argument ordering - #3337

Open
sergioperezcheco wants to merge 1 commit into
faker-ruby:mainfrom
sergioperezcheco:fix/c-positional-verification-20261016
Open

sergioperezcheco wants to merge 1 commit into
faker-ruby:mainfrom
sergioperezcheco:fix/c-positional-verification-20261016

Conversation

@sergioperezcheco

Copy link
Copy Markdown

Motivation / Background

PositionalGenerator documents computed block arguments as the declared deps, but currently collects them in evaluation order and drops false and nil. Two computations sharing the same dependencies in opposite orders therefore receive the same argument order; collect each dependency's value in its declared slot instead, without changing graph evaluation or random-number calls.

Additional information

The four regression tests cover shared dependencies with different orders, forward references, and false/nil slots; two fail on the original code and all four pass with the fix. On Ruby 3.4.11/macOS, the complete bundle exec rake passes (2,185 tests and RuboCop), a separate Faker::Base.generate reproduction passes in eager/lazy loading, and 600 seeded built-in outputs remain byte-identical; other Ruby/OS CI combinations have not been run locally. Alternating local measurements showed an NRIC median fixed/baseline ratio of about 1.036, so this is not a claim of zero performance cost.

AI agents performed the investigation, implementation, independent review, and testing; no human review is claimed. This fixes the existing helper contract introduced in #2710, not a new generator or feature, and does not claim a currently broken built-in generator or close #2710.

Checklist

  • This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug, refactor something, or add a feature.
  • Tests and Rubocop are passing before submitting your proposed changes.

Bind computed arguments in declared dependency order and preserve false and nil slots without changing evaluation order. Add regression coverage for shared dependencies, forward references, and false/nil values.

Assisted-by: OpenAI gpt-6.1-sol via Hermes Agent
Signed-off-by: sergioperezcheco <checo520@outlook.com>
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.

1 participant