Repository: fractal-analytics-platform/fractal-tasks-core (language: python)

Issue:
Add test that validates NGFF metadata after copy-ome-zarr
Ref https://github.com/fractal-analytics-platform/fractal-tasks-core/commit/bffe65aff13671abb133db4e96a46e4bff26ef53


Discussion / hints:
We already have a test in place to validate the NGFF metadata for images, wells & plates after MIP, see:

https://github.com/fractal-analytics-platform/fractal-tasks-core/blob/1d1e9657e2ea7c18e0aa79923719d093520c66b0/tests/tasks/test_workflows.py#L393-L399

I also checked the outputs of example 01 & 02 and the metadata appears valid. Some workflows that rely on plate & well metadata like registration also run successfully after MIP.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1c4dc03e6..a4658ecac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,10 @@
 **Note**: Numbers like (\#123) point to closed Pull Requests on the fractal-tasks-core repository.
 
-# [WIP] 1.0.0
+# Unreleased
+
+* Make validation of NGFF Zarr attributes more strict, in tests (\#732).
+
+# 1.0.0
 
 * Update all tasks to use the new Fractal API from Fractal server 2.0 (\#671)
 * Provide new dev tooling to create Fractal manifest for new task API (\#671)


Test patch:
diff --git a/tests/tasks/_validation.py b/tests/tasks/_validation.py
index cb86aff41..00ff4028b 100644
--- a/tests/tasks/_validation.py
+++ b/tests/tasks/_validation.py
@@ -36,6 +36,19 @@ def validate_schema(*, path: str, type: str):
         zattrs = json.load(fin)
     validate(instance=zattrs, schema=schema)
 
+    if type == "plate" and "plate" not in zattrs.keys():
+        raise ValueError(
+            f"Zarr attributes of {path} do not include 'plate' key"
+        )
+    elif type == "well" and "well" not in zattrs.keys():
+        raise ValueError(
+            f"Zarr attributes of {path} do not include 'well' key"
+        )
+    elif type == "image" and "multiscales" not in zattrs.keys():
+        raise ValueError(
+            f"Zarr attributes of {path} do not include 'multiscales' key"
+        )
+
 
 def check_file_number(*, zarr_path: Path, num_axes: int = 4):
     """