Merge fix/sdk-7167-cucumber-hook-duration - #124
Merged
bsautomation merged 3 commits intoAug 7, 2026
Conversation
… 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
requested review from
dandonarahul2002 and
pri-gadhiya
and removed request for
a team
August 7, 2026 13:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge into sdk_v9_pre_prod :by automationbs