Skip to content

Fix acronym handling in camelCase→snake_case conversion#6

Merged
iimpulse merged 4 commits intoenhancement/model-syncfrom
copilot/sub-pr-4-again
Feb 11, 2026
Merged

Fix acronym handling in camelCase→snake_case conversion#6
iimpulse merged 4 commits intoenhancement/model-syncfrom
copilot/sub-pr-4-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 11, 2026

The normalize_field_name function used naive character-by-character conversion that mangled acronyms, producing false-positive drift reports (APIResponsea_p_i_response instead of api_response).

Changes

  • Replaced single-pass character iteration with two-pass regex approach:
    1. Insert underscore before uppercase followed by lowercase: APIResponseAPI_Response
    2. Insert underscore between lowercase/digit and uppercase: getUserIDget_User_ID
    3. Lowercase the result

Examples

# Before (naive)
normalize_field_name("APIResponse")      # "a_p_i_response" ❌
normalize_field_name("HTTPSConnection")  # "h_t_t_p_s_connection" ❌

# After (regex-based)
normalize_field_name("APIResponse")      # "api_response" ✓
normalize_field_name("HTTPSConnection")  # "https_connection" ✓
normalize_field_name("getUserID")        # "get_user_id" ✓

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 11, 2026 19:29
Co-authored-by: iimpulse <7397665+iimpulse@users.noreply.github.com>
Co-authored-by: iimpulse <7397665+iimpulse@users.noreply.github.com>
Co-authored-by: iimpulse <7397665+iimpulse@users.noreply.github.com>
Copilot AI changed the title [WIP] Update model sync enhancement based on feedback Fix acronym handling in camelCase→snake_case conversion Feb 11, 2026
Copilot AI requested a review from iimpulse February 11, 2026 19:33
@iimpulse iimpulse marked this pull request as ready for review February 11, 2026 20:03
@iimpulse iimpulse merged commit b1f2dc9 into enhancement/model-sync Feb 11, 2026
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