Skip to content

Add residential sub-object to anonymizer for Insights#440

Open
oschwald wants to merge 2 commits into
mainfrom
greg/stf-997-add-residential-to-anonymizer
Open

Add residential sub-object to anonymizer for Insights#440
oschwald wants to merge 2 commits 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

Also converts the __import__("datetime") inline-import hack in tests/models_test.py to a normal top-level import.

Testing

pytest (79 passed), ruff check, ruff format --check, and mypy all pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Added support for Residential Proxy anonymizer feed in Insights.
    • Includes provider name, confidence, and network last-seen date.
    • Residential feed may be present even when other anonymizer fields are empty.
    • Network last-seen is parsed into a standard date format.
  • Documentation
    • Updated release history to document the new residential anonymizer attribute.
  • Tests
    • Expanded and added assertions to cover residential-only and default/minimal payload behavior.
  • Chores
    • Updated constructor catch-all type hints and Ruff configuration.

@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: d6e45890-4114-4b2a-b0e2-e1f4d68bacc6

📥 Commits

Reviewing files that changed from the base of the PR and between bdb75bb and a1e227a.

📒 Files selected for processing (6)
  • CLAUDE.md
  • HISTORY.rst
  • pyproject.toml
  • src/geoip2/models.py
  • src/geoip2/records.py
  • tests/models_test.py

📝 Walkthrough

Walkthrough

Adds a typed AnonymizerFeed for Residential Proxy data, wires it into Anonymizer, parses network_last_seen as a date, and adds tests for full, minimal, and residential-only Insights data. Constructor catch-all annotations are also changed from Any to object.

Changes

Residential anonymizer feed and typing updates

Layer / File(s) Summary
Residential feed model and wiring
src/geoip2/records.py
Adds AnonymizerFeed, exposes Anonymizer.residential, accepts optional residential data, and parses network_last_seen.
Residential feed validation and documentation
tests/models_test.py, HISTORY.rst
Tests populated, missing, and residential-only feed data and documents the new attribute.
Constructor typing consistency
src/geoip2/models.py, src/geoip2/records.py, CLAUDE.md, pyproject.toml
Changes ignored constructor keyword annotations from Any to object, updates guidance, and removes the corresponding Ruff ignore.

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

Poem

A rabbit found a feed so neat,
With dates and names and confidence sweet.
The anonymizer learned its part,
Tests confirmed each nested chart.
Hop, hop—the changelog’s complete!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.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
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding a residential sub-object to the Insights anonymizer.
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 adds support for the GeoIP Residential Proxy database by introducing the AnonymizerFeed class and a new residential attribute to the Anonymizer record. The changes include updating the Anonymizer initialization to parse residential proxy data, updating the history log, and adding unit tests to verify the parsing and default behaviors of the new attribute. I have no feedback to provide.

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: 2

🤖 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/geoip2/records.py`:
- Around line 294-301: Update the unused keyword-argument parameter in the
__init__ method to annotate its values with object instead of Any, preserving
the existing **_ behavior and accepted arguments.

In `@tests/models_test.py`:
- Around line 346-355: Add to_dict() serialization assertions in
tests/models_test.py at lines 346-355 and 371-379: assert the absent-field case
serializes to {"traits": {"ip_address": "5.6.7.8"}}, and the residential-only
case serializes to the specified anonymizer.residential data alongside traits.
Preserve the existing attribute assertions.
🪄 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: 8d8d72c4-6fcd-432b-a6eb-36e20c648bd3

📥 Commits

Reviewing files that changed from the base of the PR and between a46411b and bdb75bb.

📒 Files selected for processing (3)
  • HISTORY.rst
  • src/geoip2/records.py
  • tests/models_test.py

Comment thread src/geoip2/records.py
Comment thread tests/models_test.py
oschwald and others added 2 commits July 14, 2026 16:02
The GeoIP Insights web service now nests a residential object inside
the anonymizer object. Add a reusable geoip2.records.AnonymizerFeed
record (confidence, network_last_seen, provider_name) so additional
anonymizer feeds can share the same shape, and expose it as
Anonymizer.residential. The residential attribute may be populated
even when no other anonymizer attributes are set, so the anonymizer
object may now contain only the residential attribute.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Use object rather than Any for the discarded **_ keyword-argument
parameters. object is the correct type for values that are accepted but
never used, and it satisfies Ruff's ANN401 rule, so the per-file ANN401
ignore for models.py and records.py can be removed.

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