rails_why 0.1.0
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 +7 -0
- data/.github/workflows/ci.yml +24 -0
- data/CHANGELOG.md +22 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/DOCKER_INTEGRATION.md +109 -0
- data/LICENSE.txt +21 -0
- data/README.md +107 -0
- data/Rakefile +8 -0
- data/lib/rails_why/condition_analyzer.rb +298 -0
- data/lib/rails_why/configuration.rb +49 -0
- data/lib/rails_why/diagnostic_engine.rb +177 -0
- data/lib/rails_why/node.rb +62 -0
- data/lib/rails_why/rails_integration.rb +222 -0
- data/lib/rails_why/redactor.rb +114 -0
- data/lib/rails_why/report.rb +77 -0
- data/lib/rails_why/text_formatter.rb +90 -0
- data/lib/rails_why/tracer.rb +200 -0
- data/lib/rails_why/version.rb +5 -0
- data/lib/rails_why.rb +86 -0
- data/sig/rails_why.rbs +4 -0
- metadata +86 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8e618a70b25fa616df6a32670b60f64ebdc77d958809466c5378c6f4bbfdb547
|
|
4
|
+
data.tar.gz: f8046a1a8ad0efe93759bc87af7150726b764020996bec19e62c318a6030b280
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b9d85f6a17a10b94cab6a3947bd9f6c1a8cf358248015c2e9557db38b8f9a3e665894c57d07aefaa0dc45584c5f8551788144036f6160956b05377ed477a8eeb
|
|
7
|
+
data.tar.gz: c5c13e162eb9c0b4644087e0df1a4b07acf9586ffc0f7fe50616367e2b3877d3d7ec847de3861250b8808f52952a9462d7f06f72106323dbf65821d03e5c022a
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
ruby-version: ['3.2', '3.3']
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- name: Set up Ruby
|
|
19
|
+
uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
22
|
+
bundler-cache: true
|
|
23
|
+
- name: Run tests
|
|
24
|
+
run: bundle exec rspec
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `rails_why` will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-11-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Complete diagnostic engine for Ruby & Rails applications.
|
|
12
|
+
- TracePoint-based execution tracing with thread-local and re-entrant safety.
|
|
13
|
+
- Prism AST-powered static condition analysis for `if`, `unless`, `case`, guard clauses, and short-circuit boolean expressions (`&&`, `||`).
|
|
14
|
+
- Automated root-cause candidate detection with support for configurable `expected:` result values.
|
|
15
|
+
- Rails integration hooks:
|
|
16
|
+
- ActiveRecord model validation diagnostics and error reporting.
|
|
17
|
+
- Aborted callback detection (`throw :abort`).
|
|
18
|
+
- ActiveSupport Notifications integration for SQL execution and transaction rollbacks.
|
|
19
|
+
- Optional Rack/Rails diagnostic middleware.
|
|
20
|
+
- Security-first redactor masking credentials, passwords, tokens, API keys, and sensitive model attributes.
|
|
21
|
+
- High-performance human-readable text formatter and structured JSON report formatter.
|
|
22
|
+
- Verified Rubygems namespace availability (`rails_why` is free to claim).
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
[INSERT CONTACT METHOD].
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
|
86
|
+
actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
93
|
+
ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
113
|
+
community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.1, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
123
|
+
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# Docker Integration Guide for Existing Rails Applications
|
|
2
|
+
|
|
3
|
+
This guide details how to integrate and run `rails_why` safely in a large, existing Rails application running within Docker containers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Add `rails_why` to Gemfile
|
|
8
|
+
|
|
9
|
+
Add `rails_why` to your application Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
# Gemfile
|
|
13
|
+
gem "rails_why", "~> 0.1.0"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then rebuild your application image:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
docker compose build web
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2. Configuration (`config/initializers/rails_why.rb`)
|
|
25
|
+
|
|
26
|
+
Create an initializer to configure tracing limits and sensitive parameter filtering:
|
|
27
|
+
|
|
28
|
+
```ruby
|
|
29
|
+
# config/initializers/rails_why.rb
|
|
30
|
+
RailsWhy.configure do |config|
|
|
31
|
+
# Output mode (:text for readable console output, :json for structured logs, :quiet for programmatic inspections)
|
|
32
|
+
config.output_format = Rails.env.development? ? :text : :json
|
|
33
|
+
|
|
34
|
+
# Safeguard limits
|
|
35
|
+
config.max_depth = 30
|
|
36
|
+
config.max_events = 5000
|
|
37
|
+
|
|
38
|
+
# Automatic data redaction (passwords, tokens, credentials, PII)
|
|
39
|
+
config.redact_sensitive_data = true
|
|
40
|
+
config.sensitive_patterns += [
|
|
41
|
+
/internal_secret/i,
|
|
42
|
+
/stripe_key/i,
|
|
43
|
+
/jwt/i
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
# Exclude non-application directories
|
|
47
|
+
config.excluded_paths += [
|
|
48
|
+
"vendor/",
|
|
49
|
+
"lib/tasks/",
|
|
50
|
+
"tmp/"
|
|
51
|
+
]
|
|
52
|
+
end
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## 3. Usage in Rails Console (Inside Docker)
|
|
58
|
+
|
|
59
|
+
Attach to the running Rails container:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
docker compose exec web bin/rails console
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Diagnose any service object, ActiveRecord query, or workflow:
|
|
66
|
+
|
|
67
|
+
```ruby
|
|
68
|
+
# Explain a service object execution
|
|
69
|
+
report = RailsWhy.explain { OrderProcessingService.new(order).call }
|
|
70
|
+
|
|
71
|
+
# Explain an ActiveRecord model save with validation or callback issues
|
|
72
|
+
report = RailsWhy.explain { user.save }
|
|
73
|
+
|
|
74
|
+
# Explain with explicit expectation
|
|
75
|
+
report = RailsWhy.explain(expected: true) { payment_gateway.charge }
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## 4. Background Job Tracing (Sidekiq / ActiveJob)
|
|
81
|
+
|
|
82
|
+
`rails_why` automatically instruments `ActiveJob` and `Sidekiq` client/server middleware:
|
|
83
|
+
- **Zero Business Argument Alteration**: Correlation tokens are preserved in job metadata or headers without modifying method signatures.
|
|
84
|
+
- **Trace Context**: When jobs fail or behave unexpectedly in worker containers, the trace hierarchy and condition analyses are preserved.
|
|
85
|
+
|
|
86
|
+
To verify in Sidekiq workers inside Docker:
|
|
87
|
+
```bash
|
|
88
|
+
docker compose logs -f sidekiq
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## 5. Middleware / HTTP Request Tracing (Optional)
|
|
94
|
+
|
|
95
|
+
Enable on-demand request diagnostics in development/staging:
|
|
96
|
+
|
|
97
|
+
Set the environment variable in your `docker-compose.yml`:
|
|
98
|
+
```yaml
|
|
99
|
+
services:
|
|
100
|
+
web:
|
|
101
|
+
environment:
|
|
102
|
+
- RAILS_WHY_MIDDLEWARE=1
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Trigger on any endpoint by sending the `X-Rails-Why: 1` header or appending `?explain=1`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
curl -H "X-Rails-Why: 1" http://localhost:3000/api/v1/checkout
|
|
109
|
+
```
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nabeel Akram
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# RailsWhy (v0.1.0)
|
|
2
|
+
|
|
3
|
+
A lightweight, non-invasive diagnostic engine for Ruby and Rails applications that explains why an operation failed, returned an unexpected result, or raised an exception.
|
|
4
|
+
|
|
5
|
+
```ruby
|
|
6
|
+
# Basic explanation
|
|
7
|
+
RailsWhy.explain { user.save }
|
|
8
|
+
|
|
9
|
+
# Explaining service objects
|
|
10
|
+
RailsWhy.explain { CheckoutService.new(user, cart).process }
|
|
11
|
+
|
|
12
|
+
# Explaining with an explicit expected target
|
|
13
|
+
RailsWhy.explain(expected: true) { payment_gateway.charge }
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Key Features
|
|
19
|
+
|
|
20
|
+
- **Exact Single Execution**: Executes the provided block exactly once. Never re-evaluates expressions or executes hidden side-effects.
|
|
21
|
+
- **Prism AST Branch Analysis**: Leverages Ruby 3.2+ Prism parser to inspect source branches (`if`, `unless`, `case`, guard clauses, and logical operators) and evaluate which branch was taken or short-circuited.
|
|
22
|
+
- **Safe Condition Evaluation**: Avoids speculative runtime inference on same-line chained boolean expressions (designated safely as `:inconclusive_same_line`).
|
|
23
|
+
- **Decoupled Truthiness vs. Failure**: Distinguishes normal boolean `false`/`nil` return values from true business failures.
|
|
24
|
+
- **Rails Ecosystem Integration**:
|
|
25
|
+
- Automatically captures ActiveRecord model validation failures (`errors.full_messages`).
|
|
26
|
+
- Pinpoints aborted callback chains (`throw :abort`).
|
|
27
|
+
- Correlates database transactions and SQL rollbacks via `ActiveSupport::Notifications`.
|
|
28
|
+
- Non-invasive trace correlation across asynchronous `ActiveJob` and native `Sidekiq` workers.
|
|
29
|
+
- Optional Rack diagnostic middleware (`RAILS_WHY_MIDDLEWARE=1`).
|
|
30
|
+
- **Zero-Trust Security**:
|
|
31
|
+
- Redacts sensitive credentials, passwords, tokens, API keys, bearer tokens, credit cards, and JWT tokens across arguments, return values, source snippets, and JSON reports.
|
|
32
|
+
- Safe inspection of arbitrary objects avoiding custom overridden `inspect`, `to_s`, or `success?` executions during diagnosis.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Supported Versions
|
|
37
|
+
|
|
38
|
+
| Framework / Tool | Minimum Version | Tested & Verified |
|
|
39
|
+
|------------------|-----------------|-------------------|
|
|
40
|
+
| **Ruby** | `>= 3.2.0` | `3.2.0`, `3.3.0` |
|
|
41
|
+
| **Rails** | `>= 7.0` | `7.2.4` |
|
|
42
|
+
| **Prism** | `>= 1.0, < 3.0` | `2.1.0` |
|
|
43
|
+
| **Sidekiq** | `>= 6.0` | `8.0.10` |
|
|
44
|
+
| **PostgreSQL** | `>= 12` | `16` |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
Add this line to your application's `Gemfile`:
|
|
51
|
+
|
|
52
|
+
```ruby
|
|
53
|
+
gem "rails_why", "~> 0.1.0"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
And then execute:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
$ bundle install
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
Customize `RailsWhy` via an initializer (e.g., `config/initializers/rails_why.rb`):
|
|
67
|
+
|
|
68
|
+
```ruby
|
|
69
|
+
RailsWhy.configure do |config|
|
|
70
|
+
# Output format (:text, :json, or :quiet)
|
|
71
|
+
config.output_format = Rails.env.development? ? :text : :json
|
|
72
|
+
|
|
73
|
+
# Stack & event thresholds
|
|
74
|
+
config.max_depth = 25
|
|
75
|
+
config.max_events = 5000
|
|
76
|
+
|
|
77
|
+
# Condition AST analysis toggle
|
|
78
|
+
config.enable_condition_analysis = true
|
|
79
|
+
|
|
80
|
+
# Security & data redaction
|
|
81
|
+
config.redact_sensitive_data = true
|
|
82
|
+
config.sensitive_patterns += [
|
|
83
|
+
/stripe_key/i,
|
|
84
|
+
/internal_secret/i
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
# Paths to exclude from trace
|
|
88
|
+
config.excluded_paths += [
|
|
89
|
+
"vendor/",
|
|
90
|
+
"lib/tasks/"
|
|
91
|
+
]
|
|
92
|
+
end
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Honest Limitations
|
|
98
|
+
|
|
99
|
+
1. **Same-Line Chained Expressions**: When multiple boolean comparisons occur on the exact same physical line (e.g., `a > 0 && b > 0`), MRI's line-level TracePoint fires only once for that line. While method-call events down the tree are attributed accurately, local variable truthiness within that line cannot be isolated without bytecode manipulation. RailsWhy reports these safely as `:inconclusive_same_line` with branch taken `:unsupported_inference` rather than making unsupported claims.
|
|
100
|
+
2. **C-Extensions**: C-level extensions (such as Nokogiri or JSON native C internals) execute outside Ruby bytecode and are not AST-analyzed.
|
|
101
|
+
3. **TracePoint Overhead**: TracePoint instrumentation introduces runtime latency (~0.3-1.5ms per trace depending on call stack depth). Automatic global tracing is disabled by default and should never be enabled indiscriminately in high-throughput production paths.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
The gem is available as open source under the terms of the [MIT License](LICENSE.txt).
|