Repository navigation
feat(cli): apply the server SDK config override - #301
kamal-kaur04 wants to merge 8 commits into
Conversation
On the CLI flow the binary forwards the server's sdk_config as serverSdkConfig with the list of overridden keys. The service deep-merges exactly those keys into its options in the main process and every worker, mapping the keys getBinConfig renames back to their option names. In onPrepare a server parallelsPerPlatform becomes each capability's wdio:maxInstances, with maxInstances raised to fit, and server platforms layer onto the capability at the same index. Without the key list nothing changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
✅ Good to go
Change map (generated deterministically from the diff)graph LR
subgraph nbinary["binary"]
ncli_test_modules_testhub_lib_server_config_test_js["server-config.test.js<br/>~43 lines"]
npackages__browserstack_testhub_lib_server_config_js["server-config.js<br/>~43 lines"]
ncli_test_modules_testhub_index_test_js["index.test.js<br/>~26 lines"]
end
subgraph nwdio_service["wdio-service"]
nwdio_browserstack_service_packages_browserstack_service_src_cli_cliUtils_ts["⚠ cliUtils.ts<br/>~129 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_cli_cliUtils_test_ts["⚠ cliUtils.test.ts<br/>~129 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_cli_index_ts["index.ts<br/>~56 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_cli_index_test_ts["index.test.ts<br/>~56 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_launcher_ts["⚠ launcher.ts<br/>~55 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_launcher_test_ts["⚠ launcher.test.ts<br/>~55 lines"]
nwdio_browserstack_service__changeset_pr_301_md["pr-301.md<br/>~5 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_constants_ts["constants.ts<br/>~2 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_util_ts["util.ts<br/>~2 lines"]
end
nsvc_Observability_TRA(["Observability/TRA"])
nsvc_collector_observability_browserstack_com(["collector-observability.browserstack.com"])
ncli_test_modules_testhub_lib_server_config_test_js --> nsvc_Observability_TRA
ncli_test_modules_testhub_lib_server_config_test_js --> nsvc_collector_observability_browserstack_com
npackages__browserstack_testhub_lib_server_config_js --> nsvc_Observability_TRA
npackages__browserstack_testhub_lib_server_config_js --> nsvc_collector_observability_browserstack_com
↻ This verdict comment is the review anchor — it's updated in place on each run (the gate posts its status separately). — SDK PR Review Agent |
…bility holds it at both levels getBinConfig flattens bstack:options last, so a key written only to the capability top level left the stale bstack:options copy in effect. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The option is a function; a server value can only be a string, which the automate module then called, so no session was named or marked. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
|
RUN_TESTS |
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
1 similar comment
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
🔴 SDK PR Review gate is red. Pending:
It turns green once the SDK PR Review Agent has run on the current head commit (any verdict — the gate only requires that the review ran). A native reviewer approval is separately required by branch protection before merge. |
|
[SDK Wdio Test] TRA build state: passed | Stability 100% — verdict: success. Passed: 53, Failed: 0, Aggregate: 53. TRA: https://observability.browserstack.com/builds/zgxnpxplunaodsmhbh3iwuk2nswolwlyl6bn7oxz |
|
RUN_TESTS |
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
…per key Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
On the review-gate findings at
|
|
[SDK Wdio Test] TRA build state: passed | Stability 100% — verdict: success. Passed: 53, Failed: 0, Aggregate: 53. TRA: https://observability.browserstack.com/builds/ib9twvzhilh4axu6ycioevx8vsfba1cvrondjvwg |
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
…to it Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
On the review-gate findings at
|
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
|
RUN_TESTS |
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
1 similar comment
|
🟢 SDK PR Review gate is green — the SDK PR Review Agent has run on the current head commit (verdict: This gate confirms a review ran on the latest commit. The verdict itself is advisory — read the findings and use your judgement; it does not block merge. A native GitHub reviewer approval is still separately required by branch protection before this PR can merge. |
|
[SDK Wdio Test] TRA build state: passed | Stability 100% — verdict: success. Passed: 53, Failed: 0, Aggregate: 53. TRA: https://observability.browserstack.com/builds/r6lr0qhuifyuunevykpgobgdmxxt5cmorhe4rpc9 |
What is this about?
In a binary-flow (central-auth) build, the SDK Config Server's
sdk_configbecomes the effective config for any key;parallelsPerPlatformis the primary one. The binary merges it and forwards two keys in the Start/ConnectBinSession config:serverSdkConfig: the normalised server config;serverSdkConfigKeys: the keys the server actually overrode.This PR makes the service apply exactly those keys and map ppp onto WebdriverIO's concurrency.
Isolation: the new code runs only when the binary sends an object
serverSdkConfigand an arrayserverSdkConfigKeys. With no override, on the fallback path, or with an older binary, behaviour is identical to main.What it does:
src/cli/index.tsapplyServerConfig, called right aftersetConfiginloadModules, in the launcher and in every worker):nullreplaces.getBinConfigmakes are mapped back:browserStackLocalOptions→opts, andtestContextOptions→setSessionName/setSessionStatus/sessionName*.CLIUtils.applyServerSdkConfig.src/launcher.ts_applyServerConfigToRunner, right after the binary starts inonPrepare, CLI flow only):parallelsPerPlatformsets each capability'swdio:maxInstancesand raisesconfig.maxInstancesto at least capabilities × ppp. The runner builds its schedule afteronPrepare, so this takes effect.platforms[i]is layered onto capability i, with flattened keys put back underbstack:options.accessibilityre-derives the launcher's accessibility flag.maxInstances.Testing
Unit: 1456 passed vs 1438 on main. Lint and build/tsc pass.
E2E: this service × binary https://github.com/browserstack/browserstack-binary/pull/1967 (WDIO guard removal), mock config server, wdio 9.32 mocha, 12 specs × Win11 chrome + edge:
maxInstances6, per-capability [3,3])Fixes after review / key matrix
applyServerPlatform: a serverplatforms[i]key that the capability holds both at the top level and inbstack:optionsis now written tobstack:options(getBinConfig flattens that copy last, so it is the one sent).sessionNameFormat: a server value (always a string) is no longer mapped onto the option, which the automate module calls as a function. Previously every session failed naming/marking.Key matrix (one combined override build + early-keys build + no-override control; mock config server, v9 service × binary #1967)
maxInstances/per-capability set from the server value; peak follows itopts(localIdentifier, forceLocal)local:truewith the server id, tunnel started--force-local, none left afterwardsplatforms[i]for thoseaccessibility:true; the no-override decline control shows the same (pre-existing)nullreplaces, and the hub rejects that platform's sessions. Rails must not sendnullfor capability keysPre-existing (reproduce without an override, not changed here):
stopBuildreturns 401 when O11y and A11y are both off; a localsessionNameFormatfunction never reaches the CLI-flow module.Limitations (documented)
platformsentries beyond the wdio.conf capabilities are inert.testContextOptionsis listed as overridden on every override build (the server echo differs from the synthesised local value); applying it is a no-op.Sibling PRs (SDK-7954)
Related Jira task/s
Release (mandatory for every PR — required for the
ready-for-reviewlabel)Version bump: (required — tick exactly one)
Release notes type: (optional)
Release notes (customer-facing): (optional but encouraged)
parallelsPerPlatform(parallel sessions per capability). Your wdio.conf remains the fallback.Release notes (internal): (required — engineer-facing; what actually changed / why)
BrowserstackCLI.applyServerConfigapplies exactly the binary-listed overridden keys (serverSdkConfigKeys) ofserverSdkConfigto the service options aftersetConfig, in the launcher and workers. The binary's renamed keys are mapped back to the service spellings.parallelsPerPlatformonto each capability'swdio:maxInstancesand raisesconfig.maxInstances, and layers serverplatforms[i]onto capability i.Checklist
PR Validations
Run Tests: Comment RUN_TESTS to trigger sanity tests.
🤖 Generated with Claude Code