test(orm): document PostGIS spatial support on memory.location_geo#23
Merged
pyramation merged 2 commits intomainfrom Apr 17, 2026
Merged
test(orm): document PostGIS spatial support on memory.location_geo#23pyramation merged 2 commits intomainfrom
pyramation merged 2 commits intomainfrom
Conversation
Seeds three memories with stable IDs and geography(Point, 4326) locations (SF, Oakland, NYC) and exercises the generated GeographyInterfaceFilter operators against memory.location_geo: - bboxIntersects2D with a Bay Area polygon returns SF + Oakland, not NYC - coveredBy with the same polygon (point-in-polygon containment) - intersects with the same polygon - isNull: false returns all geo-tagged rows and their geojson payload Also documents in the describe block that there is currently NO `dwithin` / `distance` operator on GeographyInterfaceFilter, so 'find memories within 5km of here' — as advertised in the README — is not expressible through the typed filter today and requires raw SQL (ST_DWithin) or a client-side bounding box. The four passing assertions narrow the README claim to what actually works (polygon/bbox containment), rather than removing it.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
…on guard - bboxIntersects2D/coveredBy/intersects fail upstream with 'parse error - invalid geometry' (graphile-postgis@2.9.7 doesnt wrap GeoJSON with ST_GeomFromGeoJSON for these operators) - Keep a geography round-trip test (GeoJSON + srid output) and an isNull:false filter test covering whats actually supported today - Add a regression guard that asserts the broken state so a future upstream fix will flip the test and alert us to promote the operators
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.
Summary
Adds integration test coverage for PostGIS on
memories.location_geoand, while writing the tests, discovers that the generated spatial filter operators are broken upstream. Three memories are seeded withgeography(Point, 4326)locations — SF, Oakland, and NYC — and a newdescribeblock covers what actually works today vs. what doesn't.What the tests assert (all passing in CI):
srid: 4326through the generatedlocationGeo { geojson srid }output.locationGeo: { isNull: false }returns all three geo-tagged rows.locationGeo: { bboxIntersects2D: <polygon> }currently fails withparse error - invalid geometry. The test pins this broken state so that if a futuregraphile-postgisrelease fixes it, the test will flip and we'll know to promote the operators to "supported".Why the regression guard exists. The generated
GeographyInterfaceFilterexposesbboxIntersects2D,coveredBy,covers,exactlyEquals, andintersects, but ingraphile-postgis@2.9.7their SQL resolvers pass the GeoJSON value straight through to PostgreSQL instead of wrapping it withST_GeomFromGeoJSON(...)::geography. Only thewithinDistanceoperator has the correct wrapping, and it is not wired into the generated filter at all. Net effect: "find memories within 5km of here" and "find memories inside this polygon" are not possible through the typed ORM today — they require raw SQL (ST_DWithin/ST_Covers). The describe block documents this in code comments.Files touched: <ref_file file="/home/ubuntu/repos/agentic-db/packages/integration-tests/fixtures/seed/test-data.sql" /> (3-row seed append) and <ref_file file="/home/ubuntu/repos/agentic-db/packages/integration-tests/tests/orm.test.ts" /> (one new
describeblock).Updates since last revision
The first pass of this PR tried to assert that
bboxIntersects2D,coveredBy, andintersectsreturned the expected Bay-Area rows. CI surfacedparse error - invalid geometryon all three. After tracing that tographile-postgis@2.9.7's operator SQL (noST_GeomFromGeoJSONwrap), the tests were rewritten to (a) cover the parts that do work and (b) pin the broken state as a regression guard rather than asserting a wrong claim.Review & Testing Checklist for Human
graphile-postgis@2.9.7/plugins/connection-filter-operators.jsvs.within-distance-operator.js. If my reading is wrong (e.g., the "parse error" is actually caused by the input scalar, not the operator SQL), the comment in the describe block overstates the fault. Worth a skim of those two plugin files before merging.withinDistance/dwithininto the filter schema so the claim becomes true.eeeeeeee-…0001/2/3IDs. Nothing else inorm.test.tsqueries memories without filtering by its own created id, so this should be safe, but worth a once-over.Notes
Link to Devin session: https://app.devin.ai/sessions/f7a6bf96d0784c7d90012f65f0fb50c3
Requested by: @pyramation