Skip to content

[py] Reject null list elements in BiDi serialization inbound and outbound - #18240

Merged
cgoldberg merged 3 commits into
SeleniumHQ:trunkfrom
saiyam-jain-dev:fix-bidi-list-element-null
Oct 28, 2026
Merged

cgoldberg merged 3 commits into
SeleniumHQ:trunkfrom
saiyam-jain-dev:fix-bidi-list-element-null

Conversation

@saiyam-jain-dev

@saiyam-jain-dev saiyam-jain-dev commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes part of #18193 (Python section).

In BiDi protocol serialization (ADR 17786 Decision 4), list elements must conform to their declared item type and cannot be null. Previously:

  • _read_scalar skipped primitive checks when an inbound element was None, allowing primitive lists to accept [None] silently.
  • _validate_outbound_scalar returned early on None, allowing outbound lists of primitives, records, and enums to send None elements.

This PR ensures None list elements are rejected in both directions with a descriptive BiDiSerializationError.

Motivation and Context

In accordance with ADR 17786 Decision 4 and tracking issue #18193:

  1. null list elements: A null element in a list whose element type isn't nullable should be rejected.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…ound

In BiDi protocol serialization (ADR 17786 Decision 4), list elements must conform to their declared item type and cannot be null. Previously, _read_scalar skipped primitive type checks when an element was None, allowing inbound lists of primitives to accept nulls silently. Similarly, _validate_outbound_scalar returned early on None, allowing outbound lists of primitives, records, and enums to send null elements.

Reject null list elements in both directions, raising BiDiSerializationError when encountering None in lists of primitives, records, or enums.

Fixes #18193
@qodo-code-review

Copy link
Copy Markdown
Contributor

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@selenium-ci selenium-ci added the C-py Python Bindings label Oct 25, 2026
@cgoldberg
cgoldberg self-requested a review October 28, 2026 01:07

@cgoldberg cgoldberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks @saiyam-jain-dev

@cgoldberg
cgoldberg merged commit 8a6aefc into SeleniumHQ:trunk Oct 28, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-py Python Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants