You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
scope contact updates/deletes to the requested contact book in public API
enforce contact ownership for TRPC contact mutations
return consistent 404s when contacts are outside the book
Verification
not run (not requested)
Summary by cubic
Enforces contact book ownership for update/delete across TRPC and the Public API. Blocks cross-book access and returns consistent 404s when a contact is outside the requested book.
Bug Fixes
TRPC update/delete now check contactBook.id and throw NOT_FOUND when contact isn’t in the book.
Public API update/delete verify book ownership and return UnsendApiError NOT_FOUND.
Service layer adds get/update/delete helpers scoped to a contact book to centralize checks.
Written for commit 2049909. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
Improvements
Enhanced error handling and validation for contact operations. Contact updates and deletions now include proper existence checks and return clearer error messages when contacts are not found.
✏️ Tip: You can customize this high-level summary in your review settings.
This pull request refactors contact management operations to enforce contact book context throughout the service layer. The changes introduce new service functions (getContactInContactBook, updateContactInContactBook, deleteContactInContactBook) that require both contact ID and contact book ID as parameters, replacing the previous context-agnostic equivalents. The TRPC mutations now extract contactBook from context and pass its ID to these operations. Public API handlers are updated to retrieve the contact book and use the new service functions. Error handling is added to return NOT_FOUND errors when operations fail to find the target contact.
Possibly related PRs
fix: contact update mutation #265: Modifies the contact update mutation in the same contacts router file to refactor how contactBookId is sourced and used in the update operation.
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%.
Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name
Status
Explanation
Description Check
✅ Passed
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
✅ Passed
The title 'fix: enforce contact book ownership' directly aligns with the PR's main objective of scoping contact operations to specific contact books and enforcing ownership verification.
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verification
Summary by cubic
Enforces contact book ownership for update/delete across TRPC and the Public API. Blocks cross-book access and returns consistent 404s when a contact is outside the requested book.
Written for commit 2049909. Summary will update on new commits.
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.