Skip to content

Comments

feat: add hasBeenCalled on complete & fail utility#2677

Merged
WilliamBergamin merged 5 commits intomainfrom
function-utility-has-been-called
Oct 10, 2025
Merged

feat: add hasBeenCalled on complete & fail utility#2677
WilliamBergamin merged 5 commits intomainfrom
function-utility-has-been-called

Conversation

@WilliamBergamin
Copy link
Contributor

Summary

These changes allow to easily determine if fail or complete was invoked, invoking both in the same handler can sometimes lead to errors returned from the Slack API

try {
  // do some things to create the step output
    
  await complete({
    outputs: {
      search_result: invalid_object, // this could cause a parameter validation error from the Slack API
    },
  });
} catch (error) {
  logger.error(
      `Unexpected error occurred`,
   );
  if (!complete.hasBeenCalled()){
    await fail({ error: "internal error" });
  }
}

The same applies to the fail utility function 🙏

Requirements (place an x in each [ ])

@WilliamBergamin WilliamBergamin self-assigned this Oct 9, 2025
@WilliamBergamin WilliamBergamin added enhancement M-T: A feature request for new functionality semver:minor labels Oct 9, 2025
@codecov
Copy link

codecov bot commented Oct 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.42%. Comparing base (da46246) to head (85b7a0a).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2677      +/-   ##
==========================================
+ Coverage   93.40%   93.42%   +0.01%     
==========================================
  Files          37       37              
  Lines        7613     7636      +23     
  Branches      668      666       -2     
==========================================
+ Hits         7111     7134      +23     
  Misses        497      497              
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@cchensh cchensh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@zimeg zimeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@WilliamBergamin LGTM! I'm a big fan of these implementations.

One suggestion I left is around documentation, but the code is testing good without this - no blocker IMHO! 🚢 💨

@zimeg zimeg added this to the 4.6.0 milestone Oct 10, 2025
@WilliamBergamin
Copy link
Contributor Author

@zimeg good callout on the descriptions 💯 I've updated them so that they match the ones found in bolt-python

@WilliamBergamin WilliamBergamin merged commit cb93cb9 into main Oct 10, 2025
19 checks passed
@WilliamBergamin WilliamBergamin deleted the function-utility-has-been-called branch October 10, 2025 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement M-T: A feature request for new functionality semver:minor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants