Skip to content

Add resource_limits support to spec runner#132

Merged
ianks merged 3 commits into
mainfrom
ianks/resource-limits-spec-fixed
Apr 27, 2026
Merged

Add resource_limits support to spec runner#132
ianks merged 3 commits into
mainfrom
ianks/resource-limits-spec-fixed

Conversation

@ianks
Copy link
Copy Markdown
Contributor

@ianks ianks commented Apr 27, 2026

Adds a `resource_limits:` key to spec YAML so adapters can test Liquid's
resource limit enforcement.

How it works

  • Spec YAML can declare `resource_limits:` with limit values (`render_score_limit`,
    `cumulative_render_score_limit`, etc.)
  • The runner passes them through to the adapter's render block as
    `render_options[:resource_limits]`
  • `examples/liquid_ruby.rb` shows the reference: build a `Liquid::ResourceLimits`
    instance and pass it to `Context.build`
  • Three new specs in `specs/basics/resource-limits.yml` cover per-template limits,
    cumulative limits across partials, and the "limits not triggered when unset" case

Also includes a `deep_instantiate` fix — drop class names with trailing colons
(e.g. `'instantiate:LiquidDropClass:'`) weren't being looked up correctly in
`ClassRegistry` because `key.sub("instantiate:", "")` left the trailing colon
intact. Added `.chomp(":")` to normalize both the quoted and unquoted YAML formats.

ianks added 3 commits March 18, 2026 14:55
- Add resource_limits to VALID_SPEC_KEYS and LazySpec (attr_reader + param)
- Pass raw_resource_limits through SpecLoader to LazySpec.new
- Include resource_limits in render_options in cli/runner.rb
- Apply limits via Liquid::ResourceLimits in the liquid_ruby.rb adapter
- Add specs/basics/resource-limits.yml with three cumulative/per-template tests
@ianks ianks changed the title resource limits spec fixed Add resource_limits support to spec runner Apr 27, 2026
@ianks ianks requested a review from tobi April 27, 2026 19:19
@ianks ianks changed the title Add resource_limits support to spec runner Add resource_limits support to spec runner Apr 27, 2026
@ianks ianks merged commit 004726f into main Apr 27, 2026
2 checks passed
@ianks ianks deleted the ianks/resource-limits-spec-fixed branch April 27, 2026 19:20
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