Skip to content

Add residential proxy data to Anonymizer record#740

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

Add residential proxy data to Anonymizer record#740
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. It contains residential proxy data for the network and may be populated even when no other anonymizer properties are set.

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

A deprecated constructor matching the previous Anonymizer signature keeps this a non-breaking change for the 5.2.0 minor release; the api-compat profile passes with no exclusions.

Testing

mvn -B test, mvn -B checkstyle:check, mvn -B javadoc:javadoc, and mvn -B verify -P api-compat all pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for a new residential anonymizer feed in Insights anonymizer results.
    • Includes confidence, last-seen date, and provider name, and may be provided independently of other anonymizer fields.
  • Documentation
    • Updated the changelog and public docs to describe the new residential anonymizer data and its JSON shape.
  • Tests
    • Extended anonymizer and JSON serialization tests to validate the residential feed.
    • Updated test fixtures to include residential anonymizer data.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Anonymizer record now includes a residential proxy feed represented by AnonymizerFeed, with JSON mappings, null initialization, updated fixtures, serialization coverage, and changelog documentation.

Changes

Anonymizer residential feed

Layer / File(s) Summary
Feed contract
src/main/java/com/maxmind/geoip2/record/AnonymizerFeed.java
Adds the AnonymizerFeed record with confidence, last-seen date, and provider fields mapped to JSON.
Anonymizer integration and validation
src/main/java/com/maxmind/geoip2/record/Anonymizer.java, src/test/java/com/maxmind/geoip2/model/*, src/test/resources/test-data/*, CHANGELOG.md
Adds the residential feed to Anonymizer, defaults missing values, updates constructor delegation and documentation, and extends parsing and serialization fixtures and assertions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant InsightsJSON
  participant Anonymizer
  participant AnonymizerFeed
  participant InsightsResponseTest
  InsightsJSON->>Anonymizer: Deserialize residential object
  Anonymizer->>AnonymizerFeed: Construct feed metadata
  Anonymizer-->>InsightsResponseTest: Return residential feed
  InsightsResponseTest->>AnonymizerFeed: Assert feed fields
Loading

Suggested reviewers: horgh, rafl, 2shortplanks

Poem

A rabbit hops through JSON bright,
Finds residential data in sight.
Confidence, dates, provider too,
All tucked in a feed so new.
“Anonymized!” the bunny sings,
While tests check every field it brings.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding residential proxy data to the Anonymizer record.
✨ 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 field to the Anonymizer record, which is represented by a new AnonymizerFeed record containing confidence, networkLastSeen, and providerName fields. It also updates the constructors, test cases, and test data to support and verify this new field. I have no feedback to provide as there are no review comments.

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/main/java/com/maxmind/geoip2/record/Anonymizer.java`:
- Around line 66-84: Add a deprecated public 9-parameter bridge constructor to
the Anonymizer record, matching the previous constructor signature and parameter
order, and delegate to the canonical constructor with residential set to null.
Include the appropriate deprecation annotation and Javadoc directing callers to
the current constructor.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 63b773a6-4f3d-4cd9-8805-fea131a9f103

📥 Commits

Reviewing files that changed from the base of the PR and between 33b6ceb and 71f810b.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • src/main/java/com/maxmind/geoip2/record/Anonymizer.java
  • src/main/java/com/maxmind/geoip2/record/AnonymizerFeed.java
  • src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java
  • src/test/java/com/maxmind/geoip2/model/JsonTest.java
  • src/test/resources/test-data/insights0.json
  • src/test/resources/test-data/insights1.json

Comment thread src/main/java/com/maxmind/geoip2/record/Anonymizer.java

@coderabbitai coderabbitai 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.

♻️ Duplicate comments (1)
src/main/java/com/maxmind/geoip2/record/Anonymizer.java (1)

66-84: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Add a deprecated constructor matching the old 9-parameter signature for backward compatibility.

This was previously flagged and remains unresolved. Since 5.2.0 is a minor version release, the coding guidelines require a deprecated bridge constructor matching the old 9-parameter signature (without residential) to maintain backward compatibility for callers that construct Anonymizer directly.

As per coding guidelines: "For minor version releases, add a deprecated constructor matching the old signature when adding new fields to existing record classes to maintain backward compatibility."

Note: the version in the deprecation annotation should be 5.2.0, not 5.1.1 as suggested in the prior review.

🔧 Proposed fix: add deprecated 9-parameter constructor
+    /**
+     * `@deprecated` Use the canonical constructor that includes the
+     *             {`@code` residential} parameter instead.
+     */
+    `@Deprecated`(since = "5.2.0", forRemoval = true)
+    public Anonymizer(
+        Integer confidence,
+        boolean isAnonymous,
+        boolean isAnonymousVpn,
+        boolean isHostingProvider,
+        boolean isPublicProxy,
+        boolean isResidentialProxy,
+        boolean isTorExitNode,
+        LocalDate networkLastSeen,
+        String providerName
+    ) {
+        this(confidence, isAnonymous, isAnonymousVpn, isHostingProvider,
+            isPublicProxy, isResidentialProxy, isTorExitNode,
+            networkLastSeen, providerName, null);
+    }
+
     /**
      * Constructs an {`@code` Anonymizer} record with {`@code` null} values for all the nullable
      * fields and {`@code` false} for all boolean fields.
      */
     public Anonymizer() {
         this(null, false, false, false, false, false, false, null, null, null);
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/main/java/com/maxmind/geoip2/record/Anonymizer.java` around lines 66 -
84, Add a deprecated 9-parameter constructor to the Anonymizer record matching
the previous signature without residential, annotated as deprecated since 5.2.0,
and delegate to the canonical constructor with residential set to null or the
appropriate default. Preserve the existing no-argument constructor and
null/default handling.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@src/main/java/com/maxmind/geoip2/record/Anonymizer.java`:
- Around line 66-84: Add a deprecated 9-parameter constructor to the Anonymizer
record matching the previous signature without residential, annotated as
deprecated since 5.2.0, and delegate to the canonical constructor with
residential set to null or the appropriate default. Preserve the existing
no-argument constructor and null/default handling.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d40702cc-d72a-4150-8d98-1205a21e5b72

📥 Commits

Reviewing files that changed from the base of the PR and between 71f810b and 3fa9d90.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • src/main/java/com/maxmind/geoip2/record/Anonymizer.java
  • src/main/java/com/maxmind/geoip2/record/AnonymizerFeed.java
  • src/test/java/com/maxmind/geoip2/model/InsightsResponseTest.java
  • src/test/java/com/maxmind/geoip2/model/JsonTest.java
  • src/test/resources/test-data/insights0.json
  • src/test/resources/test-data/insights1.json

@oschwald oschwald force-pushed the greg/stf-997-add-residential-to-anonymizer branch from 3fa9d90 to c8d5f9c Compare July 11, 2026 02:02
Adds a residential field to the Anonymizer record containing
residential proxy data for the network. This data is exposed as a
new reusable AnonymizerFeed record (confidence, networkLastSeen,
providerName) so that future anonymizer feeds (e.g. VPN, mobile,
datacenter) can share the same shape. The residential field may be
populated even when none of the other Anonymizer fields are set.

A deprecated constructor with the previous signature is retained on
Anonymizer for backward compatibility in this minor release.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@oschwald oschwald force-pushed the greg/stf-997-add-residential-to-anonymizer branch from c8d5f9c to d9d8576 Compare July 14, 2026 00:07
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