Skip to content

Support approximate IP-derived location metadata - #60

Open
billmcilhargey wants to merge 4 commits into
librespeed:masterfrom
blackoutsecure:billmcilhargey-add-ip-location-metadata
Open

billmcilhargey wants to merge 4 commits into
librespeed:masterfrom
blackoutsecure:billmcilhargey-add-ip-location-metadata

Conversation

@billmcilhargey

@billmcilhargey billmcilhargey commented Nov 25, 2026 •

Copy link
Copy Markdown

Summary

  • Parse optional top-level getIP location metadata.
  • Preserve the raw payload for telemetry.
  • Display approximate place and latitude/longitude in live and result views.

Verification

  • Focused Android location, getIP content, and telemetry privacy tests pass.

Context

Tracked by librespeed/speedtest#881: which covers ISP and approximate IP-derived location metadata.

Copilot AI balanced review requested due to automatic review settings November 25, 2026 21:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The metadata card can clip the Start/Stop control on constrained layouts, and non-finite coordinate strings can suppress valid location fallbacks.

2 open issues
What changed in this PR

Adds Android support for approximate IP-derived location metadata, aligning with the broader ISP/location work in librespeed/speedtest#881 while preserving legacy display text and raw telemetry payloads.

Changes:

  • Parses optional location fields and coordinate fallbacks from getIP responses.
  • Displays ISP, approximate place, and coordinates in live and result views.
  • Adds English/Czech labels and tests for parsing, display formatting, and telemetry preservation.
File Description
Speedtest-Android/​app/​src/​test/​java/​org/​librespeed/​speedtest/​engine/​IpInfoLocationTest.kt Tests location parsing, fallbacks, display splitting, and raw telemetry preservation.
Speedtest-Android/​app/​src/​main/​res/​values/​strings.xml Adds English location and coordinate labels.
Speedtest-Android/​app/​src/​main/​res/​values-cs/​strings.xml Adds Czech location and coordinate labels.
Speedtest-Android/​app/​src/​main/​java/​org/​librespeed/​speedtest/​ui/​speedtest/​SpeedtestScreen.kt Adds a live IP metadata card.
Speedtest-Android/​app/​src/​main/​java/​org/​librespeed/​speedtest/​ui/​result/​TestDetailsScreen.kt Shows location and coordinates in saved test details.
Speedtest-Android/​app/​src/​main/​java/​org/​librespeed/​speedtest/​ui/​result/​ResultScreen.kt Shows ISP, location, and coordinates in results.
Speedtest-Android/​app/​src/​main/​java/​org/​librespeed/​speedtest/​data/​IpInfoDisplay.kt Splits formatted IP metadata into display fields.
Speedtest-Android/​app/​src/​main/​java/​com/​fdossena/​speedtest/​core/​worker/​SpeedtestWorker.java Formats callbacks while retaining raw getIP data for telemetry.
Speedtest-Android/​app/​src/​main/​java/​com/​fdossena/​speedtest/​core/​getIP/​IpInfoParser.java Parses, validates, and formats optional location metadata.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 25, 2026 22:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The parser still lets out-of-range coordinates block valid fallbacks and suppresses usable place metadata when coordinates or location fields are missing or malformed.

No open issues 🎉

2 previously missed issues

In code that hasn't changed since last review

Medium severity Missing coordinates suppress valid partial location metadata

Speedtest-Android/​app/​src/​main/​java/​com/​fdossena/​speedtest/​core/​getIP/​IpInfoParser.java:63

These checks hide valid partial location data: the PHP tests in librespeed/speedtest#882 explicitly preserve place metadata when loc is malformed and country-only metadata for offline fallback. Build the place from available fields and validate/render coordinates independently, so missing components do not suppress all location rows. Add regression cases for places without coordinates and missing city/region fields.

Medium severity Out-of-range coordinates block valid location fallbacks

Speedtest-Android/​app/​src/​main/​java/​com/​fdossena/​speedtest/​core/​getIP/​IpInfoParser.java:74

Out-of-range finite coordinates suppress valid fallbacks: with latitude=91, lat=38.1234, and longitude=-77.1234, the parser accepts 91 and later discards the location instead of using lat. This also blocks nested-coordinate and loc fallbacks. Check each candidate against its latitude/longitude bounds before returning it, and add regression coverage for invalid primary values with valid fallbacks.

2 resolved since last review

Review effort: Balanced

@billmcilhargey

Copy link
Copy Markdown
Author

Ready for maintainer review.

The Android implementation now handles structured location metadata, finite coordinate fallbacks, compact-screen layout, telemetry preservation, and privacy labels. Focused tests and assembleDebug pass. The PR remains open and mergeable and is linked to librespeed/speedtest#881.

@billmcilhargey

Copy link
Copy Markdown
Author

Final review fixes are complete and all currently unresolved review threads are resolved or addressed.

The PR remains open and mergeable, linked to librespeed/speedtest#881. Ready for maintainer review.

Copilot AI balanced review requested due to automatic review settings November 26, 2026 02:41
@billmcilhargey

Copy link
Copy Markdown
Author

Latest follow-up fix: commit a1fdb7b (Fix partial IP location fallbacks).

Addressed findings:

  • Place metadata is now built independently from city, region, and country fields, so place-only, country-only, missing-city/region, and malformed-loc data remain usable.
  • Coordinates are rendered independently from place metadata; coordinate-only responses remain usable.
  • Latitude and longitude candidates are each finite and bounded for primary fields, aliases, nested coordinates, and loc fallbacks; invalid primary values no longer block valid fallbacks.
  • Added regressions for place-only, missing place fields, coordinate-only, alias, nested, and loc fallback cases.

Validation: focused getIP/location/telemetry unit tests passed, and assembleDebug passed. No status checks are currently reported. The PR remains open and mergeable. Existing inline review threads are resolved/addressed; the latest review did not add a new unresolved inline thread.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new ISP row lacks updated screenshot baselines, risking verification failures, and independent coordinate fallbacks can combine sources into a location the server never supplied.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

Medium severity Regenerate result-screen screenshot goldens

Speedtest-Android/​app/​src/​main/​java/​org/​librespeed/​speedtest/​ui/​result/​ResultScreen.kt:249

The existing screenshot fixture in ScreenshotTest.kt:60 already includes Example ISP, so this adds a visible ISP row to all three result-screen screenshots and shifts the content below it. The PR leaves result_screen.png, result_screen_light.png, and result_screen_cs.png unchanged, while .github/workflows/build.yml:32 runs screenshot verification against those baselines. Please regenerate and include the three result-screen goldens so the intentional layout change does not fail screenshot verification.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 26, 2026 03:33
@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Ready for final human review — commit 52adeab (Finish cross-repo IP location reconciliation).

Latest Android changes:

  • Preserves processedString/rawIspInfo backward compatibility and keeps the raw getIP payload unchanged for telemetry.
  • Parses normalized top-level location data with independent place metadata and complete coordinate pairs.
  • Keeps latitude/longitude from the same direct, nested, or loc fallback source instead of mixing sources.
  • Covers place-only, country/region/city partials, coordinate-only, malformed loc, alias/nested/loc fallbacks, and raw telemetry preservation.
  • Includes IP/ISP/place/coordinates in result/share text and CSV/JSON history exports.
  • Updated dark, light, and Czech result-screen screenshot goldens.
  • Existing privacy and compact-layout fixes remain in place; no browser or GPS geolocation was added.

Cross-repo check:

Validation:

  • Location/getIP/telemetry tests passed.
  • History export tests passed.
  • The three result-screen screenshot verifications passed.
  • assembleDebug passed.
  • No status checks are currently reported.

PR 60 remains open and mergeable; no merge or close was performed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The added ISP, location, and coordinate rows leave three result-screen golden images outdated, causing CI screenshot verification to fail until the baselines are regenerated, committed, and verified.

1 open issue
1 resolved since last review

Review effort: Balanced

@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Latest final audit complete on commit 52adeab.

All PR 60 review items are addressed: coordinate fallbacks stay within one complete source pair, partial place metadata and coordinate-only data remain usable, screenshot goldens are committed and passed a forced rerun, and no unresolved inline threads remain.

Fresh validation passed: location/getIP/telemetry/export and three result-screen screenshot tests, plus assembleDebug. No status checks are currently reported. PR 60 remains open and mergeable; no merge or close was performed.

Linked cross-repo status: LibreSpeed issue #881 remains open and PR #882 has no unresolved review threads in the latest audit.

@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Android latest head 52adeab is ready for the coordinated re-review. The engine preserves processedString/raw telemetry and now formats additive approximate location/Lat/Long output without browser/device GPS collection. PR remains open and mergeable.

@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Fresh latest-head review complete. No code change or additional commit was needed; the latest pushed head is 52adeab. A forced rerun passed location/getIP/telemetry/export and all three result-screen screenshot tests, and assembleDebug passed. All 4 inline threads are resolved, no checks are currently reported, and PR 60 remains open and mergeable. Issue #881 remains open; linked PR #882 has no unresolved review threads in the latest cross-repo audit.

@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Latest Android PR head 52adeab passed forced location/getIP/telemetry/export/screenshot tests and assembleDebug. The PR remains open and mergeable.

@billmcilhargey

Copy link
Copy Markdown
Author

@billmcilhargey Fresh latest-head review complete. No code change or additional commit is needed; the pushed head remains 52adeab. The full rerun of the Android unit/screenshot suite passed, and assembleDebug passed. All 4 PR 60 inline threads are resolved and no new unresolved comment or formal review request was found. PR 60 remains open and mergeable. Linked LibreSpeed PR 882 has 13 resolved threads and no unresolved threads; issue 881 remains open.

@billmcilhargey

Copy link
Copy Markdown
Author

Latest-head status: Android PR 60 is open and mergeable at 52adeab, with 0 unresolved review threads. No merge or close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants