Skip to content

Fix Promise return for empty auto task graphs - #2105

Draft
pralav-25 wants to merge 1 commit into
caolan:masterfrom
pralav-25:fix-empty-auto-promise
Draft

pralav-25 wants to merge 1 commit into
caolan:masterfrom
pralav-25:fix-empty-auto-promise

Conversation

@pralav-25

Copy link
Copy Markdown

Calling auto({}) without a callback returns undefined, even though the documented Promise API and nonempty task graphs return a Promise. This makes .then() fail when an application's task graph happens to be empty. autoInject({}) inherits the same behavior.

Resolve the existing promise callback and return its Promise in the empty-task branch. Callback calls still run synchronously with the same arguments and return value. Add regressions for auto({}), auto({}, 2), and autoInject({}) that call .then() and verify the resolved result.

Validation: all three regressions fail before the fix; all 706 Node tests and repository-wide ESLint pass afterward. git diff --check passes. Browser tests were not run locally.

Assisted by OpenAI Codex; the fix was reviewed and the regression and full Node suite were run locally.

@pralav-25
pralav-25 marked this pull request as draft October 2, 2026 07:17

This branch has not been deployed

No deployments
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.

1 participant