Skip to content

fix port to host assignments in connection strings - #1

Open
supersven wants to merge 2 commits into
wire-patchesfrom
sventennie/fix-port-to-host-assignments
Open

fix port to host assignments in connection strings#1
supersven wants to merge 2 commits into
wire-patchesfrom
sventennie/fix-port-to-host-assignments

Conversation

@supersven

@supersven supersven commented Aug 24, 2026

Copy link
Copy Markdown

The rules:

  • If there is no port field, use the default for all hosts
  • If there is exactly one port value, use it for all hosts
  • If there are more than one port values, they are matched 1:1 to the hosts (counts must match!)
  • port1, means port1,<default>, ,port2 means <default>,port2, port1,,port3 means port1,<default>,port3

Port / host mappings can fail now. Express this with MonadFail.

N.B. only 9780828 is a candidate for upstreaming as fromKeyValueParams doesn't exist upstream.

wire-server currently follows a feature branch: https://github.com/wireapp/wire-server/blob/a1fb9bc0a6fdaa8d286f8d0b25cfe6e0572b22ba/flake.lock#L350-L366 So, this won't break it now, but callers of fromKeyValueParams need to be adjusted once the followed branch is switched there.

Ticket: https://wearezeta.atlassian.net/browse/WPB-27405


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

Briefly describe the issue you have solved or implemented with this pull request. If the PR contains multiple issues, use a bullet list.

Causes (Optional)

Briefly describe the causes behind the issues. This could be helpful to understand the adopted solutions behind some nasty bugs or complex issues.

Solutions

Briefly describe the solutions you have implemented for the issues explained above.

Dependencies (Optional)

If there are some other pull requests related to this one (e.g. new releases of frameworks), specify them here.

Needs releases with:

  • GitHub link to other pull request

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Briefly describe how this change was tested and if applicable the exact steps taken to verify that it works as expected.

Notes (Optional)

Specify here any other facts that you think are important for this issue.

Attachments (Optional)

Attachments like images, videos, etc. (drag and drop in the text box)


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

@supersven
supersven force-pushed the sventennie/fix-port-to-host-assignments branch from d6b45a3 to 6f99b77 Compare August 24, 2026 15:35
@supersven supersven changed the title Sventennie/fix port to host assignments fix port to host assignments in connection strings Aug 24, 2026
@supersven
supersven force-pushed the sventennie/fix-port-to-host-assignments branch from 6f99b77 to 9780828 Compare August 25, 2026 08:32
@supersven
supersven marked this pull request as ready for review August 25, 2026 08:35

@akshaymankar akshaymankar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

This function will fail once we enforce the hosts to ports mapping
rules. So, it needs to be able to communicate failure and force callers
to deal with them.
The cases for specified `port` values are:
- 0: default port for all hosts
- 1: specified port for all hosts
- n: one port per host (counts must match)

See
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-MULTIPLE-HOSTS
@supersven
supersven force-pushed the sventennie/fix-port-to-host-assignments branch from 9780828 to 7ea58b3 Compare August 27, 2026 14:46
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