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

Đang mở
#185 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
52/100
Loại issue
Tái cấu trúc
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Python
Star
1
Fork
1
Merge trung bình
10 giờ 11 phút
Pull request đã merge (30 ngày)
51

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openvax/orfdata

Tất cả issue của openvax/orfdata

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.