Five cases disagree with Ruby Liquid 5.14.0, including contradictory strict2 expectations

Open
#170 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
ruby
Domain
testing-qa

Research direction

Start with specs/liquid_ruby/blank_body_error_handling.yml around the blank_if/unless/for_body cases and specs/liquid_ruby/filter_argument_semantics.yml for assign_swallows_filter_error, then check the mode declarations in examples/liquid_ruby.rb and examples/liquid_ruby_lax.rb. Rerun the two commands in the issue to confirm the four failures and one error. Done means each expectation is either corrected or restricted to the modes where Ruby Liquid 5.14.0 matches it, with maintainers confirming the intended strict2 behavior.

Written by the indexing model from the issue text.

Description

Summary

Five liquid-spec cases appear to disagree with Shopify's open-source Ruby Liquid 5.14.0 when run through liquid-spec's own Ruby adapters. Three blank-body cases also appear to assert opposite results for the same template and strict2 mode. We encountered this while testing an independent Liquid implementation, then reproduced the discrepancies directly with the reference engine and the suite's own adapters.

Could you confirm the intended behavior and whether these expectations or their declared modes should be updated?

Versions

Reproduction

Place clean checkouts of the pinned revisions in adjacent directories named liquid and liquid-spec. The suite Gemfile selects ../liquid when present. After installing the suite's declared dependencies, from liquid-spec run:

bundle exec ruby bin/liquid-spec run examples/liquid_ruby.rb \
  --suite liquid_ruby \
  --name '/blank_(if|unless|for)_body_(suppresses_error_text_strict|shows_error_text_strict2)|assign_swallows_filter_error/' \
  --no-max-failures --json

bundle exec ruby bin/liquid-spec run examples/liquid_ruby_lax.rb \
  --suite basics --name security_var_name_no_interpolation \
  --no-max-failures --json

In our reproduction, the first command reported 4 failures and the second reported 1 error. We invoked the same runner and adapters with explicit Ruby load paths and the existing installed gems; no Swift code or JSON-RPC bridge participated. The default strict Ruby example declares strict2_blank_body_errors missing, so it skips the positive strict2 blank-body cases in the first command.

Cases

  1. Blank-body inline errors: blank_if_body_suppresses_error_text_strict, blank_unless_body_suppresses_error_text_strict, and blank_for_body_suppresses_error_text_strict each declare error_mode: [strict2, strict] and expect an empty output. The runner selects strict2; Ruby 5.14.0 instead emits the inline comparison or invalid integer error. The corresponding *_shows_error_text_strict2 cases specify the same templates, mode and context with the opposite expectation. The file's mode-matrix comments and Shopify/liquid#2118 describe suppression as the legacy lax/strict behavior and visible errors as strict2 behavior.

  2. Assignment filter error: assign_swallows_filter_error expects beforeafter[]. The strict Ruby adapter selects strict2, where Ruby 5.14.0 renders beforeLiquid error (line 1): invalid integerafter[]. With lax and strict, our direct Ruby probes return the expected beforeafter[]. We noticed earlier work on this fixture; the mode difference may warrant a further check against the current reference.

  3. Interpolation-shaped variable name: security_var_name_no_interpolation expects empty output for {{ #{1+1} }} in lax mode. The supplied lax Ruby adapter raises Liquid::SyntaxError because the variable markup is not properly terminated. This report does not suggest evaluating the interpolation-like text; the question is whether rejection should be the expected safe behavior.

One possible resolution for the blank-body cases would be to declare the suppression cases strict only, leaving the existing strict2-visible-error cases in place. The assignment case may similarly need explicit mode-specific expectations. For the security case, an expected parse error could preserve the non-evaluation guarantee. These are suggestions for maintainer review, not assertions about Shopify's intended contract.

For context, the liquid-spec Gemfile falls back to v5.13.0 if ../liquid is absent; 5.14.0 changes the observed strict2 behavior. Shopify Liquid's own CI adapters also select different mode/render-feature scopes. We have not rerun the complete upstream CI matrix, so cannot infer the status of those broader runs from these targeted results.

Dominant language
Ruby
Stars
21
Forks
9
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Shopify/liquid-spec

All issues in Shopify/liquid-spec

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.