Skip to content

Make un-awaited getAll() fail loudly instead of yielding {} - #27

Merged
adsharma merged 1 commit into
mainfrom
fix/getall-await-footgun
Oct 15, 2026
Merged

adsharma merged 1 commit into
mainfrom
fix/getall-await-footgun

Conversation

@adsharma

Copy link
Copy Markdown
Contributor

Fixes #26.

QueryResult.getAll() is async; calling it without await returns a pending Promise that JSON.stringify renders as '{}', which looks like an empty result and can make tests falsely pass.

getAll() now returns a Promise subclass whose toJSON() throws a descriptive error (use await getAll() or getAllSync()), turning the silent footgun into a loud failure. Awaited behavior is unchanged. JSDoc and lbug.d.ts now warn prominently on all async accessors, and regression tests cover the issue's querySync repro.

QueryResult.getAll() is async; calling it without await returns a
pending Promise that JSON.stringify renders as '{}', which looks like
an empty result and can make tests falsely pass.

getAll() now returns a Promise subclass whose toJSON() throws a
descriptive error (use await getAll() or getAllSync()), turning the
silent footgun into a loud failure. Awaited behavior is unchanged.
JSDoc and lbug.d.ts now warn prominently on all async accessors.
@adsharma

Copy link
Copy Markdown
Contributor Author

Ignoring windows failure for now. It should go away when we build new extensions from main.

@adsharma
adsharma merged commit 9094f23 into main Oct 15, 2026
6 of 8 checks passed
@adsharma
adsharma deleted the fix/getall-await-footgun branch October 15, 2026 19:53
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.

Node.js: QueryResult.getAll() silently returns an empty result in sync code (async leftover; getAllSync() exists)

1 participant