Skip to content

Backport #3073 to 4.1: Avoid eagerly inspecting call traces in type assertions - #3076

Merged
soutaro merged 1 commit into
aaa-4.1.xfrom
claude/rbs-3073-backport-dh5jwk
Aug 10, 2026
Merged

Backport #3073 to 4.1: Avoid eagerly inspecting call traces in type assertions#3076
soutaro merged 1 commit into
aaa-4.1.xfrom
claude/rbs-3073-backport-dh5jwk

Conversation

@soutaro

@soutaro soutaro commented Aug 10, 2026

Copy link
Copy Markdown
Member

Backports #3073 to the aaa-4.1.x branch, cherry-picked with -x.

RBS::UnitTest::TypeAssertions eagerly interpolates trace.inspect into assertion messages, so the complete argument and return values are inspected even when the assertion succeeds.

This is problematic for ObjectSpace.reachable_objects_from_root: after the per-Ractor GC roots change in Ruby, the returned roots hash can be very large. Building its inspection string causes excessive peak memory usage and can raise NoMemoryError in the Windows test-bundled-gems job in ruby/ruby.

Assertion messages are passed as procs, so call traces and method definitions are formatted only when an assertion fails. The same lazy formatting is applied to assert_send_type, assert_send_type_error, and refute_send_type.

lib/rbs/unit_test/ ships in the gem and is what CRuby's bundled-gem tests run against, so the fix reaches CRuby only through the 4.1 line — the same reason #3074 was backported in #3075.

The cherry-pick applied cleanly with no conflicts.

Verification

  • test/stdlib/Integer_test.rb passes on this branch (67 tests, 648 assertions), so the succeeding path still type-checks calls as before.
  • A deliberately failing assert_send_type still renders the full diagnostic — the call trace and the ReturnTypeError detail — confirming the procs are called on failure.
  • steep check reports no type error with the widened _BaseAssertions#assert / #assert_empty signatures.
  • rake test was run with this commit applied to aaa-4.1.x and its failure set is identical to the unmodified branch's, with no new failures.

Generated by Claude Code

@soutaro
soutaro merged commit 0b57ea2 into aaa-4.1.x Aug 10, 2026
24 checks passed
@soutaro
soutaro deleted the claude/rbs-3073-backport-dh5jwk branch August 10, 2026 07:18
@soutaro soutaro mentioned this pull request Aug 10, 2026
soutaro pushed a commit that referenced this pull request Aug 12, 2026
The Backports section explains what `-x` buys — that the changelog
reaches the pull request the change was written and reviewed in — but
not what the entry ends up looking like, so the annotation naming the
backport was rediscovered while preparing 4.1.3, and got it wrong first.

`gem:changelog` now prints the form rather than leaving it to be
remembered. It already had both halves: `changelog_origins` resolves the
`-x` trailer to where the change was written, and the `fallbacks` path
already looked the cherry-pick's own pull request up, calling it in
passing "at least the backport that brought it here". Both ends are now
asked for together — one query rather than two, since the second was
only ever a retry — and the cherry-pick's becomes the entry's second
link instead of being discarded.

A backport also stops appearing beside the entries it carried. Its merge
commit is in the history too and has no `-x` trailer to resolve, so it
read as an ordinary commit of its own pull request: dispatching this on
the 4.1.3 cycle listed #3076 as a change of its own, above the entry it
annotates. A backport is how a change arrived rather than a change, so
the ones that annotate something are dropped from the list.

On the development line there are no origins, so entries keep the single
link they have today. A backport carrying several changes at once falls
out of the same handling: each entry names its own origin and shares the
one backport link, which is what 4.0.3 should have looked like.

docs/release.md loses the procedure it carried for assembling the
changelog by hand, which existed because the task could not run from a
Claude Code on the web session. `changelog.yml` runs it on a runner now,
so the section says to dispatch that instead — and the traps it
documented, all of them about hand-rolling the match, go with it. What
replaces them is the one thing the workflow adds: the ref picks the copy
of the task as well as the history, so a release branch needs the file
on it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QAgPhpLrU9Z4bENCR9RUub
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