The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user Yicong-Huang (triggered by Yicong-Huang).

Head commit for run:
9223ddf5192ca65672663cc968a46d10d769ca51 / Yicong Huang 
<[email protected]>
test(pyamber): add unit tests for _QueueReader and cleanup-failed-upload paths 
(#4707)

### What changes were proposed in this PR?

Adds direct pytest coverage for two pieces of
`large_binary_output_stream.py` that previously had only end-to-end
coverage:

- The private `_QueueReader` helper (partial-read buffering, EOF
sentinel handling).
- `_cleanup_failed_upload`'s silent-swallow path (when both upload and
the post-failure `delete_object` raise).

Writing the second test surfaced a real bug, which is also fixed here:
`LargeBinaryInputStream` and `LargeBinaryOutputStream` extend
`io.IOBase` but maintained their own `self._closed` flag and overrode
the `closed` property without ever calling `super().close()`. IOBase's
internal closed flag stayed `False`, so on Python 3.13 `IOBase.__del__`
re-invoked `close()` during finalization. On the failed-upload path that
re-entry called `_cleanup_failed_upload` a second time, sending a
duplicate `delete_object` to S3 and tripping `assert_called_once_with` —
only on the 3.13 matrix leg.

Fix: drop the redundant `self._closed` flag and `closed` property
override in both classes; wrap the existing `close()` logic in
`try/finally` and call `super().close()` in the `finally`. IOBase now
records the closed state even when our cleanup raises, so the implicit
finalizer call early-returns on `self.closed` and the cleanup runs at
most once. Existing `self._closed` reads (`write`, `writable`,
`readable`, `_require_open` decorator) move to `self.closed`.

### Any related issues, documentation, discussions?

Closes #4706.

### How was this PR tested?

```
cd amber/src/main/python
ruff check 
pytexera/storage/{large_binary_input_stream,large_binary_output_stream,test_large_binary_output_stream}.py
ruff format --check 
pytexera/storage/{large_binary_input_stream,large_binary_output_stream,test_large_binary_output_stream}.py
python -m pytest pytexera/storage/test_large_binary_output_stream.py
```

CI exercises the change across the full `python` matrix; before the fix
only the 3.13 leg failed on `test_delete_object_failure_is_swallowed`.

### Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (claude-opus-4-7)

Report URL: https://github.com/apache/texera/actions/runs/25292022928

With regards,
GitHub Actions via GitBox

Reply via email to