karafka-core 2.6.7 → 2.6.8

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: 985a6489d2138041eac532dc648092e518e19ead6cd0d3cf7def938529f74d12
4
- data.tar.gz: 141b16d8d305582b79ad6e2b70ae61f5d0878b5dc0a8267ccdee8936bfd0451e
3
+ metadata.gz: 4cbf9ee706d087b7dcaea80dd337de6cfb7378af2566c7c91d3f92f603241542
4
+ data.tar.gz: 9a925d25b8cd28b65c6cfccc063470d0f11d9daddcd101cbcf4f5950d0f7ba14
5
5
  SHA512:
6
- metadata.gz: 3e6dec63a69f7d0e8a91db0ad061f2c852bba964eacc88d3a7b47a9a14f7bb03b060a402efeb6979a1837301a67f079230dcdaf72f239aeffac5bd7f78b470df
7
- data.tar.gz: cf7e821ea42e1930bb6323e4a8d358311b75293094d608aa07a104bced17af79c518d1f76ca0cf6eff63fed4f63514b25b1ece7e3b7507d64accecb2d36d26b9
6
+ metadata.gz: 4ac3047a2c035c012d255ea0dfd400963eee75db432e3d9af8d40079de9bff63ea04187d3dbfde5e30310c974257d260293293ebe8a1a5f3ddf6012f55518470
7
+ data.tar.gz: 0f49c0c21bc54c9ac20785666056da63b3566a2d8a6382d8d1a627e7439cf1f0635b6bea1504701b29943c435f7cc5b38e3464e83c573b5e5b033d910d1d2f28
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Karafka Core Changelog
2
2
 
3
+ ## 2.6.8 (2026-11-12)
4
+ - [Feature] Add `Helpers::Kafka::Config.enabled?` that treats a librdkafka boolean setting as on only when it is `true` or `"true"`.
5
+ - [Change] Make `Contractable::Contract.virtual` raise `ArgumentError` when called inside `nested`. Such a rule ignored the nesting and got the root data.
6
+
3
7
  ## 2.6.7 (2026-11-10)
4
8
  - [Maintenance] Declare `rake` in the `Gemfile`. It came only through `karafka-rdkafka`, which will stop depending on it for precompiled platform gems.
5
9
  - [Enhancement] Make `Taggable::Tags#add` with the value a tag already has and `#delete` of a missing tag about 6x faster on MRI and JRuby.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka-core (2.6.7)
4
+ karafka-core (2.6.8)
5
5
  karafka-rdkafka (>= 0.20.0)
6
6
  logger (>= 1.6.0)
7
7
 
@@ -101,11 +101,17 @@ module Karafka
101
101
  # raise `FrozenError`). Build the result in the block (e.g. `[[%i[id], :invalid]]`)
102
102
  # rather than returning a constant.
103
103
  #
104
- # @note A virtual rule ignores an enclosing `nested`: its block receives the root data
105
- # (also when it is not a Hash) and its error paths start at the root. Define virtual
106
- # rules outside of `nested` and use full paths in the returned errors.
104
+ # @note A virtual rule cannot be defined inside `nested`: its block receives the root
105
+ # data (also when it is not a Hash) and its error paths start at the root. Define
106
+ # virtual rules outside of `nested` and use full paths in the returned errors.
107
+ #
108
+ # @raise [ArgumentError] when called inside a `nested` block, with the nested path as the
109
+ # message
107
110
  def virtual(&block)
108
111
  init_accu
112
+
113
+ raise ArgumentError, @nested.join(".") unless @nested.empty?
114
+
109
115
  @rules << Rule.new([], :virtual, block).freeze
110
116
  end
111
117
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Karafka
4
+ module Core
5
+ module Helpers
6
+ # Kafka related helpers
7
+ module Kafka
8
+ # Reads librdkafka configuration values the way the ecosystem acts on them
9
+ module Config
10
+ # Values that turn a librdkafka boolean setting on
11
+ ENABLED_VALUES = [true, "true"].freeze
12
+
13
+ private_constant :ENABLED_VALUES
14
+
15
+ class << self
16
+ # @param value [Object] librdkafka boolean setting value (e.g. from a `kafka` hash)
17
+ # @return [Boolean] true only when the value is `true` or `"true"`
18
+ # @note Any other value, including `nil` (setting not provided) and `"false"`, is false
19
+ def enabled?(value)
20
+ ENABLED_VALUES.include?(value)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -3,6 +3,6 @@
3
3
  module Karafka
4
4
  module Core
5
5
  # Current Karafka::Core version. We follow the versioning schema of given Karafka version
6
- VERSION = "2.6.7"
6
+ VERSION = "2.6.8"
7
7
  end
8
8
  end
data/lib/karafka-core.rb CHANGED
@@ -7,6 +7,7 @@ require "rdkafka"
7
7
  require "karafka/core"
8
8
  require "karafka/core/version"
9
9
  require "karafka/core/helpers/time"
10
+ require "karafka/core/helpers/kafka/config"
10
11
  require "karafka/core/monitoring"
11
12
  require "karafka/core/monitoring/event"
12
13
  require "karafka/core/monitoring/monitor"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.7
4
+ version: 2.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -80,6 +80,7 @@ files:
80
80
  - lib/karafka/core/contractable/contract.rb
81
81
  - lib/karafka/core/contractable/result.rb
82
82
  - lib/karafka/core/contractable/rule.rb
83
+ - lib/karafka/core/helpers/kafka/config.rb
83
84
  - lib/karafka/core/helpers/minitest_locator.rb
84
85
  - lib/karafka/core/helpers/rspec_locator.rb
85
86
  - lib/karafka/core/helpers/time.rb