CatalogRegistry and DatasetRegistry duplicate version resolution, species filtering and build-receipt checks

Aperta
#185 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
52/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Compare the duplicated logic in orfdata/catalogs.py and orfdata/datasets.py, starting with _version, list(), _data_registry, and the build-receipt checks. Read the existing catalogue and dataset tests before choosing whether a shared base class or functions alongside orfdata/cache.py best fit the code. Done means each shared piece exists once, public behavior and error messages stay unchanged, and both existing test suites pass unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

CatalogRegistry (orfdata/catalogs.py) and DatasetRegistry (orfdata/datasets.py) are the same kind of object: a registry over a JSON of pinned releases, each either published or built locally. Each class keeps its own copy of the shared parts (line numbers are on main at cd1b828):

  • Version resolution. _version (catalogs 116, datasets 99) raises the same unknown-name and unknown-version errors. The constructors repeat the same checks that default_version is pinned and that the distribution's access_terms and redistributable are explicit.
  • Species filter. list() (catalogs 124, datasets 107) repeats the species_taxon lookup and the "Unknown species alias" and "Species and taxon_id disagree" errors line for line.
  • Published-artifact registry. Both classes have published and _published. _data_registry (catalogs 167, datasets 205) builds a VersionedDatasetRegistry from the releases that have assets, with the same default-version fallback (default if default in published else min(published)) and the same store_path closure, <area>/<name>/<version>/<digest of release>.
  • Build-receipt check. CatalogRegistry.inspect_build (catalogs 221) and datasets._inspect_build (datasets 327) compare a materialize receipt with the manifest in the same steps: the source and output inventory, each source's SHA-256, size and verified flag, and the transform. Only the output name and the messages differ.

Because the logic is duplicated, a fix to one of these has to be made in both classes, and nothing checks that they still agree.

Proposal: put these four pieces in one place, either a shared base class or functions next to orfdata/cache.py (#180). They would be parameterized by the cache area, the output asset name and the manifest type. CatalogRegistry and DatasetRegistry would keep only what really differs: catalogue priority and optional, dataset archives, assays and search references, and each class's manifest validation.

Acceptance: each of the four pieces exists once, public behavior and error messages are unchanged, and the existing catalogue and dataset tests pass unchanged.

Related: #161 covers one acquisition interface per resource kind across downloads, data_resources and install. This issue is the registry-level part of that work. Found while reviewing #180.

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
10h 11m
PR unite (30g)
51

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openvax/orfdata

Tutte le issue di openvax/orfdata

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.