Add residential property to Anonymizer record#319
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThe anonymizer model now supports an optional residential feed containing confidence, last-seen, and provider data. A new immutable record handles parsing and serialization, with tests covering full and residential-only inputs. ChangesAnonymizer residential feed
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant InputRecord
participant Anonymizer
participant AnonymizerFeed
InputRecord->>Anonymizer: residential array
Anonymizer->>AnonymizerFeed: construct feed record
Anonymizer->>AnonymizerFeed: jsonSerialize()
AnonymizerFeed-->>Anonymizer: residential JSON fields
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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.
Code Review
This pull request introduces a new residential property to the Anonymizer record, represented by the new AnonymizerFeed class, to support data from the GeoIP Residential Proxy database. It also includes comprehensive test coverage for this new feature. The review feedback suggests adding a defensive type check to ensure $record['residential'] is an array before instantiating AnonymizerFeed to prevent potential runtime type errors.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| $this->residential = isset($record['residential']) | ||
| ? new AnonymizerFeed($record['residential']) | ||
| : null; |
There was a problem hiding this comment.
To prevent a potential TypeError at runtime, it is safer to verify that $record['residential'] is indeed an array before passing it to the AnonymizerFeed constructor. If the API response is malformed or contains an unexpected type for this key, this defensive check will prevent a crash.
$this->residential = isset($record['residential']) && \is_array($record['residential'])
? new AnonymizerFeed($record['residential'])
: null;Surface the full-feed GeoIP Residential Proxy database in the anonymizer object as a residential sub-object with confidence, networkLastSeen, and providerName. The feed is a superset of the residential proxies in Anonymous Plus, so the anonymizer object may now be returned with only this property set. The new GeoIp2\Record\AnonymizerFeed class is written to be reused if the server adds sibling sub-objects (vpn, mobile, datacenter) with the same shape. STF-997 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
f0d050c to
0449833
Compare
Summary
The GeoIP Insights web service is adding a
residentialsub-object to theanonymizerobject, sourced from the full-feed GeoIP Residential Proxy database. Because that feed is a superset of the residential proxies in GeoIP Anonymous Plus, theanonymizerobject may now contain only theresidentialkey.confidence,network_last_seen,provider_name) namedAnonymizerFeed, so future sibling feeds (VPN, mobile, datacenter) can share itresidentialproperty on theAnonymizerrecordTesting
phpunit(58 tests, 286 assertions),php-cs-fixer,phpcs, andphpstanall pass.🤖 Generated with Claude Code
Summary by CodeRabbit