Skip to content

Fix instance_key dtype check rejecting object vs str string ids - #1270

Merged
LucaMarconato merged 1 commit into
mainfrom
fix/instance-key-string-dtype-check
Oct 8, 2026
Merged

LucaMarconato merged 1 commit into
mainfrom
fix/instance-key-string-dtype-check

Conversation

@LucaMarconato

@LucaMarconato LucaMarconato commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

AI-generated—manually reviewed

Since 65dc73e the check in validate_table_in_spatialdata raised whenever the dtypes differed and either side was string-like. With pandas>=3 the index of shapes read from parquet is str, while anndata reads string columns as object, so valid datasets (e.g. the mouse_liver sandbox dataset) failed to load. Only raise for a string vs non-string mismatch.

Add a network regression test on the real cells dataset, annotating cell_boundaries via the cell_id column.

Since 65dc73e the check in `validate_table_in_spatialdata` raised whenever
the dtypes differed and either side was string-like. With pandas>=3 the
index of shapes read from parquet is `str`, while anndata reads string
columns of zarr v2 stores as `object`, so valid datasets (e.g. the
mouse_liver sandbox dataset) failed to load. Only raise for a string vs
non-string mismatch.

Add a network regression test on the real `cells` dataset, annotating
`cell_boundaries` via the `cell_id` column.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LucaMarconato
LucaMarconato enabled auto-merge (squash) October 8, 2026 22:59
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.42%. Comparing base (ea93a37) to head (8dcbc09).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1270      +/-   ##
==========================================
+ Coverage   91.40%   91.42%   +0.01%     
==========================================
  Files          53       53              
  Lines        8381     8381              
==========================================
+ Hits         7661     7662       +1     
+ Misses        720      719       -1     
Files with missing lines Coverage Δ
src/spatialdata/_core/spatialdata.py 93.46% <100.00%> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LucaMarconato

Copy link
Copy Markdown
Member Author

No changelog entry (I'll label as release-ignore): this fixes an unreleased regression. The stricter check came in with 65dc73e (#1197), which isn't in any release yet. The latest release, v0.8.0, still has the old dtype is str comparison, and that comparison never fires because a dtype object is never the builtin str. So released versions never raised this error.

@LucaMarconato
LucaMarconato merged commit 560caf9 into main Oct 8, 2026
21 checks passed
@LucaMarconato
LucaMarconato deleted the fix/instance-key-string-dtype-check branch October 8, 2026 23:04
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.

1 participant