ruby_llm-contract 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8111e9c77abab44b943129932bf6f225f619c930568bfe848c96b916cb72224
4
- data.tar.gz: 4d54273d0b0dfd2fc4a44a34ff681aaa767956bbe89230659e975a91bf2a3821
3
+ metadata.gz: '080fd81afd87ad234cf66f7577080a4ac55a59f890e0c8c479479fccec57ad32'
4
+ data.tar.gz: cdabbac3ea1d81e1abd3cb850e927f410d98282bd23111be79463804ea4d84b9
5
5
  SHA512:
6
- metadata.gz: d5226bdd266a5676bbf4bef0b71580387825f15eb77e9739426e6845b62d6410d22583d2f3f3ad47d2eacca8980fb0763a8a23bf1c1f04c723cae5d4f021ed68
7
- data.tar.gz: 2ee39172b68a94fd8dae1b633d17cc1e0bfac4f82413a0d4233d50f1851b860527248887ca35ebf88ef6b1fc69de78f6fc2775712c75e272891f36d44ba30f57
6
+ metadata.gz: 294b36f7264a2ba8b04334f3fd1c6b4433466a04c6be4aaccf23a92df3c7e92d04061ace018aa5243e28a9ef4fe64abc7f6de5ec11143c32bf5466bf591b9130
7
+ data.tar.gz: d7447319e3389264571209bc84d7dc84a441ffb76d1f64506d9cac2dc1953d26ba8cf3e1eb4169adf64576f1be7ae182bdf0c6e8e6b876220b102cea1e653fa6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.3 (2026-03-23)
4
+
5
+ Production hardening from senior Rails review panel.
6
+
7
+ - **`around_call` propagates exceptions** — no longer silently swallows DB errors, timeouts, etc. User who wants swallowing can rescue in their block.
8
+ - **Nil section content skipped** — `section "X", nil` no longer renders `"null"` to the LLM. Section is omitted entirely.
9
+ - **Range support in `expected:`** — `expected: { score: 1..5 }` works in `add_case`. Previously only Regexp was supported.
10
+ - **`Trace#dig`** — `trace.dig(:usage, :input_tokens)` works on both Step and Pipeline traces.
11
+
3
12
  ## 0.2.2 (2026-03-23)
4
13
 
5
14
  Fixes from first real-world integration (persona_tool).
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby_llm-contract (0.2.2)
4
+ ruby_llm-contract (0.2.3)
5
5
  dry-types (~> 1.7)
6
6
  ruby_llm (~> 1.0)
7
7
  ruby_llm-schema (~> 0.3)
@@ -165,7 +165,7 @@ CHECKSUMS
165
165
  rubocop-ast (1.49.1) sha256=4412f3ee70f6fe4546cc489548e0f6fcf76cafcfa80fa03af67098ffed755035
166
166
  ruby-progressbar (1.13.0) sha256=80fc9c47a9b640d6834e0dc7b3c94c9df37f08cb072b7761e4a71e22cff29b33
167
167
  ruby_llm (1.14.0) sha256=57c6f7034fc4a44504ea137d70f853b07824f1c1cdbe774ab3ab3522e7098deb
168
- ruby_llm-contract (0.2.2)
168
+ ruby_llm-contract (0.2.3)
169
169
  ruby_llm-schema (0.3.0) sha256=a591edc5ca1b7f0304f0e2261de61ba4b3bea17be09f5cf7558153adfda3dec6
170
170
  unicode-display_width (3.2.0) sha256=0cdd96b5681a5949cdbc2c55e7b420facae74c4aaf9a9815eee1087cb1853c42
171
171
  unicode-emoji (4.2.0) sha256=519e69150f75652e40bf736106cfbc8f0f73aa3fb6a65afe62fefa7f80b0f80f
@@ -67,6 +67,7 @@ module RubyLLM
67
67
  def match?(expected_value, actual)
68
68
  case expected_value
69
69
  when ::Regexp then actual.to_s.match?(expected_value)
70
+ when ::Range then expected_value.include?(actual)
70
71
  else expected_value == actual
71
72
  end
72
73
  end
@@ -27,6 +27,8 @@ module RubyLLM
27
27
  "missing key: #{key}"
28
28
  elsif expected_value.is_a?(::Regexp)
29
29
  mismatch_message(key, expected_value, actual) unless actual.to_s.match?(expected_value)
30
+ elsif expected_value.is_a?(::Range)
31
+ mismatch_message(key, expected_value, actual) unless expected_value.include?(actual)
30
32
  elsif actual != expected_value
31
33
  mismatch_message(key, expected_value, actual)
32
34
  end
@@ -38,6 +38,8 @@ module RubyLLM
38
38
  end
39
39
 
40
40
  def render_section_node(node, variables, messages)
41
+ return if node.content.nil?
42
+
41
43
  section_content = node.content.is_a?(Hash) || node.content.is_a?(Array) ? node.content.to_json : node.content
42
44
  return unless content_present?(section_content)
43
45
 
@@ -120,9 +120,6 @@ module RubyLLM
120
120
 
121
121
  around_call.call(self, input, result)
122
122
  result
123
- rescue StandardError => e
124
- warn "[ruby_llm-contract] around_call raised #{e.class}: #{e.message}"
125
- result
126
123
  end
127
124
 
128
125
  def effective_contract
@@ -2,6 +2,6 @@
2
2
 
3
3
  module RubyLLM
4
4
  module Contract
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_llm-contract
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justyna