Skip to content

fix(peers): compare effective ports when recognizing our own URL - #1279

Draft
hackobi wants to merge 2 commits into
chef/peer-self-url-trailing-dotfrom
chef/peer-self-url-variants
Draft

hackobi wants to merge 2 commits into
chef/peer-self-url-trailing-dotfrom
chef/peer-self-url-variants

Conversation

@hackobi

@hackobi hackobi commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

This follow-up to #1198 extends the existing self-address check to compare effective TCP ports. The comparison keeps the existing host and port-string checks and also recognizes a default port written explicitly under another scheme. Sixteen new unit cases cover URL normalization, the four newly handled pairs and distinct peers that should remain accepted.

Verification

  • On the repository's pinned Bun 1.4.4, bun test ./src/libs/peer/selfUrlAlias.test.ts passed 22/22 at 2b7e256c55c6c33a5e848f5a694fd0efa5e3c8c9. Against fix(peer): refuse our own address written with a trailing dot #1198's implementation, 18 cases passed and precisely the four new behavior cases failed.
  • The release suite, build-style type check and rehearsal passed. The base and candidate had the same existing lint, TypeScript, launcher, consensus and lockstep failures. The peer-directory run also had the same five failures on both revisions.
  • Claude built the change. An independent Hermes review approved this SHA and repeated the focused positive and negative controls on Bun 1.3.14. The coordinator separately verified the focused suite on Bun 1.4.4. The stacked target falls outside the branch filter for the main consensus CI workflow.

The legacy comparison still treats two implicit ports on the same host as equal, including when HTTP and HTTPS defaults differ. The reviewer flagged this as a pre-existing policy question. This change keeps that behavior and limits the new comparison to the existing self-address guard.

Cover host and scheme case, percent-encoded host letters, leading zeros
in the port, explicit default ports, and our host and TCP port written
under the other scheme's default port.
urlPointsAtUs compared URL.port strings, so our host and TCP port
written under the other scheme's default (https://us.example and
http://us.example:443) was accepted for another identity. Also refuse
when the effective ports match.
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

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.

1 participant