clickwrap 0.3.2 → 0.3.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: 1ea29dba21d2740876c9708ad687520310951911eab737844b59577fbbe24464
4
- data.tar.gz: 01140025f14f2c137ba35a25ab694898d31fdbc719a42a488d63204007b0dc85
3
+ metadata.gz: 4e284e0a7a0474b4dc4d3031424074d45c06dfb3f4432d78a3c64c2ec9ca77ba
4
+ data.tar.gz: 1b09f1436d6f8b18bcfb7f39b4f4f33e311438bb79a020a6b9f47c777cdada15
5
5
  SHA512:
6
- metadata.gz: 752ed3dda0897564843222843c444a9c5c945493152ec04e697241871afda8df0eeea9635b3f07296a392f58c46abe763366daa759f0916cd5bb455f56a04e01
7
- data.tar.gz: 71e5c6512a165734f941b7e5483b399e8d46e83a3963e05af5ae2d3e077dbcf4eac0b0e7eddebc9ff61b7a9d3b73c551502fb434388c65c1830e2b75a6e0add1
6
+ metadata.gz: 1778cebf0236280efaab60e63ec3f6591742e12188c27c152923d6ee58ad1eb04bc71c74b14f1b606ed93ea3212d8f307fc31e284db0a595235f20848311907e
7
+ data.tar.gz: 653515517233ee6b0d94245098c0d5dff6bd48cf3c708183b86158c9147a579aeac9ab345d5b52eda9ac7d53fc8f291feedfc2e286291da26a38fe123cf88f0e
data/CHANGELOG.md CHANGED
@@ -6,6 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.3.3] - 2026-08-31
10
+
11
+ ### Fixed — the actor class survives a reload
12
+
13
+ - **`config.actor_class` followed the constant it had cached, not the one the
14
+ app has.** In a Rails app with reloading, every capture after the first code
15
+ change of a session raised
16
+
17
+ ```
18
+ Clickwrap was asked to record User as the actor, but
19
+ `config.actor_class_name` says the records that can act are User.
20
+ ```
21
+
22
+ Both halves name the same class, which reads as a contradiction and sends
23
+ whoever hits it to an initializer that is correct. They were two different
24
+ Ruby objects printing the same name: `actor_class` memoized the
25
+ constantized `Class` and re-resolved only when the class NAME changed —
26
+ which never happens, since the name is set once in an initializer — while
27
+ Zeitwerk replaces the class behind that name on every edit. The cache then
28
+ held a class no living record was an instance of, so
29
+ `actor.is_a?(config.actor_class)` was false for an ordinary `User` and
30
+ capture refused to record it.
31
+
32
+ The memo is gone. `constantize` after the first load is a `const_get` and
33
+ this is called once per capture rather than in a loop, so it was never
34
+ buying anything; `parent_controller_class` has always resolved this way.
35
+ Production was never affected — classes are not reloaded there — but every
36
+ development session was, from its second edit onwards.
37
+
9
38
  ## [0.3.2] - 2026-08-20
10
39
 
11
40
  ### Fixed — two guards that looked like they held
@@ -307,16 +307,29 @@ module Clickwrap
307
307
  @describe_authentication_with = ensure_callable(value, "describe_authentication_with")
308
308
  end
309
309
 
310
- # The constantized actor class, resolved lazily on first use. Lazy on
311
- # purpose: the initializer that sets `config.actor_class_name = "User"` runs
312
- # before the User model is necessarily loaded.
310
+ # The constantized actor class, resolved lazily on EVERY use. Lazy on
311
+ # purpose: the initializer that sets `config.actor_class_name = "User"`
312
+ # runs before the User model is necessarily loaded.
313
+ #
314
+ # Not memoized, deliberately. This used to cache the resolved Class object
315
+ # and re-resolve only when the class NAME changed — which is never, since
316
+ # the name is set once in an initializer. In a Rails app with reloading,
317
+ # the class behind that name is replaced on every code change: Zeitwerk
318
+ # unloads the old User and defines a new one, same name, different object.
319
+ # The cache then held a class no living record was an instance of, and
320
+ # `actor.is_a?(config.actor_class)` failed for a perfectly ordinary User.
321
+ #
322
+ # What that looked like from the outside was worse than the bug: the
323
+ # ConfigurationError names the offending class and the configured class,
324
+ # and both printed "User". The message read as a contradiction, sent
325
+ # people to an initializer that was correct, and came back after every
326
+ # edit — the first signup of a dev session worked and the second did not.
327
+ #
328
+ # `constantize` after the first load is a const_get, and this is called
329
+ # once per capture rather than in a loop, so there was nothing to save.
330
+ # `parent_controller_class` below has always resolved this way.
313
331
  def actor_class
314
- name = actor_class_name
315
- if @actor_class.nil? || @actor_class_name_at_resolution != name
316
- @actor_class = name.constantize
317
- @actor_class_name_at_resolution = name
318
- end
319
- @actor_class
332
+ actor_class_name.constantize
320
333
  end
321
334
 
322
335
  def parent_controller_class = parent_controller_class_name.constantize
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Clickwrap
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
 
6
6
  # The canonical schema version for receipts, event digests, and presentation
7
7
  # manifests. This is deliberately independent of VERSION: gem releases may
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clickwrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - rameerez
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-08-20 00:00:00.000000000 Z
10
+ date: 2026-08-31 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: actionpack