Repository navigation
eegprep-lean: let the host choose the transport - #414
Conversation
FetchTransport reads through a client the host supplies, and set_default_transport makes it the default, so a sandboxed runtime without pyodide.http can still run reader code written with no transport= argument. Tested against the real loopback servers, all four extra tiers, ruff and ty. Refs #413
A new wheel filename, so a host caching wheels by name never serves the old bytes under it. Refs #413
There was a problem hiding this comment.
If your organization's extra usage balance is empty, an organization admin can add extra usage credits at claude.ai/admin-settings/usage. If its monthly spend limit was reached, an admin can raise it on the same page. If neither applies, contact Anthropic support.
Once extra usage is available, reopen this pull request to trigger a review.
|
Claude encountered an error after 0s —— View job I'll analyze this and get back to you. |
A client that does not follow redirects hands back the 3xx, and an opaque response reports 0; both were read as data. The Fetch contract now says a refusal raises rather than answering 403, which the store reads as absence. Shared transport tests are parametrized over both implementations, the default resets after every test, and an explicit transport= is shown to beat a registered one. All tiers pass. Refs #413
|
🤖 Review round 1: five reviewers (code, tests, error handling, comments and types, simplification). Addressed in the latest commit:
Deliberately not changed:
All four extra tiers pass locally (134 with both extras), plus |
Closes #413.
What changed
FetchTransport(fetch): aTransportover a client the host supplies, awaited asfetch(url, headers=...)and returning(status, body).It sends
Rangeand nothing else, and applies the checks the built-in transports apply: a status of 400 or more is aTransportError, a range answered in full is refused, and a client that raises becomes aTransportErrorwith no status.set_default_transport(transport): the host that owns the interpreter chooses whatdefault_transport()returns;Nonerestores platform selection, and an explicittransport=still wins.0.1.0.dev1, in its own commit, so a host caching wheels by filename never serves the old bytes under the same name.Why a module-level default
AGENTS.md asks for no hidden global state, so this deserves a word.
The default is environment configuration, set once by the host before any reader code runs, in the way
zarr.configis; no processing function reads it except throughdefault_transport(), and every reader still takestransport=explicitly.The alternative, threading a transport through every call, would make NEMAR's
python_browserrecipe (await open_array(url)) wrong in exactly the runtime it is written for.Tests
tests/conftest.pyaddsHostFetch, a host client that makes real HTTP requests withurlliband returns the status rather than raising, plus a fixture that restores the default after each test.test_transport.py:FetchTransportagainst the existing loopback server (closed, open-ended and suffix ranges, onlyRangesent, a range answered in full refused, 404 carrying its status, a dead port with no status), and the default selection, including emscripten.test_read_window.py: a sharded store read end to end with notransport=argument, through a registeredFetchTransport, with the shard index and inner chunk shown to go through the host's client.ruff check,ruff format --checkandty checkare clean.