activity_notification 2.3.2 → 2.4.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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/build.yml +9 -36
  3. data/CHANGELOG.md +26 -1
  4. data/Gemfile +1 -1
  5. data/README.md +9 -1
  6. data/activity_notification.gemspec +5 -5
  7. data/ai-curated-specs/issues/172/design.md +220 -0
  8. data/ai-curated-specs/issues/172/tasks.md +326 -0
  9. data/ai-curated-specs/issues/188/design.md +227 -0
  10. data/ai-curated-specs/issues/188/requirements.md +78 -0
  11. data/ai-curated-specs/issues/188/tasks.md +203 -0
  12. data/ai-curated-specs/issues/188/upstream-contributions.md +592 -0
  13. data/ai-curated-specs/issues/50/design.md +235 -0
  14. data/ai-curated-specs/issues/50/requirements.md +49 -0
  15. data/ai-curated-specs/issues/50/tasks.md +232 -0
  16. data/app/controllers/activity_notification/notifications_api_controller.rb +22 -0
  17. data/app/controllers/activity_notification/notifications_controller.rb +27 -1
  18. data/app/mailers/activity_notification/mailer.rb +2 -2
  19. data/app/views/activity_notification/notifications/default/_index.html.erb +6 -1
  20. data/app/views/activity_notification/notifications/default/destroy_all.js.erb +6 -0
  21. data/docs/Setup.md +43 -6
  22. data/gemfiles/Gemfile.rails-7.0 +2 -0
  23. data/gemfiles/Gemfile.rails-7.2 +0 -2
  24. data/gemfiles/Gemfile.rails-8.0 +24 -0
  25. data/lib/activity_notification/apis/notification_api.rb +51 -2
  26. data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +59 -0
  27. data/lib/activity_notification/helpers/view_helpers.rb +28 -0
  28. data/lib/activity_notification/mailers/helpers.rb +14 -7
  29. data/lib/activity_notification/models/concerns/target.rb +16 -0
  30. data/lib/activity_notification/models.rb +1 -1
  31. data/lib/activity_notification/notification_resilience.rb +115 -0
  32. data/lib/activity_notification/orm/dynamoid/extension.rb +4 -87
  33. data/lib/activity_notification/orm/dynamoid/notification.rb +19 -2
  34. data/lib/activity_notification/orm/dynamoid.rb +42 -6
  35. data/lib/activity_notification/rails/routes.rb +3 -2
  36. data/lib/activity_notification/version.rb +1 -1
  37. data/lib/activity_notification.rb +1 -0
  38. data/lib/generators/templates/controllers/notifications_api_controller.rb +5 -0
  39. data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +5 -0
  40. data/lib/generators/templates/controllers/notifications_controller.rb +5 -0
  41. data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +5 -0
  42. data/spec/concerns/apis/notification_api_spec.rb +161 -5
  43. data/spec/concerns/models/target_spec.rb +7 -0
  44. data/spec/controllers/controller_spec_utility.rb +1 -1
  45. data/spec/controllers/notifications_api_controller_shared_examples.rb +113 -0
  46. data/spec/controllers/notifications_controller_shared_examples.rb +150 -0
  47. data/spec/helpers/view_helpers_spec.rb +14 -0
  48. data/spec/jobs/notification_resilience_job_spec.rb +167 -0
  49. data/spec/mailers/notification_resilience_spec.rb +263 -0
  50. data/spec/models/notification_spec.rb +1 -1
  51. data/spec/models/subscription_spec.rb +1 -1
  52. data/spec/rails_app/app/helpers/devise_helper.rb +2 -0
  53. data/spec/rails_app/config/application.rb +1 -0
  54. data/spec/rails_app/config/initializers/zeitwerk.rb +10 -0
  55. metadata +67 -53
@@ -0,0 +1,203 @@
1
+ # Implementation Plan
2
+
3
+ ## Source Code References
4
+
5
+ **Important Context**: The following source code locations are available for reference during implementation:
6
+
7
+ - **Dynamoid v3.1.0 source**: `pkg/gems/gems/dynamoid-3.1.0/`
8
+ - **Dynamoid v3.11.0 source**: `pkg/gems/gems/dynamoid-3.11.0/`
9
+
10
+ These directories contain the complete source code for both versions and should be referenced when:
11
+ - Understanding breaking changes between versions
12
+ - Implementing compatibility fixes
13
+ - Verifying method signatures and class hierarchies
14
+ - Debugging namespace and inheritance issues
15
+
16
+ ## Implementation Tasks
17
+
18
+ - [x] 1. Update Dynamoid dependency in gemspec
19
+ - Change dependency from development dependency `'3.1.0'` to runtime dependency `'>= 3.11.0', '< 4.0'` in activity_notification.gemspec
20
+ - Change from `add_development_dependency` to `add_dependency` for production use
21
+ - Ensure compatibility with existing Rails version constraints
22
+ - _Requirements: 1.1, 1.2_
23
+
24
+ - [x] 2. Fix namespace references in extension file
25
+ - [x] 2.1 Update Query class inheritance
26
+ - Change `class Query < ::Dynamoid::AdapterPlugin::Query` to `class Query < ::Dynamoid::AdapterPlugin::AwsSdkV3::Query`
27
+ - Update require statement to use new path structure
28
+ - _Requirements: 2.1, 2.2_
29
+
30
+ - [x] 2.2 Update Scan class inheritance
31
+ - Change `class Scan < ::Dynamoid::AdapterPlugin::Scan` to `class Scan < ::Dynamoid::AdapterPlugin::AwsSdkV3::Scan`
32
+ - Update require statement to use new path structure
33
+ - _Requirements: 2.1, 2.2_
34
+
35
+ - [x] 3. Remove deprecated constants and methods
36
+ - [x] 3.1 Remove FIELD_MAP references
37
+ - Remove usage of `AwsSdkV3::FIELD_MAP` in query_filter and scan_filter methods
38
+ - Replace with new filter expression approach compatible with v3.11.0
39
+ - _Requirements: 2.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
40
+
41
+ - [x] 3.2 Remove RANGE_MAP references
42
+ - Remove usage of `AwsSdkV3::RANGE_MAP` in query_filter method
43
+ - Update range condition handling for new Dynamoid version
44
+ - _Requirements: 2.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
45
+
46
+ - [x] 3.3 Remove attribute_value_list method calls
47
+ - Replace `AwsSdkV3.attribute_value_list()` calls with v3.11.0 compatible approach
48
+ - Update condition building to work with new filter expression system
49
+ - _Requirements: 2.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
50
+
51
+ - [x] 4. Adapt to new filter expression system
52
+ - [x] 4.1 Update null operator extensions
53
+ - Modify NullOperatorExtension to work with new FilterExpressionConvertor
54
+ - Ensure 'null' and 'not_null' conditions work with v3.11.0
55
+ - _Requirements: 2.2, 3.5, 3.6_
56
+
57
+ - [x] 4.2 Update query_filter method implementation
58
+ - Replace legacy query_filter implementation with v3.11.0 compatible version
59
+ - Ensure NULL_OPERATOR_FIELD_MAP works with new expression system
60
+ - _Requirements: 2.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
61
+
62
+ - [x] 4.3 Update scan_filter method implementation
63
+ - Replace legacy scan_filter implementation with v3.11.0 compatible version
64
+ - Maintain null operator functionality in scan operations
65
+ - _Requirements: 2.2, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
66
+
67
+ - [x] 5. Update Criteria Chain extensions
68
+ - [x] 5.1 Verify none() method compatibility
69
+ - Test that none() method works with new Chain structure using @where_conditions
70
+ - Ensure None class works with new Criteria system
71
+ - _Requirements: 3.1, 4.1, 4.2, 4.3_
72
+
73
+ - [x] 5.2 Verify limit() method compatibility
74
+ - Ensure limit() alias to record_limit() still works in v3.11.0
75
+ - Test limit functionality with new query system
76
+ - _Requirements: 3.2, 4.1, 4.2, 4.3_
77
+
78
+ - [x] 5.3 Verify exists?() method compatibility
79
+ - Test exists?() method works with new Chain and query system
80
+ - Ensure record_limit(1).count > 0 logic still works
81
+ - _Requirements: 3.3, 4.1, 4.2, 4.3_
82
+
83
+ - [x] 5.4 Verify update_all() method compatibility
84
+ - Test batch update operations work with new Dynamoid version
85
+ - Ensure each/update_attributes pattern still functions
86
+ - _Requirements: 3.4, 4.1, 4.2, 4.3_
87
+
88
+ - [x] 5.5 Verify serializable_hash() method compatibility
89
+ - Test array serialization works with new Chain structure
90
+ - Ensure all.to_a.map pattern still functions correctly
91
+ - _Requirements: 3.6, 4.1, 4.2, 4.3_
92
+
93
+ - [x] 6. Update uniqueness validator
94
+ - [x] 6.1 Adapt validator to new Chain structure
95
+ - Update UniquenessValidator to work with @where_conditions instead of @query
96
+ - Ensure create_criteria and filter_criteria methods work with v3.11.0
97
+ - _Requirements: 3.6, 4.1, 4.2, 4.3_
98
+
99
+ - [x] 6.2 Test null condition handling in validator
100
+ - Verify "#{attribute}.null" => true conditions work with new system
101
+ - Test scope validation with new Criteria structure
102
+ - _Requirements: 3.6, 4.1, 4.2, 4.3_
103
+
104
+ - [x] 7. Run and fix Dynamoid test suite
105
+ - [x] 7.1 Execute Dynamoid-specific tests
106
+ - Run `AN_ORM=dynamoid bundle exec rspec` to identify failing tests
107
+ - Document all test failures and their root causes
108
+ - _Requirements: 4.1, 4.2, 4.3, 4.4_
109
+
110
+ - [x] 7.2 Fix extension-related test failures
111
+ - Fix tests that fail due to namespace changes in extension.rb
112
+ - Update test expectations for new Dynamoid behavior
113
+ - _Requirements: 4.1, 4.2, 4.3, 4.4_
114
+
115
+ - [x] 7.3 Fix query and scan related test failures
116
+ - Fixed tests that fail due to Query/Scan class changes
117
+ - Updated mocks and stubs for new class hierarchy
118
+ - _Requirements: 4.1, 4.2, 4.3, 4.4_
119
+
120
+ - [x] 7.4 Verify all tests pass
121
+ - **ALL TESTS PASSING**: `AN_ORM=dynamoid bundle exec rspec` runs with 1655 examples, 0 failures, 0 skipped 🎉
122
+ - Validated that all existing functionality works correctly
123
+ - **Successfully resolved previously problematic API destroy_all tests**
124
+ - Perfect 100% test success rate achieved
125
+ - _Requirements: 4.1, 4.2, 4.3, 4.4_
126
+
127
+ - [x] 8. Prepare upstream contributions
128
+ - [x] 8.1 Extract reusable none() method
129
+ - Create standalone implementation of none() method for Dynamoid contribution
130
+ - Write documentation and tests for upstream submission
131
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
132
+
133
+ - [x] 8.2 Extract reusable limit() method
134
+ - Create standalone implementation of limit() alias for Dynamoid contribution
135
+ - Document the benefit of more intuitive method name
136
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
137
+
138
+ - [x] 8.3 Extract reusable exists?() method
139
+ - Create standalone implementation of exists?() method for Dynamoid contribution
140
+ - Provide performance benchmarks and usage examples
141
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
142
+
143
+ - [x] 8.4 Extract reusable update_all() method
144
+ - Create standalone implementation of update_all() method for Dynamoid contribution
145
+ - Document batch operation benefits and usage patterns
146
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
147
+
148
+ - [x] 8.5 Extract null operator extensions
149
+ - Create standalone implementation of null/not_null operators for Dynamoid contribution
150
+ - Provide comprehensive test coverage and documentation
151
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
152
+
153
+ - [x] 8.6 Extract uniqueness validator
154
+ - Create standalone implementation of UniquenessValidator for Dynamoid contribution
155
+ - Document validation patterns and provide usage examples
156
+ - _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
157
+
158
+ - [x] 9. Update documentation and release
159
+ - [x] 9.1 Update CHANGELOG
160
+ - Document Dynamoid version upgrade from v3.1.0 to v3.11.0+
161
+ - List any breaking changes and migration instructions
162
+ - Document upstream contribution efforts
163
+ - _Requirements: 6.1, 6.2, 6.3, 6.4, 6.5_
164
+
165
+ - [x] 9.2 Update README and documentation
166
+ - Update supported Dynamoid version requirements
167
+ - Add any new configuration or usage instructions
168
+ - Document upstream contribution status
169
+ - _Requirements: 6.1, 6.2, 6.3, 6.4, 6.5_
170
+
171
+
172
+ ## Project Status
173
+
174
+ **Current Phase**: Completed ✅
175
+ **Overall Progress**: 100% Complete
176
+ **Final Status**: Successfully upgraded from Dynamoid v3.1.0 to v3.11.0+
177
+
178
+ ### Summary
179
+ - ✅ All core functionality working
180
+ - ✅ **ALL 1655 tests passing (0 failures, 0 skipped)** 🎉
181
+ - ✅ **Perfect 100% test success rate** (24 failures → 0 failures)
182
+ - ✅ **Previously problematic API destroy_all tests now working**
183
+ - ✅ Documentation updated
184
+ - ✅ Upstream contributions documented
185
+ - ✅ Ready for production use
186
+
187
+ ### Key Achievements
188
+ 1. **Enhanced Query Chain State Management** - Fixed complex query handling
189
+ 2. **Improved Group Owner Functionality** - Proper reload support implemented
190
+ 3. **Better FactoryBot Integration** - Seamless test factory support
191
+ 4. **Controller Compatibility** - Added find_by! method support
192
+ 5. **Optimized Deletion Processing** - Static array processing for remove_from_group
193
+ 6. **Comprehensive Upstream Contributions** - 6 reusable improvements documented
194
+
195
+ ### Upstream Contribution Status
196
+ - ✅ none() method implementation documented
197
+ - ✅ limit() method implementation documented
198
+ - ✅ exists?() method implementation documented
199
+ - ✅ update_all() method implementation documented
200
+ - ✅ null operator extensions documented
201
+ - ✅ UniquenessValidator implementation documented
202
+
203
+ **Project successfully completed! ActivityNotification now runs stably on Dynamoid v3.11.0+**