flipper-notifications 0.1.10 → 0.1.11

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: 5f6ffe2530157b223628713342f83960c5a89dc2a8fca928df146c9553552279
4
- data.tar.gz: c4fba936bef2a2629c6171bfd2418a08c7b8b379b12b87cbcc97808f0b8a4815
3
+ metadata.gz: b89e1c2fa5d254aebc89291bb50eec14b5687d9ea95f17f061e8f4972cc452f8
4
+ data.tar.gz: 870159e8ebf702200423b873448e8ac63140322fb4dbe6f811c746805ecdbf5b
5
5
  SHA512:
6
- metadata.gz: c576ff049c4ff0000dc628793e293a83e6a8814d0d73278bb62094207133c64860f0dc43028a800fd6e2b0072ff86a7bf01a790b20b70db5055eda9e73ca4ec9
7
- data.tar.gz: 54d2344c796fbafa721d18e55cfc68d46bd703df8a7b06bb9e5ef38b27171c144fb9757492ce26428937febaa6bdeeae2c24abdb07aa4243db7866153ad8cc55
6
+ metadata.gz: 63da6fdb0abb5067d5f1c6dd09e7103c1172fa3e294fb9e30817205ba75986c07c3f4aa9ba84328ac41790306e41d256657fdca09a7751a7135faad149d6ebf4
7
+ data.tar.gz: cf2ead088adc75c0aa2fb4c8c82b818264c89bd9bdd7d551a22dc16acb7808136b3a268f680e72b72069143d62172a0e3df5c3b7f5c3f4823c4263c9b2aba8df
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flipper-notifications (0.1.10)
4
+ flipper-notifications (0.1.11)
5
5
  activesupport (>= 7, < 8.2)
6
6
  flipper (>= 0.24, < 2.0)
7
7
  httparty (~> 0.17)
@@ -104,6 +104,7 @@ PLATFORMS
104
104
  arm64-darwin-21
105
105
  arm64-darwin-23
106
106
  arm64-darwin-24
107
+ arm64-darwin-25
107
108
  x86_64-linux
108
109
 
109
110
  DEPENDENCIES
data/README.md CHANGED
@@ -53,6 +53,34 @@ Flipper::Notifications.configure do |config|
53
53
  end
54
54
  ```
55
55
 
56
+ ### Stale State with Cached Adapters
57
+
58
+ Notifications are rendered inside a background job (`WebhookNotificationJob`),
59
+ which may run in a **different process** from the one that changed the feature.
60
+ The message ("The feature is now fully enabled/disabled", the list of groups,
61
+ actors, and percentages) is built by reading the feature's current state at
62
+ job-run time.
63
+
64
+ If your Flipper adapter is fronted by a **per-process cache** — for example an
65
+ in-memory `ActiveSupportCacheStore` layer — the process running the job can hold
66
+ a stale value: enabling a feature in your web process does not invalidate a
67
+ worker's in-memory cache. The notification then reports the wrong state.
68
+
69
+ By default state is read through the global `Flipper`. Point `config.flipper` at
70
+ a cache-free instance backed by your source of truth so notifications always
71
+ render the real value:
72
+
73
+ ```ruby
74
+ # config/initializers/flipper.rb
75
+
76
+ Flipper::Notifications.configure do |config|
77
+ config.flipper = Flipper.new(Flipper::Adapters::ActiveRecord.new)
78
+ end
79
+ ```
80
+
81
+ This only affects how notifications **read** state; your application keeps using
82
+ its cached `Flipper` everywhere else.
83
+
56
84
  ### Slack invalid_blocks Errors
57
85
 
58
86
  Slack limits the size of webhook messages. The Slack API returns a 400 status
@@ -8,14 +8,31 @@ module Flipper
8
8
  @enabled = false
9
9
  @notifiers = []
10
10
  @webhook_character_limit = nil
11
+ @flipper = nil
11
12
  end
12
13
 
13
14
  attr_accessor :enabled, :notifiers, :webhook_character_limit
15
+ attr_writer :flipper
14
16
 
15
17
  def enabled?
16
18
  @enabled
17
19
  end
18
20
 
21
+ # The Flipper instance used to READ feature state when rendering a
22
+ # notification. Defaults to the global `Flipper`.
23
+ #
24
+ # Notifications are rendered in a background job, which may run in a
25
+ # different process from the one that changed the feature. If your Flipper
26
+ # adapter is fronted by a per-process cache (e.g. an in-memory
27
+ # ActiveSupportCacheStore), the reading process can hold a stale value and
28
+ # the message reports the wrong state. Point this at a cache-free instance
29
+ # backed by your source of truth to always render the real value, e.g.:
30
+ #
31
+ # config.flipper = Flipper.new(Flipper::Adapters::ActiveRecord.new)
32
+ def flipper
33
+ @flipper || Flipper
34
+ end
35
+
19
36
  end
20
37
  end
21
38
  end
@@ -20,7 +20,7 @@ module Flipper
20
20
  end
21
21
 
22
22
  def initialize(feature_name:, operation:)
23
- @feature = Flipper.feature(feature_name)
23
+ @feature = Flipper::Notifications.configuration.flipper.feature(feature_name)
24
24
  @operation = operation.to_s
25
25
  end
26
26
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Flipper
4
4
  module Notifications
5
- VERSION = "0.1.10"
5
+ VERSION = "0.1.11"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-notifications
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Lubrano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-10 00:00:00.000000000 Z
11
+ date: 2026-07-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -256,7 +256,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
256
  - !ruby/object:Gem::Version
257
257
  version: '0'
258
258
  requirements: []
259
- rubygems_version: 3.5.9
259
+ rubygems_version: 3.4.10
260
260
  signing_key:
261
261
  specification_version: 4
262
262
  summary: Rails-compatible Slack notifications for Flipper feature flags