Skip to content

[docs] decision: BiDi events are awaited with expect_* context managers#17671

Open
AutomatedTester wants to merge 1 commit into
trunkfrom
adr-bidi-expect-events
Open

[docs] decision: BiDi events are awaited with expect_* context managers#17671
AutomatedTester wants to merge 1 commit into
trunkfrom
adr-bidi-expect-events

Conversation

@AutomatedTester

Copy link
Copy Markdown
Member

💥 What does this PR do?

Proposes a design decision record: BiDi events are awaited with expect_* context managers.

Today the only way to react to a BiDi event is a fire-and-forget callback. To wait for an event triggered by a user action, users must subscribe, act, then wait — which races (the event can fire before the wait starts) and forces everyone to re-implement capture-and-filter boilerplate. This record proposes a race-free, predicate-filtered expect_* family (arm-before-action context managers) over a small reusable Subscription primitive, consistent across all five bindings, as the foundation the other event-driven decisions (navigation, downloads, user prompts) build on.

🔧 Implementation Notes

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code
    • What was generated: Initial draft of the decision record, derived from a CDDL-validated comparison of the Python BiDi surface against Playwright; revised through discussion and review
    • I reviewed all AI output and can explain the change

💡 Additional Considerations

Part of a set of BiDi ergonomics decision records proposed together (events, user prompts, storage/cookies, network body+timing, emulation, navigation). This one should be considered first since the others build on the expect_* primitive it defines. Cross-binding convergence is tracked in the record's binding-status table.

🔄 Types of changes

  • Documentation (design decision record)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant