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
Updates to the latest proposed version of #17786 (reject a missing required inbound field)
Reverses the tolerance added in #17844
💥 What does this PR do?
A required field missing from an inbound BiDi payload now raises Error::SerializationError instead of being tolerated as omitted and warned.
Removes the SE_BIDI_STRICT environment variable, which selected between those two behaviors.
🔧 Implementation Notes
The ADR rejects the tolerance outright, so no second behavior is left for a toggle to select; a remote end that lags a newly-required field is handled by an override in the shared schema rather than at runtime.
Serialization.strict? and the missing_required helper existed only to branch on the toggle, so the raise folds into wire_value.
🤖 AI assistance
AI assisted (complete below)
Tool(s): Claude Code (Opus 5)
What was generated: the change, tests, and this description
I reviewed all AI output and can explain the change
💡 Additional Considerations
Python's generated BiDi layer needs the same change for parity in a separate PR
We'll also want to figure out an override implementation as part of the schema generation in case we need it
• Raise SerializationError when required inbound BiDi fields are missing.
• Remove SE_BIDI_STRICT toggle and strict-mode branching from serialization.
• Update Ruby unit/integration tests to reflect strict inbound behavior.
Diagram
graph TD
A["Inbound BiDi JSON"] --> B["Record.from_json"] --> C["wire_value"] --> E{"Required field missing?"}
E -- "no" --> D["read() / cast"]
E -- "yes" --> F["raise SerializationError"]
Loading
High-Level Assessment
The following are alternative approaches to this PR:
1. Keep SE_BIDI_STRICT as a deprecated transition flag
➕ Reduces immediate breakage for consumers interacting with lagging browser implementations
➕ Allows phased rollout while updating generated schemas/overrides
➖ Perpetuates two runtime behaviors and increases long-term maintenance and test matrix
➖ Contradicts the stated ADR direction to reject tolerance at runtime
2. Collect missing-required errors and return a partially-populated object
➕ Can improve resilience for non-critical fields without hard failure
➕ Enables callers to decide whether missing fields are acceptable
➖ Produces invalid typed objects and pushes correctness burden to callers
➖ Complicates generated protocol layer and invariants around required/nullable fields
Recommendation: Given the ADR decision, the PR’s approach (always raising on missing required inbound fields and removing the toggle) is the cleanest and most predictable behavior for a typed protocol layer. If compatibility issues arise with lagging remote ends, prefer schema-level overrides (as noted in the PR) rather than reintroducing runtime tolerance.
Files changed (5) +16 / -51
Bug fix (1) +8 / -17
record.rbAlways raise on missing required inbound fields+8/-17
Always raise on missing required inbound fields
• Updates inbound deserialization semantics so required fields missing from the payload raise Error::SerializationError unconditionally. Removes the missing_required helper and folds the raise directly into wire_value.
test_environment.rbStop forcing BiDi strict mode in integration test environment+0/-3
Stop forcing BiDi strict mode in integration test environment
• Removes the test harness logic that set SE_BIDI_STRICT=true when WEBDRIVER_BIDI is enabled. This reflects that strictness is no longer configurable via environment variable.
serialization_spec.rbUpdate unit tests to require errors for missing required inbound fields+7/-14
Update unit tests to require errors for missing required inbound fields
• Replaces the prior tolerance/warn behavior test with assertions that missing required fields raise SerializationError. Adds/keeps coverage that explicit null is accepted for required-and-nullable fields.
serialization.rbRemove strict inbound toggle (SE_BIDI_STRICT) from serialization runtime+1/-13
Remove strict inbound toggle (SE_BIDI_STRICT) from serialization runtime
• Deletes Serialization.strict? and its documentation, eliminating the env-controlled strict/lenient inbound behavior split. Keeps the module focused on UNSET, enum validation, and shared serialization helpers.
serialization.rbsRemove strict? and missing_required signatures from RBS+0/-4
Remove strict? and missing_required signatures from RBS
• Deletes the RBS declarations for Serialization.strict? and Record.missing_required to match the runtime removals. Keeps type signatures aligned with the simplified strict inbound behavior.
1. SE_BIDI_STRICT removed without deprecation✗ Dismissed📘 Rule violation⚙ Maintainability
Description
This PR removes the previously user-facing SE_BIDI_STRICT toggle and the prior tolerant/warn
behavior for missing required inbound BiDi fields without a deprecation period or migration warning,
which can abruptly break users relying on it. It also leaves rb/CHANGES documenting the old
behavior and an environment variable that no longer exists/works, making the release notes
inaccurate.
- def self.strict?- value = ENV.fetch('SE_BIDI_STRICT', '').strip.downcase- !value.empty? && value != '0' && value != 'false'- end
Evidence
PR Compliance ID 2 requires public functionality to be deprecated before removal, but the PR changes
inbound BiDi deserialization to unconditionally raise Error::SerializationError when a required
field is absent, eliminating the earlier tolerated/warn path and removing the strict-mode toggle
interface from the serialization module. At the same time, rb/CHANGES still describes tolerant
behavior and references SE_BIDI_STRICT as the mechanism to escalate, demonstrating a mismatch
between documented and actual behavior and confirming that a deprecation notice or temporary
compatibility shim with warning is missing.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The previously user-facing `SE_BIDI_STRICT` toggle (and the prior tolerant+warn behavior for missing required inbound BiDi fields) was removed outright, but the deprecation policy requires a deprecation notice and/or a temporary compatibility shim with warning before full removal. Additionally, `rb/CHANGES` still documents the old tolerant behavior and references `SE_BIDI_STRICT`, which is now inaccurate given the new default behavior of always raising.
## Issue Context
The Ruby BiDi serialization layer previously supported a runtime toggle via `SE_BIDI_STRICT` (documented in `rb/CHANGES`) to escalate missing required inbound field handling. The new implementation always raises on missing required fields and the strict-mode env var and associated warning path were removed, leaving no deprecation warning for users who still set/use `SE_BIDI_STRICT` and leaving the changelog describing behavior that no longer exists.
## Fix Focus Areas
- rb/lib/selenium/webdriver/bidi/serialization.rb[20-51]
- rb/lib/selenium/webdriver/bidi/serialization/record.rb[217-226]
- rb/CHANGES[1-20]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Tip of the day
💡 Did you know, you can tweak Display preferences with a live preview to see your comment before it ships
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
B-devtoolsIncludes everything BiDi or Chrome DevTools relatedC-rbRuby Bindings
2 participants
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.
🔗 Related Issues
Updates to the latest proposed version of #17786 (reject a missing required inbound field)
Reverses the tolerance added in #17844
💥 What does this PR do?
A required field missing from an inbound BiDi payload now raises
Error::SerializationErrorinstead of being tolerated as omitted and warned.Removes the
SE_BIDI_STRICTenvironment variable, which selected between those two behaviors.🔧 Implementation Notes
The ADR rejects the tolerance outright, so no second behavior is left for a toggle to select; a remote end that lags a newly-required field is handled by an override in the shared schema rather than at runtime.
Serialization.strict?and themissing_requiredhelper existed only to branch on the toggle, so the raise folds intowire_value.🤖 AI assistance
💡 Additional Considerations
🔄 Types of changes