riffer 0.57.2 → 0.58.0

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: 5a0b2c4a5de151eb7d6b04fcdb294109ec985016e3c0a664518215c0056b6b3d
4
- data.tar.gz: 2b07877eead03fca26a9f59418c9b590cbb4b65fcfc9d39c947c470e79c3b48f
3
+ metadata.gz: f9fa5540c0e1f6138fd5c2cec808a38585ff8425ff6165773518f268d9262429
4
+ data.tar.gz: d808181362f34d80be746a6a289a55af13083f9d8064a0da76675704702019cf
5
5
  SHA512:
6
- metadata.gz: a815d376b2ade4129f162ae0ae2e1c526fcc0fabe6a29901a26ee0a621c1c17b3ec7452faf379e880f0c4d08fc3ee8b783f1bad6d0242645a8890c9ce7aadb30
7
- data.tar.gz: c15a1e4521e950f9d6b11565e0cfbfeeff25950beaf2ad3445a90074fce85f8fa652ae89a8e2e30f52ec84a60643b7057564fbfaff4e5fd1ed8b8ee46592d3e2
6
+ metadata.gz: 5d5092a3010a391b8cb5d32b1bacd9167d638e96cfe82a3235d830f1d88b528a7ac45144ca95ce0c1ddc04a0a80268ce81244bfc4775856beaa2ffd9b83d6597
7
+ data.tar.gz: d30d7d7a3eb6ac84fd34d81e9120bb8ae4831b8040eb7b2d3ad3011e88c9385203031bb453d37174aef1dfa00c6896094e70cf74c49ca6e711994c5867968623
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.57.2"
2
+ ".": "0.58.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.58.0](https://github.com/janeapp/riffer/compare/riffer/v0.57.2...riffer/v0.58.0) (2026-11-20)
9
+
10
+
11
+ ### ⚠ BREAKING CHANGES
12
+
13
+ * **config:** `config.pricing` and `Riffer::Config::Pricing` are removed, and a model with no catalog pricing carries no cost. Move rates into a catalog file listed in `config.catalog_files` (see UPGRADING.md).
14
+
15
+ ### Features
16
+
17
+ * **config:** remove config.pricing ([#589](https://github.com/janeapp/riffer/issues/589)) ([efb5889](https://github.com/janeapp/riffer/commit/efb58892c1380f411789c0422cc62b6548cf3f91))
18
+ * **deprecations:** silence specific deprecation ids ([#597](https://github.com/janeapp/riffer/issues/597)) ([cff65e8](https://github.com/janeapp/riffer/commit/cff65e84a5aef6c1d50872250a564fa5a7639459))
19
+
8
20
  ## [0.57.2](https://github.com/janeapp/riffer/compare/riffer/v0.57.1...riffer/v0.57.2) (2026-11-20)
9
21
 
10
22
 
data/UPGRADING.md CHANGED
@@ -1,3 +1,43 @@
1
1
  # Upgrading
2
2
 
3
3
  Upgrade guides for breaking releases will appear here. See the [stability policy](https://riffer.ai/guides/stability/) for when breaking changes can happen. To try a breaking release's new behaviour early, turn on its [future flag](https://riffer.ai/guides/configuration/#future-flags).
4
+
5
+ ## 0.58.0
6
+
7
+ ### `config.pricing` is removed
8
+
9
+ `config.pricing` and `Riffer::Config::Pricing` are gone, and cost comes only from the [model catalog](https://riffer.ai/guides/catalog/). Calling `config.pricing` raises `NoMethodError`, and a model with no catalog pricing carries no cost (`token_usage.cost` is `nil`, and spans have no `riffer.cost`).
10
+
11
+ Move each rate into a catalog file and list it in `config.catalog_files`. Before:
12
+
13
+ ```ruby
14
+ Riffer.configure do |config|
15
+ config.pricing.set("anthropic/claude-sonnet-4-6", input: 3.0, output: 15.0, cache_read: 0.3, cache_write: 3.75)
16
+ config.pricing.set(["openai/gpt-5.1", "azure_openai/my-gpt-prod"], input: 1.25, output: 10.0)
17
+ end
18
+ ```
19
+
20
+ After:
21
+
22
+ ```ruby
23
+ Riffer.configure do |config|
24
+ config.catalog_files = ["config/riffer/models.json"]
25
+ end
26
+ ```
27
+
28
+ ```json
29
+ {
30
+ "version": 1,
31
+ "models": {
32
+ "anthropic/claude-sonnet-4-6": {
33
+ "pricing": { "input": 3.0, "output": 15.0, "cache_read": 0.3, "cache_write": 3.75 }
34
+ },
35
+ "openai/gpt-5.1": {
36
+ "aliases": ["azure_openai/my-gpt-prod"],
37
+ "pricing": { "input": 1.25, "output": 10.0 }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ The rates and the cost formula are unchanged: prices per million tokens, with `cache_read` and `cache_write` optional. A `set` call with an array of ids becomes one entry, with the other ids listed under `aliases`. `Riffer.configure` loads the file at boot and raises `Riffer::ArgumentError` if it is missing or malformed. See [Model Catalog → Pricing](https://riffer.ai/guides/catalog/#pricing).
data/docs/CATALOG.md CHANGED
@@ -5,7 +5,7 @@ The model catalog holds per-model data that riffer can't derive from the model n
5
5
  Riffer ships no catalog. Without one:
6
6
 
7
7
  - `reasoning` still works through each provider's default mapping (see [Provider defaults](#provider-defaults)).
8
- - Calls carry no cost (`token_usage.cost` is `nil`), unless the deprecated [`config.pricing`](CONFIGURATION.md#pricing-deprecated) prices the model.
8
+ - Calls carry no cost (`token_usage.cost` is `nil`).
9
9
 
10
10
  ## Loading catalog files
11
11
 
@@ -166,7 +166,7 @@ cost = (input − cache_read − cache_write) × input_rate
166
166
 
167
167
  (all rates ÷ 1,000,000; an unset cache rate falls back to `input_rate`.) Cost is for observability, not billing: it's a `Float`, and sub-cent rounding can accumulate over a long run. See [Messages → Token Usage Semantics](MESSAGES.md#token-usage-semantics) for how cost surfaces and aggregates.
168
168
 
169
- A model with no catalog pricing carries no cost. The deprecated [`config.pricing`](CONFIGURATION.md#pricing-deprecated) is still read as a fallback; catalog pricing wins when both price a model.
169
+ A model with no catalog pricing carries no cost.
170
170
 
171
171
  ## Layering files
172
172
 
@@ -264,7 +264,7 @@ A file that fails resolution raises a `Riffer::FileError` subclass — `Riffer::
264
264
 
265
265
  ### Model Catalog
266
266
 
267
- List JSON catalog files that hold per-model reasoning mappings and pricing. Riffer ships no catalog, so without one, `reasoning` uses each provider's default mapping, and calls carry no cost unless the deprecated [`config.pricing`](#pricing-deprecated) prices the model.
267
+ List JSON catalog files that hold per-model reasoning mappings and pricing. Riffer ships no catalog, so without one, `reasoning` uses each provider's default mapping, and calls carry no cost.
268
268
 
269
269
  ```ruby
270
270
  Riffer.configure do |config|
@@ -278,29 +278,12 @@ end
278
278
 
279
279
  See [Model Catalog](CATALOG.md) for the file format, lookup, layering, and validation.
280
280
 
281
- ### Pricing (deprecated)
282
-
283
- `config.pricing` is deprecated and will be removed in a future release. Move rates into a [catalog file](CATALOG.md#pricing); each line that calls `set` reports a [deprecation](#deprecations). Riffer still reads these rates as a fallback, and catalog pricing wins when both price a model.
284
-
285
- ```ruby
286
- # before
287
- Riffer.configure do |config|
288
- config.pricing.set("anthropic/claude-sonnet-4-6", input: 3.0, output: 15.0)
289
- end
290
- ```
291
-
292
- ```json
293
- { "version": 1, "models": { "anthropic/claude-sonnet-4-6": { "pricing": { "input": 3.0, "output": 15.0 } } } }
294
- ```
295
-
296
- `set` takes a `provider/model` id or an array of ids, plus `input:`, `output:`, and optional `cache_read:` and `cache_write:` rates per million tokens. The rates and cost formula are the same as [catalog pricing](CATALOG.md#pricing).
297
-
298
281
  ### Deprecations
299
282
 
300
283
  A deprecated riffer call reports itself at least one release before it is removed. The report names the line in your code that made the call:
301
284
 
302
285
  ```
303
- riffer: config.pricing is deprecated and will be removed in a future version; move rates into a catalog file listed in config.catalog_files (see docs/CATALOG.md). Called from config/initializers/riffer.rb:4.
286
+ riffer: [param_class_types] String as a param type is deprecated and will be removed in a future version, not before 1 December 2026; use :string. Called from app/tools/weather_tool.rb:5.
304
287
  ```
305
288
 
306
289
  `config.deprecations` decides what happens:
@@ -320,6 +303,17 @@ end
320
303
 
321
304
  Any other value raises `Riffer::ArgumentError`.
322
305
 
306
+ Each report starts with its deprecation id in brackets (`param_class_types` above), which is also `event.id`. `config.silenced_deprecations` takes a list of ids that every mode skips, callables included, so you can keep `:raise` on for everything except the deprecations you can't move off yet:
307
+
308
+ ```ruby
309
+ Riffer.configure do |config|
310
+ config.deprecations = :raise if Rails.env.local?
311
+ config.silenced_deprecations = %i[evals config_evals param_class_types]
312
+ end
313
+ ```
314
+
315
+ It defaults to `[]`; anything but an Array of Symbols raises `Riffer::ArgumentError`.
316
+
323
317
  ### Future flags
324
318
 
325
319
  `config.future` lets you turn on new behaviour before it becomes the default, so you can try it and adapt ahead of the breaking release that switches it on for everyone:
data/docs/MESSAGES.md CHANGED
@@ -91,7 +91,7 @@ tool_call.to_h # => {call_id: "call_123", name: "weather_tool", argu
91
91
 
92
92
  The cache buckets are subsets of `input_tokens`, never additions to it — summing `input_tokens + cache_read_tokens` double-counts. `total_tokens` (input + output) matches the totals providers report on their dashboards.
93
93
 
94
- - `cost` — the computed cost of the call, set when a [catalog](CATALOG.md#pricing) or the deprecated [`config.pricing`](CONFIGURATION.md#pricing-deprecated) prices the model in use; `nil` when the model is unpriced. It's for observability, not billing. Run-level usage sums per-call costs through `TokenUsage#+`, so `response.token_usage.cost` is the total spend across the run — but the sum is `nil` if any call in the run used an unpriced model, rather than silently under-reporting.
94
+ - `cost` — the computed cost of the call, set when a [catalog](CATALOG.md#pricing) prices the model in use; `nil` when the model is unpriced. It's for observability, not billing. Run-level usage sums per-call costs through `TokenUsage#+`, so `response.token_usage.cost` is the total spend across the run — but the sum is `nil` if any call in the run used an unpriced model, rather than silently under-reporting.
95
95
 
96
96
  #### Finish Reasons
97
97
 
data/docs/TESTING.md CHANGED
@@ -122,8 +122,10 @@ Riffer.config.deprecations = :raise
122
122
  Every deprecated call then raises `Riffer::DeprecationError`, naming the line that made it. A test that uses a deprecated call on purpose wraps it in `allow_deprecations`:
123
123
 
124
124
  ```ruby
125
- it 'still reads legacy pricing' do
126
- allow_deprecations { Riffer.config.pricing.set('openai/gpt-5', input: 1.0, output: 2.0) }
125
+ it 'still accepts class param types' do
126
+ tool = allow_deprecations do
127
+ Class.new(Riffer::Tool) { params { required :city, String } }
128
+ end
127
129
 
128
130
  # ...
129
131
  end
@@ -131,6 +133,16 @@ end
131
133
 
132
134
  `allow_deprecations` silences deprecations until the block returns or raises, and returns the block's value. It applies to the current thread or fiber and to threads and fibers started inside the block; other threads keep reporting. It is also available as `Riffer::Testing.allow_deprecations` outside an example. See [Configuration — Deprecations](CONFIGURATION.md#deprecations) for the other modes.
133
135
 
136
+ To keep `:raise` on while exempting specific deprecations you can't move off yet, list their ids (shown in brackets in each report) in `config.silenced_deprecations`:
137
+
138
+ ```ruby
139
+ # test/test_helper.rb
140
+ Riffer.config.deprecations = :raise
141
+ Riffer.config.silenced_deprecations = %i[param_class_types]
142
+ ```
143
+
144
+ Prefer this to a `config.deprecations` callable that raises. A callable is called once per deprecation per calling line, so it fails only the first test to reach that line, and which test that is depends on run order.
145
+
134
146
  ## When a stub leaks
135
147
 
136
148
  Stubbing an identifier that is already taken raises `Riffer::DuplicateIdentifierError`:
data/docs/TRACING.md CHANGED
@@ -253,7 +253,7 @@ Riffer normalizes this across providers, so the number may differ from a provide
253
253
 
254
254
  ### Cost
255
255
 
256
- `riffer.cost` is the modeled cost of one call (on a `chat` span) or a whole run (on the `invoke_agent` span). It lives in Riffer's own namespace because the GenAI semantic conventions define no cost attribute by design — Riffer never squats `gen_ai.*` for it. The attribute appears only when a [catalog](CATALOG.md#pricing) or the deprecated [`config.pricing`](CONFIGURATION.md#pricing-deprecated) prices the model in use: Riffer ships no price table and never guesses, so an unpriced model simply carries no `riffer.cost`.
256
+ `riffer.cost` is the modeled cost of one call (on a `chat` span) or a whole run (on the `invoke_agent` span). It lives in Riffer's own namespace because the GenAI semantic conventions define no cost attribute by design — Riffer never squats `gen_ai.*` for it. The attribute appears only when a [catalog](CATALOG.md#pricing) prices the model in use: Riffer ships no price table and never guesses, so an unpriced model simply carries no `riffer.cost`.
257
257
 
258
258
  The value is **unitless on the wire** — Riffer attaches no currency. It is the sum of the per-token rates you configured, in whatever currency you expressed them, so a `riffer.cost` of `0.0123` means 0.0123 of that unit. The raw float is emitted unrounded; round for display in your backend, not before.
259
259
 
data/lib/riffer/config.rb CHANGED
@@ -58,9 +58,6 @@ class Riffer::Config
58
58
 
59
59
  attr_reader :future #: Riffer::Config::Future # @dynamic future
60
60
 
61
- # @deprecated Use +catalog_files+.
62
- attr_reader :pricing #: Riffer::Config::Pricing # @dynamic pricing
63
-
64
61
  attr_reader :catalog_files #: Array[String] # @dynamic catalog_files
65
62
 
66
63
  #--
@@ -111,6 +108,18 @@ class Riffer::Config
111
108
  @deprecations = value
112
109
  end
113
110
 
111
+ attr_reader :silenced_deprecations #: Array[Symbol] # @dynamic silenced_deprecations
112
+
113
+ #--
114
+ #: (Array[Symbol]) -> void
115
+ def silenced_deprecations=(ids)
116
+ unless ids.is_a?(Array) && ids.all?(Symbol)
117
+ raise Riffer::ArgumentError, "silenced_deprecations must be an Array of Symbols, got #{ids.inspect}"
118
+ end
119
+
120
+ @silenced_deprecations = ids.dup.freeze
121
+ end
122
+
114
123
  #--
115
124
  #: () -> void
116
125
  def initialize
@@ -128,10 +137,11 @@ class Riffer::Config
128
137
  @tracing = Tracing.new
129
138
  @files = Files.new
130
139
  @future = Future.new
131
- @pricing = Pricing.new
132
140
  no_files = [] #: Array[String]
133
141
  @catalog_files = no_files.freeze
134
142
  @message_id_strategy = :none
135
143
  @deprecations = :warn
144
+ no_ids = [] #: Array[Symbol]
145
+ @silenced_deprecations = no_ids.freeze
136
146
  end
137
147
  end
@@ -19,7 +19,7 @@ class Riffer::Deprecation::Event
19
19
  #--
20
20
  #: () -> String
21
21
  def to_s
22
- text = "riffer: #{message}"
22
+ text = "riffer: [#{id}] #{message}"
23
23
  location ? "#{text} Called from #{location}." : text
24
24
  end
25
25
  end
@@ -19,7 +19,7 @@ module Riffer::Deprecation
19
19
  #--
20
20
  #: (id: Symbol, message: String) -> void
21
21
  def warn(id:, message:)
22
- return if Fiber[ALLOWED_KEY]
22
+ return if Fiber[ALLOWED_KEY] || Riffer.config.silenced_deprecations.include?(id)
23
23
 
24
24
  frame = caller_locations&.find { |location| !location.path.to_s.start_with?(LIB_DIR) }
25
25
  location = frame && "#{frame.path}:#{frame.lineno}"
@@ -226,7 +226,7 @@ class Riffer::Providers::Base
226
226
  key = catalog_key(model)
227
227
  return nil unless key
228
228
 
229
- Riffer.config.catalog.rates_for(key) || Riffer.config.pricing.rates_for(key)
229
+ Riffer.config.catalog.rates_for(key)
230
230
  end
231
231
 
232
232
  #--
@@ -2,5 +2,5 @@
2
2
  # rbs_inline: enabled
3
3
 
4
4
  module Riffer
5
- VERSION = "0.57.2" #: String
5
+ VERSION = "0.58.0" #: String
6
6
  end
@@ -41,9 +41,6 @@ class Riffer::Config
41
41
 
42
42
  attr_reader future: Riffer::Config::Future
43
43
 
44
- # @deprecated Use +catalog_files+.
45
- attr_reader pricing: Riffer::Config::Pricing
46
-
47
44
  attr_reader catalog_files: Array[String]
48
45
 
49
46
  # --
@@ -72,6 +69,12 @@ class Riffer::Config
72
69
  # : ((Symbol | ^(Riffer::Deprecation::Event) -> void)) -> void
73
70
  def deprecations=: (Symbol | ^(Riffer::Deprecation::Event) -> void) -> void
74
71
 
72
+ attr_reader silenced_deprecations: Array[Symbol]
73
+
74
+ # --
75
+ # : (Array[Symbol]) -> void
76
+ def silenced_deprecations=: (Array[Symbol]) -> void
77
+
75
78
  # --
76
79
  # : () -> void
77
80
  def initialize: () -> void
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: riffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.57.2
4
+ version: 0.58.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Bottrall
@@ -165,7 +165,6 @@ files:
165
165
  - lib/riffer/config/mcp.rb
166
166
  - lib/riffer/config/open_ai.rb
167
167
  - lib/riffer/config/open_router.rb
168
- - lib/riffer/config/pricing.rb
169
168
  - lib/riffer/config/skills.rb
170
169
  - lib/riffer/config/tracing.rb
171
170
  - lib/riffer/deprecation.rb
@@ -336,7 +335,6 @@ files:
336
335
  - sig/generated/riffer/config/mcp.rbs
337
336
  - sig/generated/riffer/config/open_ai.rbs
338
337
  - sig/generated/riffer/config/open_router.rbs
339
- - sig/generated/riffer/config/pricing.rbs
340
338
  - sig/generated/riffer/config/skills.rbs
341
339
  - sig/generated/riffer/config/tracing.rbs
342
340
  - sig/generated/riffer/deprecation.rbs
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
- # rbs_inline: enabled
3
-
4
- # @deprecated Set pricing in a catalog file instead (see docs/CATALOG.md).
5
- # A catalog entry's pricing wins over rates registered here.
6
- class Riffer::Config::Pricing
7
- # @rbs @rates: Hash[String, Riffer::Catalog::Rates]
8
-
9
- #--
10
- #: () -> void
11
- def initialize
12
- @rates = {}
13
- end
14
-
15
- #--
16
- #: ((String | Array[String]), input: Numeric, output: Numeric, ?cache_read: Numeric?, ?cache_write: Numeric?) -> void
17
- def set(models, input:, output:, cache_read: nil, cache_write: nil)
18
- Riffer::Deprecation.warn(
19
- id: :config_pricing,
20
- message: "config.pricing is deprecated and will be removed in a future version; move rates into a catalog " \
21
- "file listed in config.catalog_files (see docs/CATALOG.md).",
22
- )
23
-
24
- ids = models.is_a?(Array) ? models : [models]
25
- raise Riffer::ArgumentError, "at least one model id is required" if ids.empty?
26
-
27
- ids.each { |id| Riffer::Helpers::Validate.model_id(id, attribute: "pricing model id") }
28
-
29
- rates = Riffer::Catalog::Rates.new(input: input, output: output, cache_read: cache_read, cache_write: cache_write)
30
- ids.each { |id| @rates[id] = rates }
31
- end
32
-
33
- #--
34
- #: (String) -> Riffer::Catalog::Rates?
35
- def rates_for(model)
36
- @rates[model]
37
- end
38
-
39
- #--
40
- #: () -> bool
41
- def empty?
42
- @rates.empty?
43
- end
44
- end
@@ -1,23 +0,0 @@
1
- # Generated from lib/riffer/config/pricing.rb with RBS::Inline
2
-
3
- # @deprecated Set pricing in a catalog file instead (see docs/CATALOG.md).
4
- # A catalog entry's pricing wins over rates registered here.
5
- class Riffer::Config::Pricing
6
- @rates: Hash[String, Riffer::Catalog::Rates]
7
-
8
- # --
9
- # : () -> void
10
- def initialize: () -> void
11
-
12
- # --
13
- # : ((String | Array[String]), input: Numeric, output: Numeric, ?cache_read: Numeric?, ?cache_write: Numeric?) -> void
14
- def set: (String | Array[String], input: Numeric, output: Numeric, ?cache_read: Numeric?, ?cache_write: Numeric?) -> void
15
-
16
- # --
17
- # : (String) -> Riffer::Catalog::Rates?
18
- def rates_for: (String) -> Riffer::Catalog::Rates?
19
-
20
- # --
21
- # : () -> bool
22
- def empty?: () -> bool
23
- end