[Bot] A failure midway through converting raw tracks deletes the tracks not yet converted #520
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while doing #393 (v4.3.0 phase 5), outside that lane's scope; same family as #399.
RecordingCog._processinbot/questboard_bot/cogs/recording.pyconverts each speaker's raw capture track ({session_id}_{user_id}_raw.16k-mono.s16le) into its WAV and, in afinally:block at the end, unlinks every remaining entry ofraw_track_files. The normal stop path deletes each raw track as soon as it is converted, so on success thefinallyhas nothing to do. But if the conversion loop raises partway (disk full, a corrupt track, an exception in the WAV writer), thefinallystill runs and deletes the raw tracks that were not converted, which is the only copy of that audio. The failure message the GM sees was reworded in #393 so it makes no promise about what is left on disk, but the loss itself still happens.Expected: a failure in the conversion loop leaves the unconverted raw tracks in place, so #399's startup recovery (which treats leftover raw tracks as the signal that a recording never finished) can convert and hand them off on the next start, or an operator can. The cleanup should only remove tracks that have a WAV to show for them.
Acceptance:
finally(or its replacement) removes only raw tracks whose WAV was written.recover_interrupted_recordingspicks the survivors up on the next start (existing behaviour; add a test if one does not cover this shape).