Verify find -delete safely
An AI assistant gave you a Bash one-liner to delete log files older than 7 days from `/var/log/myapp`: `find /var/log/myapp -name '*.log' -mtime +7 -delete`. It looks right and you're about to put it in a cron job. What do you do to confirm it does the right thing before it runs unattended with `-delete`?
Implement
preview_find_delete(file_lines: list[str], mtime_plus_days: int) → list[str]Examples
in
[["/var/log/myapp/app.log|10","/var/log/myapp/app.log.1|30","/var/log/myapp/access.log|7","/var/log/myapp/debug.log|8"],7]out["/var/log/myapp/app.log","/var/log/myapp/debug.log"]in
[["/var/log/myapp/app.log|10","/var/log/myapp/app.log.1|30","/var/log/myapp/access.log|7","/var/log/myapp/debug.log|8"],0]out["/var/log/myapp/app.log","/var/log/myapp/access.log","/var/log/myapp/debug.log"]in
[["/var/log/myapp/archive/old.log|365","/var/log/myapp/notes.txt|400","/var/log/myapp/app.log.gz|400"],7]out["/var/log/myapp/archive/old.log"]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 10 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.
Run or narrate your approach, then ask the coach.