Skip to content

feat(zarr-metadata): export base64_fill_value_rules for data type definitions - #4609

Merged
d-v-b merged 3 commits into
zarr-developers:mainfrom
d-v-b:claude/great-stonebraker-732ded
Nov 9, 2026
Merged

d-v-b merged 3 commits into
zarr-developers:mainfrom
d-v-b:claude/great-stonebraker-732ded

Conversation

@d-v-b

@d-v-b d-v-b commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

zarr-metadata exports a rule that rejects a string that's not standard-alphabet base64, which allows externally-defined data types to use this rule to constrain admissible values for the fill_value field. This is demonstrated in a new section in the guide to parsing and validation.

🤖 AI text below 🤖

Agent summary

Export base64_fill_value_rules from zarr_metadata.v3.data_type.bytes, the rule that rejects a fill value string that is not standard-alphabet base64, so a data type defined outside the package can pass it as fill_value_rules for a Base64Bytes fill value, or yield from it in a rule of its own. The guide to parsing and validation now shows how to define a data type with fill_value_rules.

Refs d-v-b#425. The issue asks for a way to constrain a fill value beyond its JSON type. fill_value_rules already does that, and both the reader and the pydantic field apply it. The consumer's definition only set fill_value=str, the guides never mentioned fill_value_rules, and the package's base64 rule was private. This PR fixes the last two.

  • base64_fill_value_rules (in v3/data_type/_byte.py) fits the fill_value_rules slot and checks only strings, so it also serves bytes, whose fill value may be written as byte values. bytes and variable_length_bytes now use it in place of their own copies. null_terminated_bytes and zarr_python_raw_bytes still call base64_problems directly before their size checks.
  • docs/parsing-validation.md gains an example: an acme.packed data type whose rule yields from base64_fill_value_rules and then checks the size its configuration sets. It adds the type with CORE_AND_EXTENSIONS_CONTEXT.union(ZarrV3Context(data_types=[PACKED])), and runs in the docs tests.
  • JSON Schema still does not carry rules, as the json_schema module documents, so a schema for such a context accepts any string.

The agent rebased this onto main as one commit: the branch had been stacked on the ZARR_PYTHON_CONTEXT branch, which merged upstream as #4583, and the docs example switched from the removed context.update(...) to union. just check in packages/zarr-metadata passes (3696 tests and the strict docs build).

🤖 Generated with Claude Code

…initions

Export the rule that rejects a fill value string that is not
standard-alphabet base64, so a data type defined outside the package can
pass it as `fill_value_rules` or yield from it. `bytes` and
`variable_length_bytes` now share it. The parsing and validation guide
shows a data type that defines `fill_value_rules`, built with `union`.

Rebased onto main as one commit; the earlier history carried the merged
ZARR_PYTHON_CONTEXT branch.

Assisted-by: ClaudeCode:claude-opus-5-5
@github-actions github-actions Bot added needs release notes Automatically applied to PRs which haven't added release notes zarr-metadata Specific to the zarr-metadata sub-package labels Nov 9, 2026
@read-the-docs-community

read-the-docs-community Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 zarr-metadata | 🛠️ Build #35766741 | 📁 Comparing 9801fef against latest (9783489)

  🔍 Preview build  

4 files changed
± models/index.html
± parsing-validation/index.html
± api/model/index.html
± api/v3/data_type/index.html

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.90%. Comparing base (27f034e) to head (9801fef).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4609   +/-   ##
=======================================
  Coverage   94.90%   94.90%           
=======================================
  Files          96       96           
  Lines       14048    14048           
=======================================
  Hits        13332    13332           
  Misses        716      716           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@d-v-b
d-v-b marked this pull request as ready for review November 9, 2026 20:43
@d-v-b
d-v-b merged commit daef49b into zarr-developers:main Nov 9, 2026
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes zarr-metadata Specific to the zarr-metadata sub-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant