concatenate(): orphan tables crash the dict form; a generator input gives a misleading error
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 65/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- backend-api-design, data
Direzione di ricerca
Inizia da src/spatialdata/_core/concatenate.py, concentrandoti su concatenate e _fix_ensure_unique_element_names. Esegui il repro.py fornito con uv run per confermare entrambi i fallimenti. Il lavoro è completato quando la concatenazione in forma di dict conserva le tabelle orfane con il suffisso e l’input del generatore viene completato senza l’errore fuorviante di unicità.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
[!NOTE]
This whole message is AI-generated. The issue was automatically discovered and reported by an AI agent (Claude) during an autonomous bug hunt on thespatialdatacode base. It has not been verified or triaged by a human yet; theneeds: triagelabel is set so that a maintainer can confirm it. The reproduction script below was executed by the agent in an isolated environment (see Environment) and its output is pasted verbatim.
Summary
- A table without
spatialdata_attrs(orphan table, supported elsewhere viainclude_orphan_tables) makesconcatenate({...})raiseValueError: No spatialdata_attrs key found in table.uns. 2. The signature acceptsIterable[SpatialData]but a generator is exhausted after the first pass, so the length check fails withKeyError: 'Images must have unique names across the SpatialData objects to concatenate...'.
Severity (agent's assessment): low
Where: src/spatialdata/_core/concatenate.py (_fix_ensure_unique_element_names calls get_table_keys(table) unconditionally; concatenate iterates sdatas several times)
Expected behaviour
Orphan tables are carried over (renamed with the suffix); generators are materialised with list(sdatas) or the type hint is Sequence.
Reproduction
Save as repro.py and run uv run repro.py (the PEP 723 header pins spatialdata to the commit the bug was found on; replace the URL fragment with @main to test the current main branch).
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "spatialdata @ git+https://github.com/scverse/spatialdata.git@ccf1ea048d054b6624214bf618008a9f9ae223e0",
# ]
# ///
"""concatenate(): orphan tables crash the dict form; a generator input gives a misleading error."""
import warnings
import numpy as np
from anndata import AnnData
from spatialdata import SpatialData, concatenate
from spatialdata.models import Image2DModel
warnings.simplefilter("ignore")
def mk():
return SpatialData(images={"img": Image2DModel.parse(np.zeros((1, 4, 4), dtype=np.uint8))})
bug = False
s1, s2 = mk(), mk()
s1.tables["orphan"] = AnnData(X=np.zeros((2, 1))) # table without spatialdata_attrs (allowed elsewhere)
try:
m = concatenate({"a": s1, "b": s2})
print("dict form with an orphan table: OK ->", list(m.tables))
except Exception as e: # noqa: BLE001
print("dict form with an orphan table:", type(e).__name__, str(e)[:100])
bug = True
try:
concatenate(s for s in [mk(), mk()])
print("generator input: OK")
except Exception as e: # noqa: BLE001
print("generator input:", type(e).__name__, str(e)[:100])
bug = True
print("VERDICT:", "BUG REPRODUCED" if bug else "NOT REPRODUCED")
Observed output
dict form with an orphan table: ValueError No spatialdata_attrs key found in table.uns, therefore, no table keys found. Please parse the table.
generator input: KeyError 'Images must have unique names across the SpatialData objects to concatenate. Please pass a `dict[st
VERDICT: BUG REPRODUCED
Possible fix direction (unverified)
See above.
Environment
uv run repro.py with the PEP 723 metadata in the script (fresh, isolated environment; spatialdata built from main @ ccf1ea0 (2026-08-28); Python 3.13, latest releases of the dependencies at run time: pandas 3.0, anndata 0.13, zarr 3.3, dask 2026.8, numpy 2.5, geopandas 1.1, shapely 2.1). macOS (arm64). Also reproduced in a second environment with pandas 2.3.3 / anndata 0.12.11 / numpy 2.4.4 / zarr 3.2.1.
Automatically generated; discovered by an AI agent (Claude) and not yet reviewed by a human.
- Lingua principale
- Python
- Stelle
- 394
- Fork
- 95
- Merge medio
- 3g 9h
- PR unite (30g)
- 5
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di scverse/spatialdata
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
scverse/spatialdata#1249 ·
-
bug 🚨 element: images 🌌 element: labels 🏷️ needs: triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
scverse/spatialdata#1239 ·
-
bug 🚨 element: shapes ▲ models needs: triage priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
scverse/spatialdata#1234 ·
-
bug 🚨 element: labels 🏷️ method: aggregation 🔢 needs: triage priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
scverse/spatialdata#1230 ·
-
bug 🚨 element: labels 🏷️ element: table 📑 models needs: triage priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
scverse/spatialdata#1229 ·
Tutte le issue di scverse/spatialdata
Issue simili
-
triage/confirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
apache/cloudstack#14222 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100