Skip to content

Commit a46ea1d

Browse files
committed
Exclude legacy liquid-c from defaults
1 parent c936848 commit a46ea1d

8 files changed

Lines changed: 53 additions & 27 deletions

File tree

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ bundle exec rake generate
331331
### Directory Structure
332332

333333
- `bin/` - CLI executable
334-
- `examples/` - Example adapters (`liquid_ruby.rb`, `liquid_ruby_lax.rb`, `liquid_ruby_shopify.rb`, `json_rpc_ruby_liquid.rb`, `liquid_c.rb`, `liquid_c_strict.rb`, JIT variants)
334+
- `examples/` - Example adapters (`liquid_ruby.rb`, `liquid_ruby_lax.rb`, `liquid_ruby_shopify.rb`, `json_rpc_ruby_liquid.rb`, JIT variants); liquid-c examples are legacy explicit opt-ins and are excluded from defaults
335335
- `lib/liquid/spec/cli/` - CLI implementation
336336
- `specs/basics/` - Curated beginner ramp specs
337337
- `specs/liquid_ruby/` - Core Liquid specs from Shopify/liquid

Gemfile

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ else
1212
gem "liquid", github: "Shopify/liquid", tag: "v5.13.0"
1313
end
1414

15-
# liquid-c is an optional C extension for performance. Only use if locally available.
16-
local_liquid_c_path = File.expand_path("../liquid-c", __dir__)
17-
if File.exist?(local_liquid_c_path)
18-
gem "liquid-c", path: local_liquid_c_path, require: false
19-
end
20-
2115
# Core test dependencies
2216
gem "minitest"
2317
gem "minitest-focus"

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ The `matrix` command runs specs across multiple adapters simultaneously and show
455455
liquid-spec tools matrix [options]
456456

457457
Options:
458-
--all Run all available adapters from examples/
458+
--all Run all default adapters from examples/
459459
--adapters=LIST Comma-separated list of adapters
460460
--reference=NAME Reference adapter (default: liquid_ruby)
461461
-n, --name PATTERN Filter specs by name pattern
@@ -465,14 +465,14 @@ Options:
465465
-v, --verbose Show detailed output
466466

467467
Examples:
468-
# Compare all bundled adapters
468+
# Compare the default bundled adapters
469469
liquid-spec tools matrix --all
470470

471471
# Compare specific adapters
472472
liquid-spec tools matrix --adapters=liquid_ruby,liquid_ruby_lax
473473

474474
# Compare adapters on specific tests
475-
liquid-spec tools matrix --adapters=liquid_ruby,liquid_c -n truncate
475+
liquid-spec tools matrix --adapters=liquid_ruby,my_adapter.rb -n truncate
476476
```
477477

478478
Output shows which adapters produce different results for each spec:
@@ -493,7 +493,7 @@ Adapters: liquid_ruby
493493
Output:
494494
"Hello w..."
495495
496-
Adapters: liquid_c
496+
Adapters: my_adapter
497497
Output:
498498
"Hello wo..."
499499
======================================================================
@@ -585,7 +585,7 @@ Use `liquid-spec bench --profile` to generate StackProf profiles for detailed pe
585585
liquid-spec bench examples/liquid_ruby.rb --profile
586586

587587
# Multi-adapter profiling
588-
liquid-spec bench --adapters=liquid_ruby,liquid_c --profile
588+
liquid-spec bench --adapters=liquid_ruby,liquid_ruby_lax --profile
589589
```
590590

591591
A single-adapter profile directory contains four dumps:
@@ -639,7 +639,7 @@ Complexity: 20
639639
Saved to: /tmp/liquid-spec-2026-01-02.yml
640640
```
641641

642-
When using `--compare` (the default), the `expected` field can be omitted - it will be filled from the reference implementation. If your implementation differs from the reference, you'll see a prominent message encouraging you to contribute the spec.
642+
When using `--compare`, the `expected` field can be omittedit will be filled from the reference implementation. If your implementation differs from the reference, you'll see a prominent message encouraging you to contribute the spec.
643643

644644
Specs are automatically saved to `/tmp/liquid-spec-{date}.yml` for easy contribution back to liquid-spec.
645645

@@ -684,7 +684,7 @@ See the `examples/` directory:
684684
- **`liquid_ruby_lax.rb`** - Shopify/liquid configured for lax-mode compatibility specs
685685
- **`liquid_ruby_shopify.rb`** - Shopify-flavored Liquid behavior
686686
- **`json_rpc_ruby_liquid.rb`** - JSON-RPC adapter backed by Shopify/liquid
687-
- **`liquid_c.rb`** / **`liquid_c_strict.rb`** - [liquid-c](https://github.com/Shopify/liquid-c) native extension examples
687+
- **`liquid_c.rb`** / **`liquid_c_strict.rb`** - Legacy, explicit opt-in liquid-c examples; excluded from default adapter runs
688688
- **`liquid_ruby_yjit.rb`** / **`liquid_ruby_zjit.rb`** - Ruby JIT benchmark variants
689689

690690
```bash

lib/liquid/spec/cli/bench.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module Spec
1010
module CLI
1111
# `liquid-spec bench` — run benchmarks sequentially with nice per-spec output.
1212
#
13-
# - `liquid-spec bench` → all builtin adapters, one after another
13+
# - `liquid-spec bench` → default builtin adapters, one after another
1414
# - `liquid-spec bench my_adapter.rb` → my_adapter vs liquid_ruby
1515
# - `liquid-spec bench my_adapter.rb -n storefront` → filtered
1616
#
@@ -22,7 +22,7 @@ module Bench
2222
2323
Run benchmarks with hyperfine-style output.
2424
25-
With no adapter: runs all builtin adapters sequentially
25+
With no adapter: runs default builtin adapters sequentially
2626
With an adapter: runs ADAPTER vs liquid_ruby (reference)
2727
2828
Comparisons that mix inline and JSON-RPC adapters emit a warning because
@@ -31,7 +31,7 @@ module Bench
3131
Options:
3232
-n, --name PATTERN Filter specs by name pattern
3333
-s, --suite SUITE Spec suite (default: benchmarks)
34-
--all Run all builtin adapters
34+
--all Run all default builtin adapters
3535
--adapter=PATH Add a specific adapter
3636
--adapters=LIST Comma-separated adapter list
3737
--profile Write StackProf CPU/allocation profiles to /tmp
@@ -43,7 +43,7 @@ module Bench
4343
liquid-spec bench
4444
liquid-spec bench my_adapter.rb
4545
liquid-spec bench my_adapter.rb -n storefront
46-
liquid-spec bench --adapters=liquid_ruby,liquid_c
46+
liquid-spec bench --adapters=liquid_ruby,liquid_ruby_lax
4747
HELP
4848

4949
class << self

lib/liquid/spec/cli/matrix.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module Matrix
2020
2121
Options:
2222
-o, --output=DIR Reports directory (default: $LIQUID_SPEC_REPORTS or #{Config::DEFAULT_REPORTS_DIR})
23-
--all Run all available adapters from examples/
23+
--all Run all default adapters from examples/
2424
--adapter=PATH Add a local adapter (can be used multiple times)
2525
--adapters=LIST Comma-separated list of adapters to run
2626
--reference=NAME Reference adapter (default: liquid_ruby)
@@ -110,7 +110,7 @@ def run_matrix(options)
110110
$stderr.puts ""
111111
$stderr.puts "Usage:"
112112
$stderr.puts " liquid-spec tools matrix --all"
113-
$stderr.puts " liquid-spec tools matrix --adapters=liquid_ruby,liquid_c"
113+
$stderr.puts " liquid-spec tools matrix --adapters=liquid_ruby,liquid_ruby_lax"
114114
$stderr.puts " liquid-spec tools matrix --adapter=./my_adapter.rb"
115115
exit(1)
116116
end

lib/liquid/spec/cli/runs.rb

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,17 @@ module CLI
1010
# whether adapters are builtin (from examples/) or local.
1111
class Runs
1212
Adapter = Struct.new(:name, :path, :builtin, :transport, keyword_init: true)
13+
EXAMPLES_DIR = File.expand_path("../../../../examples", __dir__)
14+
LEGACY_BUILTIN_ADAPTERS = %w[liquid_c liquid_c_strict].freeze
1315

1416
attr_reader :adapters, :output_dir, :extra_specs
1517

18+
def self.default_builtin_adapter_paths
19+
Dir[File.join(EXAMPLES_DIR, "*.rb")].sort.reject do |path|
20+
LEGACY_BUILTIN_ADAPTERS.include?(File.basename(path, ".rb"))
21+
end
22+
end
23+
1624
def initialize
1725
@adapters = []
1826
@extra_specs = []
@@ -74,9 +82,10 @@ def add_adapter(name_or_path)
7482
@adapters << resolved unless @adapters.any? { |a| a.path == resolved.path }
7583
end
7684

77-
# Add all builtin adapters from examples/
85+
# Add the default builtin adapters. Legacy examples remain explicitly
86+
# addressable by name/path, but are not part of no-argument or --all runs.
7887
def add_all_builtin_adapters
79-
Dir[File.join(examples_dir, "*.rb")].sort.each do |path|
88+
self.class.default_builtin_adapter_paths.each do |path|
8089
name = File.basename(path, ".rb")
8190
@adapters << Adapter.new(
8291
name: name,
@@ -202,7 +211,7 @@ def adapter_transport(path)
202211
end
203212

204213
def examples_dir
205-
@examples_dir ||= File.expand_path("../../../../examples", __dir__)
214+
EXAMPLES_DIR
206215
end
207216
end
208217
end

lib/liquid/spec/cli/test.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# frozen_string_literal: true
22

3+
require_relative "runs"
4+
35
module Liquid
46
module Spec
57
module CLI
@@ -8,16 +10,16 @@ module Test
810
HELP = <<~HELP
911
Usage: liquid-spec tools test [options]
1012
11-
Run specs against all available example adapters in the gem.
12-
Automatically skips adapters whose dependencies are not installed.
13+
Run specs against the default example adapters in the gem.
14+
Legacy adapters remain available explicitly but are not run here.
1315
1416
Options:
1517
-c, --compare Compare adapter output against reference liquid-ruby
1618
-v, --verbose Show verbose output
1719
-h, --help Show this help
1820
1921
Examples:
20-
liquid-spec tools test # Run all available adapters
22+
liquid-spec tools test # Run default example adapters
2123
liquid-spec tools test --compare # Compare mode
2224
liquid-spec tools test -v # Verbose output
2325
@@ -59,7 +61,7 @@ def self.run_all_adapters(options)
5961
exit(1)
6062
end
6163

62-
adapters = Dir[File.join(adapters_dir, "*.rb")]
64+
adapters = Runs.default_builtin_adapter_paths
6365

6466
if adapters.empty?
6567
$stderr.puts "No example adapters found in #{adapters_dir}"

test/runs_test.rb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,27 @@
66
require "liquid/spec/cli/runs"
77

88
class RunsTest < Minitest::Test
9+
def test_default_builtin_adapters_exclude_legacy_liquid_c
10+
paths = Liquid::Spec::CLI::Runs.default_builtin_adapter_paths
11+
names = paths.map { |path| File.basename(path, ".rb") }
12+
13+
assert_includes names, "liquid_ruby"
14+
assert_includes names, "json_rpc_ruby_liquid"
15+
refute_includes names, "liquid_c"
16+
refute_includes names, "liquid_c_strict"
17+
18+
runs = Liquid::Spec::CLI::Runs.new
19+
runs.add_all_builtin_adapters
20+
assert_equal names.sort, runs.adapter_names.sort
21+
end
22+
23+
def test_legacy_liquid_c_adapter_remains_explicitly_addressable
24+
runs = Liquid::Spec::CLI::Runs.new
25+
runs.add_adapter("liquid_c")
26+
27+
assert_equal ["liquid_c"], runs.adapter_names
28+
end
29+
930
def test_classifies_adapters_and_detects_mixed_benchmark_transports
1031
Dir.mktmpdir do |dir|
1132
inline_path = File.join(dir, "inline.rb")

0 commit comments

Comments
 (0)