Skip to content

[PROF-13303] Remove 3.5.0-preview1 and 4.0.0-preview3 headers and bump gem version to 3.5.0#24

Merged
ivoanjo merged 2 commits into
masterfrom
ivoanjo/prof-13303-ruby4-cleanups
Jan 8, 2026
Merged

[PROF-13303] Remove 3.5.0-preview1 and 4.0.0-preview3 headers and bump gem version to 3.5.0#24
ivoanjo merged 2 commits into
masterfrom
ivoanjo/prof-13303-ruby4-cleanups

Conversation

@ivoanjo

@ivoanjo ivoanjo commented Jan 7, 2026

Copy link
Copy Markdown
Member

What does this PR do?

This PR:

  • Removes the 3.5.0-preview1 and 4.0.0-preview3 headers

    I still left the 4.0.0-preview2 headers since dd-trace-rb CI is still, as of this writing, using them, but once we update it those should be cleaned up as well

  • Bump gem version to 3.5 in preparation for release

Motivation:

Get the next release out for customers.

Additional Notes:

Why gem version 3.5 instead of 4.0.0 like upstream does?

So the reason upstream moved to 4.0.0 is to match the Ruby version; e.g. before they shipped 4.0.0.preview2 and before that 3.4.1.

But I think this numbering format does not make sense for us. Specifically, dd-trace-rb pulls in this gem in a format such as

  spec.add_dependency 'datadog-ruby_core_source', '~> 3.4', '>= 3.4.2'

and thus regardless of you being on Ruby 2.5 or 4.0, you'll get the latest version of this gem.

Coupling with upstream numbers is awkward because:

  • For preview Rubies, a release like "4.0.0.preview2" doesn't get picked up by bundler automatically, so we'd add manual toil to customers that want to test preview releases
  • We don't ship headers for every Ruby version. So what happens if we find out we need to add headers for Ruby 2.7.3 specifically?
    What release number do we use? 4.0.1? 4.0.0.2.7.3?
    Do we do a "patch release" from an older branch? But then how do we make sure the patch release gets picked up over a 4.0.0 release that has a bigger number but does not yet have the 2.7.3 headers?

So for the time being I propose we do the following:

  • Decouple from upstream/ruby version schemes
  • Bump the minor version whenever we release support for a newer Ruby. That is, for Ruby 4.0 we'll bump to 3.5.0, for 4.1 it will be 3.6.0, etc

In the end, I belive this is a two-way door decision -- e.g. nothing's stopping us from changing our minds, and e.g. going back to match upstream or other schemas in the future.

How to test the change?

I manually tested locally that 4.0.0-preview2 still uses the correct headers and passes the test suite:

Using datadog-ruby_core_source headers from rvm/gems/ruby-4.0.0-preview2/gems/datadog-ruby_core_source-3.5.0/lib/datadog/ruby_core_source/ruby-4.0.0-preview2

4.0.0 stable is fine:

Using datadog-ruby_core_source headers from rvm/gems/ruby-4.0.0/gems/datadog-ruby_core_source-3.5.0/lib/datadog/ruby_core_source/ruby-4.0.0-p0

...and 3.4.7 stable is fine:

**************************************************************************
No source for ruby-3.4.7-p58 (revision 7a5688e2a27668e48f8d6ff4af5b2208b98a2f5e) provided with
datadog-ruby_core_source gem. Falling back to ruby-3.4.0-p0.
**************************************************************************
Using datadog-ruby_core_source headers from rvm/gems/ruby-3.4.7/gems/datadog-ruby_core_source-3.5.0/lib/datadog/ruby_core_source/ruby-3.4.0-p0

Finally, this change does break 4.0.0-preview3 since it falls back to the preview2 headers:

**************************************************************************
No source for ruby-4.0.0-preview3 (revision cfa3e7cf75531a8c90b39bbd9b977f30315b12e7) provided with
datadog-ruby_core_source gem. Falling back to ruby-4.0.0-preview2.
**************************************************************************
Using datadog-ruby_core_source headers from .rvm/gems/ruby-4.0.0-preview3/gems/datadog-ruby_core_source-3.5.0/lib/datadog/ruby_core_source/ruby-4.0.0-preview2

But since we don't officially support preview versions that seems fine! If for any weird reason that I can't think of any user needs -preview3, it's still possible to pin to the 3.4.3 version of this gem to get the correct headers -- but we strongly recommend moving to 4.0.0 stable.

Now that 4.0.0 stable is out, we no longer need these outdated headers.

I still left the 4.0.0-preview2 headers since dd-trace-rb CI is still,
as of this writing, using them, but once we update it those should be
cleaned up as well.
Why gem version 3.5 instead of
[4.0.0](https://rubygems.org/gems/debase-ruby_core_source/versions) like
upstream does?

So the reason upstream moved to 4.0.0 is to match the Ruby version;
e.g. before they shipped 4.0.0.preview2 and before that 3.4.1.

But I think this numbering format does not make sense for us.
Specifically, dd-trace-rb pulls in this gem in a format such as

```ruby
  spec.add_dependency 'datadog-ruby_core_source', '~> 3.4', '>= 3.4.2'
```

and thus regardless of you being on Ruby 2.5 or 4.0, you'll get the
latest version of this gem.

Coupling with upstream numbers is awkward because:
* For preview Rubies, a release like "4.0.0.preview2" doesn't get
  picked up by bundler automatically, so we'd add manual toil to
  customers that want to test preview releases
* We don't ship headers for every Ruby version. So what happens
  if we find out we need to add headers for Ruby 2.7.3 specifically?
  What release number do we use? 4.0.1? 4.0.0.2.7.3?
  Do we do a "patch release" from an older branch? But then how
  do we make sure the patch release gets picked up over a 4.0.0
  release that has a bigger number but does not yet have the 2.7.3
  headers?

So for the time being I propose we do the following:
* Decouple from upstream/ruby version schemes
* Bump the minor version whenever we release support for a newer
  Ruby. That is, for Ruby 4.0 we'll bump to 3.5.0, for 4.1 it
  will be 3.6.0, etc

In the end, I belive this is a two-way door decision -- e.g. nothing's
stopping us from changing our minds, and e.g. going back to match
upstream or other schemas in the future.
@ivoanjo
ivoanjo merged commit 452c92a into master Jan 8, 2026
37 checks passed
@ivoanjo
ivoanjo deleted the ivoanjo/prof-13303-ruby4-cleanups branch January 8, 2026 13:13
ivoanjo added a commit that referenced this pull request Jan 13, 2026
…em version to 3.5.1

**What does this PR do?**

This PR fixes a bug in the "fuzzy" matching of headers to Ruby
versions, where Ruby 4.0.1 would incorrectly fall back to
4.0.0-preview2 headers INSTEAD of 4.0.0 stable headers.

It also bumps the gem version so we can get this fix out ASAP before
we cause issues to customers upgrading to 4.0.1 and later.

**Motivation:**

Fix support for Ruby > 4.0.0.

**Additional Notes:**

This bug lay dormant for a long time, as usually we didn't ship at
the same time preview/rc headers and stable headers. But because
dd-trace-rb CI is still running on 4.0.0-preview2, we kept both
this time and so the bug came and said hi.

The issue boils down to `Gem::Version` treating any suffixes as
non-stable versions (including the `p0`).

Thus `4.0.0.preview2` > `4.0.0.p0` because between non-stable
versions it sorts on string (and `preview` comes after `p0`);
eliminating the useless prefix for stable Rubies avoids this.

Interestingly, in #24 I mentioned that we had a slight sharp edge
where `4.0.0-preview3` would fall back to `4.0.0-preview2` and that
didn't work correctly; and this PR actually fixes that as a side-effect:
`4.0.0-preview3` will now fall back to the stable headers, which is
actually correct.

**How to test the change?**

Since the gem didn't previously have tests I bootstrapped some
quickly so I could add test coverage for this change.
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