zenchantlive
a2b0909724
fix: recover from mass file corruption incident (2026-02-15)
...
INCIDENT SUMMARY:
A catastrophic corruption event affected the working directory, with null
bytes (0x00) overwriting content in dozens of files including:
- package.json (corrupted)
- tailwind.config.ts (corrupted)
- All modified tracked files
- Untracked directories (components/ui/, node_modules/, .next/)
ROOT CAUSE:
Unknown - files were filled with null bytes, destroying their content.
RECOVERY PROCESS:
1. Discovered corruption when npm run dev failed with EJSONPARSE
2. Checked git diff --stat - showed many files as "binary"
3. Found dangling stash commits (0d80ad9, a1a33cf) containing our work
4. Restored tracked files from stash: git checkout a1a33cf -- .
5. Removed corrupted untracked directories (node_modules, .next, components/ui)
6. Reinstalled dependencies: npm install
7. Reinitialized shadcn/ui: npx shadcn@latest init
8. Reinstalled shadcn components: npx shadcn@latest add button card ...
9. Recreated earthy-dark tokens (bb-ui2.1) - lost in shadcn init overwrite
10. Verified all closed bb-ui2 beads still had their deliverables
DATA PRESERVED:
- All tracked source code (recovered from git stash)
- .beads/issues.jsonl (recovered from stash)
- All bead history and metadata
DATA LOST:
- Uncommitted changes to untracked files
- Earthy-dark tokens (recreated from bead spec)
- components/ui/ (regenerated from shadcn)
LESSONS LEARNED:
1. Commit work frequently - untracked changes are not protected
2. Git stash captures tracked files only
3. shadcn init overwrites globals.css - preserve tokens separately
4. Dangling commits can save the day
VERIFICATION POST-RECOVERY:
- npm run typecheck: PASS
- npm run lint: PASS
- npm run test: PASS
- All bb-ui2 closed bead deliverables present
CLOSES: bb-silver-castle (triage bead for this incident)
2026-02-15 21:19:58 -08:00