[DEV-15452] Mythos finding - district_original location filter silently overwrites district_current - #4702
Merged
Conversation
sethstoudenmier
approved these changes
Jul 27, 2026
sethstoudenmier
left a comment
Contributor
There was a problem hiding this comment.
Overall LGTM. Left one comment that I won't block over.
Contributor
There was a problem hiding this comment.
This file seems so share similar logic with the "location_filter_geocode.py" file. Won't block on this, but could some of it be consolidated to avoid repeating?
Contributor
Author
There was a problem hiding this comment.
I will evaluate the possibility of consolidation and report back. Thanks!
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.
Description:
In location_filter_geocode.py a district_current filter silently overwrites a district_original filter when both present in multi-element filter.
Expected behavior is to combine in a django query using logical OR operator.
Technical Details:
location_filter_geocode.py:47-50 assigns district_qs = Q(...) for district_current then unconditionally reassigns (not |=) for district_original, so when both lists are non-empty the current-CD predicate is dropped.
The only guard, validate_location_keys at :75, rejects both keys within a single list element, but create_nested_object at :126-134 .extend()s per-state across multiple elements, so [{state:VA,district_current:08},{state:VA,district_original:11}] populates both lists for VA without tripping :75.
Upstream TinyShield schemas (common/validator/award_filter.py:141-178, download/v2/request_validations.py:171-223) validate shape/length per element only, with no cross-element district check.
Reachable from the public Postgres download path via download/lookups.py:86 → search.py:25 → search.py:226/241 → geocode_filter_locations.
Acceptance Criteria
The district_current filter is no longer overwritten.
Requirements for PR Merge:
Explain N/A in above checklist:
2 - NA (API documentation) - there was no change to the API
3 - NA (Data validation) - there was no change to the data
4 - NA (ops tickets) - there is no ops involvement beyond the standard qat merge and deployment