mirror of
https://github.com/morluto/rea
synced 2026-10-28 23:11:11 -04:00
8b74f30bf9
* fix(javascript): stop double-expanding application projection estimates estimateJavaScriptStaticApplicationProjection multiplied the per-record metadata allowance (2 KB plus the path) by the 8x expansion that it also applies to checkpoint bytes. A projected record serializes to about 0.46 KB, so the allowance alone already covers retention; expanded again, the charge was about 25x the serialized application relationships. The charge accumulates in the parent's shared result budget. On a synthetic 2.8 MB Vite-style build (88 files, one 456 KB chunk), the first 10 files used 2.0 GB of a 2.08 GB budget while the parent heap held about 300 MiB. The other 78 files lost their application relationships and were offered a 0-byte semantic budget. On a 201-file build the charges exceeded the budget at file 93 and the analysis failed with resource_constraint, leaving the remaining sources without static facts. Keep the 8x expansion for checkpoint and repeated bytes and count the per-record allowance once. The same builds now refuse 14 and 102 projections instead of 78 and a failed run; peak RSS stays at 1.2 GB and 2.0 GB under a 4.2 GB parent heap limit. workerFailureComposition simulated 64 KiB of parent result budget, which the corrected charge for its one-finding checkpoint fits. Lower that headroom to 32 KiB so the case still exercises a refused projection. * test(javascript): cover application projections near the shared parent budget The estimate test compares one file's charge with its serialized graph, but no test put several sources against one parent result budget. Replay one recorded static checkpoint for five sources against an exact budget: sources 1-3 fit, source 4 misses by half a source and keeps its static facts with the reported required and budget bytes, and the last source fits again once no checkpoint reserve is held back. A worker that charges the projection twice, or not at all, passes the existing tests and fails this one. * test(javascript): cover a malformed source before a valid one under the shared budget The testing guide asks representation-expansion and capacity changes for a large malformed input followed by a valid input, and for escaped or expanded representations. Under an exact parent budget, a 3 MiB checkpoint cut off inside a string comes first and is rejected as unreadable output with no static facts. The valid source after it keeps its application relationships; it fits only if the rejected bytes took no charge. A worker that charges the static checkpoint on receipt, before parsing, passes the existing tests and fails this one. The estimate ratio test also runs with a nested source path and storage keys holding quotes, backslashes, a tab and multibyte text, which expand in serialized JSON; the charge stays within 3x to 8x of the serialized application graph (5.3x).