Skip to content

Add REST Assured test exercising bounding box precision bug #11559 - #12698

Open
tuannx wants to merge 3 commits into
IQSS:developfrom
tuannx:11559-bbox-precision-test
Open

tuannx wants to merge 3 commits into
IQSS:developfrom
tuannx:11559-bbox-precision-test

Conversation

@tuannx

@tuannx tuannx commented Sep 11, 2026

Copy link
Copy Markdown

What this PR does / why we need it:

  • Adds a REST Assured integration test (testGeographicBoundingBoxHighPrecisionValidation in DatasetsIT) exercising the bounding box precision bug The validateBoundingBox method fails with values having more than 5 decimal places. #11559.
  • Fixes single-precision float truncation in DatasetFieldValueValidator by parsing and comparing bounding box coordinates with BigDecimal.
  • Updates bounding box aggregation in IndexServiceBean to use BigDecimal.
  • Adds unit tests in DatasetFieldValueValidatorTest covering high-precision edge cases.
  • Adds release note snippet in doc/release-notes/11559-bbox-bigdecimal.md.

Which issue(s) this PR closes:

Special notes for your reviewer:
This PR includes both the REST Assured reproduction test in DatasetsIT and the BigDecimal precision fix in DatasetFieldValueValidator / IndexServiceBean.

Suggestions on how to test this:

  • Unit tests: mvn test -Dtest=DatasetFieldValueValidatorTest
  • Integration test: mvn test -Dtest=DatasetsIT#testGeographicBoundingBoxHighPrecisionValidation

Does this PR introduce a user interface change?: No
Is there a release notes update needed for this change?: Yes (included)

@pdurbin

pdurbin commented Sep 11, 2026

Copy link
Copy Markdown
Member

@tuannx thanks for the PR! We'll discuss it at Triage Tuesday and get back to you! 😄

@tuannx
tuannx force-pushed the 11559-bbox-precision-test branch from 08252d7 to 5152e19 Compare September 11, 2026 18:39
@tuannx

tuannx commented Sep 11, 2026

Copy link
Copy Markdown
Author

[ERROR] Failures:
[ERROR] DatasetsIT.testGeographicBoundingBoxHighPrecisionValidation:7555 1 expectation failed.
Expected status code (<400> or <403>) but was <201>.

Solr index:

Remote error message: ERROR: [doc=dataset_4_draft] Error adding field 'geolocation'='ENVELOPE(-71.0,-70.0,42.001000,42.001001)'
msg=Unable to parse shape given formats "lat,lon", "x y" or as WKT because
org.locationtech.spatial4j.exception.InvalidShapeException: maxY must be >= minY: 42.001001 to 42.001

@pdurbin pdurbin moved this from Ready for Triage to Ready for Review ⏩ in IQSS Dataverse Project Sep 15, 2026
@pdurbin pdurbin added the Size: 10 A percentage of a sprint. 7 hours. label Sep 15, 2026
@tuannx
tuannx marked this pull request as ready for review September 15, 2026 20:59
Copilot AI lite review requested due to automatic review settings September 15, 2026 20:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Add aggregation regression coverage and assert BAD_REQUEST explicitly in the integration test.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR fixes geographic bounding-box precision loss using BigDecimal, with regression tests and release notes.

Changes:

  • Updates validation and bounding-box aggregation precision.
  • Adds unit and REST integration coverage.
  • Documents the fix in release notes.
File summaries
File Summary
src/test/java/edu/harvard/iq/dataverse/DatasetFieldValueValidatorTest.java Tests high-precision validation cases.
src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java Adds REST regression coverage.
src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java Uses precise bounding-box aggregation.
src/main/java/edu/harvard/iq/dataverse/DatasetFieldValueValidator.java Uses BigDecimal coordinate validation.
doc/release-notes/11559-bbox-bigdecimal.md Documents the fix.
Review details

Suppressed comments (1)

src/test/java/edu/harvard/iq/dataverse/api/DatasetsIT.java:7555

  • Allowing FORBIDDEN here can let this regression test pass for an authorization/setup failure instead of proving that metadata validation rejected the reversed coordinates. This user just created the dataverse and the invalid payload should produce BAD_REQUEST, so assert that status explicitly.
                .statusCode(anyOf(equalTo(BAD_REQUEST.getStatusCode()), equalTo(FORBIDDEN.getStatusCode())))
  • Files reviewed: 5/5 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main/java/edu/harvard/iq/dataverse/search/IndexServiceBean.java

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No unresolved issues were identified, and the fix includes unit and integration coverage.

Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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

Labels

Size: 10 A percentage of a sprint. 7 hours.

Projects

Status: Ready for Review ⏩

Development

Successfully merging this pull request may close these issues.

The validateBoundingBox method fails with values having more than 5 decimal places.

3 participants