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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2ccd7eb081bc5f6f34e998978e38d7d9d5282d097818224c10bd56ff4d30c75
4
- data.tar.gz: 0bb8a8ad8f57a11a04a41dd2ab9e30f57f25b08382d1b5edca67af0c3db68f38
3
+ metadata.gz: 35ff190a8ba7d3cad8db797b62b37d14595317f0fbb496de79d68a05e31791f2
4
+ data.tar.gz: a22572911254cd6ede2927a8833ac8c499ae5a3aee615825daaaa50451a59bf6
5
5
  SHA512:
6
- metadata.gz: dadae053988700c4c82e841dc5d18c0c22f6584ceef3616e7a520388e57bea89bb1535dc2ca658b5960d3d5d3a11ecbedc912f69386485412c0d833d1c8d1cfa
7
- data.tar.gz: 07bba392bb191112f18cf14e89147b445078d04b404d0bea9f974e148f42f1ef2ee4d83ccacc7049e132dacf2ad0c1ac17fd4079b779d2dd0d6039c739359092
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.action_methods.to_a.sort if unreadable_ancestor || source.nil?
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAiContext
4
- VERSION = "5.21.0"
4
+ VERSION = "5.21.1"
5
5
  end
data/server.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/crisnahine/rails-ai-context",
8
8
  "source": "github"
9
9
  },
10
- "version": "5.20.3",
10
+ "version": "5.21.0",
11
11
  "packages": [
12
12
  {
13
13
  "registryType": "mcpb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-ai-context
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.21.0
4
+ version: 5.21.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - crisnahine