Repository navigation
Add wait, mutation waits and whenBusy to web detection - #3237
Draft
GuiltyDolphin wants to merge 4 commits into
Draft
GuiltyDolphin wants to merge 4 commits into
GuiltyDolphin wants to merge 4 commits into
Conversation
Contributor
Build Branch
Static preview entry points
QR codes (mobile preview)
Integration commandsnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", branch: "pr-releases/gd-c-web-detection-wait")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/gd-c-web-detection-wait
git -C submodules/content-scope-scripts checkout origin/pr-releases/gd-c-web-detection-waitPin to exact commitnpm (Android / Extension): Swift Package Manager (Apple): .package(url: "https://github.com/duckduckgo/content-scope-scripts.git", revision: "11cc5d22c54112c53928c3e9a696df6be7c41220")git submodule (Windows): git -C submodules/content-scope-scripts fetch origin pr-releases/gd-c-web-detection-wait
git -C submodules/content-scope-scripts checkout 11cc5d22c54112c53928c3e9a696df6be7c41220 |
Contributor
[Beta] Generated file diffTime updated: Mon, 30 Nov 2026 12:59:24 GMT Android
File has changed AppleFile has changed Chrome-mv3File has changed FirefoxFile has changed IntegrationFile has changed WindowsFile has changed |
This was referenced Nov 23, 2026
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 24, 2026 16:52
edbbb9b to
3a9036d
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 25, 2026 13:15
3a9036d to
61f2374
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
2 times, most recently
from
November 25, 2026 17:46
f35f1a1 to
a7570aa
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 25, 2026 19:18
a7570aa to
b567f3a
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 25, 2026 20:50
b567f3a to
54dc385
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 25, 2026 21:54
54dc385 to
28a3158
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 25, 2026 22:29
28a3158 to
ca76592
Compare
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 30, 2026 10:47
ca76592 to
d0e62f5
Compare
This adds the wait source, which suspends a run until the next item arrives at a recorder, a target's own listener or a mutation observer, or until timeoutMs passes. A detector has one run at a time, and an arrival while it's suspended queues a run, abandons it or is skipped, as its on body's whenBusy sets. detectorPerf times each slice of a run and counts wait misses apart from the run's total. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This lets an arrival's whenPending act on a run queued behind a suspended run, as on one waiting for its delayMs timer, so with whenBusy "queue" and whenPending "skip" or "batch" a detector has one run queued at most. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A wait whose target wasn't a node or event target waited silently until timeoutMs, which read as no change on the page. The wait now fails at its target straight away, as a root that isn't a node fails. An engine with no MutationObserver or listener methods still gives no item. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A slice that ends its run on a failure is timed as failed, as one that ends on an error is, so a resumed run counts towards detectorPerf_<group>_failed the same way a run that never suspends does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GuiltyDolphin
force-pushed
the
gd-c-web-detection-wait
branch
from
November 30, 2026 12:57
d0e62f5 to
4662820
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Asana Task/Github Issue: https://app.asana.com/1/137249556945/task/1220838330987911
Description
Builds on #3236.
This adds
wait, the first source that suspends a run, so a detector can see what happens after an arrival in the run it started:waitgives the first item to arrive after the wait starts that passes itswhere(withfieldread from it), orundefinedoncetimeoutMspasses.timeoutMsis required (a number, ornullfor no timeout), as the config build writes the defaulttargetwaits on the recorder its type registers atinit. With atarget, evaluated when the wait starts, it adds a listener of its own, or formutationaMutationObserverof its own with the body's options, which it removes when the wait ends.MutationObserveris captured with the other recorder globals, and each record getstimeStampfrom when the callback ran. Atargetthat isn't an event target, or formutationa node, fails thewaitat itstargetstraight away. An engine withoutMutationObservergives no item, so the wait resumes attimeoutMswhereis tested on each item as it arrives, in the task that recorded it. An arrival with no item passing leaves the run suspended. A resumed run reads the page through the frame's read cache, so a change made while it was suspended clears what it read beforeonbody queues a run behind it (whenBusy: "queue", the default), abandons it and runs ("interrupt"), or is skipped ("skip"). Queued runs run in order after it ends. An abandoned run's detector names anddones stand, and the debug notification recordsaborted.autoand breakage report runs queuedetectorPerf:recordtakes a slice kind. A run is counted at its first slice, a later slice that moves it forward adds to its run total, and a wait miss (an arrival with no item passing) adds to every total but the run's.over<N>ms,worstMsand single-runsevereuse the run total. Detectors whose runs suspended getworstSliceMs,waitMissesandwaitMissMsin breakage reports. Each callback and timeout that tests or resumes a run is a dispatch of its own. A slice that ends its run on a failure or an error is a failed run.waitgoes where layer 3 allows a run to suspend: a sequence, anif,expr, besideusing, or an action's value, inactions.Testing Steps
wheremisses, the timeout, items from before the wait, atarget's own listener, mutation waits, a failedtarget, and one it can't listen on or observe,whenBusyqueue, skip and interrupt (withdoneheld before the wait), the slice kinds and dispatches recorded, a resumed run that ends on a failure being recorded as failed, and parse errorsdetectorPerfunit tests follow the "page event with a wait" timeline: one run, its total across the slices that move it forward, wait misses in the accumulated totals only, an edge crossed at the slice whose run total crosses itsyncrun's mutation wait sees the change the page makes in its own click handler, and resumes with nothing at its timeout when there's noneChecklist
Please tick all that apply:
🤖 Generated with Claude Code