Skip to content

fix(api): drop unreachable scalar branch in save_array - #412

Open
d-v-b wants to merge 11 commits into
mainfrom
fix/save-array-dead-scalar-branch
Open

d-v-b wants to merge 11 commits into
mainfrom
fix/save-array-dead-scalar-branch

Conversation

@d-v-b

@d-v-b d-v-b commented Oct 21, 2026

Copy link
Copy Markdown
Owner

🤖 AI text below 🤖

save_array rejects anything that is not NDArrayLike before it reaches np.isscalar(arr), and numpy scalars never pass that protocol check because they lack __len__ and __setitem__, so the np.array(arr) fallback could never run. This PR deletes the dead branch and adds a test pinning the TypeError path that actually handles scalars.

Why now

numpy 2.5.4 changed the np.isscalar stub from TypeGuard[...] to TypeIs[...]. A TypeIs lets mypy intersect the already-narrowed NDArrayLike with the scalar union, discover the intersection is empty, and report Statement is unreachable. That is the lint failure on the upstream dependabot bump zarr-developers/zarr-python#4549, where mypy fails only because the lock moves numpy from 2.5.2 to 2.5.4. The agent bisected it: mypy 2.4.0 with numpy 2.5.2 passes, mypy 2.3.1 with numpy 2.5.4 fails.

Verification

  • uv run --frozen mypy passes on all 203 files under both numpy 2.5.2 (this branch's lock) and 2.5.4 (the dependabot lock).
  • The 78 save-related tests in tests/test_api.py pass, plus the new test_save_array_rejects_scalar.
  • All pre-commit hooks passed at commit time.

No changelog fragment: internal cleanup with no user-visible behavior change.

Stack bookkeeping

Independent of other PRs. Once this lands on upstream main, the dependabot PR 4549 needs a rebase for its lint job to go green.

🤖 Generated with Claude Code

dependabot Bot and others added 7 commits October 20, 2026 22:12
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.14.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…rs#4535)

Bumps [certifi](https://github.com/certifi/python-certifi) from 2026.4.22 to 2026.10.19.
- [Commits](certifi/python-certifi@2026.04.22...2026.10.19)

---
updated-dependencies:
- dependency-name: certifi
  dependency-version: 2026.10.19
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…r-developers#4543)

* ci(docs): fix the Read the Docs sub-site builds and skip filters

The zarr-indexing, zarr-metadata and zarr-http-server docs sites install their docs group with pip on Read the Docs, without a lockfile, so pymdown-extensions floated to 12.3, whose Highlight extension API the pinned mkdocstrings 1.0.6 cannot drive (Highlight.__init__() missing argument 'md'). No zarr-indexing build has succeeded since. Pin pymdown-extensions to 11.0.1, the version the repo-root uv.lock resolves to, and refresh the package lockfiles.

The post_checkout skip filters compared the PR head against the tip of main with a two-dot diff, so any PR that was behind main appeared to touch every package and built every site. Compare against the merge base instead, after fetching full history into the shallow checkout. Also exclude zarr-http-server from the root site's filter, as the other two packages already were.

Assisted-by: ClaudeCode:claude-fable-5.1

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs: add changelog entry for zarr-developers#4543

Assisted-by: ClaudeCode:claude-fable-5.1

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…rusting Debian (zarr-developers#4547)

* ci(big-endian): resolve dependencies from pyproject.toml instead of trusting Debian

The s390x job installed zarr with --no-deps into an image whose numpy and numcodecs come from Debian sid, so Debian's package versions defined the test environment and zarr's own constraints were never checked. Debian currently ships numcodecs 0.17.0, which zarr excludes (GHSA-jqc8-qjfv-5m6r), and the job failed through the pickle opt-in tests instead of saying so.

Install zarr with its dependencies resolved and run pip check, so an image that does not satisfy pyproject.toml fails at install time. Debian stays a source of prebuilt s390x binaries only. Build a satisfying numcodecs from source in the image, where the compile is cached as a layer, using Debian's meson, Cython and numpy so nothing else compiles under emulation.

Assisted-by: ClaudeCode:claude-fable-5.1

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* docs: add changelog entry for zarr-developers#4547

Assisted-by: ClaudeCode:claude-fable-5.1

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.3.0 to 13.0.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](python-pillow/Pillow@12.3.0...13.0.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 13.0.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [uv](https://github.com/astral-sh/uv) from 0.12.21 to 0.13.4.
- [Release notes](https://github.com/astral-sh/uv/releases)
- [Changelog](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md)
- [Commits](astral-sh/uv@0.12.21...0.13.4)

---
updated-dependencies:
- dependency-name: uv
  dependency-version: 0.13.4
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
`save_array` rejects anything that is not `NDArrayLike` before it reaches
`np.isscalar(arr)`. numpy scalars lack `__len__` and `__setitem__`, so they
never pass the protocol check, and the `np.array(arr)` fallback was dead.

numpy 2.5.4 changed the `np.isscalar` stub from `TypeGuard` to `TypeIs`,
which lets mypy intersect the narrowed `NDArrayLike` with the scalar union
and report the branch as unreachable. Delete it and pin the error path.

Assisted-by: ClaudeCode:claude-fable-5-1
dependabot Bot and others added 3 commits October 21, 2026 21:33
---
updated-dependencies:
- dependency-name: aiohttp
  dependency-version: 3.14.4
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…zarr-developers#4552)

Bumps the actions group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `10.2.0` | `10.3.0` |
| [CodSpeedHQ/action](https://github.com/codspeedhq/action) | `5.2.1` | `5.5.0` |
| [actions/upload-artifact](https://github.com/actions/upload-artifact) | `7.0.1` | `7.0.2` |
| [actions/download-artifact](https://github.com/actions/download-artifact) | `8.0.1` | `8.0.2` |
| [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.6.4` | `0.7.1` |



Updates `astral-sh/setup-uv` from 10.2.0 to 10.3.0
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](astral-sh/setup-uv@c18668a...1c37ad0)

Updates `CodSpeedHQ/action` from 5.2.1 to 5.5.0
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](CodSpeedHQ/action@373d686...821a40c)

Updates `actions/upload-artifact` from 7.0.1 to 7.0.2
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@043fb46...cf430e0)

Updates `actions/download-artifact` from 8.0.1 to 8.0.2
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@3e5f45b...9000827)

Updates `zizmorcore/zizmor-action` from 0.6.4 to 0.7.1
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](zizmorcore/zizmor-action@cc914d7...85b2b9f)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: 10.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: CodSpeedHQ/action
  dependency-version: 5.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: actions/upload-artifact
  dependency-version: 7.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: 8.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: actions
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.7.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Assisted-by: ClaudeCode:claude-opus-5-5

This branch has not been deployed

No deployments
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.

1 participant