You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Recover DOM capture on documents that missed injection #286
core's drainCollectorWithRecovery re-injects into the current
document when a drain finds no collector, then retries. Python has no equivalent,
so a document that missed injection contributes nothing and the actions on it
replay the previous page.
Acceptance criteria
A drain that finds no collector re-injects and retries
once, logging the recovery. Unit tested against a fake execute_script that
reports a missing collector and then a present one.
Done in 70a6223 (#317), which arrived via a review comment on the preload PR rather than by picking this up — recording it here so nobody rebuilds it.
Both acceptance criteria are met:
"A drain that finds no collector re-injects and retries once" — pull_mutations now distinguishes the two failure modes the old code flattened together. _READ_TRACE_SCRIPT answers null when the collector is absent from this document, which is the only signal that says so; a read that actually failed returns a separate _UNREADABLE sentinel and does not trigger recovery, because a dead session should not be re-injected into. On null it installs via the <script> path and reads once more. Mirrors core's drainCollectorWithRecovery, including recovering at drain time rather than at inject time — which costs nothing on the happy path, since the drain happens either way.
"Unit tested against a fake execute_script that reports a missing collector and then a present one" — test_the_drain_recovers_a_document_without_a_collector drives exactly that fake, plus test_a_healthy_preloaded_document_is_not_reinstalled asserting a document that answers triggers no <script> at all.
Worth noting the gap this closed was wider than the issue described: the <script> path never had drain-time recovery either, so this was not only a preload concern.
Activity
vishnuv688 commentedon Aug 18, 2026
Done in 70a6223 (#317), which arrived via a review comment on the preload PR rather than by picking this up — recording it here so nobody rebuilds it.
Both acceptance criteria are met:
pull_mutationsnow distinguishes the two failure modes the old code flattened together._READ_TRACE_SCRIPTanswersnullwhen the collector is absent from this document, which is the only signal that says so; a read that actually failed returns a separate_UNREADABLEsentinel and does not trigger recovery, because a dead session should not be re-injected into. Onnullit installs via the<script>path and reads once more. Mirrors core'sdrainCollectorWithRecovery, including recovering at drain time rather than at inject time — which costs nothing on the happy path, since the drain happens either way.execute_scriptthat reports a missing collector and then a present one" —test_the_drain_recovers_a_document_without_a_collectordrives exactly that fake, plustest_a_healthy_preloaded_document_is_not_reinstalledasserting a document that answers triggers no<script>at all.Worth noting the gap this closed was wider than the issue described: the
<script>path never had drain-time recovery either, so this was not only a preload concern.