Skip to content

Add optional addressable-normalize to Twingly::URL::Extended - #169

Merged
Eric-Twingly merged 6 commits into
masterfrom
v7.1.1/addressable-normalize
Sep 15, 2026
Merged

Eric-Twingly merged 6 commits into
masterfrom
v7.1.1/addressable-normalize

Conversation

@Eric-Twingly

@Eric-Twingly Eric-Twingly commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Rename of #167.

Adds an opt-in addressable normalize to extended normalization.

@Eric-Twingly Eric-Twingly changed the title V7.1.1/addressable normalize Add optional addressable-normalize to Twingly::URL::Extended Sep 9, 2026
@Eric-Twingly

Copy link
Copy Markdown
Contributor Author

@bjornkellner Renaming the branch auto closed the original, tried to address your comments from #167 in 6653091.

@Eric-Twingly
Eric-Twingly requested review from bjornkellner and a balanced review from Copilot September 9, 2026 10:46
@Eric-Twingly
Eric-Twingly marked this pull request as ready for review September 9, 2026 10:48

Copilot AI 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.

🟡 Changes recommended

The public struct layout breaks positional consumers, and invalid URLs reject the new normalization keyword.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds optional Addressable canonicalization before extended URL normalization and hashing.

Changes:

  • Adds addressable_normalize support and exposes the canonicalized URL.
  • Expands tests and documents the new behavior.
  • Identified compatibility issues with HashResult ordering and invalid URLs.
File summaries
File Description
lib/twingly/url/extended.rb Implements Addressable normalization and extends hash results.
spec/lib/twingly/url/extended_spec.rb Tests canonicalization and hashing behavior.
README.md Documents the new API and result field.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/twingly/url/extended.rb Outdated
Comment thread lib/twingly/url/extended.rb
Comment thread lib/twingly/url/extended.rb

original_url = twingly_url.original_url_without_blacklisted_parameters
original_url = twingly_url.original_url_without_blacklisted_parameters
addressable_normalized = twingly_url.addressable_normalized

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I consider addressable_normalized_url the new "standard url" that we will use and pass through our system, i think it should have the blacklisted parameters removed.

Same in the addressable_normalized function. Maybe add it there, even though the name get's a bit misguiding.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added blacklisted parameter stripping to the addressable normalized URL in 10c9129. I opted to not include the blacklisted parameter stripping in the addressable_normalized function because it would be misleading, like you suggested.

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

Nice job!
maybe update version ?

Base automatically changed from v7.1.0/hasher to master September 15, 2026 04:49
Refactors to avoid parsing multiple times, and renames to addressable normalize to more accurately reflect the normalization applied.
Renames the addressable normalized URL in normalize_and_calculate_urlhash return to callable URL, which includes blacklist stripping.
@Eric-Twingly
Eric-Twingly force-pushed the v7.1.1/addressable-normalize branch from 10c9129 to 41ab605 Compare September 15, 2026 04:50
@Eric-Twingly
Eric-Twingly merged commit 2a4be4b into master Sep 15, 2026
18 checks passed
@Eric-Twingly
Eric-Twingly deleted the v7.1.1/addressable-normalize branch September 15, 2026 04:57
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.

3 participants