Repository navigation
fix(engine): a render keeps a fixed amount of the page's warning text and script addresses - #8821
Conversation
… and script addresses A warning's message and each of its lists are cut to the page-text bounds. Warnings stop at a fixed total of text; past it, one per code is kept with its lists emptied. The served-script set is capped by count and URL length.
terencecho
left a comment
There was a problem hiding this comment.
P2 — Keep render failure detection when the script URL budget fills. packages/engine/src/services/frameCapture.ts:3244 drops attribution for otherwise valid composition script URLs once the set is full or a URL exceeds the length cap. The exception listener then returns before updating pageErrors (:3276). When the expected timeline never registers, isScriptFailure at :2118 can treat that render as an ordinary readiness timeout. The producer can continue in its permissive mode and deliver a render missing animation. Keep the URL cache bounded and preserve the failure signal for an expected timeline that times out after an attributable project script exception. The served-script test currently expects that exception to disappear.
The fails without the fix: line should name the regression tests or frameCapture.test.ts directly so the cases can be located from the line.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
P2 — Apply the warning budget to the whole render. The counter at packages/engine/src/services/frameCapture.ts:2606 resets with each capture session. The segmented stage saves each recycled session's warning summary (packages/producer/src/services/render/stages/captureSegmentedStage.ts:522), then the orchestrator combines all those warnings (packages/producer/src/services/renderOrchestrator.ts:5911). The retained warnings can therefore grow with the session count. Apply the aggregate budget as these summaries are retained, and keep the per-kind fallback for policy.
The warning copy also leaves the full diagnostic-only isolatedCompositions list on the capture session (packages/engine/src/services/frameCapture.ts:2178). Bound the retained list at that assignment while preserving the isolation work performed in the page.
— tai (automated review)
Edit accuracy: accurate 273 (base branch 271), smooth 64 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) Unstable (1)
|
… its capture sessions A summary joins the render's list through retainCapturePerf, which bounds its warnings by what the list already keeps. Past the served-script cap, a script on the composition's server still counts, so its throw still marks the script failure. The isolated-composition record is cut to the bounds.
|
Both reviews are addressed at 30537d4. The body stays as opened (legal hold), so the corrections are here. Served-script cap and timeline failure detection. Past Warning budget for the whole render. The new engine export
fails without the fix: in Checked on the devbox: engine suite 3,754 tests pass, producer vitest lane 1,628 pass, the two changed test files pass 10 runs in a row, engine and producer typecheck, lint and format are green, packed engine 520,147 bytes (budget 522,000). |
terencecho
left a comment
There was a problem hiding this comment.
The new path caps warning summaries across recycled sessions and preserves script failure attribution past the tracking cap. Two items still block approval.
packages/engine/src/services/frameCapture.ts:2152bounds isolation diagnostics afterpage.evaluatereturns. The full array still crosses CDP and is decoded in the render process before the slice. Bound the diagnostic count and string lengths inside the page callback while continuing to isolate every broken composition. The current test checks the retained session list, so it misses the size of the callback result.- The
fails without the fix:line still refers to “all three new tests,” and the test plan describes a script-cap test that this revision replaced. Name the current regression tests or their files directly on that line and update the expected result in the test plan.
Static review and git diff --check passed. I did not rerun the suites.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
Two more findings from tracing the new fallback and budget through their callers.
- [P2]
packages/engine/src/services/frameCapture.ts:3193treats the render document URL as a served script once the fallback activates. An inline-handler exception can then turn a readiness timeout into a fatal script failure. Preserve the existing document exclusion after either limit triggers the fallback. - [P2]
packages/engine/src/services/parallelCoordinator.ts:1054still returns each worker's full warning summary. The coordinator collects all results beforeperfSummary.ts:54applies the shared budget, so peak retention still scales with the worker count. Apply the shared budget as worker summaries are collected.
— tai (automated review)
… are bounded as they finish The isolation script records at most 50 compositions with ids cut to 2,000 characters, while still isolating every broken one. The served-script fallback keeps excluding the documents the server served. Each parallel worker's summary is bounded against the others as it finishes. Page text bounds and the warning budget move to pageTextBounds.ts.
|
All four findings on 30537d4 are addressed at 5c807e3. This PR's title and body are frozen under the legal hold, so the current test plan and Isolation record crosses CDP at full size. The isolation script in Document errors after the fallback. The Parallel workers' summaries. Test plan (current)
fails without the fix: in |
terencecho
left a comment
There was a problem hiding this comment.
Changes requested at 5c807e39.
- P2
packages/engine/src/services/frameCapture.ts:3216–3231— The fallback still attributes document exceptions to project scripts when the document URL exceeds 2,000 characters or the document arrives after the first 50. Once the script fallback is active, an exception attributed to an untracked document can make a timeline readiness timeout count as a script failure. Please keep document exclusion correct when the diagnostic cache reaches its limits, and cover that boundary in the listener test. - The Comments check is red. It flags the added comment at
packages/engine/src/services/parallelCoordinator.ts:1322for increasing that file’s comment share.
The page callback now bounds the isolated-composition record before returning it, and parallel workers bound retained warning summaries as they finish. The author’s updated test plan names the current regressions. I reviewed the delta statically.
— tai (automated review)
terencecho
left a comment
There was a problem hiding this comment.
Two details from the additional static pass at 5c807e39.
packages/engine/src/services/frameCapture.ts:3133— The existing document exclusion also misses handler errors after a same-document URL change. The new listener test uses the exact document response URL. Please carry the existing same-document navigation case into the fallback coverage.packages/engine/src/services/frameCapture.ts:2767— The new message cap can remove the exception and repair text from the warning because pending composition IDs come first. Keep the exception and repair guidance in the bounded message and leave the IDs in the structured details.
— tai (automated review)
…ngs keep their advice Past the served-script cap, a URL counts as served unless a frame shows it now, so a long, late or moved document is still excluded with nothing cached. Messages name at most three items of a list, so the exception and repair advice survive the cut; details keep the lists.
|
Round 4 on 5c807e3 is addressed at 2bfcb81. Document or script, from a source that cannot overflow. The document cache is gone. Past the served-script cap, a URL on the composition server counts as served unless one of the page's frames shows it now ( Exception and repair advice stay in the capped warning. Comments check. The added comment in New and changed tests in
fails without the fix (all current regression tests): in Checked on the devbox: engine suite 3,759 tests pass, producer typecheck and vitest lane pass, the three changed test files pass 10 runs in a row. |
terencecho
left a comment
There was a problem hiding this comment.
Changes requested at 2bfcb813.
- P2
packages/engine/src/services/frameCapture.ts:3221— The fallback excludes an exception URL if it matches the current document in any frame. A script outside the exact tracking limits can lose its exception when another frame displays that same URL as a document. That can leave a missing timeline classified as a readiness timeout. Scope document exclusion to the exception's originating context and add a cross-frame regression. - The current test plan is in the author comment. The PR body's
fails without the fix:line still refers to three tests without naming one and describes the earlier script-attribution result. The review requirement calls for a named regression on that line in the body.
The live frame lookup addresses stale document URLs in the single-frame cases, and the shorter diagnostic lists preserve space for repair guidance. Reviewed statically.
— tai (automated review)
…, with no cap or fallback The served-script set keeps a sha1 digest of every script URL the composition server answered, so attribution is exactly main's: a script's throw always counts, a document's never does.
|
Round 5 on 2bfcb81 is addressed at e2d3784. Script or document, exactly as on main. The capped served-script set and its fallback are gone. On the round-1 point that the cache stay bounded: each entry is a fixed 28-character digest, whatever the URL's length, so a long URL costs no more than a short one. Entries are added only from the Page-side isolation cap. Node keeps its own cut after the page's, since a page can patch the built-ins the isolation script uses. Test, in fails without the fix (all current regression tests, per the frozen body): in Checked on the devbox: engine suite 3,759 tests pass, the three changed test files pass 10 runs in a row, typecheck, lint and the comment ratchet pass, packed engine 520,922 bytes. |
terencecho
left a comment
There was a problem hiding this comment.
[P2] Bound the pending timeline diagnostics before retaining them (packages/engine/src/services/frameCapture.ts:2176)
The warning limit applies to the emitted copy. The capture session still retains the full pending-ID list, and a clean timeout retains it in the shared memo at line 2192. Keep a bounded diagnostic sample and skip memoization when the complete list exceeds its budget, so a partial list cannot change timeline polling. The long-ID regression currently exercises the emitted warning only.
Digest lookup resolves the script-versus-document attribution problem from the previous review. It fixes the retained size per URL and still grows with the number of distinct served scripts. The author comment names the current regression tests. The PR body's fails without the fix: line still refers to the earlier test set without naming a current test.
Static review only on this revision.
— tai (automated review)
…ds, each cut short The id scan returns at most 1,000 ids of up to 200 characters, so the session and the render's memo keep a bounded list; a cut id only means that host is waited on again. The script-failure log names a few failures.
|
Round 6 on e2d3784 is addressed at 68aaf33. Pending timeline ids are bounded where they come from. Every pending id comes from Body. Home grants the exception in its re-review post: OSS PR bodies are frozen under the legal hold, and these author comments are the record. New test, in fails without the fix (all current regression tests): in Checked on the devbox: engine suite 3,760 tests pass; the changed test files, with |
terencecho
left a comment
There was a problem hiding this comment.
[P2] A shortened diagnostic ID can change which timeline is waited on (packages/engine/src/services/frameCapture.ts:2200)
The new size bounds cover the page response and session. After a clean timeout, the code also copies the shortened IDs to the memo used for exact matching in later sessions. A shortened label can equal a different host's actual ID. The next poll can then skip that host before its timeline registers. Keep the shortened labels for diagnostics and memoize only exact, unmodified IDs within the budget, or omit the memo when the list is shortened. The regression checks the list's size but does not check this identity distinction.
The author comment names the current regressions. This was a static review.
— tai (automated review)
The page sends null for an id over 200 characters instead of a cut copy, Node shows it as a fixed label, and the render's memo keeps only exact ids, so no shortened id can match another host and skip its wait.
|
Round 7 on 68aaf33 is addressed at a1bb6dc. Display labels kept apart from the memo. The id scan in Tests in
fails without the fix (all current regression tests): in Checked on the devbox: engine suite 3,761 tests pass; the timeline memo, terminal and frame-capture test files pass 10 runs in a row; typecheck, lint, the commit hooks and the comment ratchet pass. |
terencecho
left a comment
There was a problem hiding this comment.
Re-reviewed a1bb6dcb. Overlength timeline IDs still count as pending. Their display label is excluded from the memo, so only exact IDs can suppress a later readiness wait. The author comment names the collision regression and the bounds regression.
This was a static review. The comments check passed and the runtime suite was still running when I reviewed.
— tai (automated review)
What
A render now keeps a fixed amount of the page's text in its warnings and in its record of served scripts. Each warning's message, and each list in its details (media sources, timeline ids still unregistered, isolated elements), is cut to the same bounds #8727 set for page errors: 2,000 characters per entry, 50 entries per list. All warnings together stop at 1,000,000 characters of text; past that, a warning is still kept once per kind, with its lists emptied, so a render's policy still sees every kind of warning. The set of served script URLs used to tell whether an error came from the project keeps at most 500 URLs of up to 2,000 characters.
Why
#8727 and #8810 bounded page errors, failed scripts, the console buffer and throw-site lookups. Three places still kept page-chosen text without a limit: warnings (each one listed every source or timeline id the page named, at full length, and every distinct warning was kept), and the served-script set (one entry per script URL the page fetched from the server). A page that names many long sources, or fetches scripts under ever-new URLs, grew the render's memory without end.
How
In
packages/engine/src/services/frameCapture.ts:boundedWarningcuts a warning's message withboundedPageTextand every array in its details toPAGE_LIST_MAXentries, cutting each string (and each string field of an object entry). It is applied inrecordCaptureWarnings, the one place every capture warning goes through beforesession.warnings.warningToKeepcharges each new warning's text tosession.warningTextChars. PastWARNINGS_TEXT_MAX_CHARSa warning is kept only if no warning of its code is kept yet, with its lists emptied.responselistener adds a served script URL only while the set holds fewer thanSERVED_SCRIPTS_MAXand the URL is at mostPAGE_TEXT_MAX_CHARS. A throw from a script past those limits is not attributed to the project.Page errors, failed scripts and scene-callback errors are not charged to the warnings total: they are already capped by count and length, and charging them would let a flood of warnings drop a real script error before the render fails on it. With every list capped, a render keeps at most about 2.7M characters of page text in all: the console buffer (200 × 2,000), page errors, failed scripts and scene-callback errors (50 × 2,000 each), warnings (1,000,000, plus one emptied warning per kind), and served scripts (500 × 2,000).
Left as is:
lateImageskeeps each late image's full source, because it is matched against the frame's images to fail a frame that would miss one; cutting or capping it would let a missing image through.Reused:
boundedPageText,PAGE_TEXT_MAX_CHARSandPAGE_LIST_MAXfrom #8727; no new helper outside this file.Test plan
packages/engine/src/services/frameCapture.test.ts:fails without the fix: all three new tests fail on main d15883f (a kept entry of 10,006,264 characters; 4,177,396 characters of warnings; the 2,000th served script still attributed). With the warnings total raised out of reach, the total test fails again with 4,177,396.