Skip to content

fix(observability): BuildUpdate one-shot guard — flip haveSentBuildUpdate [SDK-6574]#1133

Open
xxshubhamxx wants to merge 1 commit into
masterfrom
fix/SDK-6574-buildupdate-oneshot-guard
Open

fix(observability): BuildUpdate one-shot guard — flip haveSentBuildUpdate [SDK-6574]#1133
xxshubhamxx wants to merge 1 commit into
masterfrom
fix/SDK-6574-buildupdate-oneshot-guard

Conversation

@xxshubhamxx

@xxshubhamxx xxshubhamxx commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

What is this about?

The Observability reporter is designed to send BuildUpdate once, but the one-shot guard never flipped its flag. In bin/testObservability/reporter/index.js, the guard is if(!this.haveSentBuildUpdate && ...), but this.haveSentBuildUpdate was never set to true after the event was sent. So it stayed false and BuildUpdate re-fired on every test/hook event — hundreds to thousands of byte-identical observability_version payloads per build (≥10k observed for a single Cypress tenant in prod; 13/13 top BuildUpdate emitters are Cypress across SDK 1.31–1.36.x).

The payload (observability_version) is a build-level constant, so every re-emit is redundant. This floods the TRA event_batch_top_v2 Kafka partition (build-uuid-keyed → hot partition) and drives redundant testhub round-trips.

Fix (additive, one line): set this.haveSentBuildUpdate = true immediately after the BuildUpdate is sent. BuildUpdate now fires once per reporter instance (≈ once per spec process); the byte-identical per-process emits are collapsed to one per build by the consumer-side dedupe in TRAP-4033.

Note: the guard has never worked since it was introduced (commit a0f7404, 2023-06-18) — it is not a recent regression.

Change

         await uploadEventData(buildUpdateData);
+        this.haveSentBuildUpdate = true;
       }

Related Jira task/s

Testing

Single-line change; validated locally (no test file added to keep the PR minimal):

  • Reproduce → resolve: a throwaway proxyquire/sinon harness driving 5 test events through one reporter instance emits 5 BuildUpdate without this line and exactly 1 with it.
  • No regressions: full npm test suite is unchanged at 678 passing / 13 failing (the 13 are pre-existing failures in unrelated modules — errorReporting / zipUpload / results-table / video-config).

@xxshubhamxx xxshubhamxx requested a review from a team as a code owner June 22, 2026 11:18
@xxshubhamxx xxshubhamxx force-pushed the fix/SDK-6574-buildupdate-oneshot-guard branch from 73945f9 to 1e08d42 Compare June 22, 2026 11:32
…, not per test/hook [SDK-6574]

The one-shot guard `if(!this.haveSentBuildUpdate && ...)` never flipped
`haveSentBuildUpdate`, so the BuildUpdate event (a byte-identical, build-level
`observability_version` payload) re-fired on every test/hook event — hundreds to
thousands of identical events per build. Set the flag right after the event is
sent so it is emitted once per reporter instance. Complements consumer-side
dedupe TRAP-4033.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@xxshubhamxx xxshubhamxx force-pushed the fix/SDK-6574-buildupdate-oneshot-guard branch from 1e08d42 to 5f782e8 Compare June 22, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant