Skip to content

DEV-15826: Handle no matching toptier on agency office autocomplete endpoints - #4728

Open
gregrholden wants to merge 6 commits into
qatfrom
fix/DEV-15826-no-toptier-in-autocomplete
Open

DEV-15826: Handle no matching toptier on agency office autocomplete endpoints#4728
gregrholden wants to merge 6 commits into
qatfrom
fix/DEV-15826-no-toptier-in-autocomplete

Conversation

@gregrholden

@gregrholden gregrholden commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description:

DEV-15826: Handle no matching toptier on agency office autocomplete endpoints [f9019].

The references/autocomplete.py's BaseAutocompleteViewSet class contains a logic error where toptier_agency is referenced incorrectly in the subtier_agency lookup loop.

Technical Details:

At first glance, it looked like the error was due to cases where an empty toptier_agency variable had not been instantiated, but is then later called in the subtier_agency loop, throwing an error. Upon further inspection, it appears the reference to toptier_agency is incorrect altogether. All toptier_agency results are handled in the toptier_agency loop on lines 107-134. Referencing this variable in a later subtier_agency loop would only reference the last iteration value from the toptier loop, potentially returning stale and/or incorrect data for the subtier iteration. Since it might not have been instantiated, it also opened the door to the reported errors happening when no toptier agency gets used.

The fix is straightforward: Update the subtier_agency loop so it correctly searches the subtier_agency office values instead of the toptier_agency office values, which have already been handleld in an earlier loop. Tests have been added to cover cases where subtier agencies are all that are present in the autocomplete lookup for both awarding and funding agencies.

Requirements for PR Merge:

  1. Unit & integration tests updated
  2. API documentation updated (examples listed below)
    1. API Contracts
    2. API UI
    3. Comments
  3. Data validation completed (examples listed below)
    1. Does this work well with the current frontend? Or is the frontend aware of a needed change?
    2. Is performance impacted in the changes (e.g., API, pipeline, downloads, etc.)?
    3. Is the expected data returned with the expected format?
  4. Appropriate Operations ticket(s) created
  5. Jira Ticket(s)
    1. DEV-15826

Explain N/A in above checklist:

@gregrholden gregrholden added the ready for review [PR] ready to be reviewed label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review [PR] ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant