Current checkpoint — fb161314a
The pinned terminal-failure ordering is now implemented: materialize the shared abort reason, transfer the error to any buffered response body, then re-read and cancel the upload sink last. The sink can invoke JavaScript synchronously, so the ordering and ownership matter; simply removing the early return would not preserve the complete contract.
The entire unchanged abort file advances from 1 pass / 1 fail / 5 assertions to 2 passes / 0 failures / 6 assertions, matching pinned Bun. The original 2,500 ms timeout sentinel and 50-cancellation workload remain unchanged. Queued abort remains 1/1 / 3 assertions. The new native regression verifies 24 scenarios across five buffered consumers and stream reading, default/custom exact reasons, one cancellation, abort/GC/fetch reentry, recovery requests and natural exit. Published parent fails its settlement bound; the final candidate passes normally, with VM destruction/JSC exception checks, and in the full regression run.
Native build 17/17; units 1,824 pass / 19 skips / 0 failures, 19/19 steps; runtime regressions 57/57, including 26 native files. Five complete unchanged body files pass (clone 25, async-iterator 2, mixin-errors 2, fast-path 18, body 346 with 4 skips). The five previous fetch files remain green, including gzip 24/24. All 64 measured upstream sources match the exact pin; no upstream assertion/workload/deadline change.
The broad body-stream file remains 4,883 pass / 4,203 fail, with 10 candidate between-test errors versus 2 in the parent, all in the failing HTTP/3 path. The candidate and parent emit identical failing test-name counts. The extra errors and original five-second timeouts remain recorded; no whole-file non-regression/pass claim is made. #530 tracks HTTP/3 separately and #66's historical completion claim has been corrected.
Evidence: zig-out/body-abort-{parent1,release1,candidate1}.json, body-native-{parent1,candidate1,destruction}.json, body-unit1.log, body-regression1s.json, body-corpus-{parent1,release1,candidate1}.json, body-matrix-comparison1.json, body-abort-pin1.json, body-source-integrity-final1.json, and body-build1-binary.json. More detail is in docs/docs/NATIVE_RUNTIME_BINDINGS.md.
Published as Chris Breuer without coauthors on codex/runtime-port, not merged to main. Shared Darwin checkout; unrelated compiler work excluded. This issue retains Linux/Windows and branch-integration verification. Skips/TODOs and full source ownership remain unverified. Full parity under #66 is incomplete.
Original reproduction
Follow-up to #66 and #527. The full unchanged js/web/fetch/fetch-abort-stream-body.test.ts reproduces a native Home response-body settlement gap.
- Published Home
90ced0ed660150c26af009cbea64c40b46993805: 1 pass / 1 fail / 5 assertions. The first test printsarrayBuffer timed outandtext timed outunder its original 2,500 ms sentinel. - Pinned Bun release
1.4.0-canary.1+4982b91e3: 2 pass / 0 fail. Both consumers reject with AbortError. - The separate unchanged queued-abort case passes in both runtimes.
In FetchTasklet.onBodyReceived, a failed response with an upload sink calls sink.cancel() and returns before body.toErrorInstance(). The pinned Rust implementation materializes the cancellation error, transfers it to the response body, then cancels the still-current sink last because cancellation can synchronously re-enter JavaScript. Port the complete ordering/ownership behavior, not a timeout workaround. Cover all buffered consumers, exact abort reasons, reentrant cancellation, streaming consumers and natural process shutdown.
Evidence: zig-out/body-abort-{parent1,release1}.json, body-abort-pin1.json, and full per-file stdout/stderr. All four upstream test/fixture sources and the consulted Rust source match pin 4982b91e3702094330f3be3883354c52b8c01323; no test source, workload or deadline changes. The broader 9,086-case body-stream matrix is still running in Home and is not yet a pass. Full port under #66 remains incomplete.