Skip to content

Commit e9761e7

Browse files
rustyconoverclaude
andcommitted
client: a bind written to an exited worker is a ClientError on Windows too
BindRequest grew by ~450 bytes (arguments_location), which pushes the client's bind request past the Windows pipe buffer. Writing it to a worker that already exited then raises a plain OSError (EINVAL) instead of BrokenPipeError, which vgi-rpc does not treat as a transport error, so the worker-exit tests saw OSError rather than ClientError. _do_bind now maps an OSError from sending the request to ClientError (stderr enrichment still applies upstream). Also route the tests' BindRequest.arguments reads through require_arguments() so `mypy tests/` passes with the nullable field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 81258a7 commit e9761e7

5 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎tests/catalog/column_native_reference.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
def _args(params: Any) -> dict[str, Any]:
3636
call = params.bind_call if isinstance(params, BindParams) else params.init_call.bind_call
37-
target = json.loads(present(call.arguments.positional[0]).as_py())
37+
target = json.loads(present(call.require_arguments().positional[0]).as_py())
3838
return dict(
3939
attach_opaque_data=params.attach_opaque_data,
4040
transaction_opaque_data=params.transaction_opaque_data,

‎tests/catalog/generated_columns_reference.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def _args(params: Any) -> dict[str, Any]:
5454
return dict(
5555
attach_opaque_data=params.attach_opaque_data,
5656
transaction_opaque_data=params.transaction_opaque_data,
57-
**json.loads(present(call.arguments.positional[0]).as_py()),
57+
**json.loads(present(call.require_arguments().positional[0]).as_py()),
5858
)
5959

6060

‎tests/catalog/transactional_write_reference.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def _identifier(name: str) -> str:
9797

9898
def _table_argument(params: BindParams[None] | InitParams[None] | ProcessParams[None]) -> str:
9999
bind = present(params).bind_call if isinstance(params, BindParams) else present(params.init_call).bind_call
100-
arguments = bind.arguments.positional
100+
arguments = bind.require_arguments().positional
101101
if len(arguments) != 1 or arguments[0] is None:
102102
raise _error("one table-name argument is required")
103103
name = arguments[0].as_py()

‎tests/test_argument_metadata.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def test_bind_and_init_preserve_argument_metadata() -> None:
8686
original = _arguments()
8787
bind = BindRequest(function_name="f", arguments=Arguments.from_batch(original), function_type=FunctionType.TABLE)
8888
restored = BindRequest.deserialize_from_bytes(bind.serialize_to_bytes())
89-
assert restored.arguments.to_batch().equals(original, check_metadata=True)
89+
assert restored.require_arguments().to_batch().equals(original, check_metadata=True)
9090
init = InitRequest(bind_call=restored, output_schema=pa.schema([]))
9191
restored_init = InitRequest.deserialize_from_bytes(init.serialize_to_bytes())
92-
assert restored_init.bind_call.arguments.to_batch().equals(original, check_metadata=True)
92+
assert restored_init.bind_call.require_arguments().to_batch().equals(original, check_metadata=True)
9393

9494

9595
@pytest.mark.parametrize(
@@ -145,7 +145,7 @@ class _MetadataWorker(Worker):
145145
"""Return the decoded argument schema through the real bind RPC."""
146146

147147
def bind(self, request: BindRequest, ctx: CallContext) -> BindResponse:
148-
return BindResponse(output_schema=request.arguments.schema())
148+
return BindResponse(output_schema=request.require_arguments().schema())
149149

150150

151151
def test_public_http_bind_preserves_argument_metadata() -> None:

‎vgi/client/client.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,12 @@ def _do_bind(
17671767
bind_response: BindResponse = proxy.bind(request=bind_request)
17681768
except RpcError as e:
17691769
raise ClientError.from_rpc_error(e) from e
1770+
except OSError as e:
1771+
# Writing the request to a worker that has already exited. POSIX
1772+
# raises BrokenPipeError, which vgi-rpc reports as an RpcError; a
1773+
# Windows pipe raises a plain OSError (EINVAL) once the request is
1774+
# larger than the pipe buffer, which reaches here unwrapped.
1775+
raise ClientError(f"bind: the worker connection failed while sending the request: {e}") from e
17701776

17711777
if bind_result_callback is not None:
17721778
bind_result_callback(bind_response)

0 commit comments

Comments
 (0)