Skip to content

Reject builder reuse after cancelled append#94

Draft
zaniebot wants to merge 1 commit into
astral-sh:mainfrom
zaniebot:zb/cancel-safe-builder-append
Draft

Reject builder reuse after cancelled append#94
zaniebot wants to merge 1 commit into
astral-sh:mainfrom
zaniebot:zb/cancel-safe-builder-append

Conversation

@zaniebot

Copy link
Copy Markdown

Summary

  • guard every public builder append operation against cancellation
  • poison the builder when an append future is dropped in progress
  • reject later appends and finalization instead of emitting a corrupt archive

Why

An append can write part of a header or payload before returning Pending. Dropping that future loses its write offset; retrying starts a new entry at the current sink position and can produce a corrupt archive while reporting success. Since a generic AsyncWrite sink cannot be rolled back, the builder must not be reused after cancellation.

Testing

  • added a regression test that cancels after a partial header write and verifies that retry is rejected without further output
  • cargo check --all --all-targets --all-features
  • cargo test
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants