From 518a61f3f6437c2fa6467bd9512d6cd095a6a967 Mon Sep 17 00:00:00 2001 From: darshan3881 Date: Mon, 6 Jul 2026 17:48:58 +0530 Subject: [PATCH 1/2] OB-10135: propagate automate build id on observability buildStop Cache the automate build hashed_id at build-create time and include it as `automate_build_id` on the observability-api buildStop payload (`PUT /api/v1/builds/:id/stop`). Lets obs-api persist the mapping so the synergy dashboard can call the railsApp resource-errors endpoint in the automate id-space directly (removing the OB-9830 reverse-lookup shim once end-to-end coverage is verified). Only fires when `isTestObservabilitySession` is true, so non-o11y runs are unaffected. Payload change is additive; obs-api ingest accepts the new field via a typed `automate_build_id` on `BuildStopParams`. Spec: https://browserstack.atlassian.net/wiki/spaces/ENG/pages/6322258049/ Co-Authored-By: Claude Opus 4.7 (1M context) --- bin/commands/runs.js | 5 +++++ bin/testObservability/helper/helper.js | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/commands/runs.js b/bin/commands/runs.js index df02954a..025037ff 100644 --- a/bin/commands/runs.js +++ b/bin/commands/runs.js @@ -340,6 +340,11 @@ module.exports = function run(args, rawArgs) { utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData); if(isTestObservabilitySession) { utils.setO11yProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData); + // OB-10135: cache the automate build id so `stopBuildUpstream` + // can include it on the obs-api buildStop payload. Enables the + // synergy dashboard to call the railsApp resource-errors + // endpoint in the automate id-space directly. + process.env.BROWSERSTACK_AUTOMATION_BUILD_ID = data.build_id; } let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`; let dashboardLink = `${Constants.userMessages.VISIT_DASHBOARD} ${data.dashboard_url}`; diff --git a/bin/testObservability/helper/helper.js b/bin/testObservability/helper/helper.js index 9bb2a579..3e213d77 100644 --- a/bin/testObservability/helper/helper.js +++ b/bin/testObservability/helper/helper.js @@ -684,7 +684,12 @@ exports.stopBuildUpstream = async () => { }; } else { const data = { - 'stop_time': (new Date()).toISOString() + 'stop_time': (new Date()).toISOString(), + // OB-10135: propagate the automate build hashed_id (cached at + // build-create time in runs.js) so obs-api can persist it and the + // synergy dashboard can call the railsApp resource-errors endpoint + // in the automate id-space directly. + 'automate_build_id': process.env.BROWSERSTACK_AUTOMATION_BUILD_ID }; const config = { headers: { From 76b3b00a634021ee11c90fc530e64864670bc597 Mon Sep 17 00:00:00 2001 From: darshan3881 Date: Mon, 13 Jul 2026 15:31:28 +0530 Subject: [PATCH 2/2] OB-10135: trim comments to one-liners --- bin/commands/runs.js | 5 +---- bin/testObservability/helper/helper.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/bin/commands/runs.js b/bin/commands/runs.js index 025037ff..4ca15ab8 100644 --- a/bin/commands/runs.js +++ b/bin/commands/runs.js @@ -340,10 +340,7 @@ module.exports = function run(args, rawArgs) { utils.setProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData); if(isTestObservabilitySession) { utils.setO11yProcessHooks(data.build_id, bsConfig, bs_local, args, buildReportData); - // OB-10135: cache the automate build id so `stopBuildUpstream` - // can include it on the obs-api buildStop payload. Enables the - // synergy dashboard to call the railsApp resource-errors - // endpoint in the automate id-space directly. + // OB-10135: read by stopBuildUpstream in testObservability/helper/helper.js process.env.BROWSERSTACK_AUTOMATION_BUILD_ID = data.build_id; } let message = `${data.message}! ${Constants.userMessages.BUILD_CREATED} with build id: ${data.build_id}`; diff --git a/bin/testObservability/helper/helper.js b/bin/testObservability/helper/helper.js index 3e213d77..49d625a1 100644 --- a/bin/testObservability/helper/helper.js +++ b/bin/testObservability/helper/helper.js @@ -685,10 +685,7 @@ exports.stopBuildUpstream = async () => { } else { const data = { 'stop_time': (new Date()).toISOString(), - // OB-10135: propagate the automate build hashed_id (cached at - // build-create time in runs.js) so obs-api can persist it and the - // synergy dashboard can call the railsApp resource-errors endpoint - // in the automate id-space directly. + // OB-10135: cached in bin/commands/runs.js at build-create 'automate_build_id': process.env.BROWSERSTACK_AUTOMATION_BUILD_ID }; const config = {