Skip to content

Fix #454: Report failed HLR lookup sources instead of silently ignoring - #455

Open
marioalbu08 wants to merge 3 commits into
NovaCode37:mainfrom
marioalbu08:fix/hlr-lookup-trap
Open

marioalbu08 wants to merge 3 commits into
NovaCode37:mainfrom
marioalbu08:fix/hlr-lookup-trap

Conversation

@marioalbu08

Copy link
Copy Markdown
Contributor

Summary

Resolves #454 by tracking network timeouts and HTTP errors from reverse lookup sources and appending them to a new sources_failed array.

Changes

  • Updated HLRLookup.reverse_lookup in modules/hlr_lookup.py to capture requests.get timeouts and non-200 status codes.
  • Added a total_sources_attempted counter. If the length of sources_failed matches the total attempted sources, the result is now properly annotated as an ERROR using module_status.annotate.
  • Added test_reverse_lookup_partial_failure and test_reverse_lookup_all_failed to tests/test_modules_extended.py using monkeypatch to simulate 500/404/Timeouts and verify the new arrays.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • I have tested these changes locally
  • I have added/updated tests as needed

@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

Thanks for the first pull request here. CI needs a maintainer to approve the run before it starts, so it may sit for a bit before anything happens. pytest tests/ -q passing is the main thing I look at.

@github-actions github-actions Bot added the python Pull requests that update python code label Oct 1, 2026
@NovaCode37

Copy link
Copy Markdown
Owner

Thanks, this works: every source now ends up in either sources or sources_failed, and the tests cover both. One change before merging.

total_sources_attempted += 2 has to be kept in step with the list of sites by hand. Add a third site and forget the counter, and "all sources failed" either never fires or fires when one source answered. Since every attempted source lands in exactly one of the two lists, the condition can be:

if result["sources_failed"] and not result["sources"]:

and the counter can go.

Also, for next time: comment on the issue before you start. You have done good work on several of these, and a comment is how the next person knows it is taken.

@github-actions github-actions Bot added the javascript Pull requests that update javascript code label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hlr_lookup: report which sources failed, not only the ones that answered

2 participants