ariadna 1.3.1 → 2.0.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.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/ariadna.gemspec +0 -1
  3. data/data/agents/ariadna-codebase-mapper.md +34 -722
  4. data/data/agents/ariadna-debugger.md +44 -1139
  5. data/data/agents/ariadna-executor.md +75 -396
  6. data/data/agents/ariadna-planner.md +78 -1215
  7. data/data/agents/ariadna-roadmapper.md +55 -582
  8. data/data/agents/ariadna-verifier.md +60 -702
  9. data/data/ariadna/templates/config.json +8 -33
  10. data/data/ariadna/workflows/debug.md +28 -0
  11. data/data/ariadna/workflows/execute-phase.md +31 -513
  12. data/data/ariadna/workflows/map-codebase.md +20 -319
  13. data/data/ariadna/workflows/new-milestone.md +20 -365
  14. data/data/ariadna/workflows/new-project.md +19 -880
  15. data/data/ariadna/workflows/plan-phase.md +24 -443
  16. data/data/ariadna/workflows/progress.md +20 -376
  17. data/data/ariadna/workflows/quick.md +19 -221
  18. data/data/ariadna/workflows/roadmap-ops.md +28 -0
  19. data/data/ariadna/workflows/verify-work.md +23 -560
  20. data/data/commands/ariadna/add-phase.md +11 -22
  21. data/data/commands/ariadna/debug.md +11 -143
  22. data/data/commands/ariadna/execute-phase.md +12 -30
  23. data/data/commands/ariadna/insert-phase.md +7 -14
  24. data/data/commands/ariadna/map-codebase.md +16 -49
  25. data/data/commands/ariadna/new-milestone.md +12 -25
  26. data/data/commands/ariadna/new-project.md +22 -26
  27. data/data/commands/ariadna/plan-phase.md +13 -22
  28. data/data/commands/ariadna/progress.md +16 -6
  29. data/data/commands/ariadna/quick.md +9 -11
  30. data/data/commands/ariadna/remove-phase.md +9 -12
  31. data/data/commands/ariadna/verify-work.md +14 -19
  32. data/data/skills/rails-backend/API.md +138 -0
  33. data/data/skills/rails-backend/CONTROLLERS.md +154 -0
  34. data/data/skills/rails-backend/JOBS.md +132 -0
  35. data/data/skills/rails-backend/MODELS.md +213 -0
  36. data/data/skills/rails-backend/SKILL.md +169 -0
  37. data/data/skills/rails-frontend/ASSETS.md +154 -0
  38. data/data/skills/rails-frontend/COMPONENTS.md +253 -0
  39. data/data/skills/rails-frontend/SKILL.md +187 -0
  40. data/data/skills/rails-frontend/VIEWS.md +168 -0
  41. data/data/skills/rails-performance/PROFILING.md +106 -0
  42. data/data/skills/rails-performance/SKILL.md +217 -0
  43. data/data/skills/rails-security/AUDIT.md +118 -0
  44. data/data/skills/rails-security/SKILL.md +422 -0
  45. data/data/skills/rails-testing/FIXTURES.md +78 -0
  46. data/data/skills/rails-testing/SKILL.md +160 -0
  47. data/data/skills/rails-testing/SYSTEM-TESTS.md +73 -0
  48. data/lib/ariadna/installer.rb +11 -15
  49. data/lib/ariadna/tools/cli.rb +0 -12
  50. data/lib/ariadna/tools/config_manager.rb +10 -72
  51. data/lib/ariadna/tools/frontmatter.rb +23 -1
  52. data/lib/ariadna/tools/init.rb +201 -401
  53. data/lib/ariadna/tools/model_profiles.rb +6 -14
  54. data/lib/ariadna/tools/phase_manager.rb +1 -10
  55. data/lib/ariadna/tools/state_manager.rb +170 -451
  56. data/lib/ariadna/tools/template_filler.rb +4 -12
  57. data/lib/ariadna/tools/verification.rb +21 -399
  58. data/lib/ariadna/uninstaller.rb +9 -0
  59. data/lib/ariadna/version.rb +1 -1
  60. metadata +20 -91
  61. data/data/agents/ariadna-backend-executor.md +0 -261
  62. data/data/agents/ariadna-frontend-executor.md +0 -259
  63. data/data/agents/ariadna-integration-checker.md +0 -418
  64. data/data/agents/ariadna-phase-researcher.md +0 -469
  65. data/data/agents/ariadna-plan-checker.md +0 -622
  66. data/data/agents/ariadna-project-researcher.md +0 -618
  67. data/data/agents/ariadna-research-synthesizer.md +0 -236
  68. data/data/agents/ariadna-test-executor.md +0 -266
  69. data/data/ariadna/references/checkpoints.md +0 -772
  70. data/data/ariadna/references/continuation-format.md +0 -249
  71. data/data/ariadna/references/decimal-phase-calculation.md +0 -65
  72. data/data/ariadna/references/git-integration.md +0 -248
  73. data/data/ariadna/references/git-planning-commit.md +0 -38
  74. data/data/ariadna/references/model-profile-resolution.md +0 -32
  75. data/data/ariadna/references/model-profiles.md +0 -73
  76. data/data/ariadna/references/phase-argument-parsing.md +0 -61
  77. data/data/ariadna/references/planning-config.md +0 -194
  78. data/data/ariadna/references/questioning.md +0 -153
  79. data/data/ariadna/references/rails-conventions.md +0 -416
  80. data/data/ariadna/references/tdd.md +0 -267
  81. data/data/ariadna/references/ui-brand.md +0 -160
  82. data/data/ariadna/references/verification-patterns.md +0 -853
  83. data/data/ariadna/templates/codebase/architecture.md +0 -481
  84. data/data/ariadna/templates/codebase/concerns.md +0 -380
  85. data/data/ariadna/templates/codebase/conventions.md +0 -434
  86. data/data/ariadna/templates/codebase/integrations.md +0 -328
  87. data/data/ariadna/templates/codebase/stack.md +0 -189
  88. data/data/ariadna/templates/codebase/structure.md +0 -418
  89. data/data/ariadna/templates/codebase/testing.md +0 -606
  90. data/data/ariadna/templates/context.md +0 -283
  91. data/data/ariadna/templates/continue-here.md +0 -78
  92. data/data/ariadna/templates/debug-subagent-prompt.md +0 -91
  93. data/data/ariadna/templates/phase-prompt.md +0 -609
  94. data/data/ariadna/templates/planner-subagent-prompt.md +0 -117
  95. data/data/ariadna/templates/research-project/ARCHITECTURE.md +0 -439
  96. data/data/ariadna/templates/research-project/FEATURES.md +0 -168
  97. data/data/ariadna/templates/research-project/PITFALLS.md +0 -406
  98. data/data/ariadna/templates/research-project/STACK.md +0 -251
  99. data/data/ariadna/templates/research-project/SUMMARY.md +0 -247
  100. data/data/ariadna/templates/state.md +0 -176
  101. data/data/ariadna/templates/summary-complex.md +0 -59
  102. data/data/ariadna/templates/summary-minimal.md +0 -41
  103. data/data/ariadna/templates/summary-standard.md +0 -48
  104. data/data/ariadna/templates/user-setup.md +0 -310
  105. data/data/ariadna/workflows/add-phase.md +0 -111
  106. data/data/ariadna/workflows/add-todo.md +0 -157
  107. data/data/ariadna/workflows/audit-milestone.md +0 -241
  108. data/data/ariadna/workflows/check-todos.md +0 -176
  109. data/data/ariadna/workflows/complete-milestone.md +0 -644
  110. data/data/ariadna/workflows/diagnose-issues.md +0 -219
  111. data/data/ariadna/workflows/discovery-phase.md +0 -289
  112. data/data/ariadna/workflows/discuss-phase.md +0 -408
  113. data/data/ariadna/workflows/execute-plan.md +0 -448
  114. data/data/ariadna/workflows/help.md +0 -470
  115. data/data/ariadna/workflows/insert-phase.md +0 -129
  116. data/data/ariadna/workflows/list-phase-assumptions.md +0 -178
  117. data/data/ariadna/workflows/pause-work.md +0 -122
  118. data/data/ariadna/workflows/plan-milestone-gaps.md +0 -256
  119. data/data/ariadna/workflows/remove-phase.md +0 -154
  120. data/data/ariadna/workflows/research-phase.md +0 -74
  121. data/data/ariadna/workflows/resume-project.md +0 -306
  122. data/data/ariadna/workflows/set-profile.md +0 -80
  123. data/data/ariadna/workflows/settings.md +0 -145
  124. data/data/ariadna/workflows/transition.md +0 -493
  125. data/data/ariadna/workflows/update.md +0 -212
  126. data/data/ariadna/workflows/verify-phase.md +0 -226
  127. data/data/commands/ariadna/add-todo.md +0 -42
  128. data/data/commands/ariadna/audit-milestone.md +0 -42
  129. data/data/commands/ariadna/check-todos.md +0 -41
  130. data/data/commands/ariadna/complete-milestone.md +0 -136
  131. data/data/commands/ariadna/discuss-phase.md +0 -86
  132. data/data/commands/ariadna/help.md +0 -22
  133. data/data/commands/ariadna/list-phase-assumptions.md +0 -50
  134. data/data/commands/ariadna/pause-work.md +0 -35
  135. data/data/commands/ariadna/plan-milestone-gaps.md +0 -40
  136. data/data/commands/ariadna/reapply-patches.md +0 -110
  137. data/data/commands/ariadna/research-phase.md +0 -187
  138. data/data/commands/ariadna/resume-work.md +0 -40
  139. data/data/commands/ariadna/set-profile.md +0 -34
  140. data/data/commands/ariadna/settings.md +0 -36
  141. data/data/commands/ariadna/update.md +0 -37
  142. data/data/guides/backend.md +0 -3069
  143. data/data/guides/frontend.md +0 -1479
  144. data/data/guides/performance.md +0 -1193
  145. data/data/guides/security.md +0 -1522
  146. data/data/guides/style-guide.md +0 -1091
  147. data/data/guides/testing.md +0 -504
  148. data/data/templates.md +0 -94
@@ -1,168 +0,0 @@
1
- # Features Research Template
2
-
3
- Template for `.ariadna_planning/research/FEATURES.md` — feature landscape for the project domain.
4
-
5
- <template>
6
-
7
- ```markdown
8
- # Feature Research
9
-
10
- **Domain:** [domain type]
11
- **Researched:** [date]
12
- **Confidence:** [HIGH/MEDIUM/LOW]
13
-
14
- ## Feature Landscape
15
-
16
- ### Table Stakes (Users Expect These)
17
-
18
- Features users assume exist. Missing these = product feels incomplete.
19
-
20
- | Feature | Why Expected | Complexity | Rails Approach | Notes |
21
- |---------|--------------|------------|----------------|-------|
22
- | [feature] | [user expectation] | LOW/MEDIUM/HIGH | [e.g., Rails authentication generator, Action Cable, Active Storage, Turbo Streams, background job, standard CRUD] | [implementation notes] |
23
- | [feature] | [user expectation] | LOW/MEDIUM/HIGH | [Rails approach] | [implementation notes] |
24
- | [feature] | [user expectation] | LOW/MEDIUM/HIGH | [Rails approach] | [implementation notes] |
25
-
26
- ### Differentiators (Competitive Advantage)
27
-
28
- Features that set the product apart. Not required, but valuable.
29
-
30
- | Feature | Value Proposition | Complexity | Rails Approach | Notes |
31
- |---------|-------------------|------------|----------------|-------|
32
- | [feature] | [why it matters] | LOW/MEDIUM/HIGH | [Rails approach] | [implementation notes] |
33
- | [feature] | [why it matters] | LOW/MEDIUM/HIGH | [Rails approach] | [implementation notes] |
34
- | [feature] | [why it matters] | LOW/MEDIUM/HIGH | [Rails approach] | [implementation notes] |
35
-
36
- ### Anti-Features (Commonly Requested, Often Problematic)
37
-
38
- Features that seem good but create problems.
39
-
40
- | Feature | Why Requested | Why Problematic | Alternative |
41
- |---------|---------------|-----------------|-------------|
42
- | [feature] | [surface appeal] | [actual problems] | [better approach] |
43
- | [feature] | [surface appeal] | [actual problems] | [better approach] |
44
-
45
- ## Feature Dependencies
46
-
47
- ```
48
- [Feature A]
49
- └──requires──> [Model/Concern B]
50
- └──requires──> [Migration C]
51
-
52
- [Feature D] ──enhances──> [Feature A via Turbo interaction]
53
-
54
- [Feature E] ──conflicts──> [Feature F]
55
- ```
56
-
57
- ### Dependency Notes
58
-
59
- - **[Feature A] requires [Model/Concern B]:** [why — e.g., needs polymorphic association, shared validation concern, new database table]
60
- - **[Feature D] enhances [Feature A]:** [how they work together — e.g., Turbo Frame wrapping, Stimulus controller coordination]
61
- - **[Feature E] conflicts with [Feature F]:** [why they're incompatible — e.g., competing authorization strategies, conflicting callback chains]
62
-
63
- ### Rails Infrastructure Needs
64
-
65
- For each major feature, note which Rails subsystems are involved:
66
-
67
- | Feature | Real-Time (Action Cable / Turbo Streams) | Background Jobs | File Handling (Active Storage) | Search | Auth Changes |
68
- |---------|------------------------------------------|-----------------|-------------------------------|--------|--------------|
69
- | [feature] | YES/NO | YES/NO | YES/NO | YES/NO | YES/NO |
70
- | [feature] | YES/NO | YES/NO | YES/NO | YES/NO | YES/NO |
71
- | [feature] | YES/NO | YES/NO | YES/NO | YES/NO | YES/NO |
72
-
73
- ## MVP Definition
74
-
75
- ### Launch With (v1)
76
-
77
- Minimum viable product — what's needed to validate the concept.
78
-
79
- - [ ] [Feature] — [why essential]
80
- - [ ] [Feature] — [why essential]
81
- - [ ] [Feature] — [why essential]
82
-
83
- ### Add After Validation (v1.x)
84
-
85
- Features to add once core is working.
86
-
87
- - [ ] [Feature] — [trigger for adding]
88
- - [ ] [Feature] — [trigger for adding]
89
-
90
- ### Future Consideration (v2+)
91
-
92
- Features to defer until product-market fit is established.
93
-
94
- - [ ] [Feature] — [why defer]
95
- - [ ] [Feature] — [why defer]
96
-
97
- ## Feature Prioritization Matrix
98
-
99
- | Feature | User Value | Implementation Cost | Priority |
100
- |---------|------------|---------------------|----------|
101
- | [feature] | HIGH/MEDIUM/LOW | HIGH/MEDIUM/LOW | P1/P2/P3 |
102
- | [feature] | HIGH/MEDIUM/LOW | HIGH/MEDIUM/LOW | P1/P2/P3 |
103
- | [feature] | HIGH/MEDIUM/LOW | HIGH/MEDIUM/LOW | P1/P2/P3 |
104
-
105
- **Priority key:**
106
- - P1: Must have for launch
107
- - P2: Should have, add when possible
108
- - P3: Nice to have, future consideration
109
-
110
- ## Competitor Feature Analysis
111
-
112
- | Feature | Competitor A | Competitor B | Our Approach |
113
- |---------|--------------|--------------|--------------|
114
- | [feature] | [how they do it] | [how they do it] | [our plan] |
115
- | [feature] | [how they do it] | [how they do it] | [our plan] |
116
-
117
- ## Sources
118
-
119
- - [Competitor products analyzed]
120
- - [User research or feedback sources]
121
- - [Industry standards referenced]
122
-
123
- ---
124
- *Feature research for: [domain]*
125
- *Researched: [date]*
126
- ```
127
-
128
- </template>
129
-
130
- <guidelines>
131
-
132
- **Table Stakes:**
133
- - These are non-negotiable for launch
134
- - Users don't give credit for having them, but penalize for missing them
135
- - Example: A Rails SaaS app without password reset or session management is broken
136
-
137
- **Differentiators:**
138
- - These are where you compete
139
- - Should align with the Core Value from PROJECT.md
140
- - Don't try to differentiate on everything
141
-
142
- **Anti-Features:**
143
- - Prevent scope creep by documenting what seems good but isn't
144
- - Include the alternative approach
145
- - Example: "Real-time updates via Action Cable for everything" when Turbo Frame lazy loading or simple polling suffices
146
- - Example: "Extract into microservices" when the Rails monolith handles the load fine
147
- - Example: "Build a custom admin panel" when a gem like Administrate or Avo covers the need
148
-
149
- **Feature Dependencies:**
150
- - Critical for roadmap phase ordering
151
- - If A requires B, B must be in an earlier phase
152
- - Conflicts inform what NOT to combine in same phase
153
- - Note migrations and concerns that multiple features share — build those first
154
- - Turbo Frame and Stimulus controller dependencies affect frontend delivery order
155
-
156
- **Rails Infrastructure Needs:**
157
- - Identifying subsystem needs early avoids mid-phase yak shaving
158
- - Features needing Action Cable or Turbo Streams use Solid Cable (database-backed, no Redis needed in Rails 8)
159
- - Features needing Active Storage require storage service setup (local, S3, etc.)
160
- - Features needing background jobs require queue adapter setup (Solid Queue is Rails 8 default, Sidekiq for high-throughput needs)
161
- - Features needing search may require an external service (Elasticsearch, Meilisearch) or pg_search
162
-
163
- **MVP Definition:**
164
- - Be ruthless about what's truly minimum
165
- - "Nice to have" is not MVP
166
- - Launch with less, validate, then expand
167
-
168
- </guidelines>
@@ -1,406 +0,0 @@
1
- # Pitfalls Research Template
2
-
3
- Template for `.ariadna_planning/research/PITFALLS.md` — common mistakes to avoid in Ruby on Rails applications.
4
-
5
- <template>
6
-
7
- ```markdown
8
- # Pitfalls Research
9
-
10
- **Rails Application:** [application name / domain]
11
- **Rails Version:** [version]
12
- **Ruby Version:** [version]
13
- **Researched:** [date]
14
- **Confidence:** [HIGH/MEDIUM/LOW]
15
-
16
- ## Critical Pitfalls
17
-
18
- ### Pitfall 1: N+1 Query Problems
19
-
20
- **What goes wrong:**
21
- [Describe where N+1 queries appear in this application — which models, associations, and controller actions trigger them]
22
-
23
- **Why it happens:**
24
- [Root cause — e.g., lazy loading by default, missing `includes`/`preload`/`eager_load` calls, new associations added without updating existing queries]
25
-
26
- **How to avoid:**
27
- [Prevention strategy — e.g., Bullet gem in development, strict_loading mode, query count assertions in tests]
28
-
29
- **Warning signs:**
30
- [How to detect early — e.g., slow page loads, high query counts in logs, Bullet notifications ignored]
31
-
32
- **Example:**
33
- ```ruby
34
- # Bad — triggers N+1
35
- @posts = Post.all
36
- @posts.each { |post| post.author.name }
37
-
38
- # Good — eager loads association
39
- @posts = Post.includes(:author).all
40
- ```
41
-
42
- **Phase to address:**
43
- [Which roadmap phase should prevent this]
44
-
45
- ---
46
-
47
- ### Pitfall 2: Callback Ordering and Side Effects
48
-
49
- **What goes wrong:**
50
- [Describe callback chains that cause unexpected behavior — e.g., `before_save` triggering external API calls, `after_create` callbacks running in wrong order, callbacks firing during migrations or seeds]
51
-
52
- **Why it happens:**
53
- [Root cause — e.g., business logic buried in callbacks instead of service objects, callbacks added incrementally without understanding full chain]
54
-
55
- **How to avoid:**
56
- [Prevention strategy — e.g., use service objects for complex logic, limit callbacks to data normalization, document callback chains]
57
-
58
- **Warning signs:**
59
- [How to detect early — e.g., mysterious side effects on save, tests requiring elaborate setup, callbacks calling other models that trigger their own callbacks]
60
-
61
- **Example:**
62
- ```ruby
63
- # Risky — side effects hidden in callback chain
64
- class Order < ApplicationRecord
65
- after_create :charge_payment
66
- after_create :send_confirmation
67
- after_create :update_inventory
68
- after_create :notify_warehouse
69
- end
70
-
71
- # Better — explicit orchestration in a service object
72
- class Orders::CreateService
73
- def call(params)
74
- order = Order.create!(params)
75
- PaymentService.charge(order)
76
- OrderMailer.confirmation(order).deliver_later
77
- InventoryService.update(order)
78
- end
79
- end
80
- ```
81
-
82
- **Phase to address:**
83
- [Which roadmap phase should prevent this]
84
-
85
- ---
86
-
87
- ### Pitfall 3: Unsafe Migrations
88
-
89
- **What goes wrong:**
90
- [Describe migration risks in this application — e.g., adding columns with defaults locks tables, removing columns breaks running code, renaming columns causes downtime]
91
-
92
- **Why it happens:**
93
- [Root cause — e.g., not understanding how the database handles DDL locks, not using zero-downtime migration patterns, skipping `strong_migrations` gem]
94
-
95
- **How to avoid:**
96
- [Prevention strategy — e.g., strong_migrations gem, deploy migration before code that uses it, use `ignored_columns` for removals]
97
-
98
- **Warning signs:**
99
- [How to detect early — e.g., migrations that take too long in staging, lock timeout errors, failed deploys]
100
-
101
- **Example:**
102
- ```ruby
103
- # Dangerous — locks table on large datasets (PostgreSQL < 11; SQLite locks entire DB during writes)
104
- add_column :users, :status, :string, default: "active"
105
-
106
- # Safer — add column then backfill
107
- add_column :users, :status, :string
108
- # Then in a separate migration or rake task:
109
- User.in_batches.update_all(status: "active")
110
- change_column_default :users, :status, "active"
111
- ```
112
-
113
- **Phase to address:**
114
- [Which roadmap phase should prevent this]
115
-
116
- ---
117
-
118
- ### Pitfall 4: Mass Assignment / Strong Parameters Gaps
119
-
120
- **What goes wrong:**
121
- [Describe where strong parameters might be misconfigured — e.g., permitting too many attributes, nested attributes not properly scoped, admin-only fields exposed]
122
-
123
- **Why it happens:**
124
- [Root cause — e.g., copying `permit!` from StackOverflow, adding fields to permit list without review, forgetting nested attributes rules]
125
-
126
- **How to avoid:**
127
- [Prevention strategy — e.g., never use `permit!`, review parameter permits in code review, test that unpermitted attributes are rejected]
128
-
129
- **Warning signs:**
130
- [How to detect early — e.g., `Unpermitted parameter` warnings in logs being ignored, `permit!` in codebase, users able to modify fields they should not]
131
-
132
- **Example:**
133
- ```ruby
134
- # Dangerous — permits everything
135
- params.require(:user).permit!
136
-
137
- # Dangerous — admin fields exposed
138
- params.require(:user).permit(:name, :email, :role, :admin)
139
-
140
- # Safe — explicit whitelist, role handled separately
141
- params.require(:user).permit(:name, :email)
142
- ```
143
-
144
- **Phase to address:**
145
- [Which roadmap phase should prevent this]
146
-
147
- ---
148
-
149
- ### Pitfall 5: Unscoped Tenant Data Leaks
150
-
151
- **What goes wrong:**
152
- [If multi-tenant: describe how queries without tenant scoping can leak data across tenants — e.g., missing `default_scope`, direct `find` calls, background jobs losing tenant context]
153
-
154
- **Why it happens:**
155
- [Root cause — e.g., tenant scoping not enforced at the framework level, new developers unaware of scoping requirements, background jobs not carrying tenant context]
156
-
157
- **How to avoid:**
158
- [Prevention strategy — e.g., Current attributes for tenant context, controller-level `around_action` for scoping, test isolation per tenant]
159
-
160
- **Warning signs:**
161
- [How to detect early — e.g., queries without `WHERE tenant_id = ?`, cross-tenant data appearing in tests, background jobs processing wrong tenant data]
162
-
163
- **Phase to address:**
164
- [Which roadmap phase should prevent this]
165
-
166
- ---
167
-
168
- ### Pitfall 6: Gem Version Conflicts and Abandoned Dependencies
169
-
170
- **What goes wrong:**
171
- [Describe dependency risks — e.g., gems pinned to old versions blocking Rails upgrades, abandoned gems with security vulnerabilities, transitive dependency conflicts]
172
-
173
- **Why it happens:**
174
- [Root cause — e.g., adding gems without evaluating maintenance status, not running `bundle audit`, version pins too strict or too loose]
175
-
176
- **How to avoid:**
177
- [Prevention strategy — e.g., regular `bundle audit`, evaluate gem health before adding, prefer stdlib or well-maintained gems, document why each gem is needed]
178
-
179
- **Warning signs:**
180
- [How to detect early — e.g., `bundle update` failures, security advisories ignored, gems with no commits in 2+ years]
181
-
182
- **Phase to address:**
183
- [Which roadmap phase should prevent this]
184
-
185
- ---
186
-
187
- ### Pitfall 7: Explicit Translation Keys Instead of ActiveRecord Automatic Lookup
188
-
189
- **What goes wrong:**
190
- [Describe where explicit `t()` calls duplicate what Rails I18n automatic lookup provides — e.g., form labels passing explicit keys, validation messages hardcoded, model names translated manually]
191
-
192
- **Why it happens:**
193
- [Root cause — e.g., developers unaware of ActiveRecord I18n conventions, copying patterns from non-Rails projects, not reading Rails I18n guide]
194
-
195
- **How to avoid:**
196
- [Prevention strategy — e.g., use `form.label :name` instead of `form.label :name, t("teams.form.name")`, define translations under `activerecord.attributes.*` and `activerecord.models.*`, rely on automatic lookup for validation messages]
197
-
198
- **Warning signs:**
199
- [How to detect early — e.g., duplicate translation keys for the same attribute in different namespaces, inconsistent labels between forms and error messages, `t()` calls in form labels that mirror `activerecord.attributes` keys]
200
-
201
- **Example:**
202
- ```ruby
203
- # Bad — explicit key duplicates what Rails provides automatically
204
- <%= form.label :name, t("teams.form.name") %>
205
- # Requires: teams.form.name in locale file AND activerecord.attributes.team.name for validations
206
-
207
- # Good — resolves from activerecord.attributes.team.name automatically
208
- <%= form.label :name %>
209
- # Single source of truth: activerecord.attributes.team.name used by forms AND validations
210
- ```
211
-
212
- ```yaml
213
- # Good — single source of truth for attribute names
214
- en:
215
- activerecord:
216
- models:
217
- team: "Team"
218
- attributes:
219
- team:
220
- name: "Team name"
221
- errors:
222
- models:
223
- team:
224
- attributes:
225
- name:
226
- blank: "cannot be empty"
227
- ```
228
-
229
- **Phase to address:**
230
- [Which roadmap phase should prevent this]
231
-
232
- ---
233
-
234
- [Continue for additional critical pitfalls specific to this application...]
235
-
236
- ## Technical Debt Patterns
237
-
238
- Rails-specific shortcuts that seem reasonable but create long-term problems.
239
-
240
- | Shortcut | Immediate Benefit | Long-term Cost | When Acceptable |
241
- |----------|-------------------|----------------|-----------------|
242
- | Skipping database constraints (relying only on model validations) | [benefit — e.g., faster development, easier to change] | [cost — e.g., data integrity issues from console/jobs/race conditions] | [conditions, or "never"] |
243
- | Raw SQL instead of ActiveRecord | [benefit — e.g., complex query works immediately] | [cost — e.g., database-specific, skips scopes/hooks, hard to maintain] | [conditions — e.g., reporting queries, performance-critical reads] |
244
- | Monkeypatching gems instead of proper extension | [benefit — e.g., quick fix for gem behavior] | [cost — e.g., breaks on gem updates, hidden behavior, untestable] | [conditions, or "never"] |
245
- | Skipping tests / low test coverage | [benefit — e.g., ships faster initially] | [cost — e.g., regressions, fear of refactoring, broken deploys] | [conditions, or "never"] |
246
- | `skip_before_action` proliferation | [benefit — e.g., quick auth bypass for specific actions] | [cost — e.g., security holes, hard to audit which actions are protected] | [conditions — e.g., health checks only] |
247
- | Fat models with mixed concerns | [benefit — e.g., everything in one place] | [cost — e.g., 1000+ line models, tangled logic, slow tests] | [conditions, or "never"] |
248
- | Using `default_scope` | [benefit — e.g., automatic filtering] | [cost — e.g., surprising query behavior, hard to override, breaks joins] | [conditions, or "never"] |
249
- | Storing state in session instead of database | [benefit — e.g., no migration needed] | [cost — e.g., lost on logout, can't query, no audit trail] | [conditions — e.g., ephemeral wizard state only] |
250
- | [shortcut] | [benefit] | [cost] | [conditions, or "never"] |
251
-
252
- ## Integration Gotchas
253
-
254
- Common mistakes when integrating Rails gems and external services.
255
-
256
- | Integration | Common Mistake | Correct Approach |
257
- |-------------|----------------|------------------|
258
- | Authentication | [e.g., not understanding the generated `Authentication` concern flow, missing `allow_unauthenticated_access`, session fixation on login] | [what to do instead] |
259
- | Solid Queue / background jobs | [e.g., passing ActiveRecord objects instead of IDs, no retry configuration, no error handling] | [what to do instead] |
260
- | ActionCable / WebSockets | [e.g., broadcasting without authorization, no connection authentication, memory leaks from unsubscribed channels] | [what to do instead] |
261
- | ActiveStorage / file uploads | [e.g., missing virus scanning, no file size limits, serving user uploads from same domain] | [what to do instead] |
262
- | Turbo / Hotwire | [e.g., full page reloads from misconfigured frames, missing turbo stream responses, form submission edge cases] | [what to do instead] |
263
- | Rails version upgrades | [e.g., skipping deprecation warnings, upgrading multiple major versions at once, not running `rails app:update`] | [what to do instead] |
264
- | Third-party APIs | [e.g., no circuit breaker, synchronous calls in request cycle, no webhook signature verification] | [what to do instead] |
265
- | I18n / rails-i18n | [e.g., using explicit `t()` keys for model attributes and form labels instead of ActiveRecord automatic lookup, missing `rails-i18n` gem for CLDR data (dates, currency, numbers), inconsistent locale file organization mixing per-model and flat structures] | [e.g., define translations under `activerecord.attributes.*` and `activerecord.models.*`, use `form.label :field` without explicit `t()`, add `rails-i18n` gem for base locale data, organize locale files consistently] |
266
- | [integration] | [what people do wrong] | [what to do instead] |
267
-
268
- ## Performance Traps
269
-
270
- Rails patterns that work at small scale but fail as usage grows.
271
-
272
- | Trap | Symptoms | Prevention | When It Breaks |
273
- |------|----------|------------|----------------|
274
- | Missing database indexes | [e.g., slow queries on `WHERE` and `ORDER BY` columns, sequential scans in `EXPLAIN`] | [e.g., add indexes for foreign keys, frequently queried columns, compound indexes for common query patterns] | [scale threshold — e.g., 100k+ rows] |
275
- | Eager loading mistakes | [e.g., N+1 in views, or over-eager loading pulling entire tables into memory] | [e.g., use `includes` for used associations, `strict_loading` to catch missed ones, Bullet gem] | [scale threshold] |
276
- | Missing counter caches | [e.g., `COUNT(*)` queries on every page load for association counts] | [e.g., `counter_cache: true` on `belongs_to`, reset counters in migrations] | [scale threshold — e.g., 10k+ parent records] |
277
- | Fragment caching not used or invalidated incorrectly | [e.g., slow view rendering, stale data displayed, cache keys not including updated_at] | [e.g., Russian doll caching with `cache [record, "v2"]`, touch associations, cache digests] | [scale threshold] |
278
- | Serialization in hot paths | [e.g., `to_json` on large objects in loops, Jbuilder rendering slowly] | [e.g., use `oj` gem, precompute serialized data, avoid serialization in loops] | [scale threshold] |
279
- | Large file uploads blocking web workers | [e.g., Puma workers tied up during upload, request timeouts, memory spikes] | [e.g., direct-to-cloud uploads with presigned URLs, ActiveStorage direct upload, nginx upload module] | [scale threshold — e.g., files > 10MB] |
280
- | Unoptimized ActiveRecord queries | [e.g., loading full records when only IDs needed, `select *` on wide tables] | [e.g., `pluck`, `select`, `find_each` for batches, `exists?` instead of `present?` on relations] | [scale threshold] |
281
- | [trap] | [symptoms] | [prevention] | [scale threshold] |
282
-
283
- ## Security Mistakes
284
-
285
- Rails-specific security issues beyond basic web security.
286
-
287
- | Mistake | Risk | Prevention |
288
- |---------|------|------------|
289
- | SQL injection via string interpolation in `where` | [e.g., user input directly in query string allows data exfiltration] | [e.g., always use parameterized queries: `where("name = ?", params[:name])` or hash syntax `where(name: params[:name])`] |
290
- | CSRF token handling gaps | [e.g., API endpoints without `protect_from_forgery`, token not verified on state-changing requests] | [e.g., `protect_from_forgery with: :exception`, proper token handling for JS requests, `csrf_meta_tags` in layout] |
291
- | Credential management mistakes | [e.g., secrets in ENV vars without encryption, credentials checked into git, different credentials per environment not managed] | [e.g., Rails encrypted credentials, `rails credentials:edit`, per-environment credential files] |
292
- | Insecure direct object references | [e.g., `User.find(params[:id])` without authorization check, enumerable IDs exposing records] | [e.g., always scope to authorized records: `current_user.posts.find(params[:id])`, use Current.account or Current.employee] |
293
- | Mass assignment vulnerabilities | [e.g., unpermitted nested attributes modifying admin fields, `accepts_nested_attributes_for` without `reject_if`] | [e.g., explicit strong parameters, test that admin attributes cannot be set via API, `attr_readonly` for sensitive fields] |
294
- | Unsafe `html_safe` / `raw` usage | [e.g., XSS from marking user input as safe, rendering unescaped HTML from database] | [e.g., never call `html_safe` on user input, use `sanitize` helper, Content Security Policy headers] |
295
- | Open redirects | [e.g., `redirect_to params[:return_to]` allows redirecting to malicious sites] | [e.g., validate redirect URLs against allowlist, use `redirect_back` with `fallback_location`] |
296
- | [mistake] | [risk] | [prevention] |
297
-
298
- ## "Looks Done But Isn't" Checklist
299
-
300
- Rails features that appear complete but are missing critical pieces.
301
-
302
- - [ ] **Database indexes:** Foreign key columns (`*_id`) have indexes — verify with `rails db:schema:dump` and check `schema.rb`
303
- - [ ] **Background job error handling:** Jobs have `retry_on` / `discard_on` configured — verify jobs don't silently fail, dead letter queue is monitored
304
- - [ ] **Database constraints match validations:** Model validations have corresponding `NOT NULL`, uniqueness indexes, and foreign keys at database level — verify with `active_record_doctor` or `database_consistency` gem
305
- - [ ] **Association cleanup:** `has_many` associations have `dependent: :destroy` or `dependent: :nullify` — verify no orphaned records after parent deletion
306
- - [ ] **Rate limiting:** Public-facing endpoints have rate limiting — verify with `rack-attack` or similar middleware configuration
307
- - [ ] **Background job idempotency:** Jobs can safely be retried without duplicate side effects — verify by running job twice with same arguments
308
- - [ ] **Error tracking:** Exceptions are reported to monitoring service — verify error paths actually reach error tracker (Sentry, Rollbar, etc.)
309
- - [ ] **Database connection pooling:** Pool size matches worker/thread count — verify `database.yml` pool matches Puma thread count
310
- - [ ] **Timezone handling:** Application uses `Time.current` / `Date.current` instead of `Time.now` / `Date.today` — verify `config.time_zone` is set and used consistently
311
- - [ ] **Email delivery:** Mailers use `deliver_later` not `deliver_now` in web requests — verify mailer calls don't block request cycle
312
- - [ ] **I18n locale completeness:** All supported locales have matching keys for `activerecord.models.*`, `activerecord.attributes.*`, and `activerecord.errors.*` — verify with `i18n-tasks` gem or manual comparison that no locale is missing translations present in others
313
- - [ ] **[Feature]:** Often missing [thing] — verify [check]
314
- - [ ] **[Feature]:** Often missing [thing] — verify [check]
315
-
316
- ## Recovery Strategies
317
-
318
- When pitfalls occur despite prevention, how to recover.
319
-
320
- | Pitfall | Recovery Cost | Recovery Steps |
321
- |---------|---------------|----------------|
322
- | N+1 queries in production | LOW | [e.g., add `includes` calls, deploy, verify with query logs] |
323
- | Missing database indexes | LOW | [e.g., add index migration, deploy during low-traffic, monitor query performance] |
324
- | Data integrity issues from missing DB constraints | HIGH | [e.g., add constraints, write data cleanup migration, backfill invalid records] |
325
- | Callback spaghetti | MEDIUM | [e.g., extract to service objects incrementally, add integration tests first] |
326
- | Unsafe migration ran on production | HIGH | [e.g., assess damage, write corrective migration, consider rollback, schedule maintenance window] |
327
- | Security vulnerability in dependency | MEDIUM | [e.g., `bundle audit`, update gem, assess exposure, check logs for exploitation] |
328
- | [pitfall] | LOW/MEDIUM/HIGH | [recovery steps] |
329
-
330
- ## Pitfall-to-Phase Mapping
331
-
332
- How roadmap phases should address these pitfalls.
333
-
334
- | Pitfall | Prevention Phase | Verification |
335
- |---------|------------------|--------------|
336
- | N+1 queries | Phase [X] | [e.g., query count assertions in integration tests, Bullet gem in CI] |
337
- | Callback side effects | Phase [X] | [e.g., service objects documented, callback audit complete] |
338
- | Unsafe migrations | Phase [X] | [e.g., strong_migrations gem installed, CI rejects unsafe migrations] |
339
- | Mass assignment gaps | Phase [X] | [e.g., strong parameters tested, no `permit!` in codebase] |
340
- | Missing database constraints | Phase [X] | [e.g., `database_consistency` gem passes, schema reviewed] |
341
- | Missing indexes | Phase [X] | [e.g., all foreign keys indexed, slow query log clean] |
342
- | Security vulnerabilities | Phase [X] | [e.g., `brakeman` passes, `bundle audit` clean, CSRF verified] |
343
- | [pitfall] | Phase [X] | [how to verify prevention worked] |
344
-
345
- ## Sources
346
-
347
- - [Rails Guides security section referenced]
348
- - [Community discussions — e.g., Rails subreddit, GoRails, Drifting Ruby]
349
- - [Official Rails "gotchas" / upgrade guides]
350
- - [Gem documentation — strong_migrations, Bullet, Brakeman, etc.]
351
- - [Post-mortems / incident reports]
352
- - [Personal experience / known issues]
353
-
354
- ---
355
- *Pitfalls research for: [application name / domain]*
356
- *Rails version: [version]*
357
- *Researched: [date]*
358
- ```
359
-
360
- </template>
361
-
362
- <guidelines>
363
-
364
- **Critical Pitfalls:**
365
- - Focus on Rails-specific failure modes, not generic programming mistakes
366
- - Include concrete Ruby code examples showing the wrong and right approach
367
- - Include warning signs — early detection prevents production incidents
368
- - Link to specific phases — makes pitfalls actionable in the roadmap
369
- - Cover the full Rails stack: ActiveRecord, ActionController, ActionMailer, ActiveJob, ActionCable
370
-
371
- **Technical Debt:**
372
- - Be realistic — some shortcuts are acceptable in early phases (MVP, prototype)
373
- - Note when shortcuts are "never acceptable" (e.g., `permit!`, skipping DB constraints on financial data)
374
- - Include the long-term cost to inform tradeoff decisions
375
- - Rails-specific: distinguish between "Rails way" shortcuts and "anti-Rails" shortcuts
376
-
377
- **Performance Traps:**
378
- - Include scale thresholds ("breaks at 100k rows", "10k concurrent users")
379
- - Focus on what is relevant for this application's expected scale
380
- - Prioritize database-level optimizations — they have the highest impact in Rails apps
381
- - Include both read-path and write-path performance considerations
382
-
383
- **Security Mistakes:**
384
- - Beyond OWASP basics — focus on Rails-specific vectors (mass assignment, CSRF, `html_safe`)
385
- - Use Brakeman categories as a reference for common Rails security issues
386
- - Include credential management approach (Rails credentials vs. ENV vs. secrets manager)
387
- - Note which security issues are caught by Rails defaults vs. require explicit configuration
388
-
389
- **Integration Gotchas:**
390
- - Cover common Rails gem integration issues (authentication generator, Solid Queue, Turbo, ActiveStorage)
391
- - Include Rails version upgrade pain points — deprecated APIs, changed defaults
392
- - Note gems that are known to conflict or require specific version coordination
393
-
394
- **"Looks Done But Isn't":**
395
- - Checklist format for verification during execution and code review
396
- - Focus on the gap between "works in development" and "production-ready"
397
- - Include database-level checks that are easy to miss (indexes, constraints, connection pool)
398
- - Cover operational readiness items (error tracking, job monitoring, email delivery)
399
-
400
- **Pitfall-to-Phase Mapping:**
401
- - Critical for roadmap creation — each pitfall should map to a phase that prevents it
402
- - Early phases should address foundational issues (database schema, authentication)
403
- - Later phases should address optimization issues (caching, performance, scaling)
404
- - Verification should be automated where possible (CI checks, gem-based audits)
405
-
406
- </guidelines>