Skip to content

Conversation

@gildesmarais
Copy link
Member

@gildesmarais gildesmarais commented Jan 2, 2026

This pull request introduces a new convention for organizing config files by registrable domain, improves helper methods for extracting domains and hosts from URLs, and updates related tests and documentation. The most important changes are:

Domain Extraction & Helper Methods:

  • Added a new Helper.url_to_registrable_domain method to extract the registrable domain from a URL, properly handling multi-part TLDs (e.g., bbc.co.uk) and invalid URLs. Relies on the new public_suffix gem. (spec/support/helper.rb, Gemfile, spec/helper_spec.rb) [1] [2] [3]
  • Added Helper.url_to_host_name to reliably extract the full host from a URL, with error handling for invalid URLs. (spec/support/helper.rb, spec/helper_spec.rb) [1] [2]

Config Organization & Validation:

  • Updated the convention for config folder organization: configs should be placed under the registrable domain folder (e.g., example.com/), with legacy subdomain folders still supported but not preferred. (README.md)
  • Modified shared examples for config file specs to validate that configs reside in a folder named after either the host or the registrable domain, supporting the new convention. (spec/support/shared_examples/config.yml_spec.rb)

Testing:

  • Added comprehensive specs for the new helper methods, ensuring correct extraction of registrable domains and hosts, and robust handling of invalid input. (spec/helper_spec.rb)

@gildesmarais gildesmarais marked this pull request as ready for review January 2, 2026 13:28
@gildesmarais gildesmarais requested a review from Copilot January 2, 2026 13:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request relaxes the config folder organization convention to allow configs to be placed under registrable domain folders (e.g., example.com/) instead of requiring subdomain-specific folders (e.g., blog.example.com/). The change introduces new helper methods for extracting registrable domains and hosts from URLs, updates validation logic to accept both conventions, and adds the public_suffix gem dependency.

Key changes:

  • Added Helper.url_to_registrable_domain and Helper.url_to_host_name methods with robust error handling for extracting domain information from URLs
  • Modified config file validation to accept both registrable domain and full host folder names, supporting the new convention while maintaining backward compatibility
  • Added public_suffix gem for proper handling of multi-part TLDs like co.uk

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
spec/support/helper.rb Adds new helper methods for extracting registrable domains and hosts from URLs, with error handling for invalid inputs
spec/helper_spec.rb Adds test coverage for the new URL parsing helper methods with various input scenarios
spec/support/shared_examples/config.yml_spec.rb Updates validation to accept configs in either registrable domain or full host folders, supporting both conventions
README.md Documents the new config folder convention preferring registrable domain folders over subdomain folders
Gemfile Adds public_suffix gem dependency for domain extraction
Gemfile.lock Updates lockfile with public_suffix and its dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@gildesmarais gildesmarais merged commit 7782d60 into master Jan 2, 2026
7 checks passed
@gildesmarais gildesmarais deleted the dev/spec-losen-subdomain-req branch January 2, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants