Skip to content

feat(#15): geo+json conformance (PostGIS) + exact CI test gate#62

Merged
milmazz merged 2 commits into
mainfrom
ci-postgis-exact-gate
Jul 8, 2026
Merged

feat(#15): geo+json conformance (PostGIS) + exact CI test gate#62
milmazz merged 2 commits into
mainfrom
ci-postgis-exact-gate

Conversation

@milmazz

@milmazz milmazz commented Jul 7, 2026

Copy link
Copy Markdown
Owner

Closes #15.

What

Makes "the conformance suite passes" literally true: fixes the last 3 failing conformance cases — the PostGIS/geojson trio (1616/1617/1618) — and replaces CI's failure-count ratchet with an exact mix test gate.

geo+json support (cases 1616/1617/1618)

  • Fixtures loader (lib/mix/tasks/bier.fixtures.load.ex): runs CREATE EXTENSION IF NOT EXISTS postgis and creates/seeds test.shops from the frozen fragment's commented PostGIS block. spec/** stays untouched — the loader owns the dependency, as the fragment keeps the block commented precisely because postgis may be unavailable standalone.
  • Introspection / schema cache: Bier.Introspection.postgis?/1 detects the installed extension; the flag rides the Bier.SchemaCache snapshot.
  • Negotiation: relation GET/HEAD reads offer application/geo+json only when postgis is installed (without it the Accept still yields 406 PGRST107, matching the cases' preconditions).
  • Rendering: Bier.QueryExecutor gains a :geojson format on the flat read path — rows render via ST_AsGeoJSON(record) and aggregate into a GeoJSON FeatureCollection, mirroring PostgREST's asGeoJsonF. A relation without a geometry column fails with SQLSTATE 22023 geometry column is missing → 400 (case 1618), straight through the existing PgError mapping.

CI: ratchet removed (exact gate)

  • The postgres service image switches from postgres:<pg> to postgis/postgis:<pg>-3.5 (official image + PostGIS; tags 15-3.5/16-3.5/17-3.5 verified on Docker Hub).
  • The BASELINE_FAILURES regression-ratchet step is deleted and replaced with a plain mix test step (the comment about the alias loading fixtures is kept). Any test failure now fails the job.

Docs

  • CONTRIBUTING.md and docs/CONFORMANCE_IMPL.md note the local PostGIS requirement where the DB wiring is described.

Verification

  • mix test locally (exclusive DB grant for this change): 707 tests, 0 failures — including --only area:content_negotiation (39/39).
  • New test/bier/geojson_test.exs covers postgis detection, the FeatureCollection aggregation against test.shops, and the 22023 error on a geometry-less relation.
  • DB-free gates green: mix format --check-formatted, mix compile --warnings-as-errors (dev+test), mix credo --strict, mix docs --warnings-as-errors.
  • SQLSTATE/message verified against a real PostGIS: ST_AsGeoJSON(record) on a geometry-less row raises 22023: geometry column is missing.

🤖 Generated with Claude Code

milmazz and others added 2 commits July 6, 2026 23:05
…ollection rendering

Fixes the three geojson conformance failures (1616/1617/1618):

* mix bier.fixtures.load now requires PostGIS: it runs CREATE EXTENSION
  IF NOT EXISTS postgis and creates/seeds test.shops from the frozen
  fragment's commented PostGIS block (spec/ stays untouched; the loader
  owns the dependency).
* Bier.Introspection.postgis?/1 detects the installed extension; the
  flag is captured in the Bier.SchemaCache snapshot.
* Relation GET/HEAD reads offer application/geo+json only when postgis
  is installed (otherwise the Accept keeps yielding 406 PGRST107).
* Bier.QueryExecutor gains a :geojson format on the flat read path:
  rows render via ST_AsGeoJSON(record) and aggregate into a GeoJSON
  FeatureCollection, mirroring PostgREST's asGeoJsonF. A relation
  without a geometry column fails with SQLSTATE 22023 'geometry column
  is missing' (400), exactly as PostgREST (case 1618).
* Documents the local PostGIS requirement in CONTRIBUTING.md and
  docs/CONFORMANCE_IMPL.md; adds test/bier/geojson_test.exs covering
  detection and both aggregation outcomes.

Full suite is now green locally: 707 tests, 0 failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…het)

With the geo+json cases fixed the conformance suite passes outright, so
the BASELINE_FAILURES regression ratchet no longer earns its keep:

* the postgres service now uses postgis/postgis:<pg>-3.5 (the official
  postgres image + PostGIS), required by mix bier.fixtures.load's
  CREATE EXTENSION postgis.
* the 'conformance regression ratchet' step is replaced by a plain
  mix test — any failure fails the job.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@milmazz
milmazz merged commit 751afec into main Jul 8, 2026
3 checks passed
@milmazz
milmazz deleted the ci-postgis-exact-gate branch July 8, 2026 06:15
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.

[conformance][env] PostGIS not installed for GeoJSON cases (1616-1618)

1 participant