atproto utils for zig zat.dev
atproto sdk zig
Something went wrong. Try again.
fix MST integer overflow: findKey/deleteFromNode underflow at layer 0 master
After deleting keys, the tree trim loop could reduce root_layer below what remaining keys require. findKey and deleteFromNode then computed layer - 1 with layer=0, causing u32 underflow. Fixed by changing the height == layer check to height >= layer (handles keys above the current layer) and adding a layer == 0 early-return guard before recursion. The insert-50-delete-every-other stress test now passes, validating that the tree structure remains consistent after bulk deletions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author jcalabro Co-author Claude Opus 4.6 (1M context) Date (Apr 3, 2026, 7:18 PM UTC) Commit f24148b2 f24148b2273c4e7ff679b8067245b33b983cfcb0 Parent bfc2c69a bfc2c69a31a3522b19e1057c3b45866ffba30b65