Skip to content

Sdk 6983 flush on signal - #104

Merged
hamza-browserstack merged 7 commits into
sdk_v9_pre_prodfrom
SDK-6983-flush-on-signal
Jul 27, 2026
Merged

Sdk 6983 flush on signal#104
hamza-browserstack merged 7 commits into
sdk_v9_pre_prodfrom
SDK-6983-flush-on-signal

Conversation

@hamza-browserstack

Copy link
Copy Markdown
Contributor

What is this about?

Related Jira task/s

Release (mandatory for every PR — required for the ready-for-review label)

Version bump: (required — tick exactly one)

  • minor (backwards-compatible feature)
  • patch (bug fix or other small change)

Release notes type: (optional)

  • New Feature
  • Bug Fix
  • Other Improvement

Release notes (customer-facing): (optional but encouraged)

Release notes (internal): (required — engineer-facing; what actually changed / why)

Checklist

  • Ready to review
  • Has it been tested locally?

PR Validations

Run Tests: Comment RUN_TESTS to trigger sanity tests.

kamal-kaur04 and others added 7 commits July 24, 2026 01:58
Signal-terminated runs previously lost their SDK-log tarball (onComplete's
upload never runs on a kill) and emitted no SDKTestSuccessful at all — the
funnelDataSent flag was set by SDKTestAttempted at startup, permanently
disarming the exit-time cleanup resend. Killed builds were undebuggable and
invisible to query-side kill detection.

- capture interrupt signals on BrowserStackConfig (killSignal)
- stamp finishedMetadata {reason: user_killed, signal} on SDKTestSuccessful
- exit-time cleanup rescues the logs.tar.gz upload (--uploadLogs), gated by
  a logsUploaded flag so delivered uploads are never repeated
- mark funnelDataSent only for SDKTestSuccessful
- snapshot funnelData credentials before fireFunnelRequest redacts them
  in place

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The kill reason previously rode only the analytics funnel; the TestHub
build-stop payload stayed empty on terminated runs. Propagate the caught
signal via env (the detached cleanup child has no in-memory config) and
stamp finished_metadata {reason: user_killed, signal} on the direct-flow
stopBuildUpstream PUT, and exitSignal/exitReason on the CLI StopBinSession
request (the binary maps them to finished_metadata).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Reword the explanatory comments to remove the tracker-ID prefixes while
keeping their content.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add unit coverage for the interrupt-signal handling: the exit-handler
uploadLogs rescue arg, the cleanup log-upload with pre-redaction creds,
the funnel finish-reason/kill-signal marking, stopBuildUpstream's
finished_metadata, and grpcClient's exitSignal/exitReason on stop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…log uploads

Signal listeners suppress Node's default termination, so a hung shutdown
would live until CI's SIGKILL (which fires no 'exit' event, skipping the
cleanup rescue). Arm an unref'd 5s grace timer that forces the conventional
128+n exit. Also stop marking logsUploaded when the upload server returns a
non-success status, so a rejected upload stays eligible for the rescue.
Merge the duplicate constants import.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hamza-browserstack
hamza-browserstack requested a review from a team as a code owner July 27, 2026 17:32
@hamza-browserstack
hamza-browserstack requested review from rounak610 and xxshubhamxx and removed request for a team July 27, 2026 17:32
@hamza-browserstack
hamza-browserstack merged commit e2fb24f into sdk_v9_pre_prod Jul 27, 2026
18 of 20 checks passed
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.

2 participants