zizq 0.3.6 → 0.3.7

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: a95c96d7b844064db29aea81935d6ec6e3c6953fc47459fcfd6253b6b44aa1e7
4
- data.tar.gz: 19a8e38ef04716ba02b21bb4ce1f8f2b3e597b1f9845ada71dde5ae7d31fecd3
3
+ metadata.gz: 3252547a350b856e8122d15a77275769f62a4495efe36b36e252eba2246b51cf
4
+ data.tar.gz: 570e3ef065cbe42cfc038d6c1dd6669940d62f051d53965c48bea548f329e941
5
5
  SHA512:
6
- metadata.gz: d4158e9e2b3f58e2c1b823b26f8c81a9ee5ab347d72683377909fed7b4d0d163caf3e27708d3e1f3cbd1af3018068fda34d97405ec6095732b0cda57909a82fc
7
- data.tar.gz: 95c1453a0af6a82e8ad0abd5e2a8085550ce4cf5ef6b2871cb653fdd1068994f69b36bb04a5e30d2ec76c1ccc02a1e142621a5c5bde7de9bab84517917b90fef
6
+ metadata.gz: 545bc4510f7df1acc51817c48ec2fae04c3a96df3589c2e3f12017d8bebb311a69cd7d18b14941ed3206829d08dd1cf28dd1d0461d44c7d2a265eead57f70710
7
+ data.tar.gz: 00b8916adf6921aded73d0f16cde1c2c52c98f338b3a9e4ad79a4131f06aef42b4001623c2e43d53a7c9d67e289c62f97b6abfbee6b0bb240ed89726e273ae7e
data/README.md CHANGED
@@ -33,13 +33,13 @@ API.
33
33
  Add it to your application's `Gemfile`:
34
34
 
35
35
  ```ruby
36
- gem 'zizq', '~> 0.3.6'
36
+ gem 'zizq', '~> 0.3.7'
37
37
  ```
38
38
 
39
39
  Or install it manually:
40
40
 
41
41
  ```shell
42
- $ gem install zizq -v 0.3.6
42
+ $ gem install zizq -v 0.3.7
43
43
  ```
44
44
 
45
45
  Ruby **3.2.8 or newer** is required. Client and server share version
@@ -161,7 +161,7 @@ Zizq.enqueue_raw(
161
161
  )
162
162
  ```
163
163
 
164
- ### Cross-language and low-level dispatch { #router }
164
+ ### Cross-language and low-level dispatch
165
165
 
166
166
  When a Ruby app needs to *process* jobs enqueued by another language
167
167
  (or by `Zizq.enqueue_raw`), `Zizq::Router` maps `type` strings to
@@ -4,6 +4,8 @@
4
4
  # rbs_inline: enabled
5
5
  # frozen_string_literal: true
6
6
 
7
+ require "json"
8
+
7
9
  module Zizq
8
10
  module Test
9
11
  # A `Zizq::Client` stand-in for use in test suites.
@@ -143,7 +145,7 @@ module Zizq
143
145
  req = EnqueueRequest.new(
144
146
  queue:,
145
147
  type:,
146
- payload:,
148
+ payload: self.class.normalize_payload(payload),
147
149
  priority:,
148
150
  ready_at:,
149
151
  retry_limit:,
@@ -162,7 +164,7 @@ module Zizq
162
164
  req = EnqueueRequest.new(
163
165
  queue: params[:queue],
164
166
  type: params[:type],
165
- payload: params[:payload],
167
+ payload: self.class.normalize_payload(params[:payload]),
166
168
  priority: params[:priority],
167
169
  ready_at: params[:ready_at],
168
170
  retry_limit: params[:retry_limit],
@@ -236,6 +238,22 @@ module Zizq
236
238
  "#{ID_PREFIX}#{counter.to_s.rjust(ID_LENGTH - ID_PREFIX.length, '0')}"
237
239
  end
238
240
 
241
+ public
242
+
243
+ # Round-trip the payload through JSON so the in-memory
244
+ # representation matches what a consumer would receive over the
245
+ # wire: symbol keys / Symbol values become strings, nested
246
+ # hashes and arrays are normalized recursively, and non-JSON-
247
+ # safe values (BigDecimal, custom objects) raise here rather
248
+ # than surviving in test mode only to break in production.
249
+ #
250
+ # Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
251
+ # to normalize the query side so symbol-keyed assertion payloads
252
+ # still match the (now string-keyed) buffer.
253
+ def self.normalize_payload(payload) #: (untyped) -> untyped
254
+ JSON.parse(JSON.generate(payload))
255
+ end
256
+
239
257
  # Returns entries matching every named filter AND the predicate.
240
258
  # All filter kwargs are optional; unset means "don't filter on
241
259
  # this axis." Callers must hold `@mutex` — public accessors do
data/lib/zizq/test.rb CHANGED
@@ -168,7 +168,13 @@ module Zizq
168
168
  filters = {}
169
169
  filters[:only_queues] = queue if queue
170
170
  filters[:only_types] = type if type
171
- filters[:filter] = ->(job) { job.payload == payload } unless payload.nil?
171
+ unless payload.nil?
172
+ # Normalize the assertion-side payload the same way enqueue
173
+ # normalizes the buffered one, so symbol-keyed test payloads
174
+ # still match the (string-keyed) wire-format buffer.
175
+ normalized = Client.normalize_payload(payload)
176
+ filters[:filter] = ->(job) { job.payload == normalized }
177
+ end
172
178
  client.enqueued_jobs(**filters).size
173
179
  end
174
180
 
data/lib/zizq/version.rb CHANGED
@@ -5,5 +5,5 @@
5
5
  # frozen_string_literal: true
6
6
 
7
7
  module Zizq
8
- VERSION = "0.3.6" #: String
8
+ VERSION = "0.3.7" #: String
9
9
  end
@@ -120,6 +120,20 @@ module Zizq
120
120
 
121
121
  def synthetic_id: (untyped counter) -> untyped
122
122
 
123
+ public
124
+
125
+ # Round-trip the payload through JSON so the in-memory
126
+ # representation matches what a consumer would receive over the
127
+ # wire: symbol keys / Symbol values become strings, nested
128
+ # hashes and arrays are normalized recursively, and non-JSON-
129
+ # safe values (BigDecimal, custom objects) raise here rather
130
+ # than surviving in test mode only to break in production.
131
+ #
132
+ # Also used by `Zizq::Test.enqueued_raw?` / `enqueued_raw_count`
133
+ # to normalize the query side so symbol-keyed assertion payloads
134
+ # still match the (now string-keyed) buffer.
135
+ def self.normalize_payload: (untyped payload) -> untyped
136
+
123
137
  # Returns entries matching every named filter AND the predicate.
124
138
  # All filter kwargs are optional; unset means "don't filter on
125
139
  # this axis." Callers must hold `@mutex` — public accessors do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zizq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Corbyn <chris@zizq.io>
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-05-27 00:00:00.000000000 Z
11
+ date: 2026-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http