Skip to content

Merge fix/sdk-7167-cucumber-hook-duration - #124

Merged
bsautomation merged 3 commits into
sdk_v9_pre_prodfrom
fix/sdk-7167-cucumber-hook-duration
Aug 7, 2026
Merged

Merge fix/sdk-7167-cucumber-hook-duration#124
bsautomation merged 3 commits into
sdk_v9_pre_prodfrom
fix/sdk-7167-cucumber-hook-duration

Conversation

@bsautomation

Copy link
Copy Markdown

Merge into sdk_v9_pre_prod :by automationbs

osho-20 and others added 3 commits August 5, 2026 01:33
… build duration (SDK-7167)

A cucumber hook (typically AFTER_EACH) that emitted HookRunStarted but never
its HookRunFinished stayed open on the Test Observability backend until the
project's hook timeout (2h), inflating the build duration shown on the new
dashboard (customer saw 4h35m for a 2h42m build). Customer SDK debug logs
confirmed the drop is client-side: 525 hook starts vs 521 finishes triggered,
zero upload failures.

Three complementary fixes:

- Extend the teardown sweep (previously mocha-only, documented known gap) to
  cucumber: hook meta is tagged kind/name/hookType/testRunId at start,
  scenario meta is tagged in beforeScenario and stamped finished in
  afterScenario, and sweepUnfinished now emits terminal HookRunFinished /
  TestRunFinished for any started-but-unfinished cucumber entity before the
  worker's event queue shuts down.
- Journal open hook runs like open test runs, so when the worker is killed
  outright mid-hook (Ctrl-C / CI cancellation) the exit cleanup finalizes the
  orphaned hook with a HookRunFinished (hook_run envelope) instead of only
  finalizing the test run.
- Guard the cucumber hook 'after' path against a missing start record (skip
  with a warning instead of emitting an unmatched finish / TypeError), and
  reset in-flight step state at scenario start so an aborted step can no
  longer silently drop every later AFTER_EACH hook's events.

Verified end-to-end on Automate: interrupting a run mid-After-hook with the
published 9.33.0 leaves the hook open (only the test run is finalized);
with this fix the exit cleanup finalizes both ("Finalized 2 orphaned
test/hook run(s)").

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ation (SDK-7167)

cucumber's hookId is assigned at Before()/After() registration time, so every
scenario invoking the same registered hook shares one _tests key — a still-open
entry orphaned in an earlier scenario was clobbered by the next invocation
before sweepUnfinished() could close it. Suffix the key with the current
scenario's run uuid so each invocation is tracked independently; this also
stops a dropped 'before' from matching a previous scenario's closed entry and
re-emitting its uuid.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@bsautomation
bsautomation requested a review from a team as a code owner August 7, 2026 13:09
@bsautomation
bsautomation requested review from dandonarahul2002 and pri-gadhiya and removed request for a team August 7, 2026 13:09
@bsautomation
bsautomation merged commit 605b0ae into sdk_v9_pre_prod Aug 7, 2026
19 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.

3 participants