Skip to content

hlr_lookup: report parse and request failures through module_status (part of #493) - #538

Merged
NovaCode37 merged 1 commit into
NovaCode37:mainfrom
Nandika-Gupta:fix/493-hlr-lookup-status
Oct 10, 2026
Merged

NovaCode37 merged 1 commit into
NovaCode37:mainfrom
Nandika-Gupta:fix/493-hlr-lookup-status

Conversation

@Nandika-Gupta

Copy link
Copy Markdown
Contributor

Summary

Part of #493 (hlr_lookup only). validate_phone now reports its result through annotate instead of setting result["error"] directly.

Changes

  • Number parse failures and unexpected exceptions in validate_phone are now ERROR, with the same message in error.
  • A successful lookup is OK, including a number that parses but is not valid, because the lookup itself worked.
  • reverse_lookup already used annotate, so I only moved its import to the top of the module.
  • Added tests/test_hlr_lookup_status.py covering valid, invalid-but-parseable, parse failure and unexpected exception.

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

git grep -n 'result\["error"\] =' modules/hlr_lookup.py now returns nothing. pytest on the new tests and the existing test_hlr_numverify_fallback.py passes (7 tests).

Screenshots

N/A

@github-actions

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 10, 2026

@NovaCode37 NovaCode37 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. A Numverify failure stays in numverify_error, so the overall OK is right when the offline parse worked.

@NovaCode37 NovaCode37 added the hacktoberfest-accepted Counts toward Hacktoberfest label Oct 10, 2026
@NovaCode37
NovaCode37 merged commit 92af757 into NovaCode37:main Oct 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Counts toward Hacktoberfest python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants