Skip to content

fix: handle NumPy arrays in channel receive wrappers - #300

Merged
toby-coleman merged 1 commit into
mainfrom
fix/numpy-channel-receive
Oct 20, 2026
Merged

toby-coleman merged 1 commit into
mainfrom
fix/numpy-channel-receive

Conversation

@toby-coleman

Copy link
Copy Markdown
Contributor

Receiving a NumPy array currently compares it elementwise with the channel close-marker string. This raises ValueError for multi-element and empty arrays, raises TypeError for structured arrays, and incorrectly closes the channel for scalar or single-element string arrays containing the marker.

Guard the close-marker comparison with isinstance(msg, str) in both Channel and SerdeChannel. Add 22 regression cases across the direct and serialized wrappers, covering array shapes, dtypes, noncontiguous views, marker-containing arrays, subsequent messages, and normal channel closure. Before the fix, 18 of these cases failed; all 22 now pass.

Validation:

  • Channel tests: 28 passed (.venv/bin/pytest -q tests/unit/test_channel.py tests/unit/test_channel_numpy.py tests/unit/test_zmq_channel.py), including Ray and ZMQ multiprocessing coverage.
  • Repository-wide Ruff lint, format check, and ty type check passed.
  • Full suite attempted with benchmarks disabled; 6 passed before stopping at the RabbitMQ integration test because no RabbitMQ URL/connection is configured.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T20:06:05.049895Z e629be2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

Benchmark comparison for f4914fee (base) vs e629be28 (PR)


------------------------------------------------------------------------------------------------------------------ benchmark: 2 tests -----------------------------------------------------------------------------------------------------------------
Name (time in ms)                                                                         Min                 Max                Mean            StdDev              Median               IQR            Outliers     OPS            Rounds  Iterations
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_process_run (main/.benchmarks/Linux-CPython-3.14-64bit/0001_base)     555.6293 (1.0)      563.4707 (1.0)      560.6255 (1.0)      3.2830 (1.19)     561.4860 (1.00)     5.0495 (1.20)          1;0  1.7837 (1.0)           5           1
test_benchmark_process_run (pr/.benchmarks/Linux-CPython-3.14-64bit/0001_pr)         559.0205 (1.01)     565.3700 (1.00)     561.3202 (1.00)     2.7704 (1.0)      559.6225 (1.0)      4.2126 (1.0)           1;0  1.7815 (1.00)          5           1
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Legend:
  Outliers: 1 Standard Deviation from Mean; 1.5 IQR (InterQuartile Range) from 1st Quartile and 3rd Quartile.
  OPS: Operations Per Second, computed as 1 / Mean

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@toby-coleman
toby-coleman merged commit 2cf8411 into main Oct 20, 2026
27 checks passed
@toby-coleman
toby-coleman deleted the fix/numpy-channel-receive branch October 20, 2026 20:17
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