Skip to content

Conversation

@ixti
Copy link
Member

@ixti ixti commented Jun 21, 2025

Hash#inspect output changed in Ruby-3.4 thus specs were failing. But even without that I don't think dumping all headers in Response#inspect was pointless, same about Headers#inspect.

@ixti ixti requested a review from tarcieri June 21, 2025 20:44
# @return [String]
def inspect
"#<#{self.class} #{to_h.inspect}>"
"#<#{self.class}>"
Copy link
Member

Choose a reason for hiding this comment

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

What's with these seemingly unrelated changes?

Copy link
Member Author

@ixti ixti Jun 22, 2025

Choose a reason for hiding this comment

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

LOL, that was my question as well when I saw changes to headers and response in SOCKS5 PR. Ruby 3.4 changed the output of Hash#inspect:

> chruby-exec ruby-3.4 -- ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
{a: 42, "b" => 161}

> chruby-exec ruby-3.3 -- ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
{:a=>42, "b"=>161}

> chruby-exec ruby-3.2 -- ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
{:a=>42, "b"=>161}

So we could either switch to JSON.dump(...), or just remove those. And I found myself being mostly annoyed with the inspect output of a real-world Response and Headers in the console:

Before this PR

image


image

After this PR

image

Copy link
Member Author

Choose a reason for hiding this comment

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

@tarcieri any objections against merging this?

Copy link
Member

Choose a reason for hiding this comment

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

I would personally prefer such changes be considered in a separate PR but don’t consider it a blocker

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm. I can extract this change in a "prepare for ruby-3.4" PR.

Copy link
Member

Choose a reason for hiding this comment

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

These changes don’t seem directly related to the Ruby 3.4 upgrade, even if it changes the inspect output

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, thus they are in a separate commit ;D

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way, extracted to #810

Copy link
Member

Choose a reason for hiding this comment

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

The repo is on squash-and-merge. You can shut that off I guess and just merge the two commits, but really it seems like the goal of those changes is to change the inspect output format independent of the Ruby version.

Anyway, merge if you want I guess.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've already separated the PRs LOL.

On the squash&merge topic:


image


Although I was actually thinking on git merge origin add-ruby-3-4-support:main as GH allows that when the PR is approved ;))

ixti added a commit to ixti/lograge that referenced this pull request Jun 27, 2025
    > chruby ruby-3.4
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {a: 42, "b" => 161}

    > chruby ruby-3.3
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {:a=>42, "b"=>161}

    > chruby ruby-3.2
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {:a=>42, "b"=>161}

See: httprb/http#808 (comment)
ixti added a commit to ixti/lograge that referenced this pull request Jun 27, 2025
    > chruby ruby-3.4
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {a: 42, "b" => 161}

    > chruby ruby-3.3
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {:a=>42, "b"=>161}

    > chruby ruby-3.2
    > ruby -e 'puts({ a: 42, "b" => 161 }.inspect)'
    {:a=>42, "b"=>161}

See: httprb/http#808 (comment)
ixti added a commit that referenced this pull request Jun 30, 2025
* Dumping all headers in `Headers#inspect` mostly useless
* Same about response, the only header part that is meaningfull there is
  MIME type

More importantly, Ruby-3.4 changed the inspect output, and we will
either need to have if/else in specs, or modify the output to become
ruby version-agnostic (i.e., not using Hash#inspect).

Blocks: #808
ixti added a commit that referenced this pull request Jun 30, 2025
* Dumping all headers in `Headers#inspect` mostly useless
* Same about response, the only header part that is meaningfull there is
  MIME type

More importantly, Ruby-3.4 changed the inspect output, and we will
either need to have if/else in specs, or modify the output to become
ruby version-agnostic (i.e., not using Hash#inspect).

Blocks: #808
@ixti ixti force-pushed the add-ruby-3-4-support branch from 5432fb0 to f66c9cc Compare June 30, 2025 15:06
@ixti ixti merged commit 7a32573 into main Jun 30, 2025
7 checks passed
@ixti ixti deleted the add-ruby-3-4-support branch June 30, 2025 15:07
@ixti
Copy link
Member Author

ixti commented Jun 30, 2025

@tarcieri merged as three separate PRs.

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