Skip to content

feat(catalog): refuse a catalog newer than the supported schema version - #70

Merged
timtreis merged 2 commits into
mainfrom
feat/catalog-schema-version-guard
Nov 8, 2026
Merged

timtreis merged 2 commits into
mainfrom
feat/catalog-schema-version-guard

Conversation

@timtreis

@timtreis timtreis commented Nov 8, 2026

Copy link
Copy Markdown
Member

What

The catalog loader now refuses a catalog cut under a schema newer than this client understands, instead of mis-parsing it.

  • SUPPORTED_CATALOG_SCHEMA = 2 in _catalog_schema.py — the newest schema this client reads.
  • Catalog(...) reads catalog_schema_version from the parquet sddb_release_info metadata (a JSON copy of release_info.json the producer embeds, so it travels with the file through both remote download and the local-copy cache, exactly like sddb_generated_at).
  • A declared version > 2 raises a clear ValueError naming the version and pointing at pip install -U spatialdata-db-client.
  • A catalog that declares no version is a legacy (<= 2) catalog and loads unchanged.

Why

The engine bumps catalog_schema_version to 3 when the catalog emits vocab technology ids + a vendor column. An old client must fail loud on such a catalog rather than silently drop or misread the new columns. The website does the same guard on its side.

Scope note

Only the parquet metadata is read. A separate sibling release_info.json was considered but rejected: fetch_catalog copies even local catalogs into a single-file cache, so a sidecar would not survive the fetch; the embedded parquet metadata is the only reliable transport.

Tests

tests/test_catalog_metadata.py: supported version loads, absent version loads (legacy), newer version raises. Full catalog suite green (102 passed), ruff clean.

Catalog load reads catalog_schema_version from the parquet sddb_release_info
metadata and raises a clear error when it exceeds SUPPORTED_CATALOG_SCHEMA=2.
A legacy catalog that declares no version loads unchanged (missing == OK).
@codecov

codecov Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.72%. Comparing base (c73d54c) to head (fdc56e1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
+ Coverage   94.67%   94.72%   +0.05%     
==========================================
  Files          22       22              
  Lines        2291     2313      +22     
==========================================
+ Hits         2169     2191      +22     
  Misses        122      122              

☔ View full report in Codecov by Harness.
📢 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.

Per review: only a missing sddb_release_info or a missing catalog_schema_version
key is legacy. Provenance that is present must be sound — unparseable
sddb_release_info, or a non-integer catalog_schema_version, now raises ValueError
(a release shipping broken provenance is a bug), as does an int above
SUPPORTED_CATALOG_SCHEMA.
@timtreis
timtreis merged commit 3b856f3 into main Nov 8, 2026
7 checks passed
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.

1 participant