Repository navigation
Conversation
Every element anndata or scanpy writes survives every copy path, read back by anndata (and scanpy for rank_genes_groups): - record arrays copied field by field across backends (F017), and no record fill value handed to h5py (F021) - anndata 0.7 frames nested in raw/obsm/uns keep their references in HDF5 copies (F006), legacy `ordered` read from __categories (F072), no root-attribute warning for the 0.7 layout (F164) - attributes: nested bytes, h5py.Empty, references (F130); vlen numbers and references not taken for text (F126); float32 at its own precision (F125); a carried fill converted with the dtype (F071) - Zarr v2: compressors via the current API, None kept (F134, F135); an untagged empty dataspace not made a null (F136); missing text in pickle tables as a categorical (F133) - hardening for crafted HDF5 inputs (F041, security) - zarr floor 3.2.0 (lock 3.4.1): 3.1 cannot read a v3 record dtype newer zarr writes - fixtures written by anndata 0.7.8, 0.7.8 in the version matrix, every release and oracle pinned exactly (F087); plain-string fixtures under pandas 3 (F090); convert and split/concat read back by each release (F086); spec and testing docs corrected (F154, F156); dead code and duplicated spec constants removed (F163) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
- the HDF5 layout check follows object references too, and walks into linked folders of a convert source (F041, security) - a reference is copied only inside an element HDF5 copies whole, on both copy paths, with no stray root link left behind - concat compares record arrays field by field, so --uns-merge same keeps rank_genes_groups read from an h5ad - subset's growable datasets get a fill fit for their dtype (F071) - a record field of variable-length numbers is not taken for text Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Closes #95. Part of #87. For 0.17.5: merge after 0.17.4 is tagged.
Every element anndata or scanpy writes now survives every copy path (HDF5 to HDF5, HDF5 to Zarr, Zarr to HDF5, Zarr v2 and v3), checked by anndata reading each copy back (and scanpy, for
rank_genes_groups), on stores anndata itself wrote, including real anndata 0.7.8 files.What changed, by ref
open_storechecks an HDF5 file's layout when it opens it, the copy paths check what they copy, andconvertchecks its HDF5 sources; the input is refused before anything is read.rec-array, scanpy'srank_genes_groups) are copied field by field: text fields as variable-length UTF-8 to HDF5 and as<Uof the longest value to Zarr, as anndata writes them; other fields kept.rec-array0.2.0 added tospec.expand_refs=True, so anndata 0.7 dataframes nested inraw,obsmorunskeep live references (HDF5 repoints them at the copies). MuData modalities too.orderedis read from__categories/<key>, where anndata 0.7 kept it (read.is_ordered(col, parent)), in every copy.obs/var) opens without the "missing or invalid AnnData attrs" warning.copy_attrsdecodes bytes at any depth, writesh5py.Emptyas JSON null (and null back ash5py.Empty), and refuses a reference-valued attribute naming the element and attribute.0.1, not0.10000000149011612), matching pandas'to_csv.create_datasetconverts a carried fill value to the new dtype, or leaves it to HDF5's default when the conversion would change it; recast to bool of a float h5ad matrix works (CSR, CSC, dense).compressors, not the deprecatedcompressor, and the bareexcept Exceptionblocks around zarr attributes are gone.Noneis forwarded).nullis written as a null. An untagged empty dataspace is copied as itself between HDF5 files, and left out of Zarr with a warning.nullable-string-array.reference_stores.ORACLES. Two stores written by anndata 0.7.8 are committed undertests/fixtures/anndata-0.7.8/(118 KB) so the unit suite reads the real legacy layout.string-arrayencoding is tested under pandas 3: concat of plain, nullable and mixed inputs againstanndata.concat. It passes on main (B3a fixed the path); the gap was the test.convert(both backends) andsplit+concatoutputs with the release that wrote the input; the reference store gained a categorical inraw/varandrank_genes_groups. The docs' claim says which outputs are read back, and troubleshooting has an entry for older releases refusingnullable-string-arrayornull.__categories/<key>),orderedlives on the labels,dictis current rather than legacy, Zarr string scalars are variable-length UTF-8, a rec-array section, and what 0.7 files tag.reference_stores.py: 0.11 is the first release that reads anullable-string-array, 0.12 the first that reads anull.strip_string_filters,write._backend_ofand_target_zarr_format;storagetakes its encoding names and versions fromelements.spec(theadata.elementspackage now loads its submodules lazily, which removes the import cycle).Also changed, outside the batch's files
pyproject.toml/uv.lock: zarr floor 3.1.5 -> 3.2.0, lock 3.1.5 -> 3.4.1 (adds msgspec). zarr 3.2 changed how a v3 record dtype is spelt (struct), and 3.1 cannot open a store that newer zarr wrote with one: anndata 0.13.4 on zarr 3.4 writesrank_genes_groupsthat way, and the integration suite'sviewfailed on it. 3.2.0 reads both spellings.commands/convert.py: one call checking the HDF5 source (and--raw), since most converters open their HDF5 with h5py directly.core/concat.py(4 lines,_hashable) andcore/subset.py(2 lines,_growable_like): review findings 2 and 4 below; B3b and B4 have been told.formats/json_data.py: 3 lines;export dictof an h5ad holdingrank_genes_groupsfailed ("bytes is not JSON serializable"). A record array now exports as{field: [values]}.tests/test_external_readers.py:_runmaps bare package names through the pins, and a scanpy oracle test forrank_genes_groupsacross backends.tests/test_legacy_copies.py,tests/test_storage_root_attrs.py,tests/test_pandas_frame.py: regression tests.AGENTS.md,docs/index.md,docs/developers.md,docs/troubleshooting.md: the version claims and one troubleshooting entry.How it was tested
tests/test_element_fidelity.py: each source written by anndata (or the committed 0.7.8 stores), copied byconvertandsubsetto h5ad, zarr2 and zarr3, read back by anndata. The--compressioncopy of a rec-array runs in a subprocess, so a crash fails the test rather than the run.test_storage.py,test_elements.py,test_pandas_frame.py,test_legacy_copies.py,test_storage_root_attrs.py,test_anndata_roundtrip.py. Each docstring names its ref. Run against main, 84 of them fail there; the others are controls (same-backend copies, float64) and F090's test.COLUMNS=80 uv run pytest -m "not integration" --cov=adata --cov-fail-under=90(after the review fixes, 3f5efa1): 2778 passed, 1 skipped; coverage 95.92%floorsrecipe: zarr 3.2.0, numcodecs 0.14.0, anndata 0.13.0), before the review fixes: 2768 passed, 1 skippedADATA_REQUIRE_VERSION_FIXTURES=1 uv run pytest tests/test_anndata_versions.py -m integration: together withtests/test_concat_versions.py, which shares the releases, after the review fixes: 280 passed, 14 skipped (anndata 0.7 cannot read what adata writes, so its read-backs skip, as does the nullable column it does not write)tests/test_external_readers.py -k rank_genes_groups(scanpy 1.12.5), after the review fixes: 4 passed.uv run pytest tests/test_docs_are_accurate.py: passed, also after merging main (0.17.4) at c6e7c06.Review
A fresh subagent reviewed the diff against the audit entries and AGENTS.md, reproducing what it reported. Seven findings:
concat --uns-merge same|uniquedropped text rec-arrays whenever an input was h5ad. The value comparison used the record's raw bytes, which for h5py's text are heap pointers. Fixed: records are compared field by field (4 lines incore/concat.py, B3b's file; B3b told). Tested againstanndata.concat.~obj_pointed_by_<n>at the output's root (all ofX, in the repro); copied dataset by dataset, it was refused. Now a reference is copied only inside an element HDF5 copies whole, and refused otherwise, on both paths. A target copied ahead of its place in the tree no longer leaves a duplicate root link, which also happened for a 0.7 column named before__categories("Phase"). The spec pages say so.subset._growable_like, which creates its HDF5 datasets directly:recast --dtype bool --layout csrof a dense float X with a non-zero fill still failed. Fixed with a sharedstorage.fit_fill(2 lines incore/subset.py, B4's file; B4 told).Store.close, staging, Zarr version and codecs kept, imports;test_performancepasses; the new tests fail on main and use anndata as the oracle; the zarr floor's justification reproduces (3.1.5 cannot read astructdtype 3.4 writes).Changelog entry
Fixed
rank_genes_groups(record arrays inuns) failed every conversion and subset between h5ad and Zarr, andconvert --compressionof an h5ad holding them crashed the process. They are now copied field by field, as anndata writes them,concat --uns-merge samekeeps them (it dropped every text one read from an h5ad), andexport dictwrites them as JSON.raw,obsmoruns(anndata could not open the output), every copy made an ordered categorical unordered, and every command warned that such a file's root attributes were invalid. CI now reads stores written by anndata 0.7.8.null(which anndata 0.8 to 0.11 refuse).export dataframeprinted 0.1 in a float32 column as 0.10000000149011612; it now writes what pandas writes.nullable-string-array, which they refuse.rank_genes_groups.🤖 Generated with Claude Code