Skip to content

fix(preprod): fix flaky test by avoiding search field collisions#108641

Draft
joshuarli wants to merge 2 commits intomasterfrom
fix/flaky-test-preprod-build-search
Draft

fix(preprod): fix flaky test by avoiding search field collisions#108641
joshuarli wants to merge 2 commits intomasterfrom
fix/flaky-test-preprod-build-search

Conversation

@joshuarli
Copy link
Member

Summary

  • test_list_builds_search_by_build_id searches with query={artifact.id} and expects 1 result, but the endpoint's search does an OR query across id, pr_number, and head_sha (icontains)
  • The old head_sha ("1234567890...") contained most small numbers as substrings, causing auto-incremented artifact IDs to accidentally match all 4 artifacts via head_sha__icontains
  • Additionally, pr_number=123 could collide with auto-incremented artifact IDs
  • Changed head_sha to all-letter hex ("abcdefab...") and pr_number to 99000123 to eliminate collisions

Fixes #108637

test_list_builds_search_by_build_id searches with query={artifact.id}
and expects exactly 1 result. However, the search does an OR across
id, pr_number, and head_sha (icontains). The old head_sha
"1234567890..." contained most small numbers as substrings, and
pr_number=123 could collide with auto-incremented artifact IDs.

Use an all-letter hex head_sha and a large pr_number to prevent
auto-incremented IDs from accidentally matching other search fields.

Fixes #108637
Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

head_sha="1234567890098765432112345678900987654321",
base_sha="9876543210012345678998765432100123456789",
head_sha="abcdefabcdefabcdefabcdefabcdefabcdefabcd",
base_sha="fedcbafedcbafedcbafedcbafedcbafedcbafedcb",
Copy link
Contributor

Choose a reason for hiding this comment

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

base_sha is 41 characters instead of 40

Low Severity

The new base_sha value "fedcbafedcbafedcbafedcbafedcbafedcbafedcb" is 41 characters long, while a valid SHA-1 hash is exactly 40 hex characters. The head_sha correctly uses the pattern "abcdef" × 6 + "abcd" = 40 chars, but base_sha uses "fedcba" × 6 + "fedcb" = 41 chars. The trailing "fedcb" has one extra character compared to the "abcd" suffix of head_sha.

Fix in Cursor Fix in Web

@joshuarli joshuarli marked this pull request as draft February 21, 2026 22:56
@joshuarli
Copy link
Member Author

why is fedcbafedcbafedcbafedcbafedcbafedcbafedcb 1 character extra? seems wrong

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

1 participant