Skip to content

Commit 34b13b9

Browse files
committed
Fix assign_swallows_filter_error, server error propagation and error_mode
assign_swallows_filter_error: add render_errors: true so strict_errors is false and assign swallows the filter error as expected. Server (remote-liquid.rb): - Default error_mode to :strict (was defaulting to liquid-ruby's lax) - Use strict_errors from render options for rethrow_errors (was always false, causing errors to be swallowed instead of raised) With proper feature opt-outs (ruby_drops, ruby_types, drop_class_output, lax_parsing, strict2_blank_body_errors, template_factory), JSON-RPC adapter is down to 9 failures — all pre-existing: - 4 filesystem error message format differences ('asset' vs 'template') - 3 date filter formatting (raw Time#to_s instead of formatted) - 2 resource limits (not enforced over JSON-RPC) Ruby reference: 5010 passes, 0 failures, 274 skipped, level 1000/1000. 92 unit tests, 0 failures. All 5 verifiers pass.
1 parent 0b9306a commit 34b13b9

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

scripts/remote-liquid/remote-liquid.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def handle_compile(params)
304304
# Build parse options
305305
parse_options = {}
306306
parse_options[:line_numbers] = true if options["line_numbers"]
307-
parse_options[:error_mode] = options["error_mode"]&.to_sym
307+
parse_options[:error_mode] = (options["error_mode"] || "strict").to_sym
308308

309309
# Parse template - capture parse errors in result, not as exception
310310
begin
@@ -346,11 +346,13 @@ def handle_render(params)
346346
registers = {}
347347
registers[:file_system] = @filesystems[template_id]
348348

349-
# Build context - never rethrow errors, we capture them
349+
# Build context — rethrow errors when strict_errors is true
350+
# so the adapter can match them against expected error patterns
351+
strict_errors = options["strict_errors"] || false
350352
context = Liquid::Context.build(
351353
static_environments: unwrapped_env,
352354
registers: Liquid::Registers.new(registers),
353-
rethrow_errors: false
355+
rethrow_errors: strict_errors
354356
)
355357

356358
# Handle time freezing

specs/liquid_ruby/filter_argument_semantics.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ specs:
5757
- name: assign_swallows_filter_error
5858
template: 'before{% assign v = "x" | truncate: nil %}after[{{ v }}]'
5959
expected: beforeafter[]
60+
render_errors: true
6061
complexity: 500
6162
hint: |
6263
A filter that raises during the expression of an {% assign %} does not

0 commit comments

Comments
 (0)