fix(selenium-devtools-py): anchor the document the drain reads - #327
Merged
Conversation
Greptile SummaryThe PR makes Python Selenium collector drains synchronously anchor the current document before reading and resetting its trace buffer, preventing short-lived navigation destinations from disappearing from replay.
Confidence Score: 5/5The PR appears safe to merge, with the anchor operation synchronously completing before the trace buffer is read and reset. The changed Python drain mirrors the existing guarded JavaScript adapter sequence, the collector synchronously appends at most one document anchor, and the recovery path retries through the same atomic operation.
|
| Filename | Overview |
|---|---|
| packages/selenium-devtools-py/src/selenium_devtools/snapshot.py | Introduces an atomic guarded anchor-and-drain expression and applies it to normal and recovery reads without an identified correctness regression. |
| packages/selenium-devtools-py/tests/test_snapshot.py | Adds focused fake-collector coverage for forced anchoring, single anchor emission, operation ordering, collector absence, and reinjection recovery. |
| packages/selenium-devtools-py/README.md | Updates the DOM snapshot capability description to document forced document anchoring during drains. |
| CLAUDE.md | Records the drain race, unconditional anchoring invariant, and collector idempotence rationale. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Python Selenium drain] --> B{Collector present?}
B -- No --> C[Install collector]
C --> D[Retry drain]
B -- Yes --> E[Capture current document]
D --> E
E --> F[Read and reset trace buffer]
F --> G[Normalize mutations]
G --> H[Send DOM evidence]
Reviews (1): Last reviewed commit: "fix(selenium-devtools-py): anchor the do..." | Re-trigger Greptile
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.
What & why
Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)backend(server)app(UI)script(page-injected runtime)selenium-devtools-pyNotes for reviewers
Screenshots / recordings