ask-solid_errors 0.1.0 → 0.1.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: f5fc53842cb442db8d1ca3b2545515ad9d4763bcdeec8dc93c375f3901c2b12f
4
- data.tar.gz: 9f024d03059f3c96864991ef633d9d98ef86808c569d5c21094804f3a6d420c5
3
+ metadata.gz: 9bc92f1121f81b6a0ed87e8e141a698a13257e12fa6306fbc564032b964c2b2c
4
+ data.tar.gz: f25b7fe3b53975150dd5880ca08f1c188b5d2f19d957414a87a186c26c521f82
5
5
  SHA512:
6
- metadata.gz: 7f48fdce7fe85b1b43f74d9c6720e159541984a1f9ce8cf4855cfa9fecbf97302d12d5c355bab1110d850ea674b1537ee59bbbde7f6eaf7fe760f8cac12c1431
7
- data.tar.gz: 34bd2e2cbcb8ba7049c09de62c5bd60c4fd9ad858b79afe1aa647af0cfe1f158765b7cb86189e46e47bf9b14e7d2b04567e07d54e5183c56232e1cf1f1ad44af
6
+ metadata.gz: 61aa60d118cd6f17e7604af52673b5f6e56d1606c31f65edce8145fe9d24e32f34c0c186e780aeb85559bc7e9daa3b6588586cf035bef7166a5703637c21da20
7
+ data.tar.gz: 4e5727509ea785da77c7bf989124cec2b1d6a11551fd2cc9536b80a35fc7be7fbf3d2d3a7f6800e3acd44cc2647442a122e4ffca95ae41510fdd2bfc46600a83
data/README.md CHANGED
@@ -8,11 +8,52 @@ SolidErrors — error tracking stored in your Rails database
8
8
  gem "ask-solid_errors"
9
9
  ```
10
10
 
11
+ ## Prerequisites
12
+
13
+ This gem requires the `solid_errors` gem to be installed and configured in your Rails app:
14
+
15
+ ```ruby
16
+ gem "solid_errors"
17
+ ```
18
+
19
+ Run the SolidErrors migration:
20
+
21
+ ```bash
22
+ bin/rails solid_errors:install:migrations
23
+ bin/rails db:migrate
24
+ ```
25
+
11
26
  ## Usage
12
27
 
13
28
  ```ruby
29
+ # Recent errors
30
+ errors = Ask::SolidErrors.recent(limit: 10)
31
+ errors.map { |e| { id: e.id, class: e.exception_class, message: e.message.truncate(200) } }
32
+
33
+ # Find by ID
34
+ error = Ask::SolidErrors.find(42)
35
+ error.backtrace
36
+ error.context
37
+ error.occurrences
38
+
39
+ # Filter by status
40
+ Ask::SolidErrors.unresolved # errors needing attention
41
+ Ask::SolidErrors.resolved # previously resolved errors
42
+
43
+ # Filter by class or severity
44
+ Ask::SolidErrors.by_class("ActiveRecord::RecordNotFound")
45
+ Ask::SolidErrors.by_severity("error")
46
+
47
+ # Search messages
48
+ Ask::SolidErrors.search("timeout")
49
+
50
+ # Occurrence count
51
+ Ask::SolidErrors.occurrence_count(error)
52
+ Ask::SolidErrors.occurrence_count(42)
53
+
54
+ # Low-level client for custom queries
14
55
  client = Ask::SolidErrors.client
15
- # ... use the client according to its API
56
+ client.where(exception_class: "RuntimeError").order(created_at: :desc)
16
57
  ```
17
58
 
18
59
  ## Development
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: solid_errors.use_solid_errors
3
+ description: How to navigate SolidErrors — query errors, occurrences, and backtraces in your Rails database
4
+ ---
5
+
6
+ Use this skill when you need to review application errors stored in your Rails
7
+ database via the SolidErrors engine.
8
+
9
+ ## Step 1: Understand the Difference
10
+
11
+ Unlike other service gems, SolidErrors has **no external API** — errors are
12
+ stored in your Rails database. `Ask::SolidErrors.client` returns a proxy
13
+ to `ActiveRecord::Relation` objects from `SolidErrors::Error`.
14
+
15
+ ## Step 2: Explore the Context
16
+
17
+ ```ruby
18
+ Ask::SolidErrors::Context::QUICK_START # Query examples
19
+ ```
20
+
21
+ ## Step 3: Use Convenience Helpers
22
+
23
+ The gem ships with helpers for common queries:
24
+
25
+ ```ruby
26
+ # Most recent errors
27
+ errors = Ask::SolidErrors.recent(limit: 10)
28
+
29
+ # Find by ID with occurrences
30
+ error = Ask::SolidErrors.find(id)
31
+ puts error.exception_class
32
+ puts error.message
33
+ puts error.backtrace
34
+ puts error.context
35
+
36
+ # Unresolved errors
37
+ unresolved = Ask::SolidErrors.unresolved
38
+
39
+ # Resolved errors
40
+ resolved = Ask::SolidErrors.resolved
41
+
42
+ # Filter by exception class
43
+ not_founds = Ask::SolidErrors.by_class("ActiveRecord::RecordNotFound")
44
+
45
+ # Filter by severity
46
+ warnings = Ask::SolidErrors.by_severity("warning")
47
+
48
+ # Search by message text
49
+ results = Ask::SolidErrors.search("timeout")
50
+ ```
51
+
52
+ ## Step 4: Chaining Queries like ActiveRecord
53
+
54
+ Since the proxy returns `ActiveRecord::Relation` objects, you can chain:
55
+
56
+ ```ruby
57
+ # Count
58
+ Ask::SolidErrors.unresolved.count
59
+
60
+ # Order and limit
61
+ Ask::SolidErrors.by_class("NoMethodError").order(created_at: :desc).limit(5)
62
+
63
+ # Get occurrences for a specific error
64
+ error = Ask::SolidErrors.find(id)
65
+ error.occurrences.each do |occ|
66
+ occ.parsed_backtrace.each do |trace_line|
67
+ puts "#{trace_line['file']}:#{trace_line['line_number']}"
68
+ end
69
+ end
70
+ ```
71
+
72
+ ## Step 5: Common Issues
73
+
74
+ - **Table doesn't exist**: Run `bin/rails solid_errors:install:migrations db:migrate`
75
+ - **No database configured**: SolidErrors requires a Rails database connection
76
+ - **No errors found**: The app may not have encountered errors yet, or the
77
+ table may be empty — check `Ask::SolidErrors.recent` first to confirm
78
+ - **Occurrence details**: Each error has multiple occurrences (the same error
79
+ happening multiple times). Use `error.occurrences` to get individual events
80
+
81
+ ## Step 6: Fallback Strategy
82
+
83
+ 1. SolidErrors uses standard ActiveRecord — any valid ActiveRecord query works
84
+ 2. Call `Ask::SolidErrors.client.methods(false)` to see all available methods
85
+ 3. The underlying `SolidErrors::Error` model has columns like `exception_class`,
86
+ `message`, `severity`, `backtrace`, `context`, `created_at`
87
+ 4. For custom queries not covered by helpers, use `Ask::SolidErrors.client`
88
+ directly — it delegates to `SolidErrors::Error`
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ask
4
4
  module SolidErrors
5
- VERSION = "0.1.0"
5
+ VERSION = "0.1.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-solid_errors
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto
@@ -75,6 +75,7 @@ files:
75
75
  - LICENSE
76
76
  - README.md
77
77
  - lib/ask-solid_errors.rb
78
+ - lib/ask/skills/solid_errors.use_solid_errors/SKILL.md
78
79
  - lib/ask/solid_errors/client.rb
79
80
  - lib/ask/solid_errors/context.rb
80
81
  - lib/ask/solid_errors/error_guide.rb