fix: await Node API operations whose run() returns a non-async Promise#2659
Merged
GCHQDeveloper581 merged 2 commits intoJul 21, 2026
Merged
Conversation
GCHQDeveloper581
approved these changes
Jul 21, 2026
GCHQDeveloper581
left a comment
Contributor
There was a problem hiding this comment.
Good catch!
Thanks for your contribution.
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.
Description
The Node API decides whether an operation is asynchronous by inspecting how its
runmethod is declared:A
run()can return a Promise without being declaredasync. Those operations were treated as synchronous, so the wrapper never awaited them and the output Dish held an unresolved Promise — surfacing asData is not a valid string: {}(Avro to JSON) orData is not a valid ArrayBuffer: {}(Bzip2 Compress).This affected two operations, both of which returned
new Promise(...)from a plainrun():src/core/operations/AvroToJSON.mjs)src/core/operations/Bzip2Compress.mjs)The fix declares both
run()methodsasync, which flipsisAsynctotrueso the Node API uses its awaiting wrapper. This matches the pattern already used by several operations, including the sibling Bzip2 Decompress (async runthat returns a Promise). The web UI is unaffected becausesrc/core/Recipe.mjsalready awaits every operation regardless of howrunis declared, which is why the bug was Node-only.Existing Issue
#2658
Screenshots
N/A — no visual changes.
AI disclosure
Claude Code was used to diagnose the root cause, implement the fix, and write the Node API regression tests. I have reviewed and understand all of the changes.
Test Coverage
Added two Node API regression tests in
tests/node/tests/operations.mjs:Both tests fail on the unfixed code (the result is an unresolved Promise) and pass with the fix. The existing core-path fixtures in
tests/operations/tests/AvroToJSON.mjsare unchanged and remain green. Verified locally:npm test(261 node + 2186 operation tests),npm run testnodeconsumer,npx grunt lint, andnpx grunt prodall pass.