rails_error_dashboard 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: bfd6bfaddc3831f37ef4162c92037dddfb18129068e1ad279449b4fcdf164514
4
- data.tar.gz: 031a14fd395298e46d95bcbb182c8333dab85d12c64439e7d840a577a7ced989
3
+ metadata.gz: 128bf5d8e84190cf45290fc1000c5a0bc45dd27aea13f7cc6447d5795ad5059f
4
+ data.tar.gz: 94e96577de22affd2fecbd2f7d723823840021b8fbcc3df10c1cf5092c150248
5
5
  SHA512:
6
- metadata.gz: dae9aaa0bebaf0daf71bd5b3e64590b19b5e48d5a032273304639f49535bc17d5eaa2991a460d9e97403cebcc4dc1f0e70baca2c5291c4c4191d1a5ae092bbf3
7
- data.tar.gz: 6bc6d8a6fcf5cb0c262688102ec57cd79d24a8d87f3bed2417ef29d9b63102bc67937784217fbf4a54822b06b1691c333b9210f6bc77c1be49e6055a54559708
6
+ metadata.gz: 4743bd41df374b04291b6887e7b08e0889ec7093bd312ba361b93156be9fbeb6bf4a103a35e8ff65b33cf0d07161c771ababbad1bcdd1d77e930bb3265b80f63
7
+ data.tar.gz: 79dd710f629a9c3f6d3eab49405a13efb08b25f3f6212fe6b70d1f98839bffe5e36ba55524a77c99c3bcaf00ade39ac61e3dd2563179797e1ea5e1cfa03696e7
@@ -66,14 +66,14 @@
66
66
  <hr class="my-2">
67
67
  <small class="text-muted d-block mb-2">By model</small>
68
68
  <% llm_summary[:by_model].each do |row| %>
69
- <div class="d-flex justify-content-between align-items-center mb-1">
70
- <small style="word-break: break-all;">
69
+ <div class="d-flex justify-content-between align-items-center mb-1" style="gap: 0.5rem;">
70
+ <small style="min-width: 0; overflow-wrap: anywhere;" title="<%= [ row[:provider], row[:model].presence || "unknown" ].compact.join(" · ") %>">
71
71
  <% if row[:provider].present? %>
72
72
  <span class="text-muted"><%= row[:provider] %>·</span>
73
73
  <% end %>
74
74
  <strong><%= row[:model].presence || "unknown" %></strong>
75
75
  </small>
76
- <small class="text-muted">
76
+ <small class="text-muted text-nowrap">
77
77
  <%= row[:calls] %> · <%= number_with_delimiter(row[:tokens]) %>tok
78
78
  <% if row[:cost_usd] > 0 %>
79
79
  · $<%= "%.4f" % row[:cost_usd] %>
@@ -18,6 +18,23 @@ module RailsErrorDashboard
18
18
  MAX_METADATA_VALUE_LENGTH = 200
19
19
  MAX_METADATA_KEYS = 10
20
20
 
21
+ # Categories whose metadata is emitted by LlmCallEvent#to_breadcrumb_metadata.
22
+ LLM_CATEGORIES = %w[llm llm_tool].freeze
23
+
24
+ # Keys on llm / llm_tool crumbs whose values are structured (numeric counts,
25
+ # identifiers, durations, costs) and must not be redacted by the
26
+ # ActiveSupport::ParameterFilter substring matcher. Without this whitelist,
27
+ # the default `:token` pattern matches `input_tokens` / `output_tokens` and
28
+ # corrupts the LlmSummary rollup, sidebar card, and markdown export tokens
29
+ # column. Sensitive-looking fields like tool_arguments / tool_result /
30
+ # error_message are intentionally NOT in this list — they go through the
31
+ # filter as usual because they can carry user-provided content.
32
+ LLM_STRUCTURED_METADATA_KEYS = %w[
33
+ provider model status
34
+ input_tokens output_tokens duration_ms
35
+ tool_name error_class cost_usd
36
+ ].freeze
37
+
21
38
  # Fixed-size ring buffer — O(1) append, wraps around when full
22
39
  class RingBuffer
23
40
  def initialize(max_size)
@@ -156,7 +173,7 @@ module RailsErrorDashboard
156
173
 
157
174
  # Filter metadata values
158
175
  if filtered[:meta].is_a?(Hash)
159
- filtered[:meta] = filter.filter(filtered[:meta])
176
+ filtered[:meta] = filter_metadata_for_crumb(filter, filtered[:c], filtered[:meta])
160
177
  end
161
178
 
162
179
  filtered
@@ -166,6 +183,22 @@ module RailsErrorDashboard
166
183
  breadcrumbs.is_a?(Array) ? breadcrumbs : []
167
184
  end
168
185
 
186
+ # Apply the sensitive-data filter to a single breadcrumb's metadata hash,
187
+ # with a narrow whitelist for llm/llm_tool crumbs. The default
188
+ # ActiveSupport::ParameterFilter does substring matching (e.g. the `:token`
189
+ # default redacts every key containing "token"), which corrupts the
190
+ # structured numeric metadata emitted by LlmCallEvent. For llm/llm_tool
191
+ # crumbs we filter only the non-whitelisted keys, then merge the
192
+ # untouched structured keys back in.
193
+ def self.filter_metadata_for_crumb(filter, category, metadata)
194
+ return filter.filter(metadata) unless LLM_CATEGORIES.include?(category.to_s)
195
+
196
+ structured, rest = metadata.partition { |k, _| LLM_STRUCTURED_METADATA_KEYS.include?(k.to_s) }
197
+ filtered_rest = filter.filter(rest.to_h)
198
+ structured.to_h.merge(filtered_rest)
199
+ end
200
+ private_class_method :filter_metadata_for_crumb
201
+
169
202
  # Truncate message to MAX_MESSAGE_LENGTH
170
203
  def self.truncate_message(message)
171
204
  str = message.to_s
@@ -1,3 +1,3 @@
1
1
  module RailsErrorDashboard
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_error_dashboard
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
  - Anjan Jagirdar
@@ -508,7 +508,7 @@ metadata:
508
508
  funding_uri: https://github.com/sponsors/AnjanJ
509
509
  post_install_message: |
510
510
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
511
- RED (Rails Error Dashboard) v0.7.0
511
+ RED (Rails Error Dashboard) v0.7.1
512
512
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
513
513
 
514
514
  First install: