admin_suite 0.7.0 → 0.7.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: 7ea45471224303ab612d3d27887cd3245fcd1f942c06c4a3108e98e5ee91ca4e
4
- data.tar.gz: ad3e08e25c5e977ace59521565309f5702fbbfb6ff6d2a20d09630161d659c51
3
+ metadata.gz: d906b8f8c886e5672d619be4f40ee499c21308a4fef4418c62fb3a8b2dac2c6c
4
+ data.tar.gz: 49d765d0d2ffb86775b804191b593ea93ee785193923f87bc430a88f9656bf5e
5
5
  SHA512:
6
- metadata.gz: b971fe2fbd3d44d7b3fc0addefd909c0cde1716442cd80c0e3627ba6bdcbcd3c4a9d42eac9e4dab767fef10c1793279639ec63c32c934682520afd8ea931998e
7
- data.tar.gz: 7f6f6a1bdbdf194cf5eed18cbe5336c021ab4df544af1c62f0dbc4ad96e6a5c24f503126f50c1702af2bf1c8ab7c2a5ac70ba8fbf5ea6890903292b0190b622d
6
+ metadata.gz: b873ccefa650a35fc52ddd5a319092d4870e1e7668b148ef4c7f9a6de87fc74fa8b560c23d86c280f3becc570448b930572ce04345d42557ed9059cce8794edb
7
+ data.tar.gz: cf00c5b3fa273932e847f078f9bb7641b44ea223a2bfd577b974459367771d7fee01e5d73a2ac3488d19d16f7cc7873a2f86d901ebda39b7470baf20844565d0
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ 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
+ ## [0.7.1] - 2026-11-26
9
+
10
+ ### Fixed
11
+ - A resource's show, edit and action pages now find a record by its
12
+ `prefixed_ids` id, which is what the resource's own links use. Before, a
13
+ model with `has_prefix_id` returned 404 from every index link.
14
+
8
15
  ## [0.7.0] - 2026-10-04
9
16
 
10
17
  ### Added
data/Gemfile CHANGED
@@ -3,6 +3,10 @@ source "https://rubygems.org"
3
3
  # Declare runtime dependencies in the gemspec.
4
4
  gemspec
5
5
 
6
+ group :development do
7
+ gem "rubocop-rails-omakase", require: false
8
+ end
9
+
6
10
  group :development, :test do
7
11
  # Provides the asset pipeline used by the engine/dummy app.
8
12
  gem "propshaft"
@@ -15,7 +15,7 @@ module AdminSuite
15
15
  AdminSuite::DefinitionLoader.load!(:resources)
16
16
  server = AdminSuite::Mcp.server_for(actor: admin_suite_actor, request: request)
17
17
  transport = ::MCP::Server::Transports::StreamableHTTPTransport.new(
18
- server, stateless: true, allowed_hosts: [request.host]
18
+ server, stateless: true, allowed_hosts: [ request.host ]
19
19
  )
20
20
  status, headers, body = transport.handle_request(request)
21
21
  self.status = status
@@ -396,6 +396,13 @@ module AdminSuite
396
396
  return record if record
397
397
  end
398
398
 
399
+ # prefixed_ids defines `find_by_prefix_id` on every model; only a
400
+ # model that called `has_prefix_id` has a `_prefix_id` to decode with.
401
+ if klass.try(:_prefix_id)
402
+ record = klass.find_by_prefix_id(id)
403
+ return record if record
404
+ end
405
+
399
406
  raise ActiveRecord::RecordNotFound
400
407
  end
401
408
 
data/config/routes.rb CHANGED
@@ -10,7 +10,7 @@ AdminSuite::Engine.routes.draw do
10
10
  # Must precede the portal catch-all, which would otherwise treat "mcp" as
11
11
  # a portal name.
12
12
  post "mcp", to: "mcp#create", as: :mcp
13
- match "mcp", to: "mcp#create", via: [:get, :delete]
13
+ match "mcp", to: "mcp#create", via: [ :get, :delete ]
14
14
 
15
15
  # Portal dashboards (e.g. /ops, /email). Accept optional trailing slash.
16
16
  get ":portal(/)", to: "portals#show", as: :portal
@@ -161,8 +161,6 @@ module Admin
161
161
 
162
162
  handler_name = "#{resource_class.resource_name.camelize}#{action.name.to_s.camelize}Action"
163
163
  "Admin::Actions::#{handler_name}".constantize
164
- rescue NameError
165
- nil
166
164
  end
167
165
 
168
166
  def execute_handler(handler_class, target, params)
@@ -60,7 +60,7 @@ module AdminSuite
60
60
  glob_key: :resource_globs,
61
61
  reset: -> { Admin::Base::Resource.reset_registry! },
62
62
  loaded?: -> { Admin::Base::Resource.registered_resources.any? },
63
- mark_loaded!: -> {},
63
+ mark_loaded!: -> { },
64
64
  # Resource registration happens *only* via `Class#inherited`
65
65
  # (lib/admin/base/resource.rb), which fires on class *creation* and
66
66
  # never on reopening an already-defined class. Resetting the
@@ -87,7 +87,7 @@ module AdminSuite
87
87
  glob_key: :portal_globs,
88
88
  reset: -> { AdminSuite::PortalRegistry.reset! },
89
89
  loaded?: -> { AdminSuite::PortalRegistry.all.any? },
90
- mark_loaded!: -> {},
90
+ mark_loaded!: -> { },
91
91
  dev_resettable: true
92
92
  },
93
93
  dashboards: {
@@ -30,11 +30,11 @@ module AdminSuite
30
30
  end
31
31
 
32
32
  def denied_response
33
- ::MCP::Tool::Response.new([{ type: "text", text: DENIED_MESSAGE }], error: true)
33
+ ::MCP::Tool::Response.new([ { type: "text", text: DENIED_MESSAGE } ], error: true)
34
34
  end
35
35
 
36
36
  def error_response(message)
37
- ::MCP::Tool::Response.new([{ type: "text", text: message }], error: true)
37
+ ::MCP::Tool::Response.new([ { type: "text", text: message } ], error: true)
38
38
  end
39
39
 
40
40
  private
@@ -12,14 +12,14 @@ module AdminSuite
12
12
  q: { type: "string" },
13
13
  filters: { type: "object" }
14
14
  },
15
- required: ["resource"]
15
+ required: [ "resource" ]
16
16
  )
17
17
 
18
18
  def self.call(resource:, server_context:, q: nil, filters: {})
19
19
  AdminSuite::Mcp.instrument(tool: "aggregate", resource: resource, actor: server_context[:actor], request: server_context[:request], filters: filters, q: q) do
20
20
  allowed = false
21
21
  config = Authorization.authorize_resource!(name: resource, actor: server_context[:actor], action: :read, request: server_context[:request])
22
- next [Authorization.denied_response, nil, false] if config.nil?
22
+ next [ Authorization.denied_response, nil, false ] if config.nil?
23
23
 
24
24
  allowed = true
25
25
  params = (filters || {}).merge(search: q).compact
@@ -29,11 +29,11 @@ module AdminSuite
29
29
  max_page_size: AdminSuite.config.mcp.max_page_size
30
30
  ).scope
31
31
  payload = { resource: resource, count: scope.count, stats: stats_for(config, scope) }
32
- response = ::MCP::Tool::Response.new([{ type: "text", text: Serializer.dump(payload) }])
33
- [response, payload[:count], true]
32
+ response = ::MCP::Tool::Response.new([ { type: "text", text: Serializer.dump(payload) } ])
33
+ [ response, payload[:count], true ]
34
34
  rescue StandardError => e
35
35
  Rails.logger&.warn("AdminSuite MCP aggregate failed: #{e.class}: #{e.message}")
36
- [Authorization.error_response("aggregate failed"), nil, allowed]
36
+ [ Authorization.error_response("aggregate failed"), nil, allowed ]
37
37
  end
38
38
  end
39
39
 
@@ -13,18 +13,18 @@ module AdminSuite
13
13
  AdminSuite::Mcp.instrument(tool: "describe_resources", actor: server_context[:actor], request: server_context[:request]) do
14
14
  allowed = false
15
15
  if AdminSuite.config.authorize.nil? || Auth.normalize_actor(server_context[:actor]).nil?
16
- [Authorization.denied_response, nil, false]
16
+ [ Authorization.denied_response, nil, false ]
17
17
  else
18
18
  allowed = true
19
19
  payload = Authorization
20
20
  .readable_resources(actor: server_context[:actor], request: server_context[:request])
21
21
  .map { |config| describe(config) }
22
- response = ::MCP::Tool::Response.new([{ type: "text", text: Serializer.dump(payload) }])
23
- [response, payload.size, true]
22
+ response = ::MCP::Tool::Response.new([ { type: "text", text: Serializer.dump(payload) } ])
23
+ [ response, payload.size, true ]
24
24
  end
25
25
  rescue StandardError => e
26
26
  Rails.logger&.warn("AdminSuite MCP describe_resources failed: #{e.class}: #{e.message}")
27
- [Authorization.error_response("describe_resources failed"), nil, allowed]
27
+ [ Authorization.error_response("describe_resources failed"), nil, allowed ]
28
28
  end
29
29
  end
30
30
 
@@ -15,24 +15,24 @@ module AdminSuite
15
15
  AdminSuite::Mcp.instrument(tool: "get_record", resource: resource, actor: server_context[:actor], request: server_context[:request]) do
16
16
  allowed = false
17
17
  config = Authorization.authorize_resource!(name: resource, actor: server_context[:actor], action: :read, request: server_context[:request])
18
- next [Authorization.denied_response, nil, false] if config.nil?
18
+ next [ Authorization.denied_response, nil, false ] if config.nil?
19
19
 
20
20
  allowed = true
21
21
  record = config.model_class.find_by(id: id)
22
- next [Authorization.denied_response, nil, false] if record.nil?
22
+ next [ Authorization.denied_response, nil, false ] if record.nil?
23
23
  unless Authorization.authorize_record?(config: config, actor: server_context[:actor], record: record, request: server_context[:request])
24
- next [Authorization.denied_response, nil, false]
24
+ next [ Authorization.denied_response, nil, false ]
25
25
  end
26
26
 
27
27
  payload = {
28
28
  resource: resource, id: id, fields: Serializer.show_payload(record, config),
29
29
  associations: Serializer.associations_payload(record, config, max_rows: AdminSuite.config.mcp.max_page_size)
30
30
  }
31
- response = ::MCP::Tool::Response.new([{ type: "text", text: Serializer.dump(payload) }])
32
- [response, 1, true]
31
+ response = ::MCP::Tool::Response.new([ { type: "text", text: Serializer.dump(payload) } ])
32
+ [ response, 1, true ]
33
33
  rescue StandardError => e
34
34
  Rails.logger&.warn("AdminSuite MCP get_record failed: #{e.class}: #{e.message}")
35
- [Authorization.error_response("get_record failed"), nil, allowed]
35
+ [ Authorization.error_response("get_record failed"), nil, allowed ]
36
36
  end
37
37
  end
38
38
  end
@@ -16,23 +16,23 @@ module AdminSuite
16
16
  page: { type: "integer" },
17
17
  per_page: { type: "integer" }
18
18
  },
19
- required: ["resource"]
19
+ required: [ "resource" ]
20
20
  )
21
21
 
22
22
  def self.call(resource:, server_context:, q: nil, filters: {}, sort: nil, direction: nil, page: 1, per_page: nil)
23
23
  AdminSuite::Mcp.instrument(tool: "list_records", resource: resource, actor: server_context[:actor], request: server_context[:request], filters: filters, q: q) do
24
24
  allowed = false
25
25
  config = Authorization.authorize_resource!(name: resource, actor: server_context[:actor], action: :read, request: server_context[:request])
26
- next [Authorization.denied_response, nil, false] unless config
26
+ next [ Authorization.denied_response, nil, false ] unless config
27
27
 
28
28
  allowed = true
29
29
  query = build_query(config, filters, q:, sort:, direction:, per_page:)
30
30
  payload = response_payload(resource, config, query, page)
31
- response = ::MCP::Tool::Response.new([{ type: "text", text: Serializer.dump(payload) }])
32
- [response, payload[:rows].size, true]
31
+ response = ::MCP::Tool::Response.new([ { type: "text", text: Serializer.dump(payload) } ])
32
+ [ response, payload[:rows].size, true ]
33
33
  rescue StandardError => e
34
34
  Rails.logger&.warn("AdminSuite MCP list_records failed: #{e.class}: #{e.message}")
35
- [Authorization.error_response("list_records failed"), nil, allowed]
35
+ [ Authorization.error_response("list_records failed"), nil, allowed ]
36
36
  end
37
37
  end
38
38
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  module AdminSuite
4
4
  module Version
5
- VERSION = "0.7.0"
5
+ VERSION = "0.7.1"
6
6
  end
7
7
 
8
8
  # Backward-compatible constant.
@@ -73,7 +73,7 @@ module AdminSuite
73
73
 
74
74
  test "current_actor is consulted at most once per request on the legacy path" do
75
75
  calls = 0
76
- passes = ->(_controller) {}
76
+ passes = ->(_controller) { }
77
77
  counting_actor = lambda { |_controller|
78
78
  calls += 1
79
79
  nil
@@ -88,7 +88,7 @@ module AdminSuite
88
88
  end
89
89
 
90
90
  test "legacy authenticate lambda passes but a raising current_actor lambda is rescued to nil" do
91
- passes = ->(_controller) {}
91
+ passes = ->(_controller) { }
92
92
  raising_actor = ->(_controller) { raise "boom" }
93
93
 
94
94
  with_config(allow_unauthenticated: false, auth_strategy: nil, authenticate: passes,
@@ -104,7 +104,7 @@ module AdminSuite
104
104
  assert bars, "expected the bars wrapper"
105
105
  assert_equal "height: 192px;", bars["style"], "bars wrapper must carry the default definite chart height"
106
106
  assert_equal 2, bars.css(".h-full").size
107
- assert_equal ["height: 2%", "height: 100%"], bars.css(".h-full > div").map { |bar| bar["style"] }
107
+ assert_equal [ "height: 2%", "height: 100%" ], bars.css(".h-full > div").map { |bar| bar["style"] }
108
108
  assert_includes chart.text, "Jul 30"
109
109
  assert_includes chart.text, "Thursday"
110
110
  end
@@ -6,7 +6,7 @@ module McpAggregateFixtures
6
6
  class Widget
7
7
  extend ActiveModel::Naming
8
8
 
9
- def self.all = ReadOnlyResourceFixtures::Relation.new([new, new])
9
+ def self.all = ReadOnlyResourceFixtures::Relation.new([ new, new ])
10
10
  end
11
11
  end
12
12
 
@@ -66,7 +66,7 @@ class McpAuthorizationTest < McpIntegrationTest
66
66
  test "the authorize hook receives an mcp surface and a read action" do
67
67
  seen = []
68
68
  hook = lambda do |action:, record:, context:, **|
69
- seen << [action, context.surface, record]
69
+ seen << [ action, context.surface, record ]
70
70
  true
71
71
  end
72
72
 
@@ -74,7 +74,7 @@ class McpAuthorizationTest < McpIntegrationTest
74
74
  call_tool("list_records", { resource: "mcp_authorization_widget" })
75
75
  end
76
76
 
77
- assert_includes seen, [:read, :mcp, nil]
77
+ assert_includes seen, [ :read, :mcp, nil ]
78
78
  end
79
79
 
80
80
  test "describe_resources omits resources the hook denies" do
@@ -42,7 +42,7 @@ class McpInstrumentationTest < McpIntegrationTest
42
42
  resource: "mcp_instrumentation_widget", server_context: { actor: nil }
43
43
  ) }
44
44
 
45
- assert_equal [true, false], events.map { |event| event[:allowed] }
45
+ assert_equal [ true, false ], events.map { |event| event[:allowed] }
46
46
  assert events.all? { |event| event[:tool] == "list_records" }
47
47
  assert events.all? { |event| event[:action] == :read }
48
48
  assert events.all? { |event| event[:duration_ms].is_a?(Numeric) }
@@ -77,7 +77,7 @@ class McpInstrumentationTest < McpIntegrationTest
77
77
  end
78
78
 
79
79
  AdminSuite::Mcp.instrument(tool: "list_records", actor: actor, request: request) do
80
- [MCP::Tool::Response.new([{ type: "text", text: "failed" }], error: true), nil, true]
80
+ [ MCP::Tool::Response.new([ { type: "text", text: "failed" } ], error: true), nil, true ]
81
81
  end
82
82
 
83
83
  assert_equal "42", events.first.fetch(:actor_id)
@@ -14,7 +14,7 @@ module McpListRecordsFixtures
14
14
  @secret_token = secret_token
15
15
  end
16
16
 
17
- def self.all = ReadOnlyResourceFixtures::Relation.new([new])
17
+ def self.all = ReadOnlyResourceFixtures::Relation.new([ new ])
18
18
  end
19
19
  end
20
20
 
@@ -55,7 +55,7 @@ module McpParityFixtures
55
55
  @application = application
56
56
  end
57
57
 
58
- ROWS = [new(id: 1, name: "Zulu"), new(id: 2, name: "Alpha"), new(id: 3, name: "Bravo")].freeze
58
+ ROWS = [ new(id: 1, name: "Zulu"), new(id: 2, name: "Alpha"), new(id: 3, name: "Bravo") ].freeze
59
59
 
60
60
  def self.all = Relation.new(ROWS)
61
61
  def self.column_names = %w[id name]
@@ -19,7 +19,7 @@ module McpReleaseFixtures
19
19
 
20
20
  class Widget
21
21
  extend ActiveModel::Naming
22
- def self.all = Relation.new([Record.new(1, "open"), Record.new(2, "closed")])
22
+ def self.all = Relation.new([ Record.new(1, "open"), Record.new(2, "closed") ])
23
23
  def self.find_by(id:) = all.find { |row| row.id.to_s == id.to_s }
24
24
  end
25
25
  end
@@ -59,7 +59,7 @@ class McpReleaseTest < ActionDispatch::IntegrationTest
59
59
  with_authorize(->(**) { true }) do
60
60
  result = call_tool("list_records", resource: "mcp_release_widget", filters: { state: "open" })
61
61
  payload = JSON.parse(result.dig("result", "content", 0, "text"))
62
- assert_equal [1], payload.fetch("rows").map { |row| row.fetch("id") }
62
+ assert_equal [ 1 ], payload.fetch("rows").map { |row| row.fetch("id") }
63
63
  assert_equal 100, payload.fetch("applied_per_page")
64
64
  result = call_tool("aggregate", resource: "mcp_release_widget", filters: { state: "closed" })
65
65
  assert_equal 1, JSON.parse(result.dig("result", "content", 0, "text")).fetch("count")
@@ -92,7 +92,7 @@ class McpReleaseTest < ActionDispatch::IntegrationTest
92
92
 
93
93
  test "MCP rejects foreign origins while allowing same-origin and headless clients" do
94
94
  with_authorize(->(**) { true }) do
95
- ["https://attacker.example", "null", ""].each do |origin|
95
+ [ "https://attacker.example", "null", "" ].each do |origin|
96
96
  post "/internal/admin_suite/mcp", params: { jsonrpc: "2.0", id: 1, method: "tools/list" }.to_json,
97
97
  headers: { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json, text/event-stream", "HTTP_ORIGIN" => origin }
98
98
  assert_response :forbidden
@@ -99,7 +99,7 @@ module AdminSuite
99
99
 
100
100
  test "the index stats markup comes from the shared stat partial" do
101
101
  source = AdminSuite::Engine.root.join("app/views/admin_suite/resources/index.html.erb").read
102
- refute_includes source, 'text-<%= color %>-600'
102
+ refute_includes source, "text-<%= color %>-600"
103
103
  assert_includes source, "admin_suite/panels/stat"
104
104
  end
105
105
 
@@ -219,7 +219,7 @@ module AdminSuite
219
219
  end
220
220
 
221
221
  test "undeclared bulk_action names respond 404" do
222
- post "#{BASE_PATH}/bulk_action/nonexistent_bulk", params: { ids: ["1"] }
222
+ post "#{BASE_PATH}/bulk_action/nonexistent_bulk", params: { ids: [ "1" ] }
223
223
  assert_response :not_found
224
224
  end
225
225
 
@@ -189,7 +189,7 @@ module AdminSuite
189
189
  with_globs(:portals, []) do
190
190
  with_globs(:dashboards, []) do
191
191
  with_globs(:actions, []) do
192
- AdminSuite.portal(:reset_for_new_request_test) {}
192
+ AdminSuite.portal(:reset_for_new_request_test) { }
193
193
  AdminSuite::DefinitionLoader.load!(:resources)
194
194
  Admin::Base::ActionExecutor.handlers_loaded = true
195
195
  AdminSuite.config.root_dashboard_loaded = true
@@ -9,7 +9,7 @@ class McpSerializerTest < ActiveSupport::TestCase
9
9
 
10
10
  test "emits only the resource's declared columns" do
11
11
  record = Struct.new(:id, :name, :secret_token).new(1, "Widget", "sh-hh")
12
- config = Config.new(Index.new([Column.new(:id), Column.new(:name)]))
12
+ config = Config.new(Index.new([ Column.new(:id), Column.new(:name) ]))
13
13
 
14
14
  row = AdminSuite::Mcp::Serializer.index_row(record, config)
15
15
 
@@ -21,7 +21,7 @@ class McpSerializerTest < ActiveSupport::TestCase
21
21
  record = Object.new
22
22
  def record.id = 1
23
23
  def record.name = raise("boom")
24
- config = Config.new(Index.new([Column.new(:id), Column.new(:name)]))
24
+ config = Config.new(Index.new([ Column.new(:id), Column.new(:name) ]))
25
25
 
26
26
  row = AdminSuite::Mcp::Serializer.index_row(record, config)
27
27
 
@@ -31,7 +31,7 @@ class McpSerializerTest < ActiveSupport::TestCase
31
31
 
32
32
  test "association panels return bounded rows containing only declared columns" do
33
33
  show = Admin::Base::Resource::ShowConfig.new
34
- show.panel :children, association: :children, columns: [:name], limit: 500
34
+ show.panel :children, association: :children, columns: [ :name ], limit: 500
35
35
  config = Struct.new(:show_config).new(show)
36
36
  child = Struct.new(:name, :secret_token).new("Visible", "private")
37
37
  record = Struct.new(:children).new(Array.new(150, child))
@@ -56,7 +56,7 @@ class McpSerializerTest < ActiveSupport::TestCase
56
56
  test "a content lambda serializes the proc result, not a missing attribute" do
57
57
  record = Struct.new(:id).new(1)
58
58
  column = Admin::Base::Resource::ColumnDefinition.new(name: :listings_count, content: ->(_r) { 42 })
59
- config = Config.new(Index.new([column]))
59
+ config = Config.new(Index.new([ column ]))
60
60
 
61
61
  assert_equal 42, AdminSuite::Mcp::Serializer.index_row(record, config)[:listings_count]
62
62
  end
@@ -64,7 +64,7 @@ class McpSerializerTest < ActiveSupport::TestCase
64
64
  test "a label lambda serializes the proc result" do
65
65
  record = Struct.new(:id).new(1)
66
66
  column = Admin::Base::Resource::ColumnDefinition.new(name: :status, content: ->(_r) { "active" }, type: :label)
67
- config = Config.new(Index.new([column]))
67
+ config = Config.new(Index.new([ column ]))
68
68
 
69
69
  assert_equal "active", AdminSuite::Mcp::Serializer.index_row(record, config)[:status]
70
70
  end
@@ -73,7 +73,7 @@ class McpSerializerTest < ActiveSupport::TestCase
73
73
  created_at = Time.utc(2026, 9, 10, 12, 0, 0)
74
74
  application = SerializerApplication.new(id: 7, name: "Acme")
75
75
  record = Struct.new(:created_at, :application, :blob).new(created_at, application, SerializerOpaque.new)
76
- config = Config.new(Index.new([Column.new(:created_at), Column.new(:application), Column.new(:blob)]))
76
+ config = Config.new(Index.new([ Column.new(:created_at), Column.new(:application), Column.new(:blob) ]))
77
77
 
78
78
  row = AdminSuite::Mcp::Serializer.index_row(record, config)
79
79
  text = AdminSuite::Mcp::Serializer.dump(row)
@@ -86,7 +86,7 @@ class McpSerializerTest < ActiveSupport::TestCase
86
86
 
87
87
  test "a missing association panel degrades that panel instead of raising" do
88
88
  show = Admin::Base::Resource::ShowConfig.new
89
- show.panel :children, association: :missing_kids, columns: [:name]
89
+ show.panel :children, association: :missing_kids, columns: [ :name ]
90
90
  config = Struct.new(:show_config).new(show)
91
91
 
92
92
  payload = AdminSuite::Mcp::Serializer.associations_payload(Object.new, config, max_rows: 100)
@@ -47,7 +47,7 @@ class QueryTest < ActiveSupport::TestCase
47
47
  end
48
48
 
49
49
  test "per_page falls back for junk and non-positive values" do
50
- ["abc", "0", "-5", nil, "", [], true].each do |value|
50
+ [ "abc", "0", "-5", nil, "", [], true ].each do |value|
51
51
  query = AdminSuite::Query.new(resource_config: config_with(per_page: 30), params: { per_page: value })
52
52
 
53
53
  assert_equal 30, query.per_page, "per_page: #{value.inspect} must fall back to the DSL value"
@@ -55,7 +55,7 @@ class QueryTest < ActiveSupport::TestCase
55
55
  end
56
56
 
57
57
  test "the cap applies to DSL defaults as well as explicit page sizes" do
58
- [nil, "", "bad", 0, -1, [], true, 5000].each do |value|
58
+ [ nil, "", "bad", 0, -1, [], true, 5000 ].each do |value|
59
59
  query = AdminSuite::Query.new(resource_config: config_with(per_page: 500),
60
60
  params: { per_page: value }, max_page_size: 40)
61
61
  assert_equal 40, query.per_page, "per_page=#{value.inspect}"
@@ -63,7 +63,7 @@ class QueryTest < ActiveSupport::TestCase
63
63
  end
64
64
 
65
65
  test "per_page remains a positive integer when max_page_size is below 1" do
66
- [0, -5, nil].each do |cap|
66
+ [ 0, -5, nil ].each do |cap|
67
67
  query = AdminSuite::Query.new(
68
68
  resource_config: config_with(per_page: 30),
69
69
  params: { per_page: "10" },
@@ -78,7 +78,7 @@ class QueryTest < ActiveSupport::TestCase
78
78
  test "a raising includes degrades to the unoptimized scope instead of raising" do
79
79
  relation = RaisingIncludesRelation.new([])
80
80
  Model.relation = relation
81
- query = AdminSuite::Query.new(resource_config: config_with(per_page: 25, includes: [:nope]), params: {})
81
+ query = AdminSuite::Query.new(resource_config: config_with(per_page: 25, includes: [ :nope ]), params: {})
82
82
 
83
83
  assert_same relation, query.scope
84
84
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_suite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TechWright Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-10-03 00:00:00.000000000 Z
11
+ date: 2026-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails