Skip to content

Revert "fix(browserstack-service): omit unset accessibility config"#15252

Open
rahulpsq wants to merge 1 commit into
webdriverio:mainfrom
rahulpsq:revert-15215-fix-browserstack-accessibility-null-config
Open

Revert "fix(browserstack-service): omit unset accessibility config"#15252
rahulpsq wants to merge 1 commit into
webdriverio:mainfrom
rahulpsq:revert-15215-fix-browserstack-accessibility-null-config

Conversation

@rahulpsq
Copy link
Copy Markdown

Reverts #15215

@rahulpsq rahulpsq requested a review from a team as a code owner May 18, 2026 16:45
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 18, 2026

Greptile Summary

This PR reverts #15215 ("fix(browserstack-service): omit unset accessibility config") but instead of a clean revert it introduces a new null-based sentinel in place of the original undefined sentinel, with several places where null is cast to boolean via TypeScript's as keyword without actual runtime coercion.

  • getProductMapForBuildStartCall now accepts and returns boolean | null, so when a user does not configure accessibility the JSON payload sent to BrowserStack includes \"accessibility\": null rather than omitting the key — a different API contract from the original code.
  • getProductMap uses config.accessibility as boolean but the runtime value can be null; downstream consumers such as buildProductMap in capabilities receive null silently.
  • DEFAULT_OPTIONS gains accessibility: false, which is semantically inconsistent with the new null = "not configured" sentinel and can shadow the null check in the launcher if options are pre-merged.

Confidence Score: 3/5

The revert changes how an unset accessibility flag is represented in the BrowserStack API payload, replacing an omitted key with an explicit null value, which alters the contract with the remote service.

Three distinct defects exist in the changed files: the API build-start payload now sends accessibility null instead of omitting the key; getProductMap returns a runtime null through a type-only cast when callers expect a boolean; and DEFAULT_OPTIONS adds accessibility false which undermines the null sentinel relied on by the launcher.

packages/wdio-browserstack-service/src/testHub/utils.ts requires the most attention — both the return type of getProductMapForBuildStartCall and the as boolean cast in getProductMap need to be addressed to avoid incorrect API payloads.

Important Files Changed

Filename Overview
packages/wdio-browserstack-service/src/constants.ts Adds accessibility: false to DEFAULT_OPTIONS, which is semantically inconsistent with the new null-based sentinel introduced elsewhere in this revert.
packages/wdio-browserstack-service/src/config.ts Changes accessibility field from `boolean
packages/wdio-browserstack-service/src/launcher.ts Replaces undefined sentinel with null for _accessibilityAutomation. The null check replacing isUndefined is logically correct, but a null as boolean cast on line 438 silently propagates null into browserStackConfig.accessibility.
packages/wdio-browserstack-service/src/testHub/utils.ts Two issues: getProductMap claims boolean return type but returns null at runtime via a type-only cast; getProductMapForBuildStartCall now serializes null to JSON instead of omitting the key, changing API payload semantics.

Reviews (1): Last reviewed commit: "Revert "fix(browserstack-service): omit ..." | Re-trigger Greptile

return {
observability: config.testObservability.enabled,
accessibility: config.accessibility,
accessibility: config.accessibility as boolean,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 The as boolean cast on config.accessibility tells TypeScript the value is a boolean, but when accessibility is not configured the runtime value is null. This silently puts null into the buildProductMap capability sent to BrowserStack rather than false, which may cause unexpected server-side behavior. The cast should be replaced with an explicit coercion.

Suggested change
accessibility: config.accessibility as boolean,
accessibility: config.accessibility ?? false,

Comment on lines +76 to 79
export const getProductMapForBuildStartCall = (config: BrowserStackConfig, accessibilityAutomation: boolean | null): { [key: string]: boolean | null } => {
return {
observability: config.testObservability.enabled,
accessibility: accessibilityAutomation,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 When accessibilityAutomation is null (the new "not configured" sentinel), JSON.stringify serializes the value as "accessibility": null in the product_map payload. Before PR #15215 the field was undefined, which JSON.stringify omits entirely. Sending an explicit null is a behavioural change for the BrowserStack build-start API that this revert is supposed to undo. The return type should remain boolean | undefined with null converted or omitted before the object is built.

Suggested change
export const getProductMapForBuildStartCall = (config: BrowserStackConfig, accessibilityAutomation: boolean | null): { [key: string]: boolean | null } => {
return {
observability: config.testObservability.enabled,
accessibility: accessibilityAutomation,
export const getProductMapForBuildStartCall = (config: BrowserStackConfig, accessibilityAutomation: boolean | null): { [key: string]: boolean | undefined } => {
return {
observability: config.testObservability.enabled,
accessibility: accessibilityAutomation ?? undefined,

Comment on lines 23 to 28
export const DEFAULT_OPTIONS: Partial<BrowserstackConfig> = {
setSessionName: true,
setSessionStatus: true,
testObservability: true
testObservability: true,
accessibility: false
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 DEFAULT_OPTIONS now always supplies accessibility: false. The BrowserStackConfig constructor and launcher.ts now use null to mean "user did not configure accessibility". Any code path that initialises BrowserStackConfig or the launcher options from DEFAULT_OPTIONS-merged options will see false instead of null, silently bypassing the null-based sentinel check at launcher.ts line 428 (=== null).

Suggested change
export const DEFAULT_OPTIONS: Partial<BrowserstackConfig> = {
setSessionName: true,
setSessionStatus: true,
testObservability: true
testObservability: true,
accessibility: false
}
export const DEFAULT_OPTIONS: Partial<BrowserstackConfig> = {
setSessionName: true,
setSessionStatus: true,
testObservability: true
}

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