-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Refactor base64 handling in DocRecord and related structs #14082
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Conversation
|
|
WalkthroughRefactored base64 handling in TryFrom implementations to use standardized decoding with proper error mapping. Simplified multi-line Ok() wrappers to single-line expressions in DocStoragePool methods. Updated inline comments on bin/data fields to document base64 encoding. No changes to public APIs or functional behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/frontend/mobile-native/src/lib.rs (2)
269-275: Consider improving indentation consistency.The indentation in the
push_updatecall appears inconsistent. Line 270 (doc_id,) has less indentation than expected for method arguments.Apply this diff to improve alignment:
- .push_update( - doc_id, - base64_simd::STANDARD - .decode_to_vec(update) - .map_err(|e| UniffiError::Base64DecodingError(e.to_string()))?, -) - + .push_update( + doc_id, + base64_simd::STANDARD + .decode_to_vec(update) + .map_err(|e| UniffiError::Base64DecodingError(e.to_string()))?, + )
658-658: Remove unnecessary clone.
universal_id.clone()is unnecessary here sinceuniversal_idis not used elsewhere in this method. Passuniversal_iddirectly to avoid the allocation.Apply this diff:
- let result = self.inner.get(universal_id.clone()).await?.crawl_doc_data(&doc_id).await?; + let result = self.inner.get(universal_id).await?.crawl_doc_data(&doc_id).await?;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
packages/frontend/mobile-native/src/lib.rs(15 hunks)
🔇 Additional comments (4)
packages/frontend/mobile-native/src/lib.rs (4)
32-32: LGTM! Helpful documentation.The inline comments clearly document that these fields contain base64-encoded data, improving code clarity for maintainers and API consumers.
Also applies to: 67-67, 128-128, 149-149
240-240: LGTM! Concise constructor.The single-line constructor using
Default::default()is idiomatic Rust and improves readability.
255-255: LGTM! Cleaner error propagation.The single-line
Ok(...)expressions reduce boilerplate and improve readability while maintaining the same error propagation behavior.Also applies to: 299-299, 347-347, 405-405, 414-414
52-55: Verify thataffine_nbstore::DocRecord::binfield type implementsFrom<Vec<u8>>or is of typeVec<u8>.The refactored code at lines 52-55 uses
.into()to convert the decodedVec<u8>to the target field type. This conversion requires the target type to implementFrom<Vec<u8>>. Confirm the actual type of thebinfield inaffine_nbstore::DocRecordsupports this conversion.
Summary by CodeRabbit
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.