chore: tidy up ClientBatchOptions and ClientListRetationsOptions#128
chore: tidy up ClientBatchOptions and ClientListRetationsOptions#128
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughUpdated ListRelations to accept IClientListRelationsOptions instead of IClientBatchCheckOptions. Implemented equality, hashing, and no-op validation for batch check response models. Added IClientListRelationsOptions interface and updated ClientListRelationsOptions to implement it. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 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 |
Codecov Report❌ Patch coverage is
❌ Your project status has failed because the head coverage (31.61%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
==========================================
- Coverage 31.69% 31.61% -0.09%
==========================================
Files 135 135
Lines 6862 6886 +24
Branches 900 905 +5
==========================================
+ Hits 2175 2177 +2
- Misses 4499 4520 +21
- Partials 188 189 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/OpenFga.Sdk/Client/Model/ClientBatchCheckResponse.cs (2)
64-65: Consider exception type in equality check.Comparing exceptions solely by message can lead to false positives—two different exception types with identical messages would be considered equal. Consider including exception type in the comparison:
(ReferenceEquals(Error, other.Error) || - (Error != null && other.Error != null && Error.Message == other.Error.Message)); + (Error != null && other.Error != null && + Error.GetType() == other.Error.GetType() && + Error.Message == other.Error.Message));
87-89: Align hash code with equality logic.If the
Equalsmethod is updated to include exception type (per previous comment), this hash code should also incorporateError.GetType():if (Error != null) { - hashCode = (hashCode * 9923) + Error.Message.GetHashCode(); + hashCode = (hashCode * 9923) + Error.GetType().GetHashCode(); + hashCode = (hashCode * 9923) + Error.Message.GetHashCode(); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/OpenFga.Sdk/Client/Client.cs(1 hunks)src/OpenFga.Sdk/Client/Model/ClientBatchCheckResponse.cs(4 hunks)src/OpenFga.Sdk/Client/Model/ClientListRelationsOptions.cs(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/OpenFga.Sdk/Client/Model/ClientBatchCheckResponse.cs (3)
src/OpenFga.Sdk/Client/Model/ClientExpandRequest.cs (2)
IEnumerable(81-83)GetHashCode(92-110)src/OpenFga.Sdk/Client/Model/ClientCheckRequest.cs (2)
IEnumerable(98-100)GetHashCode(109-135)src/OpenFga.Sdk/Client/Model/ClientWriteResponse.cs (4)
IEnumerable(69-71)IEnumerable(138-140)GetHashCode(81-99)GetHashCode(149-163)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (csharp)
🔇 Additional comments (6)
src/OpenFga.Sdk/Client/Model/ClientListRelationsOptions.cs (2)
18-19: LGTM! Good type safety improvement.The new
IClientListRelationsOptionsinterface provides type-specific options forListRelations, improving API clarity while maintaining compatibility through inheritance fromIClientBatchCheckOptions.
21-21: LGTM! Consistent with the new interface.The class now correctly implements
IClientListRelationsOptions, aligning with the type hierarchy change.src/OpenFga.Sdk/Client/Client.cs (1)
391-393: LGTM! Type-safe signature improvement.The method signature now correctly accepts
IClientListRelationsOptions, making the API more type-safe and semantically clear. SinceIClientListRelationsOptionsextendsIClientBatchCheckOptions, the downstreamBatchCheckcall at line 411 remains valid.src/OpenFga.Sdk/Client/Model/ClientBatchCheckResponse.cs (3)
76-78: LGTM! Proper validation implementation.The no-op validation implementation is correct for a type with no validation requirements.
134-136: LGTM! Proper validation implementation.The no-op validation is appropriate for this response type.
144-154: LGTM! Correct collection hash code.The hash code properly accumulates values from the
Responsescollection with appropriate null handling.
0a52192 to
1aa2d58
Compare
Description
What problem is being solved?
How is it being solved?
What changes are made to solve it?
References
Review Checklist
mainSummary by CodeRabbit
Refactor
Bug Fixes