Repository navigation
feat(metro): locate nearest station across systems - #114
steventeng2022 wants to merge 11 commits into
Conversation
Av1anJay
left a comment
There was a problem hiding this comment.
Code review: changes requested
lib/screens/metro_dashboard_screen.dart:262-263— Incomplete system data is reported as complete. A system is counted as available whenever its three requests return successfully, even if its stations or station-of-line list is empty, or all its stations have invalid coordinates / no matching line. For example, if KRTC returns HTTP 200 with an empty station list while TRTC has data, a user in Kaohsiung will be told that a Taipei station is the nearest with no incomplete-coverage warning._getJsonListalso converts a non-list HTTP 200 response to an empty list, so this can occur without an exception. Detect systems without usable candidate stations as incomplete, and add a widget regression test with one unusable and one usable system.
Checks: GitHub CI Verify passed (Flutter analyze, full Flutter tests, web route test, Node runtime tests); Android, iOS, Linux, macOS, Windows, Wear OS and Web builds passed. Locally, git diff --check passed and the Node runtime tests passed on Node 22.23.4 (3 tests). Flutter SDK is not installed locally, so Flutter checks were not rerun here. Inspected live metro API responses and reproduced the incomplete-coverage condition with an empty KRTC station list.
Av1anJay
left a comment
There was a problem hiding this comment.
Code review: changes requested
- P2 — First web lookup can remain stuck after location permission is granted. The new metro lookup invokes the existing shared location resolver, whose web permission request can wait for a first position before reaching the resolver's six-second position timeout. See the inline comment for the failure sequence and the pinned web implementation.
Previous review: The reported wholly unusable-system scenario is fixed: systems without a selectable station now count as unavailable, and the new KRTC-empty/TRTC-usable widget test checks the partial-coverage warning (original review).
Checks and limits: Exact-head CI ran flutter analyze successfully and flutter test (704 passed); its separate web test only runs route_path_points_test. Metro widget tests inject a fake resolver and use the Windows target. The web location issue is a static analysis of the pinned plugin, not an executed browser/GPS test; Flutter was unavailable locally. git diff --check passed.
On web the browser prompt maps to LocationPermission.denied, and requestPermission() waits for a fix with a one-day timeout. Skip it on web, let the browser enforce the time limit after the prompt is answered, and report a position error as a failed fix rather than a permission refusal. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks for the review — the web first-position issue is addressed in 55e9a9b:
Not run locally (no Flutter here) and not tested in a real browser — same static-analysis caveat as the review; relying on CI and a manual web check. 🤖 Generated with Claude Code |
Av1anJay
left a comment
There was a problem hiding this comment.
Code review: changes requested
The previous first-web-lookup issue is still open: this revision bypasses the plugin's one-day permission request, but the replacement passes the requested timeout through a pinned web plugin that interprets its units incorrectly. The same change also causes a separate first-refusal regression in the rail picker and YouBike. See both inline findings below. The earlier wholly unusable-system finding remains fixed (original review); the remaining timeout issue follows up the previous review.
Checks and limits: Exact-head CI ran flutter analyze successfully and flutter test (707 passed). Its Chrome test runs only test/route_path_points_test.dart, not web location. git diff --check passed. The findings are based on static analysis of the app and pinned plugin; no real browser/GPS test or local Flutter test was run.
…-refusal state geolocator_web 4.1.3 passes the timeout to the browser in microseconds where milliseconds are expected, so the 6s limit became ~100 minutes. On web, stop passing it and start a Dart-side limit once the permission is no longer pending, so an unanswered prompt never times out. Report the permission state the browser settled on after a refusal so blocked sites are deniedForever and dismissed prompts stay retryable. Add resolver and rail picker tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks — both findings from the latest review are addressed in b33f0fa:
Not run locally (no Flutter here) and not tested in a real browser; relying on CI. 🤖 Generated with Claude Code |
Av1anJay
left a comment
There was a problem hiding this comment.
Code review: changes requested
The earlier web-location timing issue is still open for browsers without the Permissions API: an unanswered location prompt can expire after six seconds. See the inline finding. This is a remaining variant of the issue in the previous review, not a second independent timeout finding.
Prior findings: The microseconds/milliseconds timeout path is addressed for queryable, granted permissions by the Dart deadline. The previously reported first-refusal case is addressed when the browser reports the site as blocked: the resolver now rechecks the state, and the rail picker test covers that path. My earlier wording implied every first refusal behaved that way; I could not establish that broader claim for retryable dismissals as a regression, so I am not repeating it as an open blocker. The wholly unusable-system coverage warning remains fixed (original review).
Checks and limits: Exact-head CI ran flutter analyze successfully and flutter test (711 passed). Its Chrome test runs only test/route_path_points_test.dart, not browser location. git diff --check passed. The remaining finding is based on static analysis of the app, pinned plugin, and published browser compatibility data; no real browser/GPS or local Flutter test was run.
… is unknown Browsers without the Permissions API (Safari 15) report unableToDetermine, which was treated as granted and started the six-second limit while the user was still answering the prompt. Unknown now waits up to a longer cap instead. Tests observe the real pending-to-granted transition and the unknown state. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Thanks — addressed in 6e02474:
Not run locally and not tested in a real browser (e.g. Safari 15); relying on CI. 🤖 Generated with Claude Code |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…and test tolerance Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Av1anJay
left a comment
There was a problem hiding this comment.
Code review: changes requested
The unknown-permission branch improves the previous six-second prompt cutoff to 90 seconds, but the original timing issue remains in a narrower form and the same fallback now extends an already-granted, stalled fix from six to 90 seconds in existing shared-resolver callers. See the consolidated inline finding and previous review. I saw the author's explanation of this trade-off in the reply.
Earlier findings: The wholly unusable-system coverage warning remains fixed. The earlier plugin time-unit mismatch is avoided by omitting its timeout; blocked-site refusal remains fixed. My earlier broader refusal claim was not established for other dismissal cases as a new regression, so I am not repeating it.
Checks and limits: Exact-head CI ran flutter analyze successfully and flutter test (713 passed). Its Chrome test runs only test/route_path_points_test.dart (2 passed), not web location. git diff --check passed. The finding is static analysis of the app and pinned plugin; no real Safari/GPS or local Flutter test was run. Other build jobs were still running at last check.
| } catch (_) {} | ||
| }); | ||
| } else { | ||
| startDeadline(unknownLimit); |
There was a problem hiding this comment.
P2 — Unknown permission trades a prompt cutoff for a 90-second stall in existing screens. On Safari/iOS Safari 15 the pinned geolocator_web returns unableToDetermine when the Permissions API is absent, including when the site was already granted permission. If the browser then neither delivers a fix nor errors, this branch now waits 90 seconds rather than the base resolver's six-second Dart timeout. In particular, YouBikeScreen._initLocation waits for the resolver before loading the default area's stations, so the user sees the locating state for up to 90 seconds instead of reaching the fallback after six. If the user is still answering the prompt after 90 seconds, the same timer also ends the lookup and ignores a later grant; that is a narrower remaining variant of the previous finding, not a second issue.
Please preserve a prompt-aware acquisition bound without imposing the long wait on already-granted, no-fix requests. One avenue to evaluate is a web-specific browser timeout adapter with the plugin's unit conversion corrected: the Geolocation specification requests permission before starting position acquisition, but browser behavior needs validation. The new tests use a fake platform; this scenario is source-based and has not been run on a real Safari/GPS device.
Adds a Find nearest station / 定位最近的車站 button to the metro dashboard. For example, a rider in Kaohsiung with Taipei Metro selected can locate once to switch to the nearest station's system and serving line, open its map, and load its arrival information.
station-of-line, including stations whoseline_idis empty. Ignore invalid coordinates and unavailable lines; prefer the current line at an interchange when distances tie.Closes #55.
Validation with Flutter 3.47.6 / Dart 3.13.5:
nearest_metro_station_test.dart,metro_nearest_station_test.dart,user_location_test.dart,metro_direction_test.dart, andmetro_direction_selector_test.dart.git diff --check: passed.The repository-wide analyzer reports six pre-existing
unawaited_return_in_try_blockwarnings inapp_controller.dart,app_update_service.dart, andbus_repository.dartwith this newer local SDK. The repository's CI uses Flutter 3.41.6; no dependency or SDK versions are changed by this PR. Physical-device GPS and the full test suite were not exercised locally.