docHub

⚠ Never delete, force-push, or mass-edit without API verification

Severity: critical Lesson date: 2026-06-22 Status: active


What happened

On 2026-06-22 23:53 UTC, Helper executed 5 GitHub DELETE /repos/<name> calls without first inspecting the repos. Memory said they were "DEPRECATED placeholders" so the inspection was skipped. After the deletes, the underlying canonicals (which shared storage per the case-variant trap) also went 404. The lesson: memory about repo contents is not ground truth. Even if memory says "empty placeholder," verify with the API before deleting.

This is the second near-disaster in 24 hours (after the PAT leak on 2026-06-19). Both could have been prevented by a 30-second API check.


The rule

Before ANY destructive operation, run the inspect-first protocol.

OperationInspectTool
Delete a GitHub repoGET /repos/<owner>/<name>, look at size, pushed_at, description, and recent commitscurl -H "Authorization: Bearer $PAT" https://api.github.com/repos/...
Force-push to a branchCheck what's on the remote; confirm the operator wants to overwritegit fetch origin <branch> && git log origin/<branch>
Mass-edit (find/replace across many files)Dry-run the regex on a single file; review matches`find . -name '*.md' \xargs grep -l PATTERN`
Mass-delete filesList the files first; show the operator the listfind . -name '*.tmp' -print
Rotate a tokenConfirm the new token works on a read-only endpoint firstcurl -H "Authorization: Bearer $NEW_TOKEN" https://api.github.com/user
Cloudflare deployLook at the build log + diff before promoting to productiondashboard preview, then promote
Database migrationBackup first; dry-run on a copy; verify the migration is reversiblepg_dump, then test migration

The "go" signal from the operator is not the same as "I have confirmed the target is safe to delete." The operator may be trusting the same stale memory you are.


How to check before acting


The four destructive-ops mistakes, ranked by cost

MistakeCostRecoverable?
Delete a real GitHub repo with codeHigh — days of work potentially lostSometimes (GitHub support, short window)
Force-push over a real branchHigh — others' work + yours overwrittenSometimes (refs/log if you have them)
Rotate a token without testing the new oneMedium — service outage until you realizeAlways (rotate again)
Mass-edit with a broken regexLow — re-do the regexAlways (git checkout if committed)

The first two are catastrophic. The last two are recoverable. Always check before the catastrophic ones.


The 30-second rule

If a destructive op takes 30 seconds to verify, and 30 minutes to recover from, always verify. Even if you're "pretty sure" the target is empty/placeholder/whatever. Memory is not verification. API is verification.


Cross-references


← back to Mavis workshop