Extract shared matching helpers into matching_common - #574
Merged
Merged
Conversation
Move normalize, get_country_codes, to_region, and check_latin_chars into rorapi.common.matching_common and re-export from matching and matching_single_search so existing imports keep working. Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
Use max([...]+[0]) so empty/non-alpha affiliations return [] instead of raising ValueError, matching prior single-search behavior. Co-authored-by: Joseph Rhoads <jrhoads@users.noreply.github.com>
cursor
Bot
force-pushed
the
quickwin/matching-common
branch
2 times, most recently
from
September 25, 2026 14:22
20ca4de to
7c4641e
Compare
jrhoads
marked this pull request as ready for review
September 25, 2026 14:31
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.
Summary
normalize,get_country_codes,to_region, andcheck_latin_charsinto newrorapi/common/matching_common.py(shared by multi-node and single-search matching).matching.pyandmatching_single_search.pyso existing imports keep working.countries.txt.Intentional
get_country_codeschangematching.pyusedmax([...])(canValueErroron empty token lists);matching_single_search.pyusedmax([...]+[0]).matching_common.get_country_codesnow uses the defensive+ [0]form so empty/non-alpha affiliations return[]instead of raising — preserving single-search behavior and hardening multi-search.Test plan
CountriesTestCase,NormalizeTestCase, and related matching utils) via Django test loader"","123", etc.) returns[]withoutValueErrortests_uniton this PR (flow-guard+test-pr / testgreen)ruffexpected-red until Wave 5 (continue-on-error: true; not fixed in this PR)