Skip to content

[Audit/Correctness] XY-ordered mask headers pass preflight but fail read_mask #68

Closed

Description

@guijacquemet

Evidence (Sad Catapella, Batch 1; main d7a538e)

  • _known_axes accepts both YX and XY because it checks membership and uniqueness, not plane order.
  • _header_issues then accepts an XY mask if the image's physical Y/X sizes match by role; mask_size_issues similarly compares sizes by the declared roles.
  • read_mask preserves the pixel plane's axis order, then unconditionally requires axes == 'YX'. Thus an accepted XY mask cannot be read.
  • Current tests cover 1-pixel YX and TYX but not XY.

Impact

A preflight and histogram run can accept and record masks that the public reader and optional mask relationship scan later refuse. This violates the input contract's intent that accepted named axes are usable; it gives late failures rather than a clear preflight diagnosis.

Fix / acceptance

Choose and document one policy explicitly: (a) if masks are never reordered, reject XY (and any non-YX retained order) in mask header validation with a named error, or (b) transpose the selected pixel plane to YX in a documented, audited reader. Do not silently reorder. Add XY and XY-with-T/Z fixtures testing preflight, run and read agreement and non-square shapes.

Classification: confirmed source-level contract inconsistency; actual fixture execution still needed.

Activity

  1. guijacquemet commented on Nov 2, 2026

    @guijacquemet
    ContributorAuthor

    Fixed in v0.4.0.

    A mask whose header stores X before Y is now refused at preflight with mask_layout ("X is stored before Y"), so preflight and the reader agree. The fix came in PP-5 (88a14b8, #111) and PP-8b (#115):

    • the check is in masks/stated.py:86-88;
    • mask_checks.py:118-134 keeps the refusal;
    • the regression test is tests/test_masks_v040.py:195.

    Closing as completed (owner-approved triage, 2026-11-02).


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions