ariadna 1.3.0 → 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.
- checksums.yaml +4 -4
- data/ariadna.gemspec +0 -1
- data/data/agents/ariadna-codebase-mapper.md +34 -722
- data/data/agents/ariadna-debugger.md +44 -1139
- data/data/agents/ariadna-executor.md +75 -396
- data/data/agents/ariadna-planner.md +78 -1215
- data/data/agents/ariadna-roadmapper.md +55 -582
- data/data/agents/ariadna-verifier.md +60 -702
- data/data/ariadna/templates/config.json +8 -33
- data/data/ariadna/workflows/debug.md +28 -0
- data/data/ariadna/workflows/execute-phase.md +31 -513
- data/data/ariadna/workflows/map-codebase.md +20 -319
- data/data/ariadna/workflows/new-milestone.md +20 -365
- data/data/ariadna/workflows/new-project.md +19 -880
- data/data/ariadna/workflows/plan-phase.md +24 -443
- data/data/ariadna/workflows/progress.md +20 -376
- data/data/ariadna/workflows/quick.md +19 -221
- data/data/ariadna/workflows/roadmap-ops.md +28 -0
- data/data/ariadna/workflows/verify-work.md +23 -560
- data/data/commands/ariadna/add-phase.md +11 -22
- data/data/commands/ariadna/debug.md +11 -143
- data/data/commands/ariadna/execute-phase.md +12 -30
- data/data/commands/ariadna/insert-phase.md +7 -14
- data/data/commands/ariadna/map-codebase.md +16 -49
- data/data/commands/ariadna/new-milestone.md +12 -25
- data/data/commands/ariadna/new-project.md +22 -26
- data/data/commands/ariadna/plan-phase.md +13 -22
- data/data/commands/ariadna/progress.md +16 -6
- data/data/commands/ariadna/quick.md +9 -11
- data/data/commands/ariadna/remove-phase.md +9 -12
- data/data/commands/ariadna/verify-work.md +14 -19
- data/data/skills/rails-backend/API.md +138 -0
- data/data/skills/rails-backend/CONTROLLERS.md +154 -0
- data/data/skills/rails-backend/JOBS.md +132 -0
- data/data/skills/rails-backend/MODELS.md +213 -0
- data/data/skills/rails-backend/SKILL.md +169 -0
- data/data/skills/rails-frontend/ASSETS.md +154 -0
- data/data/skills/rails-frontend/COMPONENTS.md +253 -0
- data/data/skills/rails-frontend/SKILL.md +187 -0
- data/data/skills/rails-frontend/VIEWS.md +168 -0
- data/data/skills/rails-performance/PROFILING.md +106 -0
- data/data/skills/rails-performance/SKILL.md +217 -0
- data/data/skills/rails-security/AUDIT.md +118 -0
- data/data/skills/rails-security/SKILL.md +422 -0
- data/data/skills/rails-testing/FIXTURES.md +78 -0
- data/data/skills/rails-testing/SKILL.md +160 -0
- data/data/skills/rails-testing/SYSTEM-TESTS.md +73 -0
- data/lib/ariadna/installer.rb +11 -15
- data/lib/ariadna/tools/cli.rb +0 -12
- data/lib/ariadna/tools/config_manager.rb +10 -72
- data/lib/ariadna/tools/frontmatter.rb +23 -1
- data/lib/ariadna/tools/init.rb +201 -401
- data/lib/ariadna/tools/model_profiles.rb +6 -14
- data/lib/ariadna/tools/phase_manager.rb +1 -10
- data/lib/ariadna/tools/state_manager.rb +170 -451
- data/lib/ariadna/tools/template_filler.rb +4 -12
- data/lib/ariadna/tools/verification.rb +21 -399
- data/lib/ariadna/uninstaller.rb +9 -0
- data/lib/ariadna/version.rb +1 -1
- data/lib/ariadna.rb +1 -0
- metadata +20 -91
- data/data/agents/ariadna-backend-executor.md +0 -261
- data/data/agents/ariadna-frontend-executor.md +0 -259
- data/data/agents/ariadna-integration-checker.md +0 -418
- data/data/agents/ariadna-phase-researcher.md +0 -469
- data/data/agents/ariadna-plan-checker.md +0 -622
- data/data/agents/ariadna-project-researcher.md +0 -618
- data/data/agents/ariadna-research-synthesizer.md +0 -236
- data/data/agents/ariadna-test-executor.md +0 -266
- data/data/ariadna/references/checkpoints.md +0 -772
- data/data/ariadna/references/continuation-format.md +0 -249
- data/data/ariadna/references/decimal-phase-calculation.md +0 -65
- data/data/ariadna/references/git-integration.md +0 -248
- data/data/ariadna/references/git-planning-commit.md +0 -38
- data/data/ariadna/references/model-profile-resolution.md +0 -32
- data/data/ariadna/references/model-profiles.md +0 -73
- data/data/ariadna/references/phase-argument-parsing.md +0 -61
- data/data/ariadna/references/planning-config.md +0 -194
- data/data/ariadna/references/questioning.md +0 -153
- data/data/ariadna/references/rails-conventions.md +0 -416
- data/data/ariadna/references/tdd.md +0 -267
- data/data/ariadna/references/ui-brand.md +0 -160
- data/data/ariadna/references/verification-patterns.md +0 -853
- data/data/ariadna/templates/codebase/architecture.md +0 -481
- data/data/ariadna/templates/codebase/concerns.md +0 -380
- data/data/ariadna/templates/codebase/conventions.md +0 -434
- data/data/ariadna/templates/codebase/integrations.md +0 -328
- data/data/ariadna/templates/codebase/stack.md +0 -189
- data/data/ariadna/templates/codebase/structure.md +0 -418
- data/data/ariadna/templates/codebase/testing.md +0 -606
- data/data/ariadna/templates/context.md +0 -283
- data/data/ariadna/templates/continue-here.md +0 -78
- data/data/ariadna/templates/debug-subagent-prompt.md +0 -91
- data/data/ariadna/templates/phase-prompt.md +0 -609
- data/data/ariadna/templates/planner-subagent-prompt.md +0 -117
- data/data/ariadna/templates/research-project/ARCHITECTURE.md +0 -439
- data/data/ariadna/templates/research-project/FEATURES.md +0 -168
- data/data/ariadna/templates/research-project/PITFALLS.md +0 -406
- data/data/ariadna/templates/research-project/STACK.md +0 -251
- data/data/ariadna/templates/research-project/SUMMARY.md +0 -247
- data/data/ariadna/templates/state.md +0 -176
- data/data/ariadna/templates/summary-complex.md +0 -59
- data/data/ariadna/templates/summary-minimal.md +0 -41
- data/data/ariadna/templates/summary-standard.md +0 -48
- data/data/ariadna/templates/user-setup.md +0 -310
- data/data/ariadna/workflows/add-phase.md +0 -111
- data/data/ariadna/workflows/add-todo.md +0 -157
- data/data/ariadna/workflows/audit-milestone.md +0 -241
- data/data/ariadna/workflows/check-todos.md +0 -176
- data/data/ariadna/workflows/complete-milestone.md +0 -644
- data/data/ariadna/workflows/diagnose-issues.md +0 -219
- data/data/ariadna/workflows/discovery-phase.md +0 -289
- data/data/ariadna/workflows/discuss-phase.md +0 -408
- data/data/ariadna/workflows/execute-plan.md +0 -448
- data/data/ariadna/workflows/help.md +0 -470
- data/data/ariadna/workflows/insert-phase.md +0 -129
- data/data/ariadna/workflows/list-phase-assumptions.md +0 -178
- data/data/ariadna/workflows/pause-work.md +0 -122
- data/data/ariadna/workflows/plan-milestone-gaps.md +0 -256
- data/data/ariadna/workflows/remove-phase.md +0 -154
- data/data/ariadna/workflows/research-phase.md +0 -74
- data/data/ariadna/workflows/resume-project.md +0 -306
- data/data/ariadna/workflows/set-profile.md +0 -80
- data/data/ariadna/workflows/settings.md +0 -145
- data/data/ariadna/workflows/transition.md +0 -493
- data/data/ariadna/workflows/update.md +0 -212
- data/data/ariadna/workflows/verify-phase.md +0 -226
- data/data/commands/ariadna/add-todo.md +0 -42
- data/data/commands/ariadna/audit-milestone.md +0 -42
- data/data/commands/ariadna/check-todos.md +0 -41
- data/data/commands/ariadna/complete-milestone.md +0 -136
- data/data/commands/ariadna/discuss-phase.md +0 -86
- data/data/commands/ariadna/help.md +0 -22
- data/data/commands/ariadna/list-phase-assumptions.md +0 -50
- data/data/commands/ariadna/pause-work.md +0 -35
- data/data/commands/ariadna/plan-milestone-gaps.md +0 -40
- data/data/commands/ariadna/reapply-patches.md +0 -110
- data/data/commands/ariadna/research-phase.md +0 -187
- data/data/commands/ariadna/resume-work.md +0 -40
- data/data/commands/ariadna/set-profile.md +0 -34
- data/data/commands/ariadna/settings.md +0 -36
- data/data/commands/ariadna/update.md +0 -37
- data/data/guides/backend.md +0 -3069
- data/data/guides/frontend.md +0 -1479
- data/data/guides/performance.md +0 -1193
- data/data/guides/security.md +0 -1522
- data/data/guides/style-guide.md +0 -1091
- data/data/guides/testing.md +0 -504
- data/data/templates.md +0 -94
|
@@ -1,380 +0,0 @@
|
|
|
1
|
-
# Codebase Concerns Template
|
|
2
|
-
|
|
3
|
-
Template for `.ariadna_planning/codebase/CONCERNS.md` - captures known issues and areas requiring care.
|
|
4
|
-
|
|
5
|
-
**Purpose:** Surface actionable warnings about the codebase. Focused on "what to watch out for when making changes."
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
## File Template
|
|
10
|
-
|
|
11
|
-
```markdown
|
|
12
|
-
# Codebase Concerns
|
|
13
|
-
|
|
14
|
-
**Analysis Date:** [YYYY-MM-DD]
|
|
15
|
-
|
|
16
|
-
## Tech Debt
|
|
17
|
-
|
|
18
|
-
**[Area/Component]:**
|
|
19
|
-
- Issue: [What's the shortcut/workaround]
|
|
20
|
-
- Why: [Why it was done this way]
|
|
21
|
-
- Impact: [What breaks or degrades because of it]
|
|
22
|
-
- Fix approach: [How to properly address it]
|
|
23
|
-
|
|
24
|
-
**[Area/Component]:**
|
|
25
|
-
- Issue: [What's the shortcut/workaround]
|
|
26
|
-
- Why: [Why it was done this way]
|
|
27
|
-
- Impact: [What breaks or degrades because of it]
|
|
28
|
-
- Fix approach: [How to properly address it]
|
|
29
|
-
|
|
30
|
-
## Known Bugs
|
|
31
|
-
|
|
32
|
-
**[Bug description]:**
|
|
33
|
-
- Symptoms: [What happens]
|
|
34
|
-
- Trigger: [How to reproduce]
|
|
35
|
-
- Workaround: [Temporary mitigation if any]
|
|
36
|
-
- Root cause: [If known]
|
|
37
|
-
- Blocked by: [If waiting on something]
|
|
38
|
-
|
|
39
|
-
**[Bug description]:**
|
|
40
|
-
- Symptoms: [What happens]
|
|
41
|
-
- Trigger: [How to reproduce]
|
|
42
|
-
- Workaround: [Temporary mitigation if any]
|
|
43
|
-
- Root cause: [If known]
|
|
44
|
-
|
|
45
|
-
## Security Considerations
|
|
46
|
-
|
|
47
|
-
**[Area requiring security care]:**
|
|
48
|
-
- Risk: [What could go wrong]
|
|
49
|
-
- Current mitigation: [What's in place now]
|
|
50
|
-
- Recommendations: [What should be added]
|
|
51
|
-
|
|
52
|
-
**[Area requiring security care]:**
|
|
53
|
-
- Risk: [What could go wrong]
|
|
54
|
-
- Current mitigation: [What's in place now]
|
|
55
|
-
- Recommendations: [What should be added]
|
|
56
|
-
|
|
57
|
-
## Performance Bottlenecks
|
|
58
|
-
|
|
59
|
-
**[Slow operation/endpoint]:**
|
|
60
|
-
- Problem: [What's slow]
|
|
61
|
-
- Measurement: [Actual numbers: "500ms p95", "2s load time"]
|
|
62
|
-
- Cause: [Why it's slow]
|
|
63
|
-
- Improvement path: [How to speed it up]
|
|
64
|
-
|
|
65
|
-
**[Slow operation/endpoint]:**
|
|
66
|
-
- Problem: [What's slow]
|
|
67
|
-
- Measurement: [Actual numbers]
|
|
68
|
-
- Cause: [Why it's slow]
|
|
69
|
-
- Improvement path: [How to speed it up]
|
|
70
|
-
|
|
71
|
-
## Fragile Areas
|
|
72
|
-
|
|
73
|
-
**[Component/Module]:**
|
|
74
|
-
- Why fragile: [What makes it break easily]
|
|
75
|
-
- Common failures: [What typically goes wrong]
|
|
76
|
-
- Safe modification: [How to change it without breaking]
|
|
77
|
-
- Test coverage: [Is it tested? Gaps?]
|
|
78
|
-
|
|
79
|
-
**[Component/Module]:**
|
|
80
|
-
- Why fragile: [What makes it break easily]
|
|
81
|
-
- Common failures: [What typically goes wrong]
|
|
82
|
-
- Safe modification: [How to change it without breaking]
|
|
83
|
-
- Test coverage: [Is it tested? Gaps?]
|
|
84
|
-
|
|
85
|
-
## Scaling Limits
|
|
86
|
-
|
|
87
|
-
**[Resource/System]:**
|
|
88
|
-
- Current capacity: [Numbers: "100 req/sec", "10k users"]
|
|
89
|
-
- Limit: [Where it breaks]
|
|
90
|
-
- Symptoms at limit: [What happens]
|
|
91
|
-
- Scaling path: [How to increase capacity]
|
|
92
|
-
|
|
93
|
-
## Dependencies at Risk
|
|
94
|
-
|
|
95
|
-
**[Gem/Service]:**
|
|
96
|
-
- Risk: [e.g., "deprecated", "unmaintained", "breaking changes coming"]
|
|
97
|
-
- Impact: [What breaks if it fails]
|
|
98
|
-
- Migration plan: [Alternative or upgrade path]
|
|
99
|
-
|
|
100
|
-
## Missing Critical Features
|
|
101
|
-
|
|
102
|
-
**[Feature gap]:**
|
|
103
|
-
- Problem: [What's missing]
|
|
104
|
-
- Current workaround: [How users cope]
|
|
105
|
-
- Blocks: [What can't be done without it]
|
|
106
|
-
- Implementation complexity: [Rough effort estimate]
|
|
107
|
-
|
|
108
|
-
## Test Coverage Gaps
|
|
109
|
-
|
|
110
|
-
**[Untested area]:**
|
|
111
|
-
- What's not tested: [Specific functionality]
|
|
112
|
-
- Risk: [What could break unnoticed]
|
|
113
|
-
- Priority: [High/Medium/Low]
|
|
114
|
-
- Difficulty to test: [Why it's not tested yet]
|
|
115
|
-
|
|
116
|
-
---
|
|
117
|
-
|
|
118
|
-
*Concerns audit: [date]*
|
|
119
|
-
*Update as issues are fixed or new ones discovered*
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
<good_examples>
|
|
123
|
-
```markdown
|
|
124
|
-
# Codebase Concerns
|
|
125
|
-
|
|
126
|
-
**Analysis Date:** 2025-01-20
|
|
127
|
-
|
|
128
|
-
## Tech Debt
|
|
129
|
-
|
|
130
|
-
**N+1 queries in controllers:**
|
|
131
|
-
- Issue: Direct `@board.cards` iteration without eager loading in 8+ controller actions
|
|
132
|
-
- Files: `app/controllers/boards_controller.rb`, `app/controllers/cards_controller.rb`, `app/controllers/dashboards_controller.rb`
|
|
133
|
-
- Why: Rapid prototyping during MVP phase, controllers grew organically
|
|
134
|
-
- Impact: Index pages fire 50+ queries on boards with many cards, p95 response time over 800ms
|
|
135
|
-
- Fix approach: Add `preloaded` scope to Card model using `includes(:assignees, :tags, :closure, :column)`, use in controllers
|
|
136
|
-
|
|
137
|
-
**Business logic in controllers:**
|
|
138
|
-
- Issue: `CardsController#create` contains 40 lines of inline notification, assignment, and event-tracking logic
|
|
139
|
-
- Files: `app/controllers/cards_controller.rb` (lines 25-65), `app/controllers/comments_controller.rb` (lines 18-42)
|
|
140
|
-
- Why: Features added incrementally without extracting to model layer
|
|
141
|
-
- Impact: Same logic duplicated between controller and background job, behavior differs depending on entry point
|
|
142
|
-
- Fix approach: Move to model methods and concerns (`Card::Notifiable`, `Card::Assignable`), controller calls single method
|
|
143
|
-
|
|
144
|
-
**Missing concern extraction in User model:**
|
|
145
|
-
- Issue: `User` model is 520 lines with inline notification preferences, filtering, avatar handling, and role checks
|
|
146
|
-
- File: `app/models/user.rb`
|
|
147
|
-
- Why: Grew over time without periodic refactoring
|
|
148
|
-
- Impact: Hard to test individual behaviors, merge conflicts when multiple developers touch User
|
|
149
|
-
- Fix approach: Extract to `User::Filterable`, `User::NotificationPreferences`, `User::Avatars`, `User::Roles` in `app/models/user/`
|
|
150
|
-
|
|
151
|
-
## Known Bugs
|
|
152
|
-
|
|
153
|
-
**ActiveRecord callback ordering on Card creation:**
|
|
154
|
-
- Symptoms: Cards created without sequential number when `before_create` callbacks run out of order
|
|
155
|
-
- Trigger: Creating a card while another `before_create` sets `board` association via lambda default
|
|
156
|
-
- Files: `app/models/card.rb` (line 12, `before_create :set_number`), `app/models/concerns/eventable.rb`
|
|
157
|
-
- Workaround: Database-level default fills in number on save, but numbering can have gaps
|
|
158
|
-
- Root cause: `belongs_to :board` must be declared before `before_create :set_number` because `set_number` depends on `board.account`
|
|
159
|
-
|
|
160
|
-
**Race condition in background notification jobs:**
|
|
161
|
-
- Symptoms: Duplicate notifications sent when card is assigned to multiple users simultaneously
|
|
162
|
-
- Trigger: Bulk assignment via board import or API, multiple `NotifyAssigneeJob` enqueued at once
|
|
163
|
-
- Files: `app/jobs/notify_assignee_job.rb`, `app/models/card/assignable.rb`
|
|
164
|
-
- Workaround: Unique constraint on `notifications` table prevents duplicates at DB level, but jobs error with `ActiveRecord::RecordNotUnique`
|
|
165
|
-
- Root cause: No idempotency check in job before creating notification
|
|
166
|
-
- Fix: Add `find_or_create_by` guard in `Card#notify_assignee`
|
|
167
|
-
|
|
168
|
-
**Stale Current context in async operations:**
|
|
169
|
-
- Symptoms: Background jobs occasionally run with wrong tenant context, creating records in wrong account
|
|
170
|
-
- Trigger: Job enqueued during request A, executed during request B on same thread in development
|
|
171
|
-
- File: `app/jobs/application_job.rb`
|
|
172
|
-
- Workaround: Production uses separate Solid Queue process (not affected), only impacts development with inline adapter
|
|
173
|
-
- Root cause: `Current.account` not properly reset between inline job executions in development
|
|
174
|
-
|
|
175
|
-
**Turbo Stream partial not updating after card close:**
|
|
176
|
-
- Symptoms: Card status badge shows "Open" after closing via Turbo Stream until page refresh
|
|
177
|
-
- Trigger: Close card from board view when card partial uses cached fragment
|
|
178
|
-
- Files: `app/views/cards/_card.html.erb`, `app/controllers/cards/closures_controller.rb`
|
|
179
|
-
- Workaround: Hard refresh updates correctly
|
|
180
|
-
- Root cause: Fragment cache key does not include `closure` association, stale cached partial served after Turbo Stream replace
|
|
181
|
-
|
|
182
|
-
## Security Considerations
|
|
183
|
-
|
|
184
|
-
**Mass assignment on User update:**
|
|
185
|
-
- Risk: `UsersController#update` permits `role` parameter — users could escalate to admin via crafted request
|
|
186
|
-
- File: `app/controllers/users_controller.rb` (line 34, `user_params` method)
|
|
187
|
-
- Current mitigation: Frontend form does not display role field
|
|
188
|
-
- Recommendations: Remove `role` from `permit()` list, add separate `Admin::UsersController` for role changes with proper authorization
|
|
189
|
-
|
|
190
|
-
**Missing authorization checks on nested resources:**
|
|
191
|
-
- Risk: Card comments endpoint does not verify user has access to the parent board
|
|
192
|
-
- Files: `app/controllers/comments_controller.rb`, missing `authorize @comment` call
|
|
193
|
-
- Current mitigation: Denormalise tables so all include account_id and rely on `Current.account` scope, but no explicit check on board access.
|
|
194
|
-
- Recommendations: Add `before_action` scope check.
|
|
195
|
-
|
|
196
|
-
**Unscoped queries leaking tenant data:**
|
|
197
|
-
- Risk: `Admin::ReportsController` uses `Card.where(created_at: range)` without `Current.account` scope
|
|
198
|
-
- File: `app/controllers/admin/reports_controller.rb` (line 22)
|
|
199
|
-
- Current mitigation: Admin area behind authentication, but any admin sees all tenants' data
|
|
200
|
-
- Recommendations: Scope all queries through `Current.account.cards` or add `default_scope` guard in multi-tenant models
|
|
201
|
-
|
|
202
|
-
**SQL injection via string interpolation in search:**
|
|
203
|
-
- Risk: `Card.where("title LIKE '%#{params[:q]}%'")` in search controller
|
|
204
|
-
- File: `app/controllers/search_controller.rb` (line 15)
|
|
205
|
-
- Current mitigation: None
|
|
206
|
-
- Recommendations: Use parameterized query `Card.where("title LIKE ?", "%#{Card.sanitize_sql_like(params[:q])}%")` or the `Searchable` concern's safe search scope
|
|
207
|
-
|
|
208
|
-
## Performance Bottlenecks
|
|
209
|
-
|
|
210
|
-
**Boards index page (N+1 queries):**
|
|
211
|
-
- Problem: Loading boards with card counts, latest activity, and member avatars
|
|
212
|
-
- File: `app/controllers/boards_controller.rb` (line 8, `index` action)
|
|
213
|
-
- Measurement: 1.8s p95 response time with 30+ boards, 847ms with counter cache
|
|
214
|
-
- Cause: N+1 on `board.cards.count`, `board.cards.order(updated_at: :desc).first`, and `board.members`
|
|
215
|
-
- Improvement path: Add `cards_count` counter cache to `boards` table, use `includes(:members)` and preload latest card via window function scope
|
|
216
|
-
|
|
217
|
-
**Heavy after_save callbacks on Card:**
|
|
218
|
-
- Problem: Saving a card triggers cache invalidation, search reindexing, and event tracking
|
|
219
|
-
- Files: `app/models/card.rb`, `app/models/concerns/searchable.rb`, `app/models/concerns/eventable.rb`
|
|
220
|
-
- Measurement: Card save takes 120ms vs 15ms for a plain ActiveRecord save
|
|
221
|
-
- Cause: `after_save` callbacks for `reindex_search`, `invalidate_board_cache`, and `track_changes` all run synchronously
|
|
222
|
-
- Improvement path: Move `reindex_search` and `invalidate_board_cache` to `after_commit` with `perform_later` jobs
|
|
223
|
-
|
|
224
|
-
**Missing database indexes:**
|
|
225
|
-
- Problem: Slow queries on card filtering and sorting
|
|
226
|
-
- Files: `db/migrate/` (missing indexes), query visible in `app/models/card.rb` scopes
|
|
227
|
-
- Measurement: `Card.where(board_id: id).where(status: "open").order(position: :asc)` does full table scan on 10k+ cards
|
|
228
|
-
- Cause: Composite index on `[board_id, status, position]` never added
|
|
229
|
-
- Improvement path: Add migration with `add_index :cards, [:board_id, :status, :position]`
|
|
230
|
-
|
|
231
|
-
## Fragile Areas
|
|
232
|
-
|
|
233
|
-
**Concern chain in Card model:**
|
|
234
|
-
- Files: `app/models/card.rb`, `app/models/card/closeable.rb`, `app/models/card/golden.rb`, `app/models/card/eventable.rb`, `app/models/concerns/eventable.rb`
|
|
235
|
-
- Why fragile: Card includes 20+ concerns that can override each other's hooks. `Card::Eventable` layers on top of `::Eventable` with template method overrides
|
|
236
|
-
- Common failures: Adding a new concern that defines `after_save` changes callback execution order, breaking event tracking or cache invalidation
|
|
237
|
-
- Safe modification: Always check existing callback chain with `Card._save_callbacks.map(&:filter)` before adding. Add tests for callback ordering
|
|
238
|
-
- Test coverage: Individual concern tests exist, but no integration test verifying the full callback chain
|
|
239
|
-
|
|
240
|
-
**Callback ordering dependencies:**
|
|
241
|
-
- Files: `app/models/card.rb`, `app/models/concerns/eventable.rb`
|
|
242
|
-
- Why fragile: `before_create :set_number` depends on `board` being set, which depends on `belongs_to :board` declaration order
|
|
243
|
-
- Common failures: Moving association declarations or reordering `include` statements breaks number generation
|
|
244
|
-
- Safe modification: Never reorder `include` or `belongs_to` declarations without verifying dependent callbacks. Add comments documenting ordering constraints
|
|
245
|
-
- Test coverage: Happy path tested, but ordering-dependent edge cases not covered
|
|
246
|
-
|
|
247
|
-
**Multi-tenancy scoping:**
|
|
248
|
-
- Files: `app/models/current.rb`, `app/controllers/application_controller.rb`, `app/jobs/application_job.rb`
|
|
249
|
-
- Why fragile: Missing `Current.account` scope in any query leaks data across tenants
|
|
250
|
-
- Common failures: New controller action or background job forgets to scope through `Current.account` or `Current.user`
|
|
251
|
-
- Safe modification: Always query through `Current.user.boards` or `Current.account.cards`, never use unscoped `Card.find`. Add CI check for unscoped model queries in controllers
|
|
252
|
-
- Test coverage: No automated test for tenant isolation across all endpoints
|
|
253
|
-
|
|
254
|
-
## Scaling Limits
|
|
255
|
-
|
|
256
|
-
**Database connection pool (applies when using PostgreSQL):**
|
|
257
|
-
- Current capacity: 20 connections (default `pool` in `config/database.yml`)
|
|
258
|
-
- Limit: With Solid Queue workers + Puma (5 workers x 5 threads), need 50+ connections
|
|
259
|
-
- Symptoms at limit: `ActiveRecord::ConnectionTimeoutError` in background jobs during peak load
|
|
260
|
-
- Scaling path: Increase `pool` to match total thread count, configure PgBouncer for connection multiplexing
|
|
261
|
-
- Note: SQLite uses file-based locking and does not have connection pool limits, but has write concurrency constraints — consider PostgreSQL when write throughput becomes a bottleneck
|
|
262
|
-
|
|
263
|
-
**Solid Queue worker memory usage:**
|
|
264
|
-
- Current capacity: Single Solid Queue worker process, 512MB RAM
|
|
265
|
-
- Limit: Import jobs loading full CSV into memory hit OOM at ~50k rows
|
|
266
|
-
- Symptoms at limit: Worker process killed by OOM killer, jobs remain in database as claimed (require manual release)
|
|
267
|
-
- Scaling path: Stream CSV processing with `CSV.foreach`, batch database inserts with `insert_all`
|
|
268
|
-
|
|
269
|
-
## Dependencies at Risk
|
|
270
|
-
|
|
271
|
-
**Outdated gems with security patches:**
|
|
272
|
-
- Risk: `nokogiri` pinned to 1.14.x, 3 known CVEs in current version
|
|
273
|
-
- Impact: XML/HTML parsing vulnerable to crafted payloads
|
|
274
|
-
- Migration plan: Update to latest nokogiri, run test suite, check for API changes
|
|
275
|
-
|
|
276
|
-
**Deprecated Rails APIs:**
|
|
277
|
-
- Risk: Application uses classic autoloader references and `config.active_record.legacy_connection_handling`
|
|
278
|
-
- Files: `config/application.rb` (line 18), `config/environments/production.rb` (line 45)
|
|
279
|
-
- Impact: Will break on Rails 8 upgrade
|
|
280
|
-
- Migration plan: Switch to Zeitwerk autoloader conventions, remove legacy connection config, run `rails zeitwerk:check`
|
|
281
|
-
|
|
282
|
-
## Missing Critical Features
|
|
283
|
-
|
|
284
|
-
**Audit trail for admin actions:**
|
|
285
|
-
- Problem: No record of which admin changed user roles, deleted boards, or modified account settings
|
|
286
|
-
- Current workaround: Check Rails logs manually (unreliable, logs rotate)
|
|
287
|
-
- Blocks: Compliance requirements, incident investigation
|
|
288
|
-
- Implementation complexity: Medium (extend `Eventable` concern to admin controllers, add `AdminEvent` model)
|
|
289
|
-
|
|
290
|
-
**Soft delete for cards:**
|
|
291
|
-
- Problem: Card deletion is permanent, no recovery possible
|
|
292
|
-
- Current workaround: Users told to close cards instead of deleting
|
|
293
|
-
- Blocks: Accidental deletion recovery, trash/archive feature
|
|
294
|
-
- Implementation complexity: Low (add `discarded_at` column, use `discard` gem or manual scope `kept`)
|
|
295
|
-
|
|
296
|
-
## Test Coverage Gaps
|
|
297
|
-
|
|
298
|
-
**Model concern integration tests:**
|
|
299
|
-
- What's not tested: How concerns interact when composed together on Card (e.g., closing a golden card, postponing an assigned card)
|
|
300
|
-
- Risk: Concern interactions could produce unexpected behavior — callbacks from one concern conflicting with another
|
|
301
|
-
- Priority: High
|
|
302
|
-
- Difficulty to test: Need fixtures with multiple concern states, test matrix grows combinatorially
|
|
303
|
-
|
|
304
|
-
**Controller integration tests for authorization:**
|
|
305
|
-
- What's not tested: Whether non-admin users are properly blocked from admin actions, whether cross-tenant access is denied
|
|
306
|
-
- Risk: Authorization bypass, tenant data leakage
|
|
307
|
-
- Priority: High
|
|
308
|
-
- Difficulty to test: Need multi-tenant test setup with separate user contexts per tenant
|
|
309
|
-
|
|
310
|
-
**System tests for Turbo Stream flows:**
|
|
311
|
-
- What's not tested: Card state changes via Turbo Stream (close, reopen, assign) update DOM correctly without page reload
|
|
312
|
-
- Risk: UI shows stale state after actions, users see incorrect card status
|
|
313
|
-
- Priority: Medium
|
|
314
|
-
- Difficulty to test: Need Capybara with JavaScript driver, Turbo Stream assertions not built into Rails default test helpers
|
|
315
|
-
|
|
316
|
-
---
|
|
317
|
-
|
|
318
|
-
*Concerns audit: 2025-01-20*
|
|
319
|
-
*Update as issues are fixed or new ones discovered*
|
|
320
|
-
```
|
|
321
|
-
</good_examples>
|
|
322
|
-
|
|
323
|
-
<guidelines>
|
|
324
|
-
**What belongs in CONCERNS.md:**
|
|
325
|
-
- Tech debt with clear impact and fix approach
|
|
326
|
-
- Known bugs with reproduction steps
|
|
327
|
-
- Security gaps and mitigation recommendations
|
|
328
|
-
- Performance bottlenecks with measurements
|
|
329
|
-
- Fragile code that breaks easily
|
|
330
|
-
- Scaling limits with numbers
|
|
331
|
-
- Dependencies that need attention
|
|
332
|
-
- Missing features that block workflows
|
|
333
|
-
- Test coverage gaps
|
|
334
|
-
|
|
335
|
-
**What does NOT belong here:**
|
|
336
|
-
- Opinions without evidence ("code is messy")
|
|
337
|
-
- Complaints without solutions ("auth sucks")
|
|
338
|
-
- Future feature ideas (that's for product planning)
|
|
339
|
-
- Normal TODOs (those live in code comments)
|
|
340
|
-
- Architectural decisions that are working fine
|
|
341
|
-
- Minor code style issues
|
|
342
|
-
|
|
343
|
-
**When filling this template:**
|
|
344
|
-
- **Always include file paths** - Concerns without locations are not actionable. Use backticks: `app/models/user.rb`
|
|
345
|
-
- Be specific with measurements ("500ms p95" not "slow")
|
|
346
|
-
- Include reproduction steps for bugs
|
|
347
|
-
- Suggest fix approaches, not just problems
|
|
348
|
-
- Focus on actionable items
|
|
349
|
-
- Prioritize by risk/impact
|
|
350
|
-
- Update as issues get resolved
|
|
351
|
-
- Add new concerns as discovered
|
|
352
|
-
|
|
353
|
-
**Analysis approach for Rails codebases:**
|
|
354
|
-
- Check `app/models/` for fat models (300+ lines without concerns), N+1 patterns in scopes, missing validations
|
|
355
|
-
- Review `app/controllers/` for business logic that belongs in models, missing `authorize` calls, unpermitted params
|
|
356
|
-
- Scan `app/models/concerns/` for concerns with tangled dependencies or overlapping responsibilities
|
|
357
|
-
- Look at `db/schema.rb` for missing indexes on foreign keys (`_id` columns) and frequently queried columns
|
|
358
|
-
- Check `app/jobs/` for jobs with inline logic instead of delegating to model methods, missing `Current` context handling
|
|
359
|
-
- Review `config/routes.rb` for non-RESTful custom actions that should be modeled as sub-resources
|
|
360
|
-
- Check `test/` for missing model tests, controller tests without authorization assertions, absence of system tests
|
|
361
|
-
- Scan `Gemfile.lock` for outdated gems with known CVEs using `bundle audit`
|
|
362
|
-
- Look at `app/views/` for queries in templates (N+1 hidden in partials) and missing fragment cache keys
|
|
363
|
-
|
|
364
|
-
**Tone guidelines:**
|
|
365
|
-
- Professional, not emotional ("N+1 query pattern" not "terrible queries")
|
|
366
|
-
- Solution-oriented ("Fix: add `includes` scope" not "needs fixing")
|
|
367
|
-
- Risk-focused ("Could expose tenant data across accounts" not "security is bad")
|
|
368
|
-
- Factual ("1.8s p95 load time" not "really slow")
|
|
369
|
-
|
|
370
|
-
**Useful for phase planning when:**
|
|
371
|
-
- Deciding what to work on next
|
|
372
|
-
- Estimating risk of changes
|
|
373
|
-
- Understanding where to be careful
|
|
374
|
-
- Prioritizing improvements
|
|
375
|
-
- Onboarding new Claude contexts
|
|
376
|
-
- Planning refactoring work
|
|
377
|
-
|
|
378
|
-
**How this gets populated:**
|
|
379
|
-
Explore agents detect these during codebase mapping. Manual additions welcome for human-discovered issues. This is living documentation, not a complaint list.
|
|
380
|
-
</guidelines>
|