Repository navigation
Refresh IANA top level domain list and add rake update_tlds - #43
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
🟡 Changes recommended
The update task can write an error response into the checked-in TLD list.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refreshes the bundled IANA TLD snapshot and adds automated maintenance and coverage for brand gTLDs.
Changes:
- Adds
MERCKandWEBTLDs. - Adds
rake update_tldswith union-based merging. - Adds PSL coverage specs.
- Bumps version to 2.0.10 and updates the changelog.
File summaries
| File | Description |
|---|---|
spec/rails_values/public_domain_suffix_spec.rb |
Adds TLD coverage tests. |
Rakefile |
Adds the TLD refresh task. |
rails_values.gemspec |
Bumps the gem version. |
lib/rails_values/tlds-alpha-by-domain.txt |
Adds missing TLD entries. |
CHANGELOG.md |
Documents the release. |
The Rakefile task should reject unsuccessful IANA responses before parsing or overwriting the snapshot.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| published = Net::HTTP.get(URI(IANA_TLD_URL)).lines.map(&:chomp) | ||
| .reject { |line| line.empty? || line.start_with?('#') } |
|
VA is a country code, not the country name expected by Country.is?, so initialization raises an exception. This causes all 13 specs to fail during file loading, producing 0 examples, 13 errors. Change the record to the supported country name: Diff
JSON |
Summary
PublicDomainSuffix#initializerejects a domain whose last label is absent from the bundledtlds-alpha-by-domain.txt(raise ArgumentError, 'has invalid tld') beforepublic_suffixever sees it, so a stale snapshot silently turns real brand gTLD domains intoExceptionalValue. The snapshot was missingMERCKandWEB, somsd.merckwas exceptional even thoughpublic_suffix's PSL knows the tld. Downstream this breaks contact-to-company auto-linking and search indexing in nexl360 (see NEXL-LTS/nexl360#17696).The refresh merges rather than replaces: IANA has retired 51 tlds still present in our snapshot (
ABARTH,CBS,VOLKSWAGEN, …), and dropping them would make already-stored historical domains newly exceptional.rake update_tldsencodes that union rule so future refreshes are one command.A new spec asserts the snapshot is a superset of every single-label rule in
public_suffix's PSL;onionis the sole expected exception, since it is a special-use name that IANA does not publish.Checklist
rails_values.gemspecTest plan
bundle exec rspec(259 examples, 0 failures) andbundle exec rubocop(no offenses).rake update_tldsre-run against live IANA data reportsadded nothing, confirming the file is current. Verified before/after:PublicDomainSuffix.cast('msd.merck')wasExceptionalValue, now parses with tldmerck;global.weirandbmwgroup.bmware covered by the new brand-gTLD spec.Link to Devin session: https://app.devin.ai/sessions/d71cadb95122427f80ec21aafa2c8c9a
Requested by: @natelindsey-nexl