Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Authors: Please fill out this form carefully and completely.

Reviewers: By approving this Pull Request you are approving the code change, as well as its deployment and mitigation plans.
Please read this description carefully. If you feel there is anything unclear or missing, please ask for updates.

What are you trying to accomplish?

The assert_allocations helper fails silently with confusing error messages when a Ruby version isn't mapped in allocation expectations. This change makes the error explicit and actionable.

Before:

# Error: comparison of NilClass with Integer failed
assert_equal count, total, "..."  # count is nil for unmapped version

After:

# Error: No allocation count mapped for Ruby version 3.5. Available versions: 3.2, 3.3, 3.4. Actual allocations: 6

The improved error provides all information needed to add the new version mapping immediately.

Screenshots

N/A - test infrastructure change only

Integration

List the issues that this change affects.

Closes # (issue number not provided in problem statement)

Risk Assessment

  • Low risk the change is small, highly observable, and easily rolled back.
  • Medium risk changes that are isolated, reduced in scope or could impact few users. The change will not impact library availability.
  • High risk changes are those that could impact customers and SLOs, low or no test coverage, low observability, or slow to rollback.

What approach did you choose and why?

Added nil check in assert_allocations_helper.rb that raises early with diagnostic information: unmapped version, available versions, and measured allocations. This makes adding new Ruby version support self-documenting.

Verified all existing Ruby 3.4 allocation counts are correct (tests pass on Ruby 3.4.7 and 3.3).

Anything you want to highlight for special attention from reviewers?

The change only adds error handling. No allocation counts were modified—all Ruby 3.4 values were already correct.

Accessibility

N/A - test infrastructure change only

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Lookbook)
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

Original prompt

Fix the failing performance benchmark tests by ensuring that the allocation count expectations match Ruby 3.4.x (current CI version). Specifically:

  1. Update all calls to assert_allocations in these files:

    • test/performance/bench_classify.rb
    • test/performance/bench_octicons.rb
    • test/performance/bench_utilities.rb

    Add or correct the value for the key "3.4" in their allocation expectation hash arguments so that the tests reflect current allocations. Run the benchmarks as needed to obtain the correct allocation counts for Ruby 3.4.x on this codebase.

  2. (Optional but recommended): In test/test_helpers/assert_allocations_helper.rb, make the assertion logic friendlier for future Ruby versions by raising a meaningful error if the version is not mapped.

  3. Do not alter unrelated code. The goal is only to make the allocation benchmarks robust against Ruby version changes and get CI passing.

This pull request was created as a result of the following prompt from Copilot chat.

Fix the failing performance benchmark tests by ensuring that the allocation count expectations match Ruby 3.4.x (current CI version). Specifically:

  1. Update all calls to assert_allocations in these files:

    • test/performance/bench_classify.rb
    • test/performance/bench_octicons.rb
    • test/performance/bench_utilities.rb

    Add or correct the value for the key "3.4" in their allocation expectation hash arguments so that the tests reflect current allocations. Run the benchmarks as needed to obtain the correct allocation counts for Ruby 3.4.x on this codebase.

  2. (Optional but recommended): In test/test_helpers/assert_allocations_helper.rb, make the assertion logic friendlier for future Ruby versions by raising a meaningful error if the version is not mapped.

  3. Do not alter unrelated code. The goal is only to make the allocation benchmarks robust against Ruby version changes and get CI passing.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@changeset-bot
Copy link

changeset-bot bot commented Dec 3, 2025

⚠️ No Changeset found

Latest commit: ba33153

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copilot AI changed the title [WIP] Fix allocation expectations for performance benchmarks Improve allocation benchmark error handling for unmapped Ruby versions Dec 3, 2025
Copilot AI requested a review from jonrohan December 3, 2025 22:37
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.

2 participants