Fix: resolve TestHub build creation from the normalised product flags - #63
Merged
shubhamkd merged 1 commit intoSep 11, 2026
Conversation
Build start was gated on a strict `enabled === true` while every other site read the same setting for truthiness, so a config supplying `"true"`, `1`, or omitting the key entirely reported reporting as enabled, created no build, and stamped every session with an empty `testhubBuildUuid`. The gate arrived in v3.7.0 and is present through 3.11.3; the same config creates a build on 3.5.0. - parse `enabled` once, in one place, accepting the boolean/string/number forms a nightwatch.conf.js, YAML or env-derived config produces - derive the build-start decision from that resolved state, so it can no longer disagree with the product map - warn when a run intended a TestHub build but ends without a uuid, which was previously silent in both the never-attempted and the failed-attempt case Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
dandonarahul2002
approved these changes
Sep 10, 2026
rounak610
approved these changes
Sep 10, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Build creation is gated on a strict
enabled === true, while every other site reads the same setting for truthiness. Any config supplying a truthy-but-not-boolean value —"true"(what a YAML- or env-derived config produces),1, or the key omitted entirely (the plugin's own default is ON) — therefore produces a run that:testhubBuildUuid: "", so the session can never be linked to reporting data.The tests pass and nothing warns. The only symptom is missing data.
The two sites disagree about what "enabled" means: one silently skips build creation, the other goes on to declare the product active.
This arrived in v3.7.0 — the identical config creates a build on 3.5.0 and creates nothing from 3.8.0 through current 3.11.3, so upgrading is not a remedy for an affected user.
What this changes
helper.parseBooleanSetting()— one place that resolves a flag, accepting the boolean / string / numeric forms anightwatch.conf.js, YAML or env-derived config actually produces. Returnsundefinedwhen the setting is absent, so "not set" stays distinguishable from "set to false".configure()normalises before writing the env, and warns when a non-boolean value had to be interpreted. The top-leveltestObservability/testReportingflags get the same treatment — previously a top-level"false"was ignored outright.handleErrorForObservabilityturns the product flags back off before the capabilities are written — so a naive "product enabled but no uuid" check stays quiet exactly when a build-start failure loses the data.Resolution table after this change:
test_observability.enabledtrue"true"1/"1"false/"false"/0No behaviour change for anyone already passing a real boolean.
Test plan
npm test— 102 passing, 0 failing. New unit tests intest/src/utils/booleanSettings.jscover the parser, the build-start gate, andconfigure()'s normalisation.npm run eslint— clean.Wire-level A/B, no credentials — stub W3C hub + stub TestHub collector, nightwatch core 3.16.0, same test file and same config across arms. Signal is
POST /api/v[12]/buildsreaching the collector plus thetesthubBuildUuidthe hub actually received:enabledtrue"true"uuid=""1uuid=""uuid=""falseLive A/B against BrowserStack — one test,
test_observability.enabled: 'true'in both arms, only the plugin swapped:e1fca429ba1454eed2524786b2a9a8478c6b7defda5f372e86e50aa917f2916255d723f97c317d8a8815e6dc54f12b9c1c8cb724b841fdedf32aabce8c5bab3080c01a9611cc25c1b7f8fba1d7616327mxwufkw6jspxiiljalnblsznazkas7bdepicnjxxThe pre-fix run prints no build-report URL at all; the post-fix run prints one, and that build's test run carries
session_id = 8c5bab3080c01a9611cc25c1b7f8fba1d7616327— i.e. the same Automate session, now linked.Opt-out re-checked:
enabled: falseandenabled: 'false'create no build on this branch, as before.Measured production impact before the fix: a four-figure count of Automate sessions per week, spread over five accounts, reporting observability as enabled with an empty
testhubBuildUuid— and three of those accounts are on 3.11.2, which is what confirms this is config-dependent rather than version-dependent. Accounts on the same versions with a boolean in their config are unaffected.Not included here, on purpose
An accessibility-only run still never creates a build:
launchTestSession()is nested insideif (helper.isTestObservabilitySession())(nightwatch/globals.js), so theaccessibilitybranch of the build-start decision is unreachable whenever reporting is explicitly off — andBROWSERSTACK_ACCESSIBILITY='true'is only ever set from the build-start response, soaccessibility: truewithtest_observability.enabled: falsesilently disables accessibility as well. Hoisting the call would route those runs into the existing observability-denied path, which never stops the build and leaves the process wedged; that wants fixing first. Tracked separately (internal ref SDK-7538).🤖 Generated with Claude Code