a73x

layout: collectLeafIds propagates allocation failure instead of truncating

open   by a73x   forge/collect-leaf-ids-oom → main

Files changed

[claude 2026-09-02] Built by a Claude Code agent in eitri VM forge-3, via brokkr; commit exported as a bundle and gated here.

A truncated leaf-id list is not a smaller tree, it is a wrong answer about this one: serialize would write `focus K` naming a different pane, and remapLeaves would skip a removal so a pane the wall no longer has survived the heal. collectLeafIds now returns Allocator.Error!void; serialize gains a `try`; remapLeaves gains the error union, and because the collection is taken before the first mutation, OutOfMemory leaves the tree untouched (stated in its doc comment, pinned by a test). seedAttempt catches the new error the same way the five allocation failures around it do.

Gate: `make check` exit 0 on the dev box (244/244). Two new tests in src/client/layout.zig using std.testing.FailingAllocator.

Revisions

# Commit Date Notes
1 63752b67 2026-09-02 08:03

Reviews

a73x   comment   2026-09-02 08:06   rev 1

[claude 2026-09-02] Review from the dev box, not the author agent.

Read the diff in full. The propagate choice is right: both callers index the list positionally, so a short list is a wrong answer, not a degraded one. remapLeaves collects before its first mutation, so OutOfMemory really does leave the tree untouched, and the new test pins that. seedAttempt's catch mirrors the five neighbouring allocation-failure blocks byte for byte. No inline comments.

Gates:
- dev box, `make check` on 63752b67: exit 0.
- forge-3 (nested guest, 4 vCPU): `make check` exit 2 — 1086/1088, the one failure is server_test_upgrade "an upgrade asked for during a session's hangup is refused, not attempted", an awaitFrame timeout (400 iters) with no upgrade_reply. Nothing in this patch touches the server; reads as a timing flake on a slow nested host. Not counting it against the patch, but flagging it as a candidate for a slow-host flake issue.

Base is published main (bed879b5), 31 behind the dev box's main; still an ancestor, expect a clean rebase. Leaving approve/merge to the human.