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

Head commit for run:
1a65a3168c5ffbd171e8ed0d64dec495e45c1b24 / Justin Siek 
<[email protected]>
fix(workflow-operator): set alreadyClosed before onClose (#5678)

### What changes were proposed in this PR?

`AutoClosingIterator.hasNext` only set `alreadyClosed = true` after
calling `onClose()`, and so if `onClose()` throws, `alreadyClosed` would
stay false, and so a subsequent `hasNext` would reinvoke `onClose()`,
running cleanup a second time on a resource whose close already failed.

The change makes `alreadyClosed = true` run before `onClose()`.

### Any related issues, documentation, discussions?

Closes #5660 

### How was this PR tested?

Updated AutoClosingIteratorSpec — replaced the existing characterization
test ("re-invoke onClose on a retry when the previous onClose threw")
with a positive assertion that a second hasNext after a throwing close
does NOT re-invoke onClose (closeCount stays at 1) and returns false.

`sbt "WorkflowOperator/testOnly
org.apache.texera.amber.operator.source.scan.AutoClosingIteratorSpec"`
- 10/10 pass. `sbt scalafmtCheckAll` passes.

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

Generated-by: Claude Code (Claude Opus 4.8)

Co-authored-by: Justin Siek <[email protected]>

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

With regards,
GitHub Actions via GitBox

Reply via email to