Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 30, 2025

Pull Request

Issue

Closes: #1007

Approach

ParseGeoPoint longitude validation was checking latitude instead of longitude, allowing invalid coordinates like (0.0, 200.0) to pass while incorrectly rejecting valid latitudes in range [90, 180).

Fix:

  • Changed latitude to longitude in the two longitude bound assertions
// Before (incorrect)
assert(latitude < 180, 'Longitude must be within the range (-180.0, 180.0).');
assert(latitude > -180, 'Longitude must be within the range (-180.0, 180.0).');

// After (correct)
assert(longitude < 180, 'Longitude must be within the range (-180.0, 180.0).');
assert(longitude > -180, 'Longitude must be within the range (-180.0, 180.0).');

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl-ssl.google.com
    • Triggering command: /usr/bin/wget wget -qO- REDACTED (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Longitude validation checks wrong variable</issue_title>
<issue_description>### New Issue Checklist

Issue Description

Lines 14-17 and 18-21 validate latitude against longitude bounds instead of validating longitude. This means:

  • Longitude is never validated, allowing invalid coordinates like (0.0, 200.0) to pass.
  • Valid latitudes in the range [90, 180) would incorrectly fail the assertion.

Apply this diff to fix the validation:

     assert(
-      latitude < 180,
+      longitude < 180,
       'Longitude must be within the range (-180.0, 180.0).',
     ),
     assert(
-      latitude > -180,
+      longitude > -180,
       'Longitude must be within the range (-180.0, 180.0).',
     );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

      assert(
        longitude < 180,
        'Longitude must be within the range (-180.0, 180.0).',
      ),
      assert(
        longitude > -180,
        'Longitude must be within the range (-180.0, 180.0).',
      );
🤖 Prompt for AI Agents
In packages/dart/lib/src/objects/parse_geo_point.dart around lines 14 to 21, the
two assertion checks are incorrectly validating the variable latitude against
longitude bounds; change both assertions to validate longitude instead (i.e.,
assert(longitude < 180, 'Longitude must be within the range (-180.0, 180.0).')
and assert(longitude > -180, 'Longitude must be within the range (-180.0,
180.0).')), leaving the messages intact so longitude is actually validated and
latitude assertions remain correct elsewhere.

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@coderabbitai
Copy link

coderabbitai bot commented Nov 30, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Co-authored-by: mtrezza <5673677+mtrezza@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix longitude validation checks for correct variable Fix longitude validation checks wrong variable Nov 30, 2025
Copilot AI requested a review from mtrezza November 30, 2025 14:31
Copilot finished work on behalf of mtrezza November 30, 2025 14:31
@mtrezza mtrezza changed the title Fix longitude validation checks wrong variable test: Fix longitude validation checks wrong variable Nov 30, 2025
@parse-github-assistant
Copy link

parse-github-assistant bot commented Nov 30, 2025

🚀 Thanks for opening this pull request!

@mtrezza mtrezza marked this pull request as ready for review November 30, 2025 15:34
@mtrezza mtrezza changed the title test: Fix longitude validation checks wrong variable fix: ParseGeoPoint longitude validation checks wrong variable Nov 30, 2025
@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 43.51%. Comparing base (ec4eaa1) to head (e9eebc2).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1089      +/-   ##
==========================================
+ Coverage   43.40%   43.51%   +0.11%     
==========================================
  Files          61       61              
  Lines        3587     3587              
==========================================
+ Hits         1557     1561       +4     
+ Misses       2030     2026       -4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mtrezza mtrezza merged commit 6b9ef6b into master Nov 30, 2025
13 checks passed
parseplatformorg pushed a commit that referenced this pull request Nov 30, 2025
# [dart-v9.4.1](dart-9.4.0...dart-9.4.1) (2025-11-30)

### Bug Fixes

* `ParseGeoPoint` longitude validation checks wrong variable ([#1089](#1089)) ([6b9ef6b](6b9ef6b))
@parseplatformorg
Copy link

🎉 This change has been released in version dart-v9.4.1

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Longitude validation checks wrong variable Object not found for update _Installation

3 participants