Kaizen-3C infinity mark Kaizen-3C

studies · bzip2 · a series in 9 parts

Moving bzip2 to safe code.

A field study in taking one real, load-bearing C library all the way to safe code without changing what it does — every road, one part per publish. Each part pairs with a public repo you can diff and re-run.

2 of 9 published · new part every publish · project: the bzip2 project

  1. 00 Prologue — a library that almost stopped A short history of bzip2 — essential, then nearly abandoned, then revived — and why that arc is the case for de-risking change. the backstory
  2. 01 The safe baseline bzip2 → idiomatic Rust, zero unsafe in every codec module, proven byte-identical over 265 commands — and the honest thing it traded to get there. Aug 6, 2026
  3. 02 The 0-unsafe trap Why “it compiles and it's safe” is the easiest trap to fall into — and the question it quietly dodges. Aug 11, 2026
  4. 03
    A contract for migration What a migration actually owes the caller — the allocator, the aliasing, the ABI — written down as a contract. coming ~Aug 25
  5. 04
    The de-aliasing wall Split a library into units and a coherence bug appears that lives between them, not inside any one of them. coming ~Sep 8
  6. 05
    Aliasing lives in safe code Overlapping views aren't a C-only problem; safe code has to carry the same invariant across the seam. coming ~Sep 22
  7. 06
    Cycles Mutually-recursive units that resist being ported one at a time — and what to do when the pieces won't separate. coming ~Oct 6
  8. 07
    Proving the unsafe you keep The unsafe you can't remove, kept honest: proving the boundary sound rather than pretending it away. coming ~Oct 20
  9. 08
    Reading the residue What the leftover unsafe tells you about a codebase — if you read it instead of hiding it. coming ~Nov 3
  10. 09
    What well-crafted work teaches Stepping back to the careful human port that set the standard — what finishing the whole job, not just the easy 90%, actually takes. coming ~Nov 17