dionysus-rb 1.7.1 → 1.7.2

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: 4b87f084174020b048f571661e800ea514567cce186ed7701c8db43ada5f35be
4
- data.tar.gz: 62f4126b20a85405bb3337eb9b0bd71d540e39943d2a2e1b5a87b86c1eabbe5a
3
+ metadata.gz: aa2a7b59427b64a4c359cc5fdbd62b39713588cf9029e4416e3e728a2f4445be
4
+ data.tar.gz: 06afd203be36e3a123496add489ba30552ae6497b512f969de3209f0f9f5b8c1
5
5
  SHA512:
6
- metadata.gz: e0bb5902c1a0a9aaeec93ffbd16b0408fbe0288252ef36e31cca95a67ee2eb15bdb41cf120af4f6a6aec60735a2c2d9f6b571d4aad3a506ef2e214f7731cc7d7
7
- data.tar.gz: ef7a256c9ca43d3987055df6c49abfe5fcdbf53bd855b7af00ba39f0f4a394dd3923559d69d1b8abc4e8639bc0f7a6c0398b55c2b86c40188a9ee5512ee053e3
6
+ metadata.gz: 0c9ae06fe4831be2015c68806e237f1244fbecdbde5eb1948f6b01b6da8578764b8a231a087683809d229bee5af3a7821a5e64a53f548bcf512077828423f38b
7
+ data.tar.gz: c789df4b0fb8f28c208a8cd460161a42bf34f6fc1e29d61d280c2c5092e8a832e66144d7ea15b5abe351b3c08cdf4ffbf08fb18c6412f050a2326b71593642dc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.7.2]
4
+ - Read the payload by either key form. 1.7.1 looked up `id` and `updated_at` as string keys, but a serializer may key its payload with symbols, so `repairable?` was false on every publish and the class stayed a silent no-op.
5
+
6
+
3
7
  ## [1.7.1]
4
8
  - Parse an ISO8601 string timestamp in the payload instead of ignoring it. 1.7.0 required every timestamp to answer `acts_like_time?`, so a serializer that renders the parent's `updated_at` as a string made the whole class a silent no-op: the parent never looked time-like, no payload was ever examined, no row was ever corrected and `dionysus.publish.timestamp_repair` never fired.
5
9
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dionysus-rb (1.7.1)
4
+ dionysus-rb (1.7.2)
5
5
  activerecord (>= 5)
6
6
  activesupport (>= 3.2)
7
7
  concurrent-ruby
@@ -44,7 +44,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
44
44
  def repaired?(record, record_payload)
45
45
  return false unless repairable?(record, record_payload)
46
46
 
47
- published_at = coerce_time(record_payload[TIMESTAMP_ATTRIBUTE])
47
+ published_at = coerce_time(attribute(record_payload, TIMESTAMP_ATTRIBUTE))
48
48
  latest = embedded_timestamps(record_payload).max
49
49
  return false unless published_at && latest && latest > published_at
50
50
 
@@ -63,7 +63,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
63
63
 
64
64
  def repairable?(record, record_payload)
65
65
  record.is_a?(ActiveRecord::Base) && record.persisted? &&
66
- record_payload.is_a?(Hash) && record_payload[PRIMARY_KEY_ATTRIBUTE] == record.id
66
+ record_payload.is_a?(Hash) && attribute(record_payload, PRIMARY_KEY_ATTRIBUTE) == record.id
67
67
  end
68
68
 
69
69
  def embedded_timestamps(record_payload)
@@ -71,7 +71,7 @@ class Dionysus::Producer::EmbeddedTimestampRepair
71
71
  Array.wrap(value).filter_map do |embedded|
72
72
  next unless embedded.is_a?(Hash)
73
73
 
74
- coerce_time(embedded[TIMESTAMP_ATTRIBUTE])
74
+ coerce_time(attribute(embedded, TIMESTAMP_ATTRIBUTE))
75
75
  end
76
76
  end
77
77
  end
@@ -81,7 +81,11 @@ class Dionysus::Producer::EmbeddedTimestampRepair
81
81
  tags: ["model:#{record.class}", "outcome:#{updated.zero? ? "stale_read" : "row_behind"}"])
82
82
  end
83
83
 
84
- # A serializer may render the timestamp it is about to publish, so one payload carries both shapes.
84
+ # A serializer may key its payload either way, and may render the timestamp it is about to publish.
85
+ def attribute(record_payload, name)
86
+ record_payload.key?(name) ? record_payload[name] : record_payload[name.to_sym]
87
+ end
88
+
85
89
  def coerce_time(value)
86
90
  case value
87
91
  when ActiveSupport::TimeWithZone, Time then value
@@ -3,5 +3,5 @@
3
3
  module Dionysus
4
4
  module Version
5
5
  end
6
- VERSION = "1.7.1"
6
+ VERSION = "1.7.2"
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dionysus-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karol Galanciak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-09-08 00:00:00.000000000 Z
11
+ date: 2026-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord