Context
home-lang/home-os #13 added `= undefined` to 504 module-scope `var` declarations across 228 files. The 2026-05-04 re-audit confirmed the impact (87 modules flipped from typecheck-fail to OK), but found the sweep didn't catch every case.
44 of the 90 remaining typecheck-fail modules still hit `error: use of possibly uninitialized variable`. The original codemod's regex heuristic missed:
- Vars in nested blocks (inside `if`, `for`, etc.) at module scope
- Conditionally-declared vars
- `let mut` vars (the original sweep targeted only `var`, but `let mut` at module scope hits the same checker rule)
- Vars where the declaration spans multiple lines
A targeted second pass would flip another ~40 modules to OK in one PR. This alone would push the kernel's OK-rate from 40.5% to ~51% — highest single-fix leverage remaining.
Approach
- Pull rows from `~/Desktop/home-os-kernel-audit-2026-05-04.tsv` where `typecheck=FAIL` and `first_error` matches `use of possibly uninitialized variable`
- For each, find the offending declarations (the audit captures only the FIRST error per file — there may be multiple per file once you start fixing them)
- Apply the same `= undefined` (or `= 0` / `= false` for scalars where the value matters) treatment
- Same don't-touch list as #13: skip `let` declarations that already have inits, skip function-local vars, don't touch array syntax (`[T; N]` is correct)
- Verify with `home-debug check` on touched files (parser hangs are fixed per home-lang/home #16, so post-sweep validation works now)
- Conventional commit, `Closes #14` (this issue)