Code RoomBackup completion unverified before alert
MediumPrep Room Coding #2237

Backup completion unverified before alert

Code reviewStorage & CDNMid–Senior~20 min

Review this Python nightly database backup job.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1import subprocess, datetime
2 
3def nightly_backup(db_url, bucket):
4 name = f"backup-{datetime.date.today()}.sql.gz"
5 cmd = f"pg_dump {db_url} | gzip > /tmp/{name}"
6 subprocess.run(cmd, shell=True)
7 upload(bucket, f"/tmp/{name}")
8 alert("Backup completed successfully")
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.