fix(cloudflare): bound retained response heap by byte ceiling - #620
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughCloudflare 응답 헬퍼가 청크 배열 대신 ChangesCloudflare 응답 버퍼링
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
seonghobae
left a comment
There was a problem hiding this comment.
Current-head review at b746846e4890c84b568bb29937594e1b17364fa1: the reality RED is valid and isolated to chunk-cardinality retention; the causal source change removes per-chunk retention while preserving pre-accept byte-ceiling rejection, cancellation precedence, reader-lock cleanup, fatal UTF-8/JSON admission, and provider-error semantics. The behavioral one-byte fragmentation regression covers the intended adversarial case. No additional source/test/DDD or owner-boundary finding identified in the two-file diff. This COMMENT is not an approval; merge authority still requires all required exact-head gates terminal GREEN and fresh base/head/thread verification.
…-heap-authority-20260912 docs(recovery): classify #620 retained-heap hardening as protected
Problem
Protected #618 moved direct Cloudflare deploy/status/recovery response parsing from
response.text()to streaming byte admission, but the shared reader still retained every incomingUint8Arrayin achunksarray until EOF. The accepted payload was capped at 1 MiB, yet retained heap/object overhead could still scale with stream chunk cardinality rather than only with the byte ceiling. A highly fragmented response therefore caused avoidable heap/GC amplification inside the production control-plane path before the same bounded payload was decoded.The WHATWG Streams model exposes chunk reads individually and BYOB exists to let consumers control allocation; the byte-stream contract does not make a per-response chunk-cardinality bound part of Noema's resource guarantee. This repair stays inside Noema deployment/recovery transport. It does not move provider routing, Cloudflare truth, credentials, quarantine/security/outbound authority, or domain data into Noema.
Test-first RED
Test-only exact
115fc46fa0fe66eb21a292823704139659f78986added a regression requiring the shared reader to avoid retaining a per-chunk array and to preserve successful decoding of a maximally fragmented valid response. Hosted CI run34589796858checked out that exact head, passed live-base/toolchain/install/typecheck, then failed atrelease tests; downstream release/security/KPI evidence steps were skipped. This is the intended reality RED.Minimum causal repair
Exact
b746846e4890c84b568bb29937594e1b17364fa1replaces the per-chunk retention array with oneUint8Array(maxResponseBytes)allocated for the admitted ceiling. Each accepted chunk is copied directly into that fixed buffer; oversized chunks are still rejected before acceptance, and decoding uses onlysubarray(0, totalBytes). Existing cancellation, reader-lock release, fatal UTF-8/JSON admission and provider-error semantics are unchanged.The existing CHANGELOG and OPERABILITY contract from protected #618 already requires incremental consumption under the 1 MiB ceiling and remains semantically current; this PR strengthens retained-heap behavior without changing the public/control-plane contract. The moving product-technical baseline cannot truthfully classify #620 as protected until its normal merge identity exists, so protected-source classification is a post-merge documentation successor rather than a pre-merge fabricated authority claim.
Exact-head evidence
For exact
b746846e4890c84b568bb29937594e1b17364fa1against base6808a8f08970c107354e81b5a4e21adaf64fc502:34590022584: terminal SUCCESS;34590022650: terminal SUCCESS;34590022557: terminal SUCCESS;34590022610: terminal SUCCESS.Fresh COMMENT-only current-head review found no additional source/test/DDD/owner-boundary finding and there are no unresolved inline threads. This evidence is source integration authority only; it is not immutable release, deployment, recovery rehearsal, SLO, or production outcome evidence.
Summary by CodeRabbit
버그 수정
테스트