Skip to content

Fix/sdk 7167 cucumber hook duration - #144

Merged
rahulpsq merged 3 commits into
sdk_v9_pre_prod_14augfrom
fix/sdk-7167-cucumber-hook-duration
Aug 14, 2026
Merged

Fix/sdk 7167 cucumber hook duration#144
rahulpsq merged 3 commits into
sdk_v9_pre_prod_14augfrom
fix/sdk-7167-cucumber-hook-duration

Conversation

@rahulpsq

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.

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>
@rahulpsq
rahulpsq requested a review from a team as a code owner August 14, 2026 12:31
@rahulpsq
rahulpsq requested review from 07souravkunda and rounak610 and removed request for a team August 14, 2026 12:31
@rahulpsq
rahulpsq merged commit 66bb6ca into sdk_v9_pre_prod_14aug Aug 14, 2026
34 of 35 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