mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-06 06:37:29 +00:00
* fix(cli): wait for consent navigation before cataloging assets A consent click can reload the page (some CMPs reload once consent is stored). The post-click DOM reads then raced the navigation: the overlay sweep and scrollHeight probe ran against a torn-down or still-parsing document, scroll screenshots degraded to a handful of shots, and the asset catalog observed an empty body (0 assets). Add waitForPageReady: wait for network idle, then poll document.readyState so a committed-but-still-parsing reload is also waited out — network-idle alone stops counting a request once its response headers arrive, and waitForNavigation deadlocks when armed after the commit. The overlay sweep now runs on the settled document instead of the pre-reload one, and the same settle guards the asset catalog boundary. Fixes #4923 * fix(cli): bound consent-click settle by wall clock and skip it on banner-free pages waitForPageReady now shares one deadline (timeoutMs, capped by the remaining capture budget) across its network-idle waits and readyState poll, uses waitForNetworkIdle concurrency: 2 (the networkidle2 semantic navigation already uses), races each readyState evaluate against the deadline, and rethrows degradable evaluate timeouts so the stage can degrade. captureScrollScreenshots only pays the settle when the consent sweep clicked a control or performance.timeOrigin shows the document was swapped; the catalog boundary call degrades to a budget-bounded readyState check (networkIdle: after-load). * fix(cli): drop added comments to keep comment share at merge-base * fix(cli): adapt consent-settle tests to ScreenshotCaptureResult and keep comment share flat * fix(cli): tolerate missing waitForNetworkIdle in consent settle waitForPageReady called page.waitForNetworkIdle unconditionally; a Page-shaped double without it throws a synchronous TypeError that captureScrollScreenshots' catch-all reports as internal-error with zero screenshots, breaking the partial-budget contract upstream's coreExtractionPhase.test.ts exercises with a thin mock page. The idle wait is best-effort, so make the hook optional and swallow its failures; also only keep the readyState poll alive while the page affirmatively reports "loading" so a non-boolean result cannot burn the settle deadline.