Enhance record update tests and refactor attribute handling#452
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesDocument Attribute Centralization and Single-Evaluation Fix
Estimated code review effort: 3 (Moderate) | ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
lib/meilisearch-rails.rb (1)
96-108: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winInclude
add_attributefields in the searchable warning check.Line 98 only compares
searchable_attributesagainst@attributes, so a valid configuration likeattribute :name; add_attribute :search_blob; searchable_attributes ['search_blob']will log a misleading “not in attributes” warning even thoughsearch_blobis configured for the document payload.Proposed fix
- attrs = get_setting(:attributes)&.map { |k, _| k.to_s } + attrs = [get_setting(:attributes), get_setting(:additional_attributes)] + .compact + .flat_map { |configured_attributes| configured_attributes.keys.map(&:to_s) }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@lib/meilisearch-rails.rb` around lines 96 - 108, The warn_searchable_missing_attributes method only includes regular attributes from get_setting(:attributes) when checking against searchable_attributes, but it ignores attributes added via add_attribute declarations. To fix this, modify the attrs variable assignment to also collect and include any attributes that were added through add_attribute calls, so the warning comparison includes both regular and added attributes in the searchable warning check.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@lib/meilisearch-rails.rb`:
- Around line 96-108: The warn_searchable_missing_attributes method only
includes regular attributes from get_setting(:attributes) when checking against
searchable_attributes, but it ignores attributes added via add_attribute
declarations. To fix this, modify the attrs variable assignment to also collect
and include any attributes that were added through add_attribute calls, so the
warning comparison includes both regular and added attributes in the searchable
warning check.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 13a9d5d3-bace-4e11-a98f-90a3c36b4e64
📒 Files selected for processing (4)
lib/meilisearch-rails.rbspec/integration/active_record/record_is_updated_spec.rbspec/settings_spec.rbspec/support/models/custom_attribute_builder_models.rb
|
CI is failing due to meilisearch/meilisearch#6482 |
8efb252 to
bc82063
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #452 +/- ##
==========================================
+ Coverage 90.69% 90.79% +0.09%
==========================================
Files 14 14
Lines 849 847 -2
==========================================
- Hits 770 769 -1
+ Misses 79 78 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Cursor <cursoragent@cursor.com>
Pull Request
Related issue
Fixes #450
What does this PR do?
attribute/add_attributeindexing path where custom document fields could be computed twice during updates.AI disclosure
Cursor
gpt-5.4-highandcodex-5.3-highPR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!
Summary by CodeRabbit