MEM-023: tree-walk recursion holds a 1MB buffer per level (keeper/KEEP.c, keeper/WALK.c)

Two tree walkers recurse per nesting level while each frame holds a live ~1MB buffer with no depth cap: keep_walk_tree maps u8bMap(tbuf, 1<<20) per level and recurses before unmapping; walk_tree_dive carves a_carve(u8, tbuf, 1<<20) and recurses bare so each BASS carve survives across the child fetch. A pathologically deep directory chain (a legal git tree shape) drives recursion to the SHA cap (~65536) for keep_walk_tree → C-stack overflow, or exhausts the per-thread BASS arena for walk_tree_dive (graceful WALKNOROOM). The goal is to bound depth and stop stacking one big buffer per level.

Issues

Per-level recursion with a 1MB buffer live across the recursive call; no depth cap.

Blockers

None.

WIP

TODOs

-v Depth cap: walk_tree_dive returns WALKBADFMT at WALK_MAX_DEPTH (4096) — keeper/WALK.c:50, WALK.h:56 (0eb0afab KEEP-001). -v Per-level buffer shrunk 1MB→64KiB (keeper/WALK.c:60) and subtree recursion goes through try() so each child's BASS scratch rewinds on return (WALK.c:142-144) — 0eb0afab + 49039f36 GET-020. -v keep_walk_tree (KEEP.c) no longer exists — converged with 3 other walkers into KEEPWalkTree (0eb0afab KEEP-001). -v Repro: keeper/test/WALK.c Test 7 "deep tree terminates cleanly, cap holds (KEEP-001)".

Outcome