Skip to content

Conversation

@pepperoni505
Copy link
Contributor

@pepperoni505 pepperoni505 commented Nov 20, 2025

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

@pepperoni505 pepperoni505 requested a review from a team as a code owner November 20, 2025 10:12
@pepperoni505 pepperoni505 changed the title Fix array parsing in gauge example Fix input parsing in gauge example Nov 20, 2025
@SkySails SkySails requested a review from Copilot November 20, 2025 12:32
Copilot finished reviewing on behalf of SkySails November 20, 2025 12:34
Copy link

Copilot AI left a 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 ?? 0 to || 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>;
Copy link

Copilot AI Nov 20, 2025

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.

Suggested change
functionCallback: (input: string, inputAlt: string) => Promise<unknown>;
functionCallback: (input?: string, inputAlt?: string) => Promise<unknown>;

Copilot uses AI. Check for mistakes.
@pepperoni505 pepperoni505 merged commit fef402d into main Nov 20, 2025
5 checks passed
@pepperoni505 pepperoni505 deleted the fix-example branch November 20, 2025 14:55
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.

Unable to execute custom sql query

3 participants