Skip to content

Add resource_limits support to spec runner#123

Open
ianks wants to merge 1 commit intomainfrom
ianks/resource-limits-spec
Open

Add resource_limits support to spec runner#123
ianks wants to merge 1 commit intomainfrom
ianks/resource-limits-spec

Conversation

@ianks
Copy link
Contributor

@ianks ianks commented Mar 18, 2026

Situation

liquid-spec had no way to test resource limit enforcement through template rendering. Cumulative resource scoring (Liquid v5.12.0) needs behavioral specs that verify limits survive reset() across partial renders — unit tests on ResourceLimits alone don't exercise the full render pipeline.

Execution

Added resource_limits as a new spec field. Specs can now configure render_score_limit, cumulative_render_score_limit, etc. The runner passes these through render_options to the adapter, which builds a Liquid::ResourceLimits object and injects it into the render context. Updated liquid_ruby.rb example adapter.

Added 3 behavioral specs in specs/basics/resource-limits.yml:

  • cumulative_render_score_across_partials — cumulative limit triggers across multiple partial renders
  • cumulative_limits_not_triggered_when_unset — no limits means no enforcement
  • per_template_limit_still_works_with_cumulative — per-template limit fires even with generous cumulative limit

- 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 requested a review from tobi March 18, 2026 18:56
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