A failed batch repeats completed work after every restart. Process numbered synthetic records, persist the last committed cursor and restart after an injected failure.
A media tool hangs or fails without a clear diagnostic. Run a local Python child process through subprocess with a timeout, exit-code check and bounded stderr display.
Concurrent jobs produce logs that cannot be linked to their request. Use logging adapters with synthetic job IDs and redact a sample authorization field.
Background work continues after one required operation has failed. Use TaskGroup with one failing local coroutine and cleanup blocks in the other tasks.
A script schedules every request at once and overloads its dependency. Fetch from a local stub with a semaphore limit, explicit timeout and recorded peak concurrency.
A recurring local-time job runs twice or skips a time change. Use zoneinfo with an example New York schedule and display both ambiguous instants alongside stored UTC values.
A cleanup script gives no preview of the files it will remove. Build an argparse command that lists eligible temporary files and requires an explicit execute flag to remove test fixtures.
An import changes several records before discovering an invalid row. Parse a small contacts CSV with missing columns, quoted commas and invalid email values; collect row-numbered errors before applying changes.
A scheduled export leaves a partial destination after interruption. Write a temporary CSV in the destination directory, inject a failure and replace the destination only after a successful close.