waterdrop 2.8.1 → 2.8.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: 7d2fa38e1362c3069581533bd8da5ee508f00b9fea08c9a4c56ae16780c38c68
4
- data.tar.gz: 0c861f372aeae735d0033b35bc9224e45025c03b2084d796108660b976e74eb3
3
+ metadata.gz: c2e1bd150394cd2ff84114c1d42f88c1e1d2dc0aac023244e561eee406b04700
4
+ data.tar.gz: 99bd1741ea65d1cc9cda5a94d0d04979dbfadbf74f2de79f9e93790292d6cea5
5
5
  SHA512:
6
- metadata.gz: 80ae3a51e3aeaa19e875eddfefb16e415b61f7ef44861d97043b060604fc9ea06d774b9e308f198d89eb813fa405f7f650e0516c8ce5688933ffce5b1b6533d8
7
- data.tar.gz: 2da33c249c8f4e761876a18d7d95745490ed05d296a736fdf39a4ec0b84ba84f3239b8528cb91e6e08cdfe729acabda530cb464a5f8eba779373d113b5b3be94
6
+ metadata.gz: fd7f0772a35bd4e421fd46aa54cef6626f9660ad4cecbd9c03d9a912d68dabe994c84f44e7895099008cad4166ffec77fafda3b06aeacec27a707a4a7ed803a4
7
+ data.tar.gz: 8c27c3bf8db0be08f137b0f2649586cf885a9f340b381a075e3d0d20ecad38ce6f3b0ce2a1e40a5131adf67b46f3005664fd9f4b16f91c1cbf6ab93d1713bf38
checksums.yaml.gz.sig CHANGED
Binary file
@@ -0,0 +1,3 @@
1
+ /.github @mensfeld
2
+ /.github/workflows/ @mensfeld
3
+ /.github/actions/ @mensfeld
@@ -6,12 +6,18 @@ concurrency:
6
6
 
7
7
  on:
8
8
  pull_request:
9
+ branches: [ main, master ]
9
10
  push:
11
+ branches: [ main, master ]
10
12
  schedule:
11
13
  - cron: '0 1 * * *'
12
14
 
15
+ permissions:
16
+ contents: read
17
+
13
18
  jobs:
14
19
  specs:
20
+ timeout-minutes: 15
15
21
  runs-on: ubuntu-latest
16
22
  needs: diffend
17
23
  strategy:
@@ -26,31 +32,31 @@ jobs:
26
32
  - ruby: '3.4'
27
33
  coverage: 'true'
28
34
  steps:
29
- - uses: actions/checkout@v4
35
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
36
+ with:
37
+ fetch-depth: 0
30
38
 
31
39
  - name: Install package dependencies
32
40
  run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
33
41
 
34
42
  - name: Set up Ruby
35
- uses: ruby/setup-ruby@v1
43
+ uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
36
44
  with:
37
45
  ruby-version: ${{matrix.ruby}}
38
46
  bundler-cache: true
39
47
  bundler: 'latest'
40
48
 
41
- - name: Run Kafka with docker compose
49
+ - name: Run Kafka with Docker Compose
42
50
  run: |
43
51
  docker compose up -d || (sleep 5 && docker compose up -d)
44
52
 
45
53
  - name: Wait for Kafka
46
- run: |
47
- sleep 15
54
+ run: sleep 15
48
55
 
49
56
  - name: Install latest bundler
50
57
  run: |
51
58
  gem install bundler --no-document
52
59
  gem update --system --no-document
53
-
54
60
  bundle config set without 'tools benchmarks docs'
55
61
 
56
62
  - name: Bundle install
@@ -63,16 +69,23 @@ jobs:
63
69
  GITHUB_COVERAGE: ${{matrix.coverage}}
64
70
  run: bundle exec rspec
65
71
 
72
+ - name: Check Kafka logs for unexpected warnings
73
+ run: bin/verify_kafka_warnings
74
+
75
+ - name: Check test topics naming convention
76
+ run: bin/verify_topics_naming
77
+
66
78
  diffend:
79
+ timeout-minutes: 5
67
80
  runs-on: ubuntu-latest
68
81
  strategy:
69
82
  fail-fast: false
70
83
  steps:
71
- - uses: actions/checkout@v4
84
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
72
85
  with:
73
86
  fetch-depth: 0
74
87
  - name: Set up Ruby
75
- uses: ruby/setup-ruby@v1
88
+ uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.229.0
76
89
  with:
77
90
  ruby-version: 3.4
78
91
  - name: Install latest bundler
@@ -83,12 +96,25 @@ jobs:
83
96
  run: bundle secure
84
97
 
85
98
  coditsu:
99
+ timeout-minutes: 5
86
100
  runs-on: ubuntu-latest
87
101
  strategy:
88
102
  fail-fast: false
89
103
  steps:
90
- - uses: actions/checkout@v4
104
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
91
105
  with:
92
106
  fetch-depth: 0
107
+ - name: Download Coditsu script
108
+ run: |
109
+ curl -sSL https://api.coditsu.io/run/ci -o coditsu_script.sh
110
+ chmod +x coditsu_script.sh
111
+ - name: Verify Coditsu script checksum
112
+ run: |
113
+ EXPECTED_SHA256="0aecc5aa010f53fca264548a41467a2b0a1208d750ce1da3e98a217304cacbbc"
114
+ ACTUAL_SHA256=$(sha256sum coditsu_script.sh | awk '{ print $1 }')
115
+ if [ "$ACTUAL_SHA256" != "$EXPECTED_SHA256" ]; then
116
+ echo "::error::Checksum verification failed. Expected $EXPECTED_SHA256 but got $ACTUAL_SHA256."
117
+ exit 1
118
+ fi
93
119
  - name: Run Coditsu
94
- run: \curl -sSL https://api.coditsu.io/run/ci | bash
120
+ run: ./coditsu_script.sh
@@ -0,0 +1,16 @@
1
+ name: Verify Action Pins
2
+ on:
3
+ pull_request:
4
+ paths:
5
+ - '.github/workflows/**'
6
+ jobs:
7
+ verify:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
11
+ - name: Check SHA pins
12
+ run: |
13
+ if grep -E -r "uses: .*/.*@(v[0-9]+|main|master)($|[[:space:]]|$)" --include="*.yml" --include="*.yaml" .github/workflows/ | grep -v "#"; then
14
+ echo "::error::Actions should use SHA pins, not tags or branch names"
15
+ exit 1
16
+ fi
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.4.1
1
+ 3.4.2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # WaterDrop changelog
2
2
 
3
+ ## 2.8.3 (2025-04-08)
4
+ - [Enhancement] Support producing messages with arrays of strings in headers (KIP-82).
5
+ - [Refactor] Introduce a `bin/verify_topics_naming` script to ensure proper test topics naming convention.
6
+ - [Refactor] Remove factory bot and active support requirement in tests/dev.
7
+ - [Change] Require `karafka-rdkafka` `>= 0.19.1` due to KIP-82.
8
+
9
+ ## 2.8.2 (2025-02-13)
10
+ - [Feature] Allow for tagging of producer instances similar to how consumers can be tagged.
11
+ - [Refactor] Ensure all test topics in the test suite start with "it-" prefix.
12
+ - [Refactor] Introduce a `bin/verify_kafka_warnings` script to clean Kafka from temporary test-suite topics.
13
+
3
14
  ## 2.8.1 (2024-12-26)
4
15
  - [Enhancement] Raise `WaterDrop::ProducerNotTransactionalError` when attempting to use transactions on a non-transactional producer.
5
16
  - [Fix] Disallow closing a producer from within a transaction.
data/Gemfile CHANGED
@@ -6,12 +6,14 @@ plugin 'diffend'
6
6
 
7
7
  gemspec
8
8
 
9
+ # Relaxed from 2.7 because we support Ruby 3.1
10
+ gem 'zeitwerk', '~> 2.6.18'
11
+
9
12
  group :development do
10
13
  gem 'byebug'
11
14
  end
12
15
 
13
16
  group :test do
14
- gem 'factory_bot'
15
17
  gem 'ostruct'
16
18
  gem 'rspec'
17
19
  gem 'simplecov'
data/Gemfile.lock CHANGED
@@ -1,84 +1,80 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- waterdrop (2.8.1)
5
- karafka-core (>= 2.4.3, < 3.0.0)
6
- karafka-rdkafka (>= 0.17.5)
4
+ waterdrop (2.8.3)
5
+ karafka-core (>= 2.4.9, < 3.0.0)
6
+ karafka-rdkafka (>= 0.19.1)
7
7
  zeitwerk (~> 2.3)
8
8
 
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- activesupport (7.2.1)
13
- base64
14
- bigdecimal
15
- concurrent-ruby (~> 1.0, >= 1.3.1)
16
- connection_pool (>= 2.2.5)
17
- drb
18
- i18n (>= 1.6, < 2)
19
- logger (>= 1.4.2)
20
- minitest (>= 5.1)
21
- securerandom (>= 0.3)
22
- tzinfo (~> 2.0, >= 2.0.5)
23
- base64 (0.2.0)
24
- bigdecimal (3.1.8)
25
- byebug (11.1.3)
26
- concurrent-ruby (1.3.4)
27
- connection_pool (2.4.1)
28
- diff-lcs (1.5.1)
12
+ byebug (12.0.0)
13
+ diff-lcs (1.6.0)
29
14
  docile (1.4.1)
30
- drb (2.2.1)
31
- factory_bot (6.5.0)
32
- activesupport (>= 5.0.0)
33
- ffi (1.17.0)
34
- i18n (1.14.5)
35
- concurrent-ruby (~> 1.0)
36
- karafka-core (2.4.4)
37
- karafka-rdkafka (>= 0.15.0, < 0.18.0)
38
- karafka-rdkafka (0.17.6)
15
+ ffi (1.17.1)
16
+ ffi (1.17.1-aarch64-linux-gnu)
17
+ ffi (1.17.1-aarch64-linux-musl)
18
+ ffi (1.17.1-arm-linux-gnu)
19
+ ffi (1.17.1-arm-linux-musl)
20
+ ffi (1.17.1-arm64-darwin)
21
+ ffi (1.17.1-x86-linux-gnu)
22
+ ffi (1.17.1-x86-linux-musl)
23
+ ffi (1.17.1-x86_64-darwin)
24
+ ffi (1.17.1-x86_64-linux-gnu)
25
+ ffi (1.17.1-x86_64-linux-musl)
26
+ karafka-core (2.4.10)
27
+ karafka-rdkafka (>= 0.17.6, < 0.20.0)
28
+ logger (>= 1.6.0)
29
+ karafka-rdkafka (0.19.1)
39
30
  ffi (~> 1.15)
40
31
  mini_portile2 (~> 2.6)
41
32
  rake (> 12)
42
- logger (1.6.1)
43
- mini_portile2 (2.8.7)
44
- minitest (5.25.1)
33
+ logger (1.6.6)
34
+ mini_portile2 (2.8.8)
45
35
  ostruct (0.6.1)
46
36
  rake (13.2.1)
47
37
  rspec (3.13.0)
48
38
  rspec-core (~> 3.13.0)
49
39
  rspec-expectations (~> 3.13.0)
50
40
  rspec-mocks (~> 3.13.0)
51
- rspec-core (3.13.1)
41
+ rspec-core (3.13.3)
52
42
  rspec-support (~> 3.13.0)
53
43
  rspec-expectations (3.13.3)
54
44
  diff-lcs (>= 1.2.0, < 2.0)
55
45
  rspec-support (~> 3.13.0)
56
- rspec-mocks (3.13.1)
46
+ rspec-mocks (3.13.2)
57
47
  diff-lcs (>= 1.2.0, < 2.0)
58
48
  rspec-support (~> 3.13.0)
59
- rspec-support (3.13.1)
60
- securerandom (0.3.1)
49
+ rspec-support (3.13.2)
61
50
  simplecov (0.22.0)
62
51
  docile (~> 1.1)
63
52
  simplecov-html (~> 0.11)
64
53
  simplecov_json_formatter (~> 0.1)
65
54
  simplecov-html (0.13.1)
66
55
  simplecov_json_formatter (0.1.4)
67
- tzinfo (2.0.6)
68
- concurrent-ruby (~> 1.0)
69
56
  zeitwerk (2.6.18)
70
57
 
71
58
  PLATFORMS
59
+ aarch64-linux-gnu
60
+ aarch64-linux-musl
61
+ arm-linux-gnu
62
+ arm-linux-musl
63
+ arm64-darwin
72
64
  ruby
73
- x86_64-linux
65
+ x86-linux-gnu
66
+ x86-linux-musl
67
+ x86_64-darwin
68
+ x86_64-linux-gnu
69
+ x86_64-linux-musl
74
70
 
75
71
  DEPENDENCIES
76
72
  byebug
77
- factory_bot
78
73
  ostruct
79
74
  rspec
80
75
  simplecov
81
76
  waterdrop!
77
+ zeitwerk (~> 2.6.18)
82
78
 
83
79
  BUNDLED WITH
84
- 2.5.16
80
+ 2.6.2
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ # Checks Kafka logs for unsupported warning patterns
4
+ # Only specified warnings are allowed, all others should trigger failure
5
+
6
+ allowed_patterns=(
7
+ "Performing controller activation"
8
+ "registered with feature metadata.version"
9
+ )
10
+
11
+ # Get all warnings
12
+ warnings=$(docker logs --since=0 kafka | grep WARN)
13
+ exit_code=0
14
+
15
+ while IFS= read -r line; do
16
+ allowed=0
17
+ for pattern in "${allowed_patterns[@]}"; do
18
+ if echo "$line" | grep -q "$pattern"; then
19
+ allowed=1
20
+ break
21
+ fi
22
+ done
23
+
24
+ if [ $allowed -eq 0 ]; then
25
+ echo "Unexpected warning found:"
26
+ echo "$line"
27
+ exit_code=1
28
+ fi
29
+ done <<< "$warnings"
30
+
31
+ exit $exit_code
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # This script verifies that we do not create (except few needed exceptions) test topics that do
4
+ # not start with the "it-" prefix which is our standard.
5
+ #
6
+ # This ensures that we can clearly identify all test topics for removal in case of doing dev work
7
+ # on a long-lived Kafka cluster without option to fully reset it.
8
+ #
9
+ # It also ensures we have one convention that we can follow.
10
+
11
+ require 'bundler'
12
+ Bundler.setup(:default, :test, :integrations)
13
+ require 'rdkafka'
14
+
15
+ admin = Rdkafka::Config.new('bootstrap.servers': 'localhost:9092').admin
16
+
17
+ invalid = admin
18
+ .metadata
19
+ .topics
20
+ .map { |topic| topic[:topic_name] }
21
+ .select { |topic| !topic.start_with?('it-') }
22
+ .select { |topic| topic.length <= 6 }
23
+
24
+ admin.close
25
+
26
+ invalid.each do |invalid_name|
27
+ puts "#{invalid_name} does not start with the \"it-\" prefix"
28
+ end
29
+
30
+ exit invalid.empty? ? 0 : 1
@@ -39,7 +39,7 @@ en:
39
39
  key_format: must be a non-empty string
40
40
  payload_max_size: is more than `max_payload_size` config value
41
41
  headers_invalid_key_type: all headers keys need to be of type String
42
- headers_invalid_value_type: all headers values need to be of type String
42
+ headers_invalid_value_type: all headers values need to be strings or arrays of strings
43
43
 
44
44
  transactional_offset:
45
45
  consumer_format: 'must respond to #consumer_group_metadata_pointer method'
data/docker-compose.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  services:
2
2
  kafka:
3
3
  container_name: kafka
4
- image: confluentinc/cp-kafka:7.8.0
4
+ image: confluentinc/cp-kafka:7.9.0
5
5
 
6
6
  ports:
7
7
  - 9092:9092
@@ -46,7 +46,12 @@ module WaterDrop
46
46
 
47
47
  message.fetch(:headers).each do |key, value|
48
48
  errors << [%i[headers], :invalid_key_type] unless key.is_a?(String)
49
- errors << [%i[headers], :invalid_value_type] unless value.is_a?(String)
49
+
50
+ # Headers can be either strings or arrays of strings
51
+ next if value.is_a?(String)
52
+ next if value.is_a?(Array) && value.all? { |value| value.is_a?(String) }
53
+
54
+ errors << [%i[headers], :invalid_value_type]
50
55
  end
51
56
 
52
57
  errors
@@ -9,6 +9,7 @@ module WaterDrop
9
9
  include Buffer
10
10
  include Transactions
11
11
  include ::Karafka::Core::Helpers::Time
12
+ include ::Karafka::Core::Taggable
12
13
 
13
14
  # Local storage for given thread waterdrop client references for variants
14
15
  ::Fiber.send(:attr_accessor, :waterdrop_clients)
@@ -3,5 +3,5 @@
3
3
  # WaterDrop library
4
4
  module WaterDrop
5
5
  # Current WaterDrop version
6
- VERSION = '2.8.1'
6
+ VERSION = '2.8.3'
7
7
  end
data/renovate.json CHANGED
@@ -1,6 +1,18 @@
1
1
  {
2
2
  "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
3
  "extends": [
4
- "config:base"
4
+ "config:recommended"
5
+ ],
6
+ "github-actions": {
7
+ "enabled": true,
8
+ "pinDigests": true
9
+ },
10
+ "packageRules": [
11
+ {
12
+ "matchManagers": [
13
+ "github-actions"
14
+ ],
15
+ "minimumReleaseAge": "7 days"
16
+ }
5
17
  ]
6
18
  }
data/waterdrop.gemspec CHANGED
@@ -16,8 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.description = spec.summary
17
17
  spec.licenses = %w[LGPL-3.0-only Commercial]
18
18
 
19
- spec.add_dependency 'karafka-core', '>= 2.4.3', '< 3.0.0'
20
- spec.add_dependency 'karafka-rdkafka', '>= 0.17.5'
19
+ spec.add_dependency 'karafka-core', '>= 2.4.9', '< 3.0.0'
20
+ spec.add_dependency 'karafka-rdkafka', '>= 0.19.1'
21
21
  spec.add_dependency 'zeitwerk', '~> 2.3'
22
22
 
23
23
  spec.required_ruby_version = '>= 3.1.0'
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
 
29
29
  spec.cert_chain = %w[certs/cert.pem]
30
30
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
31
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
31
+ spec.executables = []
32
32
  spec.require_paths = %w[lib]
33
33
 
34
34
  spec.metadata = {
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: waterdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.1
4
+ version: 2.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -34,7 +34,7 @@ cert_chain:
34
34
  i9zWxov0mr44TWegTVeypcWGd/0nxu1+QHVNHJrpqlPBRvwQsUm7fwmRInGpcaB8
35
35
  ap8wNYvryYzrzvzUxIVFBVM5PacgkFqRmolCa8I7tdKQN+R1
36
36
  -----END CERTIFICATE-----
37
- date: 2024-12-26 00:00:00.000000000 Z
37
+ date: 2025-04-08 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: karafka-core
@@ -42,7 +42,7 @@ dependencies:
42
42
  requirements:
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 2.4.3
45
+ version: 2.4.9
46
46
  - - "<"
47
47
  - !ruby/object:Gem::Version
48
48
  version: 3.0.0
@@ -52,7 +52,7 @@ dependencies:
52
52
  requirements:
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 2.4.3
55
+ version: 2.4.9
56
56
  - - "<"
57
57
  - !ruby/object:Gem::Version
58
58
  version: 3.0.0
@@ -62,14 +62,14 @@ dependencies:
62
62
  requirements:
63
63
  - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 0.17.5
65
+ version: 0.19.1
66
66
  type: :runtime
67
67
  prerelease: false
68
68
  version_requirements: !ruby/object:Gem::Requirement
69
69
  requirements:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
- version: 0.17.5
72
+ version: 0.19.1
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: zeitwerk
75
75
  requirement: !ruby/object:Gem::Requirement
@@ -93,10 +93,12 @@ extra_rdoc_files: []
93
93
  files:
94
94
  - ".coditsu/ci.yml"
95
95
  - ".diffend.yml"
96
+ - ".github/CODEOWNERS"
96
97
  - ".github/FUNDING.yml"
97
98
  - ".github/ISSUE_TEMPLATE/bug_report.md"
98
99
  - ".github/ISSUE_TEMPLATE/feature_request.md"
99
100
  - ".github/workflows/ci.yml"
101
+ - ".github/workflows/verify-action-pins.yml"
100
102
  - ".gitignore"
101
103
  - ".rspec"
102
104
  - ".ruby-gemset"
@@ -106,6 +108,8 @@ files:
106
108
  - Gemfile.lock
107
109
  - LICENSE
108
110
  - README.md
111
+ - bin/verify_kafka_warnings
112
+ - bin/verify_topics_naming
109
113
  - certs/cert.pem
110
114
  - config/locales/errors.yml
111
115
  - docker-compose.yml
metadata.gz.sig CHANGED
Binary file