Skip to content

Commit a6d753e

Browse files
authored
Merge branch 'master' into fix/sdk-6016-o11y-circular-args
2 parents 925322f + ad1d958 commit a6d753e

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

bin/commands/runs.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ module.exports = function run(args, rawArgs) {
364364
// stop the Local instance
365365
if (!turboScaleSession) await utils.stopLocalBinary(bsConfig, bs_local, args, rawArgs, buildReportData);
366366

367+
// SDK-6211: send the Test Observability build-stop now — polling has resolved, so
368+
// the build has finished running on BrowserStack. builds_th.finished_at is stamped
369+
// server-side when the collector receives this stop event, so firing it here (before
370+
// the 5s safety wait, artifact download and HTML report generation below) keeps the
371+
// TRA build "Duration" aligned with the test window instead of the full CLI wall-clock.
372+
// printBuildLink no-ops on non-observability runs and is idempotent (buildStopped
373+
// guard); the later handleSyncExit stop becomes a no-op that still honors the exit code.
374+
await printBuildLink(true);
375+
367376
// waiting for 5 secs for upload to complete (as a safety measure)
368377
await new Promise(resolve => setTimeout(resolve, 5000));
369378

bin/testObservability/helper/helper.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,16 @@ const supportFileCleanup = () => {
9393
exports.buildStopped = false;
9494

9595
exports.printBuildLink = async (shouldStopSession, exitCode = null) => {
96-
if(!this.isTestObservabilitySession() || exports.buildStopped) return;
96+
if(!this.isTestObservabilitySession()) return;
97+
// SDK-6211: the build-stop may be sent early (runs.js fires it at poll-resolution, before the
98+
// post-test 5s wait + artifact download + report generation, so builds_th.finished_at — which
99+
// the collector stamps at stop-event receipt — reflects the test window rather than the full CLI
100+
// wall-clock). A later call here must therefore still honor the exit code instead of returning
101+
// silently, preserving the original failing-build exit behaviour.
102+
if(exports.buildStopped) {
103+
if(exitCode) process.exit(exitCode);
104+
return;
105+
}
97106
exports.buildStopped = true;
98107
try {
99108
if(shouldStopSession) {

0 commit comments

Comments
 (0)