-
Notifications
You must be signed in to change notification settings - Fork 1
Fix input parsing in gauge example #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes input parsing issues in the gauge example where empty text fields were incorrectly parsed as [""] instead of [], causing errors when queries expected no parameters. The changes standardize parameter handling and improve SQL query argument parsing.
Key Changes:
- Updated function callback signatures to use required (non-optional) parameters
- Replaced string fallback patterns from
?? ""to no fallback, and numeric fallbacks from?? 0to|| 0 - Improved SQL query parameter parsing to use proper JSON parsing with error handling
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| arguments: string[]; | ||
| name: string; | ||
| functionCallback: (input?: string, inputAlt?: string) => Promise<unknown>; | ||
| functionCallback: (input: string, inputAlt: string) => Promise<unknown>; |
Copilot
AI
Nov 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionCallback signature requires two parameters (input: string, inputAlt: string), but some callbacks in the functionList (e.g., lines 48, 222) take no parameters. This creates a type mismatch. Consider making the parameters optional with (input?: string, inputAlt?: string) or handling functions with different arities differently.
| functionCallback: (input: string, inputAlt: string) => Promise<unknown>; | |
| functionCallback: (input?: string, inputAlt?: string) => Promise<unknown>; |
Resolves #29
Previous logic led to an empty text field being parsed as
[""], which caused an error on the Rust side since that empty string counts as a parameter, and if the query doesn't expect any, it would error. New behavior expects either nothing in the field (leading to an empty array), or a JSON formatted array.Additionally, there was incorrect fallbacks for an empty string in the argument text field. This is now fixed