Skip to content

Report a malformed OME-Zarr labels group as unreadable_mask - #41

Merged
guijacquemet merged 2 commits into
mainfrom
claude/malformed-zarr-labels
Oct 30, 2026
Merged

guijacquemet merged 2 commits into
mainfrom
claude/malformed-zarr-labels

Conversation

@guijacquemet

Copy link
Copy Markdown
Contributor

Summary

Fixes #38.

  • masks.py: when an OME-Zarr image's labels group cannot be read, _label_masks now returns its path, <image>/labels. Examples are a group that does not list its label images, or a store that fails to open. find_masks reports these paths under the existing error unreadable_mask, together with masks whose headers cannot be opened.
  • Without the zarr extra, label images are still skipped quietly, as find_masks documents. In that case the OME-Zarr image itself is unreadable and already reported.
  • Docs: contract §15 (header checks) and the unreadable_mask row in user guide §8 now cover this case.

Why

The NgffError was logged at info level and then ignored. If every image of a mask type was affected, that type disappeared from the inventory and mask_missing never fired. Those objects were then not measured, and nothing said so.

Notes for review

  • No new error code: the existing unreadable_mask is reused, with an extended action text.
  • The manifest and outputs do not change for valid stores.

Tests

  • New regression test: tests/test_masks.py::test_a_malformed_labels_group_is_an_error_not_a_vanished_mask_type. It uses two OME-Zarr images whose labels attribute is not a list. It checks both preflight and that run_experiment is blocked.
  • Fails on main: the inventory is MaskInventory(types=(), files=(), issues=()) and .ok is True.
  • Full suite (Python 3.13, zarr 3.4.2, notebook extra installed): 1052 passed, 1 skipped. The skip is test_discovery.py:472: running as root ignores file modes.
  • ruff check . and ruff format --check . are clean.
  • Not run: zarr 2.18 / Python 3.11, Windows, macOS.

Generated by Claude Code

find_masks caught the NgffError from reading an OME-Zarr image's labels
group, logged it at info level and went on. When every image of a mask type
was affected, the type vanished from the inventory and mask_missing never
fired, so those objects were silently not measured. The group is now the
error unreadable_mask with the path <image>/labels, which stops check, run
and the masks command. Without the zarr extra label images are still skipped,
as documented.

Fixes #38

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Scma6W3LC11s3qjXHZuGDm
…-labels

# Conflicts:
#	docs/contract.md
#	docs/user_guide.md
#	src/morphobricks_preprocessing/masks.py
#	tests/test_masks.py

Copy link
Copy Markdown
Contributor Author

Merged main (#40, #42, #43, #44) in:

1121 passed, 1 skipped (test_discovery.py:472, root), ruff clean, CI 7/7 green on 0ddd360. Merging.


Generated by Claude Code

@guijacquemet
guijacquemet merged commit 9452d1e into main Oct 30, 2026
7 checks passed
@guijacquemet
guijacquemet deleted the claude/malformed-zarr-labels branch November 1, 2026 18:05
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.

A malformed OME-Zarr labels group is dropped with an info log

2 participants