ReviewOS

home-lang/home

Align `home ast` and `home check` parser passes — `ast` swallows errors that `check` rejects

#36
Closed glennmichael123 opened this 24 days ago · 0 comments
24 days ago

Context

The 2026-05-06 audit found that 52 of 83 remaining TC_FAIL files are actually parse failures. `home ast` reports success on these files; `home check`'s internal re-parse then rejects them with parse errors (often surfacing as `error(DebugAllocator) ... leaked` because the parser bails without freeing).

This makes the audit data confusing — files appear in the typecheck-fail bucket but actually fail at parse. It also means we've been undercounting parse coverage in every audit since #16 fixed the hangs.

Examples

Sample files where this happens (check via the audit TSV `~/Desktop/home-os-kernel-audit-2026-05-06.tsv`, filter `first_error` matching `DebugAllocator` or `Undefined variable`):

  • `drivers/pci.home` — likely parse error on `var x: [u8; 32] = undefined` at module scope (the #35 sibling case with explicit `= undefined`)
  • `drivers/ahci.home` — same shape
  • ~50 more

Hypothesis

`home ast` and `home check` use different parse paths (or one short-circuits more aggressively than the other). Bringing them into agreement means:

  • `ast` should reject what `check` rejects (so audits classify cleanly)
  • OR `check` should accept what `ast` accepts (less likely — `check` is the stricter one)

The right fix is probably to have `ast` use the same parser code path `check` uses, surfacing the same errors.

Why this matters

Highest single-fix leverage on the post-#34 board. Reclassifies ~50 files cleanly, surfaces real bugs, makes audit data actionable.

Approach

  1. Find where `home ast` and `home check` invoke the parser. Compare code paths.
  2. Identify the divergence — is it different parser entry points? Different error filters? Different walk?
  3. Align: have `ast` propagate parse errors the way `check` does.
  4. Probably also fix the `DebugAllocator leaked` symptom: when the parser bails on an error, it should free its allocations cleanly.

Reference

  • 2026-05-06 audit: `~/Desktop/home-os-kernel-audit-2026-05-06.tsv`

Sign in to comment on this issue.