From 5dfc3a2fc0bc25e2b0b61bc85026725f1f9dff4c Mon Sep 17 00:00:00 2001 From: Jasir Zaeem Date: Wed, 4 Nov 2026 22:18:45 +0300 Subject: [PATCH 01/77] Flatten elements nested deeper than 64 levels Page analysis and rendering walk the DOM recursively, so a few hundred levels of nesting exhausted the stack of a thread, which is much smaller than the main thread's; Puma serves requests in threads. 640 nested divs raised SystemStackError in Stats, 300 nested spans in the renderer, and 4000 divs or 10,000 divs with attributes raised even on the main thread. Renderer::MAX_DEPTH bounded only block rendering, not inline rendering or the walks before it. The preprocessor now replaces the children of every element 64 levels below with their text, collected without recursion, after