Context
The home-os #17 (braceless if codemod) agent surfaced ~7 parser gaps in files where the audit's first-error-per-file lumped them under `Expected '{'`. After resolving the actual braceless-if cases, the residual errors are:
| # of files | Pattern | Sample |
|---|---|---|
| 4 | `Expected '{' after struct name` (struct-decl variant) | `core/lockfree.home`, `core/numa.home`, `core/smp.home`, `iot/audio_processing.home` |
| 1 | Zig-style `!void` error-union return type | `drivers/platform/laptop.home` |
| 1 | Zig-style `if (...) | _ |
| 1 | `callconv(.C) {` calling-convention attribute on `fn` | `idt.home` |
| 3 | Missing-parens patterns in `if`/`while` (e.g. `if (a & b) != 0 { stmt }`, `while ... < x {`) | `iot/gpio_sensors.home`, `iot/i2c_sensors.home`, `iot/spi_sensors.home` |
Sub-items in proposed fix order
1. Struct-decl variant (4 files unblocked)
Investigate the 4 cited files to learn the specific shape rejected. Likely candidates:
- `struct Name { field: T = default_value }` — default field values
- `struct Name : Trait { ... }` — trait-implementing struct
- Anonymous struct in some position
- Struct attribute prefix
Read those 4 files, identify the actual declaration shape, then extend the parser accordingly.
2. `callconv(.C)` attribute (1 file)
`fn name(args) callconv(.C) -> ReturnType { body }` (Zig-style). The parser should accept `callconv(<expr>)` as an attribute between the parameter list and the return-type arrow. Check how other attributes (`pub`, `inline`, `extern` from #18) are parsed and add this consistently.
3. Zig-style `!void` error-union return type (1 file)
`fn parse() !void` is Zig's error-union sugar for `anyerror!void`. Either accept the syntax or determine if the kernel writer should use Home's `Result<void, error>` form. Decide based on whether Home has a built-in error-union type.
Design question: does Home want Zig-style error-union sugar (`!T` = `anyerror!T`)? If yes, parser fix; if no, kernel codemod.
4. `if (...) |_| { ... }` optional-unwrap (1 file)
`if (foo()) |x| { use(x) }` is Zig's optional-unwrap-with-binding syntax. Like #3, decide whether to accept Zig's form or have the kernel use Home's match-style `if let Some(x) = foo() { use(x) }` instead.
Design question: does Home want Zig-style optional unwrap, or only match-based unwrap?
5. Missing-parens patterns (3 files)
Inspect `iot/gpio_sensors.home`, `iot/i2c_sensors.home`, `iot/spi_sensors.home`. The audit suggested `if (a & b) != 0 { stmt }` and `while ... < x {`. Two interpretations:
- The kernel forgot outer parens; should be `if ((a & b) != 0) { stmt }` — kernel codemod fix
- Home's `if` should accept any expression as condition without requiring outer parens — language design call
Design question: does Home's `if` require outer parens around the condition, or is `if cond { body }` (no outer parens) acceptable?
Approach
Sub-items 1, 2 are clear parser additions. Sub-items 3, 4, 5 have design questions that should be answered first; for design-yes answers, parser fix; for design-no, kernel codemod (file separately).
Recommend: agent investigates sub-item 1 + 2 (clear parser gaps, ship), surfaces sub-items 3-5 design questions back to the user before doing more.
Reference
- 2026-05-04 home-os #17 agent's "False positives skipped" section
- Audit: `~/Desktop/home-os-kernel-audit-2026-05-04-pm.tsv`