Simplify UpdateDetails to auto-renew#58
Conversation
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe PR replaces the abstract adapter-specific UpdateDetails pattern with a single final Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/Domains/Registrar/Adapter/OpenSRS.php`:
- Around line 595-602: The MODIFY payload currently builds $attributes with
'data' => 'auto_renew' and no let_expire, causing OpenSRS to reject the command;
update the payload in OpenSRS.php where $attributes is constructed (using
$details->autoRenew) to set 'data' => 'expire_action' and include a 'let_expire'
key (set to 1 when letting expire, 0 otherwise) alongside 'auto_renew' so the
MODIFY action complies with OpenSRS requirements.
🧹 Nitpick comments (2)
tests/Registrar/NameComTest.php (1)
85-88: All three test files have identicalgetUpdateDetailsimplementations.Since
MockTest,NameComTest, andOpenSRSTestall returnnew UpdateDetails($autoRenew)with the same logic, this could be a concrete method inBase.phprather than an abstract override in each subclass.tests/Registrar/Base.php (1)
266-276: Consider adding test coverage forautoRenew = falseandautoRenew = null.The test only exercises
getUpdateDetails(true). SinceUpdateDetailsaccepts?bool, it may be worth testing thefalseandnullcases to ensure all adapters handle them correctly — especiallynull, which signals "no change."
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/Domains/Registrar/Adapter/OpenSRS.php (1)
626-630:⚠️ Potential issue | 🔴 CriticalGuard
$elements[0]against empty array at line 630.The XPath query drills into a deeply nested response path (
attributes/details/{domain}/is_success). If the OpenSRS API response for the MODIFYexpire_actionaction doesn't include this exact nesting structure, thexpath()call returns an empty array, triggering "Undefined array key 0".Other methods in this file (e.g.,
updateNameserversat line 122,cancelPurchaseat line 263) use a simpler top-levelis_successcheck. Consider whether this deeply nested path is correct for the MODIFY action, or fall back to the top-level check:Proposed fix
$result = $this->send($message); $result = $this->sanitizeResponse($result); $elements = $result->xpath($xpath); - return (string) $elements[0] === '1'; + if (empty($elements)) { + $elements = $result->xpath('//body/data_block/dt_assoc/item[`@key`="is_success"]'); + } + + return !empty($elements) && (string) $elements[0] === '1';
Summary
autoRenewonlyTesting
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Tests