Skip to content

Fix custom tag render result stringification#2104

Open
sjh9714 wants to merge 1 commit into
Shopify:mainfrom
sjh9714:fix-render-result-stringification
Open

Fix custom tag render result stringification#2104
sjh9714 wants to merge 1 commit into
Shopify:mainfrom
sjh9714:fix-render-result-stringification

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes #1893.

Custom tags that rely on the legacy render(context) compatibility path were appending non-string render results directly to the output buffer. That made an integer render result use String#<< byte semantics, so 49 rendered as 1. This restores the pre-refactor behavior by joining array render results and stringifying other truthy render results before appending.

Changes

  • Convert legacy custom tag render results before appending to the output buffer.
  • Add regression coverage for integer and array render results.

Testing

  • Red check on a temporary main worktree: docker run --rm -v /tmp/liquid-red-1893:/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rb -n /stringify/ failed with Expected: "49", Actual: "1".
  • docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rb -n /stringify/
  • docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/tag_test.rb
  • docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -Itest -Ilib test/integration/block_test.rb
  • docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -c lib/liquid/tag.rb
  • docker run --rm -v "$PWD":/repo -w /repo ruby:4.0.2 ruby -c test/integration/tag_test.rb
  • git diff --check

Verification gap: I also tried ruby -Itest -Ilib -S rake base_test in the Ruby 4.0.2 container, but the plain container lacked lru_redux. A disposable Bundler install was blocked because the Shopify/liquid-spec branch self-drop-env-lookup-specs could not be resolved.

Note: I used Codex while preparing this change, reviewed the final diff, and ran the listed checks locally.

@sjh9714

sjh9714 commented Jul 5, 2026

Copy link
Copy Markdown
Author

I have signed the CLA!

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.

Missing .to_s when rendering a node (dropped possibily by accident)

1 participant