Skip to content

Add residential property to Anonymizer record#319

Open
oschwald wants to merge 1 commit into
mainfrom
greg/stf-997-add-residential-to-anonymizer
Open

Add residential property to Anonymizer record#319
oschwald wants to merge 1 commit into
mainfrom
greg/stf-997-add-residential-to-anonymizer

Conversation

@oschwald

@oschwald oschwald commented Jul 10, 2026

Copy link
Copy Markdown
Member

Summary

The GeoIP Insights web service is adding a residential sub-object to the anonymizer object, sourced from the full-feed GeoIP Residential Proxy database. Because that feed is a superset of the residential proxies in GeoIP Anonymous Plus, the anonymizer object may now contain only the residential key.

  • New reusable record for the feed shape (confidence, network_last_seen, provider_name) named AnonymizerFeed, so future sibling feeds (VPN, mobile, datacenter) can share it
  • New residential property on the Anonymizer record
  • Tests, fixtures, and changelog updated

Testing

phpunit (58 tests, 286 assertions), php-cs-fixer, phpcs, and phpstan all pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added residential proxy feed details to anonymizer records.
    • Residential data can now include confidence, last-seen date, and provider information.
    • Residential-only anonymizer records are supported and serialize correctly.
  • Documentation
    • Updated the unreleased changelog to describe the new residential field and its available data sources.
  • Tests
    • Added coverage for full residential feed data and residential-only inputs.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 1f6cd009-90e8-48af-bf27-992eff9462e5

📥 Commits

Reviewing files that changed from the base of the PR and between f0d050c and 0449833.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • src/Record/Anonymizer.php
  • src/Record/AnonymizerFeed.php
  • tests/GeoIp2/Test/Model/InsightsTest.php

📝 Walkthrough

Walkthrough

The 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.

Changes

Anonymizer residential feed

Layer / File(s) Summary
Residential feed model integration
src/Record/Anonymizer.php, src/Record/AnonymizerFeed.php
Adds the immutable AnonymizerFeed record and exposes it through Anonymizer, including conditional JSON serialization.
Residential feed validation and release documentation
tests/GeoIp2/Test/Model/InsightsTest.php, CHANGELOG.md
Tests populated and residential-only inputs, and documents the new residential property and feed fields.

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
Loading

Poem

A rabbit hops through fields so bright,
With confidence tucked in just right.
Last-seen dates and providers flow,
Residential details now show.
The feed springs cleanly into sight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change by adding a residential property to the Anonymizer record.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch greg/stf-997-add-residential-to-anonymizer

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/Record/Anonymizer.php
Comment on lines +98 to +100
$this->residential = isset($record['residential'])
? new AnonymizerFeed($record['residential'])
: null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant