Skip to content

Unified link converter methods - #3068

Open
Evanthx wants to merge 2 commits into
mainfrom
link_converter
Open

Unified link converter methods#3068
Evanthx wants to merge 2 commits into
mainfrom
link_converter

Conversation

@Evanthx

@Evanthx Evanthx commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

There are multiple encoding and decoding methods for links, all pretty close but not quite. That had me worried as it is easy for them to get out of sync. This PR should be no functional changes, but merges those methods.

I also compared the behavior across the other SDKs, and am unifying them - a few edge cases didn't quite match up. The changes to the Java SDK behavior are:

  1. Query values are read from the raw query string
    Previously parseQueryParams used uri.getQuery(), which is already percent-decoded, then decoded it a second time. Any value containing % made URLDecoder throw and the link was silently dropped; splitting on &/= after decoding also mis-split values containing those characters. Only reason had been moved to the raw query. Now every param is read from getRawQuery().
    Aligns with: .NET (reads raw uri.Query); api-go, Python and TypeScript are correct by construction.

  2. Path segment count is matched exactly — trailing segments and trailing slashes rejected
    The StringTokenizer walk stopped checking once it had the segments it needed, so .../run-id/history/extra and .../run-id/history/ both parsed.
    Aligns with: api-go and Python (anchored regexes), .NET (exact segment count).

  3. Every decoder validates the declared link type
    Three of the four already did; nexusLinkToWorkflowEvent did not, so a mistyped link passed straight to it would parse instead of being refused. No in-repo caller is affected — they all go through the dispatcher.
    Aligns with: api-go and .NET, which check on every decoder.

  4. A repeated query key takes its first occurrence
    Previously inconsistent: reason took the first (rawQueryParam returns on match) while the workflow-event params took the last (HashMap.put). Now uniformly first.
    Aligns with: api-go (url.Values.Get). Python and .NET reject duplicates outright. No encoder emits a repeated key.

@Evanthx
Evanthx requested a review from a team as a code owner September 12, 2026 00:02
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