fix(discovery): format duplicate similarity with Locale.ROOT (robust duplicate %) - #79
Merged
Merged
Conversation
The near-duplicate 409's ProblemDetail detail carries the similarity as a machine-parsed value (the client regexes "similarity 0.87" and shows the %). It was formatted with the JVM default locale, so a comma-decimal locale would emit "0,87" and the client would read the score as 0 (0%) on the duplicate surface. Force Locale.ROOT so the decimal is always a dot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The near-duplicate
409 DUPLICATE_USER_STORYcarries the similarity as a machine-parsed value: the frontend regexessimilarity 0.87out of the ProblemDetaildetailand shows it as a percentage on the manual-create and import duplicate surfaces. It was built with"...%.2f".formatted(similarity), which uses the JVM default locale — a comma-decimal locale (es-PE, Germany, …) would emit0,87, and the client regex ([0-9]*\.?[0-9]+) would then read the score as 0 (0%).Force
Locale.ROOTso the decimal separator is always a dot, regardless of the container locale. Found during the discovery streaming audit — the duplicate flow is part of the demo.Bounded context / area: discovery
Type of Change
fixtestChecklist
develop./gradlewcompile + new unit test pass (locale-pinned assertion)How to Test
New
DiscoveryExceptionsTestpins the default locale toLocale.GERMANYand asserts the message containssimilarity 0.87(dot), not0,87. Manually: create a near-duplicate story → the 409 toast shows the correct similarity % in any locale.