Feat/named sessions - #16
Merged
Merged
Conversation
The two halves of a session label. Parsing ships for real — it needs nothing the session doesn't already store. Locating an address needs an outbound call or a licensed database, so IPGeolocator ships with zero implementations, exactly like BreachedPasswordChecker.
Computed on read from the IP and User-Agent a session already carries, so there is no schema change and no migration — every session ever recorded gets a label the first time ListNamed is called. One geolocator lookup per distinct IP, and an error means "unknown", not a failed listing.
A new facade beside ListSessions/ListPublicSessions rather than a change to either — existing callers keep their return types. Geolocator is optional in the same way BreachedPasswordChecker is: unset means the feature quietly does less, never that a call fails.
The parser is tested against authentic User-Agent strings, since the only real risk in it is that browsers impersonate each other inside the header. The rest covers the promises: one lookup per distinct IP, and a failing geolocator costs a label, never the listing.
42 checks over seven scenarios, including the two that matter most: a down geolocator costs a label and never the listing, and a session recorded before any geolocator existed gets a located label the moment one is configured — nothing is stored, so nothing needs backfilling.
Covers the interface contract a host implements, the User-Agent traps worth checking by hand (browsers impersonate each other in the header), and the upgrade check that matters: labels are computed on read, so existing sessions gain them with no migration.
Item 10's labels are computed on read, so the branch note also records that it carries items 8 and 9 and how it would separate from them.
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.
No description provided.