Skip to content

zarr-metadata: Scope.update() replaces slots whole; adding a definition can silently drop the defaults #424

Closed

Description

@d-v-b

🤖 AI text below 🤖

Scope.update() replaces each slot whole: passing data_types=[NEW_DEFINITION] silently drops every default data type from the scope rather than adding one. Extending the default scope requires re-splicing the defaults by hand:

GEOZARR_SCOPE = CORE_AND_EXTENSIONS.update(
    data_types=[
        *CORE_AND_EXTENSIONS.data_types.values(),
        FIXED_LENGTH_UTF32,
        NULL_TERMINATED_BYTES,
    ],
)

Encountered while extending CORE_AND_EXTENSIONS for GeoZarr validation in EOPF-Explorer/data-model#330. The failure mode of getting it wrong is nasty for exactly this API's audience: with strict validation on, a scope that silently lost its defaults blames every ordinary document for "unclaimed" core names, and the error points at the store, not at the scope construction.

The ask: an additive operation — scope.extend(data_types=[...]), or merge semantics on update — so adding a definition cannot drop the existing ones. If update's replace-whole semantics are intentional, a note in its docstring showing the splice idiom would at least make the footgun visible.

Activity

  1. added a commit that references this issue on Nov 6, 2026
    94dcfd1
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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions