From b29e40d707d6942953265e0dfc90a18fd98f654e Mon Sep 17 00:00:00 2001 From: Michael Wang Date: Tue, 17 Nov 2026 07:55:06 +0000 Subject: [PATCH] fix(producer): cap a render's total sub-composition expansion (#8045) * fix(producer): cap a render's total sub-composition expansion The 16 MB limit checked each composition file alone, so a few small files that mount each other many times assembled a page far larger, and the pre-flight walk and sub-composition compile redid their work for every mount. The pre-flight walk now reads each file once and charges every mount to one budget: 32 MB of composition HTML across at most 10,000 mounts. Past either limit the render fails with the existing non-retryable COMPOSITION_TOO_LARGE error, before compiling. Sub-composition compilation handles each path once, and the inliner charges each mount to the same budget as it builds the page. * docs: describe the total sub-composition expansion limit * fix(producer): check each mount path and read each fallback file once The pre-flight walk resolved and checked a mount's path on disk for every mount, and the inliner's disk fallback did the same for every mount it inlined. Both now do it once per path, so a refused fan-out costs about half a second instead of several. The test now covers both a fan-out the pre-flight refuses and one inside templates, which only the inliner sees. * fix(producer): the pre-flight charges mounts inside templates to the budget The pre-flight walk could not see mounts inside a