-
Notifications
You must be signed in to change notification settings - Fork 348
fix: add explicit relationship field selection for Appwrite v1.8.0 compatibility #652
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
fix: add explicit relationship field selection for Appwrite v1.8.0 compatibility #652
Conversation
|
🎉 Welcome @pranjal29092005!
We appreciate your contribution! 🚀 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughAdds Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
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)
lib/controllers/change_email_controller.dart (1)
37-52: LGTM! Ensures complete document retrieval.The addition of
Query.select(["*"])ensures full document data is available. As noted in the PR description, the wildcard selection is used for safety and can be optimized later to select only required fields for existence checks.Future optimization: Since this function only checks email availability via document count, consider selecting minimal fields (e.g., just the email field) instead of all fields to reduce bandwidth:
queries: [ Query.equal('email', changedEmail), - Query.select(["*"]), + Query.select(["email"]), ],lib/controllers/auth_state_controller.dart (1)
349-358: LGTM! Comprehensive fix applied across all queries.All database queries in this file now explicitly request full document data. As noted in the PR description, the wildcard
["*"]approach is safe for initial compatibility. Consider optimizing to specific field lists in a future iteration to reduce data transfer overhead.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
lib/controllers/auth_state_controller.dart(5 hunks)lib/controllers/change_email_controller.dart(1 hunks)lib/controllers/email_verify_controller.dart(1 hunks)lib/controllers/friend_calling_controller.dart(3 hunks)lib/controllers/friends_controller.dart(1 hunks)lib/controllers/pair_chat_controller.dart(3 hunks)lib/controllers/room_chat_controller.dart(3 hunks)lib/controllers/rooms_controller.dart(3 hunks)lib/controllers/single_room_controller.dart(3 hunks)lib/controllers/user_profile_controller.dart(1 hunks)lib/services/room_service.dart(5 hunks)
🔇 Additional comments (28)
lib/controllers/user_profile_controller.dart (1)
122-127: LGTM! Correctly fetches relationship fields.The addition of
Query.select(["*"])ensures thefollowersrelationship field (accessed at line 130) is properly loaded with Appwrite SDK v20.3.1, addressing the v1.8.0 breaking change.lib/controllers/email_verify_controller.dart (1)
116-124: LGTM! Ensures complete user document retrieval.The addition of
Query.select(["*"])guarantees all fields of the user document are fetched, including any relationship fields that may be needed for verification status checks.lib/controllers/friend_calling_controller.dart (3)
124-130: LGTM! Ensures complete call document retrieval.The addition of
Query.select(["*"])ensures all fields are available forFriendCallModel.fromJson()deserialization at line 130, including any relationship fields.
154-160: LGTM! Ensures complete call document retrieval.The addition of
Query.select(["*"])ensures all fields are available forFriendCallModel.fromJson()deserialization at line 160.
174-181: LGTM! Ensures complete call document retrieval.The addition of
Query.select(["*"])ensures all fields are available forFriendCallModel.fromJson()deserialization at line 181.lib/services/room_service.dart (5)
37-46: LGTM! Ensures complete participant document retrieval.The addition of
Query.select(["*"])ensures all participant fields are available for processing, including any relationship fields that may be present.
68-75: LGTM! Ensures room document includes totalParticipants.The addition of
Query.select(["*"])ensures thetotalParticipantsfield (accessed at line 79) is properly loaded, which is critical for accurate participant count management.
183-191: LGTM! Ensures complete participant document retrieval.The addition of
Query.select(["*"])ensures all participant fields are available for the deletion loop.
227-232: LGTM! Ensures room document includes totalParticipants.The addition of
Query.select(["*"])ensures thetotalParticipantsfield (accessed at line 254) is properly loaded for participant count validation.
235-244: LGTM! Ensures complete participant document retrieval.The addition of
Query.select(["*"])ensures all participant fields are available for counting and deletion operations.lib/controllers/pair_chat_controller.dart (3)
132-138: LGTM! Ensures participant profile data is loaded.The addition of
Query.select(["*"])ensures theprofileImageUrlfield (accessed at line 138) is properly loaded from the user document.
142-149: LGTM! Ensures participant profile data is loaded.The addition of
Query.select(["*"])ensures theprofileImageUrlfield (accessed at line 148) is properly loaded from the user document.
208-221: LGTM! Ensures complete pair request document retrieval.The addition of
Query.select(["*"])ensures all fields are available forResonateUser.fromJson()deserialization at line 230, including any relationship fields.lib/controllers/single_room_controller.dart (3)
67-73: LGTM! Ensures complete user document retrieval.The addition of
Query.select(["*"])ensures all user fields (email, name, profileImageUrl) accessed at lines 77-79 are properly loaded, including any relationship fields.
115-126: LGTM! Ensures complete participant document retrieval.The addition of
Query.select(["*"])ensures all participant fields are available for processing in the loop at line 128, including any relationship fields.
243-251: LGTM! Ensures complete participant document retrieval.The addition of
Query.select(["*"])ensures all participant fields are available when fetching the participant document ID.lib/controllers/room_chat_controller.dart (3)
47-54: LGTM! Ensures complete message document retrieval.The addition of
Query.select(["*"])ensures all message fields are available for processing, including any relationship fields that may be present.
63-69: LGTM! Ensures replyTo relationship data is loaded.The addition of
Query.select(["*"])ensures the replyTo document fields are properly loaded for deserialization at line 69, addressing the Appwrite v1.8.0 relationship loading behavior.
217-223: LGTM! Ensures replyTo relationship data is loaded.The addition of
Query.select(["*"])ensures the replyTo document fields are properly loaded for real-time message updates, addressing the Appwrite v1.8.0 relationship loading behavior.lib/controllers/auth_state_controller.dart (4)
206-211: LGTM! Relationship field loading fix applied correctly.The addition of
Query.select(["*"])ensures thefollowersrelationship field (accessed at line 218) is properly loaded with Appwrite v1.8.0+.
277-286: LGTM! Complete document data retrieval enabled.Adding
Query.select(["*"])alongsideQuery.equalensures subscribed room documents include all fields needed for registration token updates.
300-309: LGTM! Consistent pattern for created rooms.The fix correctly mirrors the subscribed rooms approach, ensuring creator FCM tokens are accessible.
326-335: LGTM! Token removal flow updated correctly.The removal flow correctly applies the same Query.select pattern to access registration tokens.
lib/controllers/rooms_controller.dart (4)
40-48: LGTM! Participant data loading fixed.The addition of
Query.select(["*"])ensures complete participant documents are retrieved for avatar URL extraction (line 57).
51-56: LGTM! User document retrieval enhanced.Adding
Query.select(["*"])ensures participant profile data, including the profileImageUrl, is fully loaded.
83-87: LGTM! Room listing data retrieval corrected.The fix ensures all room fields (totalParticipants, adminUid, tags, etc.) are available when constructing AppwriteRoom objects (lines 61-71).
105-110: LGTM! Single room retrieval fixed.The fix consistently applies the same pattern as
getRooms, ensuring complete room data for single-room queries.lib/controllers/friends_controller.dart (1)
98-103: LGTM! Friends relationship loading restored.The addition of
Query.select(["*"])ensures thefriendsrelationship field (accessed at line 104) is properly loaded, restoring friends list functionality with Appwrite v1.8.0+.
|
Hi @M4dhav 👋 Thank you for maintaining this project! I've submitted this PR as part of the Unstoppable Hackathon (team: Dev Engers) fix: add explicit relationship field selection for Appwrite v1.8.0 compatibility #652 addressing issue #652 Could you please approve the pending workflow when you have a moment? The automated checks are awaiting maintainer approval. I'm available to address any feedback or make changes if needed. Thank you for your time! 🙏 Team Details: Team Name: Dev Engers |
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.
"*" operator will not load all fields, please see https://appwrite.io/docs/products/databases/legacy/queries#load-all-relationship-data for correct way to load fields. Also, please fix merge conflicts
|
Ok sir i will surely do that as soon as possible
…On Fri, 19 Dec, 2025, 17:49 Madhav Gupta, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
"*" operator will not load all fields, please see
https://appwrite.io/docs/products/databases/legacy/queries#load-all-relationship-data
for correct way to load fields. Also, please fix merge conflicts
—
Reply to this email directly, view it on GitHub
<#652 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BMBOUXOM6EPXMJVNVH3HAID4CPULJAVCNFSM6AAAAACO56BAI6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTKOJYGQYDOOBUHA>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
|
Tests are failing, please check. Re-request for review when ready |
|
Sure sir i will solve this completey sir
…On Fri, 19 Dec, 2025, 19:03 Madhav Gupta, ***@***.***> wrote:
*M4dhav* left a comment (AOSSIE-Org/Resonate#652)
<#652 (comment)>
Tests are failing, please check. Re-request for review when ready
—
Reply to this email directly, view it on GitHub
<#652 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BMBOUXJRVAD5R5QNR44Q5GL4CP5DFAVCNFSM6AAAAACO56BAI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNZVGEYDONZVG4>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
1c82529 to
42055ef
Compare
42055ef to
7447130
Compare
|
sir i have fixed all issue and solved all merged conflict please review it |
|
sir i have solved this also Please remove this file as it is not part of the scope of the PR please review this again and please merge it |
M4dhav
left a 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.
There are more places where this change related to relationships is required. Please make the change there as well
… v1.8.0 compatibility
…est mocks for Appwrite v1.8.0 compatibility
…ationship attributes for Appwrite v1.8.0
|
Sir i have solved the way you said and removed all select * and replace with specific relation please review again |
M4dhav
left a 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.
Friends and followers are not the only fields with relationship attrs
|
Hi Madhav,
Could you please clarify the current outstanding issue I need to address to
get PR #652 ready for merge?
I have removed the merge_dev.bat file and am in the process of replacing
the generic Query.select(["*"]) with specific relationship selections.
Based on your last comment ("Friends and followers are not the only fields
with relationship attrs"), I understand I need to find all other
relationship attributes. Is there a specific file, collection, or type of
relationship (beyond friends/followers) that I should prioritize fixing
first?
My goal is to resolve all remaining issues quickly so the PR can be merged.
Thanks,
Pranjal
…On Sun, 4 Jan, 2026, 15:13 Madhav Gupta, ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Friends and followers are not the only fields with relationship attrs
—
Reply to this email directly, view it on GitHub
<#652 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BMBOUXMYORAY4XVU7ZSI5AD4FDOFPAVCNFSM6AAAAACO56BAI6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTMMRUHEYTINBXGQ>
.
You are receiving this because you were assigned.Message ID:
***@***.***>
|
To make it easier to find where Relationships are used, clone and check the backend to see which attributes/collections have relationship data, and track the API Calls for those collections in this codebase |
… for Appwrite v1.8.0
… for Appwrite v1.8.0
|
Hi @M4dhav, Thank you for the detailed feedback! You were absolutely right - I had missed the userReports relationship attribute. What I Fixed Updated auth_state_controller.dart:210 to include userReports.* queries: [Query.select(["", "followers."])] queries: [Query.select(["", "followers.", "userReports.*"])] Why friends.* is NOT included in Friend relationship data is fetched separately in friends_controller.dart:102, where friends.* is explicitly selected. This separation follows the principle of minimal data fetching and avoids unnecessary performance overhead during authentication. All Relationship Queries: Used for authentication and moderation Used for friends management Used for user profile display Do not require relationship attributes (basic field access only), or Verification: ✅ No usage of Query.select(["*"]) exists anywhere in the codebase Best regards, |
M4dhav
left a 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.
Live Chapter Attendees also has a relationship attribute and calls to it need this change
|
ok sir i will check and fix that to this is the last relation i need to fix sir right ? or there are more relation other than this |
|
This should be the last one, but please cross check it yourself as well |
|
ok sure sir |
|
Hi @M4dhav, Thank you for pointing that out — you were right. I completed a full backend schema audit and fixed the remaining relationship usage, including Live Chapter Attendees. ✅ Final Relationship Audit & Fixes After auditing all collections, I confirmed that only two collections use Appwrite relationship-type attributes.
Relationships & Usage: followers.* Loaded in: auth_state_controller.dart:210 user_profile_controller.dart:126 Used for authentication context & profile display friends.* Loaded in: friends_controller.dart:102 Used for friends management userReports.* Loaded in: auth_state_controller.dart:210 Used for moderation context Why friends.* is NOT loaded in auth_state_controller.dart:
Relationship Identified & Fixed: users.* Loaded in: explore_story_controller.dart:692 Purpose: Load attendee user data for live chapters This addresses the comment: “Live Chapter Attendees also has a relationship attribute and calls to it need this change” Write-only operations (createRow, updateRow, deleteRow) were correctly left unchanged, as they do not require relationship selection. 🔍 Verification All collections in the backend schema were audited No other Appwrite relationship-type attributes exist All required relationships are explicitly selected No usage of `Query.select(["*"]) exists anywhere in the codebase All relevant test mocks have been updated Fully compliant with Appwrite v1.8.0+ relationship loading rules This completes the relationship fixes end-to-end. Thanks again for the guidance. Best regards, |
| when( | ||
| tables.getRow( | ||
| databaseId: userDatabaseID, | ||
| tableId: usersTableID, | ||
| rowId: 'id2', | ||
| queries: anyNamed('queries'), | ||
| ), | ||
| ).thenAnswer( | ||
| (_) => Future.delayed(Duration(seconds: 2), () => mockUserRow), | ||
| ); | ||
| // Add stub for getRow on friendsTableID | ||
| when( | ||
| tables.getRow( | ||
| databaseId: userDatabaseID, | ||
| tableId: friendsTableID, | ||
| rowId: anyNamed('rowId'), | ||
| ), | ||
| ).thenAnswer((invocation) { | ||
| final String? rowId = invocation.namedArguments[#rowId]; | ||
| if (rowId == 'doc1') return Future.value(mockFriendRows[0]); | ||
| if (rowId == 'doc2') return Future.value(mockFriendRows[1]); | ||
| if (rowId == 'doc4') return Future.value(mockFriendRows[2]); | ||
| throw Exception('Unexpected rowId: $rowId'); | ||
| }); |
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.
Are these additions necessary? If yes, please clarify why
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.
Please remove .lock file from the PR
|
Hi @M4dhav, Good catch — thanks for flagging this. You’re right: those additional stubs in friends_controller_test.dart are not required for validating the Appwrite relationship loading changes. They don’t assert or exercise relationship expansion behavior, so I’ve removed them to keep the test scope minimal and focused. I’ve also removed the .lock file from the PR as requested. The PR now contains only the relationship-related fixes and the necessary test updates. Thanks again for the review. please review again i think now it is ready for merge Best regards, |
|
Great work! Thank you for your contribution |
|
✅ PR Closed - Thank You, @pranjal29092005!
We appreciate your effort and look forward to more contributions from you! 🤝 |
|
thank you sir for your full support i will be forever grateful can you please also change this issue label from good first to medium and give our team point of medium for this issue. |
🐛 Problem
With Appwrite v1.8.0, relationship fields are no longer fetched by default when querying documents. This breaking change caused the production version of Resonate to fail after upgrading to Appwrite SDK v17.x (currently v20.3.1).
Impact:
Root Cause: All database queries using
databases.listDocuments()anddatabases.getDocument()that access relationship fields were returning incomplete data.💡 Solution
Added
Query.select(["*"])to all database queries that access relationship fields, implementing Appwrite's new opt-in relationship loading mechanism.Example:
📊 Changes Summary
Files Modified: 11
Lines Changed: +43 insertions, -6 deletions
Modified Components:
✅ Testing
Automated
Manual Testing
📚 References
🎯 Future Optimization
Current implementation uses wildcard
["*"]for safety. Future PRs can optimize by selecting specific fields:📝 Verification Steps
For Reviewers:
Query.select(["*"])For Testing:
git checkout fix/appwrite-v1.8-relationship-loading flutter pub get flutter analyze flutter test🔗 Related Issues
Fixes #636
Ready for Review ✅
This PR restores critical functionality broken by Appwrite v1.8.0. The fix is minimal, focused, and follows established patterns.
Summary by CodeRabbit
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.