Skip to content

fix: is_uuid4 rejects valid UUID4 strings with uppercase hex digits - #3041

Open
Shubham-Padkonde wants to merge 1 commit into
snowflakedb:mainfrom
Shubham-Padkonde:fix/is-uuid4-case-sensitive
Open

Shubham-Padkonde wants to merge 1 commit into
snowflakedb:mainfrom
Shubham-Padkonde:fix/is-uuid4-case-sensitive

Conversation

@Shubham-Padkonde

@Shubham-Padkonde Shubham-Padkonde commented Sep 24, 2026 •

Copy link
Copy Markdown

Problem and change

is_uuid4() rejects valid UUID4 strings containing uppercase or mixed-case hexadecimal digits because it compares the parser's lowercase output with the original string. Parse the supplied value without forcing its version and check that its actual UUID version is 4. Existing UUID objects and invalid/non-string inputs retain their explicit handling.

The regression tests cover lowercase, uppercase, mixed-case, UUID objects, version-1 UUIDs, malformed strings, integers and None. No corresponding issue link has been identified; this description does not claim to close one.

Pre-review checklist

  • New automated tests
  • New logging messages
  • New telemetry messages
  • Authorization changes
  • New credentials
  • OCSP changes
  • New dependency

Validation

At the current PR commit d69353241eec9e0665bc454ad7b3a71be6d5d21c, all nine TestIsUuid4 tests pass on Windows with the existing test environment; 96 unrelated tests in the module were deselected. Pytest reports three existing configuration warnings. The full connector suite and live Snowflake integrations were not run for this follow-up. Hosted test workflows still require maintainer approval.

Original implementation attribution: Claude Code, as disclosed in the previous PR description.

Codex reviewed the current diff, ran the focused validation above, and updated this description.

is_uuid4() compared str(UUID(input, version=4)) against the raw input.
str(UUID(...)) always returns a lowercase string, so any input containing
uppercase hex digits (e.g. "550E8400-E29B-41D4-A716-446655440000") would
never equal the lowercase result, causing is_uuid4 to silently return
False for valid UUID4 values.

Fix by dropping the string round-trip in favour of checking the .version
attribute directly. UUID.version returns None for non-RFC-4122 UUIDs and
the integer version number otherwise, so the comparison is both correct
and case-independent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012acaiEt2JyZdUxjQndUWQL

This branch has not been deployed

No deployments
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