Skip to content

fix: flaky testProviderSearchWhitelist test - #5416

Merged
blackheaven merged 2 commits into
developfrom
gdifolco/fix-flaky-tests-provider-search-whitelist
Aug 5, 2026
Merged

fix: flaky testProviderSearchWhitelist test#5416
blackheaven merged 2 commits into
developfrom
gdifolco/fix-flaky-tests-provider-search-whitelist

Conversation

@blackheaven

Copy link
Copy Markdown
Contributor

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

randomString in integration/test/API/Common.hs used bare randomIO
(full Unicode range, including surrogate code points U+D800-U+DFFF).
When the random service-name prefix contained a surrogate, it diverged
across two transports: Text.pack (JSON body / name path) replaced it
with U+FFFD, while URL byte percent-encoding (query prefix path)
emitted raw WTF-8 bytes. The server's Text.isPrefixOf match then
failed, filtering out all services and returning services: [].

Constrain randomString to the alphanumeric alphabet [A-Za-z0-9] via
the existing mkArray/pick idiom (matching randomName and every sibling
helper in the same file), eliminating non-scalar code points at the
source. This also closes a latent ordering flake: the old full-range
Char could emit code points below '0', which would break the
"0000000000|..." sorts-first assertion.
@blackheaven
blackheaven requested a review from a team as a code owner August 4, 2026 18:06
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Aug 4, 2026
Revert the over-broad constraint on the shared `randomString` (c0cc978)
back to its original full-range `randomIO` form, restoring original fuzz
behavior for the other callers (test passwords, `randomJSON`).

Add a dedicated `randomAlphaString` ([A-Za-z0-9]) and use it only at the
`namePrefix` call site of `testProviderSearchWhitelist` — the sole value
that crosses both transports: a JSON service-name body (`Text.pack`) and a
URL search-prefix query param (percent-encoding). Full-range `Char` can
include surrogate code points that the two transports map differently
(WTF-8 bytes vs one U+FFFD per surrogate), so the reconstructed prefix is
no longer a prefix of the stored names and the search returns 0/20
services — the flake.

Leaves `serviceSuffix` on `randomString` since it is JSON-body-only.

@supersven supersven left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

@supersven

Copy link
Copy Markdown
Contributor

Please come up with a more precise and less chatty commit message when you squash and merge this 😸

@blackheaven
blackheaven merged commit 6a75667 into develop Aug 5, 2026
9 checks passed
@blackheaven
blackheaven deleted the gdifolco/fix-flaky-tests-provider-search-whitelist branch August 5, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants