Repository navigation
feat(cli): apply the server SDK config override (v8) - #302
kamal-kaur04 wants to merge 6 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 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>
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>
|
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 |
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/>~133 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_cli_cliUtils_test_ts["⚠ cliUtils.test.ts<br/>~133 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_launcher_ts["⚠ launcher.ts<br/>~56 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_launcher_test_ts["⚠ launcher.test.ts<br/>~56 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_cli_index_ts["index.ts<br/>~47 lines"]
nwdio_browserstack_service_packages_browserstack_service_tests_cli_index_test_ts["index.test.ts<br/>~47 lines"]
nwdio_browserstack_service__changeset_pr_302_md["pr-302.md<br/>~5 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_util_ts["util.ts<br/>~4 lines"]
nwdio_browserstack_service_packages_browserstack_service_src_constants_ts["constants.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 |
|
🟢 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. |
|
RUN_TESTS |
|
[SDK Wdio Test] TRA build state: failed | Stability 96% — verdict: success. Passed: 51, Failed: 2, Aggregate: 53. TRA: https://observability.browserstack.com/builds/azom2gxpig0ovgfynctygobpml32dqul81jvnyef |
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. |
|
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 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: failed | Stability 96% — verdict: success. Passed: 51, Failed: 2, Aggregate: 53. TRA: https://observability.browserstack.com/builds/0c6rmx0741vlttjrlctmpoqaomzsajjlvtko7gnq |
|
🟢 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>
|
🔴 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 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. |
|
On the remaining review-gate warning at
This is an ungrounded item. A non-author reviewer comment confirming the placement clears it on the gate. |
|
🟢 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. |
|
RUN_TESTS |
|
[SDK Wdio Test] TRA build state: failed | Stability 96% — verdict: success. Passed: 51, Failed: 2, Aggregate: 53. TRA: https://observability.browserstack.com/builds/eru2wpa6s0cco4boktzwhbpitea8tdrrp8em3zfl |
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 is the v8 port of #301 (v9): the service applies exactly those keys and maps 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; v8 has a single call site):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'smaxInstances(the key the v8 runner reads first) and 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: 1167 passed vs 1146 on origin/v8; build and tsc pass. (v8 has no lint config; v9's eslint config run over the touched files is clean.)
E2E: this service × binary https://github.com/browserstack/browserstack-binary/pull/1967, mock config server, wdio 8.46 mocha, 12 specs × Win11 chrome + edge:
maxInstances[3,3],config.maxInstances6)maxInstances[1,1])sessionNameFormat: "x"+ ppp 3v8 differences from v9:
maxInstances(notwdio:maxInstances).platforms[i]when the same key is also set at the top level, so the server must spell such a key the way the capability does.sessionNameFormatfix is needed: v8 reads it only from the service options.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 (run on v9 #301, same logic on v8 — 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'smaxInstancesand 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