Code RoomLog cleanup script safety
MediumPrep Room Coding #4345

Log cleanup script safety

Vibe & agenticAlgorithms & data structuresEntry–Mid~12 min

You want a small Bash script that deletes log files older than 30 days from a `/var/log/myapp` directory, to run as a daily cron job. You're about to ask an AI assistant to write it. Write the prompt, and name the one constraint you must include so a vague prompt can't produce something dangerous.

Implement
plan_log_deletions(paths: list[str], age_days: list[int], directory: str, max_age_days: int) → list[str]
Examples
in[["/var/log/myapp/app.log","/var/log/myapp/app.log.1","/var/log/myapp/old/deep.log","/var/log/myapp/notes.txt"],[40,40,90,90],"/var/log/myapp",30]out["/var/log/myapp/app.log"]
in[["/var/log/myapp/app.log","/etc/passwd"],[40,9000],"/",30]out[]
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 12 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.