Skip to content

Build the error markdown in a mutable string - #123

Open
pigoz wants to merge 1 commit into
fractaledmind:mainfrom
pigoz:frozen-markdown
Open

pigoz wants to merge 1 commit into
fractaledmind:mainfrom
pigoz:frozen-markdown

Conversation

@pigoz

@pigoz pigoz commented Oct 27, 2026

Copy link
Copy Markdown

Error#to_markdown appends to a string literal (md = ""). Ruby 3.4 and later flag that whenever deprecation warnings are on:

solid_errors-0.9.1/app/models/solid_errors/error.rb:61: warning: literal string will be frozen in the future

Minitest turns those warnings on, so an app whose tests render the error page prints this line on every run. The gem's own error_to_markdown_test.rb prints it five times on Ruby 4.0.

This starts from +"" instead, and marks the file frozen_string_literal, as record.rb already is. With the magic comment, the existing to_markdown tests raise FrozenError on any Ruby if a literal is mutated again: I checked that all five fail without the +.

bundle exec rake test (57 runs) and bundle exec rake standard pass on Ruby 4.0.9.

🤖 Generated with Claude Code

to_markdown appended to a string literal, which Ruby 3.4 and later flag
with "literal string will be frozen in the future" whenever deprecation
warnings are on. Minitest turns them on, so an app whose tests render
the error page prints the warning on every run.

Mark the file frozen_string_literal, as record.rb is, so the existing
to_markdown tests raise FrozenError on any Ruby if a literal is mutated
again.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.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