You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Roll back session uploads on client disconnect and cancellation #17
Audited main at a7bad12. Existing tests pass: 33 Python, 9 JavaScript.
routes.py append_session_video and upload_session_audio only clean up on OSError/ValueError. Starlette raises ClientDisconnect when a streamed request disconnects; task cancellation also bypasses these handlers.
Reproduced by calling the registered endpoints with a request stream that yields b'partial' and then raises ClientDisconnect. Both frames.h264 and audio.bin retain those partial bytes. The next audio upload returns 409 because audio.bin exists. Video accounting remains at its pre-request value despite the extra bytes, so a retry can corrupt the elementary stream and its cumulative cap no longer reflects disk contents.
Please roll video back to its accepted prefix and remove incomplete audio on every unsuccessful stream exit, including disconnect/cancellation. Preserve cancellation semantics after cleanup. Add interrupted-stream tests verifying exact video contents/counter and a successful audio retry.
Session uploads now roll back on every unsuccessful stream exit. In routes.py, the video append catches BaseException (so ClientDisconnect and CancelledError are no longer missed), truncates frames.h264 back to the accepted prefix, and restores the video_bytes counter inside the append lock; the audio upload removes the incomplete audio.bin. Both re-raise, preserving cancellation semantics.
Added 4 asyncio interrupted-stream tests (disconnect + cancellation for video and audio) that verify exact video contents/counter and a successful audio retry. All 4 were confirmed to fail against the unpatched routes.py. Full suite: 37 passed. Bumped plugin.json to 0.3.2 and updated CHANGELOG.md/CLAUDE.md.
Task list (7/7 completed)
Create feature branch
Roll back video and remove audio on BaseException (disconnect/cancel) in routes.py
Activity
pullfrog commentedon Oct 11, 2026
pullfrog commentedon Oct 11, 2026
Implemented #17 and opened PR #19: #19
Session uploads now roll back on every unsuccessful stream exit. In
routes.py, the video append catchesBaseException(soClientDisconnectandCancelledErrorare no longer missed), truncatesframes.h264back to the accepted prefix, and restores thevideo_bytescounter inside the append lock; the audio upload removes the incompleteaudio.bin. Both re-raise, preserving cancellation semantics.Added 4
asynciointerrupted-stream tests (disconnect + cancellation for video and audio) that verify exact video contents/counter and a successful audio retry. All 4 were confirmed to fail against the unpatchedroutes.py. Full suite: 37 passed. Bumpedplugin.jsonto 0.3.2 and updatedCHANGELOG.md/CLAUDE.md.Task list (7/7 completed)
big-pickle(free) | 𝕏