Skip to content

[ZFDB] Feature/zfdb/fdb 678 2nd step - refactor tests and zarr interface alignment#302

Draft
tbkr wants to merge 16 commits into
feature/zfdb/refactorfrom
feature/zfdb/fdb-678-refactor-tests-and-zarr-interface-alignment
Draft

[ZFDB] Feature/zfdb/fdb 678 2nd step - refactor tests and zarr interface alignment#302
tbkr wants to merge 16 commits into
feature/zfdb/refactorfrom
feature/zfdb/fdb-678-refactor-tests-and-zarr-interface-alignment

Conversation

@tbkr

@tbkr tbkr commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

Further refactoring and Zarr API conformity alignment. Also restructured tests, as they became a bit disordered.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🌈🌦️📖🚧 Documentation FDB 🚧📖🌦️🌈
https://sites.ecmwf.int/docs/fdb/pull-requests/PR-302

@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.25000% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.99%. Comparing base (4c75f61) to head (0b89d13).

Files with missing lines Patch % Lines
src/chunked_data_view/GribExtractor.cc 0.00% 19 Missing ⚠️
src/chunked_data_view/Axis.cc 0.00% 12 Missing ⚠️
src/chunked_data_view/RequestManipulation.cc 0.00% 10 Missing ⚠️
src/chunked_data_view/ChunkedDataViewBuilder.cc 42.85% 4 Missing ⚠️
Additional details and impacted files
@@                    Coverage Diff                    @@
##           feature/zfdb/refactor     #302      +/-   ##
=========================================================
- Coverage                  72.08%   71.99%   -0.10%     
=========================================================
  Files                        378      378              
  Lines                      23901    23946      +45     
  Branches                    2504     2513       +9     
=========================================================
+ Hits                       17230    17240      +10     
- Misses                      6671     6706      +35     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the Zarr v3 alignment for z3fdb by updating the internal Zarr store implementation (notably metadata/consolidation behavior and key handling) and substantially reorganizing/expanding the Python test suite into clearer categories.

Changes:

  • Updated FdbZarrStore/FdbZarrGroup/FdbZarrArray to use string keys and added root zarr.json generation with inline consolidated metadata for group roots.
  • Restructured tests into unit/, permutation_tests/, and zarr_interface_conformity/, adding deeper store-path and consolidated-metadata conformity coverage.
  • Updated CMake test registration to reflect the new test layout and added a minimal Ruff configuration.

Reviewed changes

Copilot reviewed 18 out of 20 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tests/z3fdb/zarr_interface_conformity/test_z3fdb_store_path_correctness.py New deep-hierarchy path/listing/get/getitem correctness coverage.
tests/z3fdb/zarr_interface_conformity/test_z3fdb_store_interface.py Adds Zarr StoreTests-based interface checks for FdbZarrStore.
tests/z3fdb/zarr_interface_conformity/test_z3fdb_consolidated_metadata.py Verifies inline consolidated metadata structure and Zarr API navigation.
tests/z3fdb/zarr_interface_conformity/conftest.py Provides shared fixtures for deep store/group and configures asyncio behavior.
tests/z3fdb/zarr_interface_conformity/_mocks.py Adds mock chunked data view + deep store factory helpers.
tests/z3fdb/unit/test_store_v3.py Moves/extends basic v3 access tests into unit/.
tests/z3fdb/unit/test_store_v3_errors.py Adds request-format and axis-extension error tests.
tests/z3fdb/test_store_v3.py Removed (tests relocated into tests/z3fdb/unit/).
tests/z3fdb/test_store_v3_random_axis.py Removed (coverage moved to new permutation tests).
tests/z3fdb/test_store_v3_pattern.py Removed (coverage moved to new permutation tests).
tests/z3fdb/permutation_tests/test_store_multiple_parts.py Refactors request strings into constants and reuses them across scenarios.
tests/z3fdb/permutation_tests/test_store_missing_values.py Adds online test coverage for bitmap-missing handling and fill_value propagation.
tests/z3fdb/permutation_tests/test_store_individual_chunking.py Formatting refactor; keeps chunking behavior checks.
tests/z3fdb/permutation_tests/test_scrambled_request_ordering.py New tests for scrambled request value ordering correctness.
tests/z3fdb/permutation_tests/test_axis_definition_permutations.py New exhaustive permutation sweep tests for axis definition ordering/chunking.
tests/z3fdb/permutation_tests/test_axis_definition_ordering.py New targeted axis-ordering/chunking scenario tests.
tests/z3fdb/CMakeLists.txt Re-registers tests by category and adjusts online test invocation.
src/z3fdb/simple_store_builder.py Narrows build() return type to FdbZarrStore.
src/z3fdb/_internal/zarr.py Implements string-key access, consolidated root zarr.json, and updated Store methods.
ruff.toml Adds Ruff target-version/line-length configuration.
Comments suppressed due to low confidence (1)

tests/z3fdb/CMakeLists.txt:66

  • The standalone online test uses ENVIRONMENT "${_env}", but _env is defined inside the add_py_test() function (function scope), so it will be empty here. That likely breaks imports (PYTHONPATH/FDB5_DIR/ECCODES_DIR) when running ctest -L z3fdb_online. Define _env in this scope (or move it to a global variable shared by both paths).
set_tests_properties(pychunked_data_view_${online_stem}
    PROPERTIES
    RESOURCE_LOCK pytest
    ENVIRONMENT "${_env}"
    LABELS "z3fdb;z3fdb_online"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/z3fdb/zarr_interface_conformity/_mocks.py
Comment thread tests/z3fdb/unit/test_store_v3.py
Comment thread src/z3fdb/_internal/zarr.py
Comment thread tests/z3fdb/CMakeLists.txt
Comment thread tests/z3fdb/CMakeLists.txt Outdated
Comment thread tests/z3fdb/zarr_interface_conformity/conftest.py
@tbkr
tbkr force-pushed the feature/zfdb/fdb-678-refactor-tests-and-zarr-interface-alignment branch 2 times, most recently from 25cecc0 to 84defd6 Compare July 20, 2026 14:54
@tbkr
tbkr force-pushed the feature/zfdb/refactor branch from cbbb4e3 to 38b3005 Compare July 21, 2026 17:22
@tbkr
tbkr force-pushed the feature/zfdb/fdb-678-refactor-tests-and-zarr-interface-alignment branch from 569322c to 117dffa Compare July 21, 2026 18:00
@tbkr
tbkr force-pushed the feature/zfdb/refactor branch from 38b3005 to 4c75f61 Compare July 22, 2026 06:14
tbkr added 13 commits July 22, 2026 08:14
Zarr provides a test harness for checking the store API. This is now
leveraged for tests.

Slight adjustedments to the return types of functions to align them with
the definition.
The prefix function now uses the consolidated paths, created at
constructor call of the store.

Added a test to check for the correct output of list.
test_z3fdb_consolidated_metadata.py:
- Imports MockChunkedDataView and make_array from _mocks (no inline stub class)
- Uses the deep_store fixture from conftest for the hierarchy tests
- Splits the monolithic test into focused functions with no abbreviations:

test_z3fdb_store_path_correctness.py:
- Remove inline mock class, array configs, fixture definitions (all in _mocks.py / conftest.py)
- Import MockChunkedDataView, ARR_ROOT, ARR_A1, ARR_AI1, ARR_AI2, ARR_BBD from _mocks
- Merge 3 zarr.json tests to test_zarr_json_accessible_via_all_apis (11 cases, 3 assertions each)
- Merge 3 chunk tests to test_chunk_accessible_via_all_apis (10 cases, 3 assertions each)

test_z3fdb_store_interface.py fixed issue introduced through zarr API
alignment of the FdbZarrGroup.
Renamed the test files and split test_store_v3_random_axis.py in
semanical subtests with their own files.
FDB derives parameters for certain types, e.g. u and v. This may
surprise users and I implemented a feature checking whether the
returned data (in a subset of the very first requested data chunk), is
matching what the user expects by iterating all parameters and check
them against the parameters in the view definition.
@tbkr
tbkr force-pushed the feature/zfdb/fdb-678-refactor-tests-and-zarr-interface-alignment branch from 117dffa to 5c2b8f1 Compare July 22, 2026 06:17
tbkr added 2 commits July 22, 2026 08:40
Shortened FDB name in docs for consistency. Also moved indices page away
from the main page to its own header section entry
The builder was moving content and this caused a nullptr issue to arise
on the second call of build. This addresses the fix for the issue.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 30 out of 34 changed files in this pull request and generated 4 comments.

Comment thread src/chunked_data_view/Axis.cc Outdated
Comment thread src/pychunked_data_view/chunked_data_view.py
Comment thread src/chunked_data_view/ChunkedDataViewBuilder.cc Outdated
Comment thread tests/chunked_data_view/test_view.cc Outdated
@tbkr
tbkr force-pushed the feature/zfdb/refactor branch from a2095ef to b4e1e36 Compare July 23, 2026 09:27
@tbkr
tbkr force-pushed the feature/zfdb/refactor branch 2 times, most recently from 92fa553 to 41278f8 Compare July 23, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants