rails-ai-context 5.21.0 → 5.21.1
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 +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/rails_ai_context/introspectors/controller_introspector.rb +23 -1
- data/lib/rails_ai_context/version.rb +1 -1
- data/server.json +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 35ff190a8ba7d3cad8db797b62b37d14595317f0fbb496de79d68a05e31791f2
|
|
4
|
+
data.tar.gz: a22572911254cd6ede2927a8833ac8c499ae5a3aee615825daaaa50451a59bf6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5afe25035b7a14ba9ed34961a9701c47e5b3f26909c7916514184123cdb1154482769ea018e751b84f5eed71ab4a1bca175a4d22b3e51bf1fccad9fa118e8ae
|
|
7
|
+
data.tar.gz: e3973d85c3b0be6dad49ee33f3d918bf9b228e481f600c0435db06ae65a42596d6cc61b968b67b95b01b78bfc35e3c4d43843c8115efca7c00b9278ef8e26d5a
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [5.21.1] - 2026-08-12
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **A controller mounted on a gem's base class no longer reports the app's
|
|
13
|
+
helpers as actions.** 5.21.0 left reflection as the answer for a controller
|
|
14
|
+
with an ancestor whose source the app does not own, and `action_methods`
|
|
15
|
+
subtracts inherited methods only as far as the nearest abstract ancestor,
|
|
16
|
+
which is `ActionController::Base`. A gem controller mounted on the app's own
|
|
17
|
+
base class, which is what Doorkeeper's `base_controller` setting produces,
|
|
18
|
+
therefore arrived carrying every public method that base and its concerns
|
|
19
|
+
define: a controller serving 4 routes was reported with 16 entries, 13 of
|
|
20
|
+
them helpers such as `set_locale` and `with_read_replica`. The base
|
|
21
|
+
controller's own `action_methods` is exactly that set, so it is subtracted.
|
|
22
|
+
(#136)
|
|
23
|
+
|
|
8
24
|
## [5.21.0] - 2026-08-12
|
|
9
25
|
|
|
10
26
|
### Fixed
|
|
@@ -187,7 +187,7 @@ module RailsAiContext
|
|
|
187
187
|
# out, and the gem class supplies them. Reflection brings inherited
|
|
188
188
|
# helpers along, which is worse than the alternative only if the
|
|
189
189
|
# alternative is not claiming the controller serves nothing.
|
|
190
|
-
return ctrl
|
|
190
|
+
return reflected_actions(ctrl) if unreadable_ancestor || source.nil?
|
|
191
191
|
|
|
192
192
|
# Every ancestor was readable and none defines an action. That is an
|
|
193
193
|
# answer, and reflection would only overwrite it with helpers.
|
|
@@ -223,6 +223,28 @@ module RailsAiContext
|
|
|
223
223
|
[ [], unreadable ]
|
|
224
224
|
end
|
|
225
225
|
|
|
226
|
+
# `action_methods` subtracts inherited methods only as far as the nearest
|
|
227
|
+
# abstract ancestor, and that is ActionController::Base. A gem controller
|
|
228
|
+
# mounted on the app's own base class - what Doorkeeper's `base_controller`
|
|
229
|
+
# setting produces - therefore arrives carrying every public method that
|
|
230
|
+
# base and its concerns define. The base's own answer is exactly that set,
|
|
231
|
+
# so subtracting it leaves the actions the gem contributes.
|
|
232
|
+
def reflected_actions(ctrl)
|
|
233
|
+
actions = ctrl.action_methods.to_a.map(&:to_s)
|
|
234
|
+
base = app_base_controller_for(ctrl)
|
|
235
|
+
actions -= base.action_methods.to_a.map(&:to_s) if base
|
|
236
|
+
actions.sort
|
|
237
|
+
end
|
|
238
|
+
|
|
239
|
+
def app_base_controller_for(ctrl)
|
|
240
|
+
klass = ctrl.superclass
|
|
241
|
+
while klass&.name && !framework_controller?(klass)
|
|
242
|
+
return klass if app_base_controller?(klass)
|
|
243
|
+
klass = klass.superclass
|
|
244
|
+
end
|
|
245
|
+
nil
|
|
246
|
+
end
|
|
247
|
+
|
|
226
248
|
def framework_controller?(klass)
|
|
227
249
|
return true if klass.name.start_with?("ActionController::", "AbstractController::")
|
|
228
250
|
return true if klass == ActionController::Base
|
data/server.json
CHANGED