Skip to content

fix(locallibrary): stop sending a cancelled net/fetch or upload body at the next chunk - #344

Merged
botandbang merged 1 commit into
mainfrom
bnb/upload-cancel-fix
Oct 31, 2026
Merged

botandbang merged 1 commit into
mainfrom
bnb/upload-cancel-fix

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

a_recording_stops_being_sent_once_publishing_is_cancelled (added in #317) fails most runs on macOS on main since #328 landed: 8 of 10 on 41abcae here, with all 32 MiB of the recording sent after the cancel. #328 moved cancelling a plugin's net/fetch and a set upload into Requests::run, which checks the token every 50 ms, and dropped the check the body made on every read. The host gets the plugin's $/cancel before publishing returns, then kept reading the file and sending it until the next check, which over loopback can be all of it.

Changed:

  • net::streamed takes the cancel token and fails the body at the next 64 KiB chunk once it's set.
  • Requests::run gives None when the token is set by the time the request finishes, so that failure reports as cancelled.
  • Body::send (a plugin's net/fetch, file bodies and multipart parts) and the recording upload in sets publish --upload pass their tokens to streamed.
  • A changelog line in apps/locallibrary/changes/upload-cancel-fix.md.

Nothing removed, and the test is unchanged. With the fix it passed 30 of 30 runs, and with the fix's two checks disabled it failed 8 of 10. The cancel, net, destinations, peer and upload tests in locallibrary and loclib-plugin pass (100 of 100), as do clippy and fmt.

@botandbang
botandbang requested a review from bnb as a code owner October 30, 2026 22:59
@botandbang
botandbang enabled auto-merge October 30, 2026 23:00
@github-actions github-actions Bot added documentation Improvements or additions to documentation locallibrary locallibrary and the loclib-* crates locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: plugins The plugin protocol, its host and the built-in plugins locallibrary: publishing The Atmosphere account, and the sets and profile published to it tests Tests, fixtures and test harnesses labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown

Rust coverage

From run 627. Both are held to the thresholds in .cargo/config.toml.

Tests Lines Functions Regions
All 97.44% (82803/84976) 96.53% (13196/13670) 95.71% (182054/190207)
Hegel property tests alone 95.6% (81233/84976) 94.27% (12887/13670) 93.72% (178258/190207)

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

Labels

documentation Improvements or additions to documentation locallibrary: core The core crate, the data model and rekordbox's formats locallibrary: plugins The plugin protocol, its host and the built-in plugins locallibrary: publishing The Atmosphere account, and the sets and profile published to it locallibrary locallibrary and the loclib-* crates tests Tests, fixtures and test harnesses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants