omi
omi copied to clipboard
[Bounty Proposal] fix(folders): bulk move deduplication, ID bounds & validation ( - USD)
Bounty Proposal: Folder Bulk-Move Deduplication, ID Bounds & Validation (\ - \ USD)
Pull Request: https://github.com/BasedHardware/omi/pull/23033
Problem & Impact
- Firestore Single Commit Contention Crash (HTTP 500):
In
POST /v1/folders/{folder_id}/conversations/bulk-move,BulkMoveConversationsRequestdid not validate or deduplicate conversation IDs. Passing duplicate IDs (common on mobile sync retries or multi-select UI) causedbulk_move_conversations_to_folderto callbatch.update()multiple times on the same document reference within a single batch, raisinggoogle.api_core.exceptions.InvalidArgument: 400 Multiple operations on document in a single commitand crashing the transaction. - Unbounded Input:
Unlike
ReorderFoldersRequest,BulkMoveConversationsRequesthad nomin_lengthormax_lengthconstraints. - Blank / Whitespace Titles:
CreateFolderRequestandUpdateFolderRequestpermitted whitespace-only names (" "), allowing empty/invisible folder titles in the database. - Unhandled HTTP 500 on Malformed Folder Read:
GET /v1/folders/{folder_id}returned raw database records without handling validation errors, raisingResponseValidationError(HTTP 500) if legacy fields were missing.
Key Improvements in PR #23033
- Deduplication & Bounds: Bounded
conversation_idswithmin_length=1, max_length=500and added field validator to strip whitespace and deduplicate IDs preserving order. - Defensive Database Layer: Added order-preserving deduplication in
bulk_move_conversations_to_folderto guarantee Firestore commit safety even against direct calls. - Folder Name Validation: Added whitespace stripping and blank validation to
CreateFolderRequestandUpdateFolderRequest(rejecting empty/whitespace names with HTTP 422). - Graceful 404 on Detail: Protected
get_folderwithValidationErrorhandler returning HTTP 404 instead of 500 on corrupted stored records. - Hermetic Test Suite: Added 7 comprehensive hermetic unit tests in
backend/tests/unit/test_folder_bulk_move_and_validation.py(all passing hermetically in ~3.6s, total diff ~277 lines).
Designated Payout Channel
- PayPal: [email protected]
- (Base USDC address can also be provided upon request)
Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏