-
Notifications
You must be signed in to change notification settings - Fork 0
fix: harden Photon client + consistent lifespan settings (#125, #126, #127) #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
/resolveis called with a street but no city,postal_codeis still always present, so after removing the street+postcode candidate this condition prevents any candidate containing the street from being sent. The client now queries Photon with only the postcode for these weak postal matches, which can returnno_resultor a coarse/wrong postcode hit despite the caller supplying street information; add a street-only candidate for this no-city case without combining it with the postcode.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked this against the module's premise before acting — I don't think it's a regression, and I'd push back on adding the street-only candidate here.
The candidate this PR removed was
f"{street}, {postal_code}"— street combined with the postcode. The whole point of this module (docstring) is that Photon returns 0 results for a street+postcode string. So for a(street, no-city, postcode)input that candidate was always an empty round-trip; postcode-only was already the only query that could return a hit. Removing it changes correctness by zero and just drops the wasted request — which is what #125 asked for. No working street fallback was lost.What you're proposing is a new street-only candidate (never combined), which is a different thing. I'd hold off on it: for a NUTS region lookup, a street with no city is low-precision — street names repeat across municipalities, so a street-alone Photon hit can land in the wrong city → wrong coordinates → wrong NUTS3. This service deliberately prefers no-result over a wrong region (0.85 geocode threshold, cross-border guard). Postcode-only is the reliable region signal for these no-city records, and "coarse" (postcode centroid) is exactly the right granularity for NUTS3.
If we do want a street-only last-resort, it should be gated and appended after the postcode query, and it's a separate enhancement rather than part of this bugfix. Happy to open an issue for it if you think the coverage is worth the precision risk.