-
Notifications
You must be signed in to change notification settings - Fork 166
chore: add test for boolean behavior and rename embeddingsValidation #759
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
| * Preprocessor for boolean values that handles string "false"/"0" correctly. | ||
| * Zod's coerce.boolean() treats any non-empty string as true, which is not what we want. | ||
| */ | ||
| export function parseBoolean(val: unknown): unknown { |
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.
This is actually largely irrelevant for CLI-based parsing because yargs-parser takes care of this for us but it's generally better to have this for other types of input.
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.
I could remove this to be honest, it's more relevant for headers case but it still doesn't hurt
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 renames the embeddings validation configuration from disableEmbeddingsValidation to embeddingsValidation with inverted boolean semantics, and adds comprehensive boolean parsing support for CLI arguments.
Key Changes:
- Renamed
disableEmbeddingsValidationtoembeddingsValidation(flipped from "disable" to "enable" semantics) - Implemented
parseBooleanhelper to correctly handle string "false"/"0" values in CLI arguments - Added extensive test coverage for boolean CLI argument parsing behavior
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/common/config/userConfig.ts | Renamed field from disableEmbeddingsValidation to embeddingsValidation, inverted default from false to true, and added parseBoolean preprocessing for boolean fields |
| src/common/config/configUtils.ts | Added parseBoolean function to correctly parse boolean values from strings, and improved commaSeparatedToArray implementation |
| src/common/config/argsParserOptions.ts | Updated boolean field name in OPTIONS configuration |
| src/common/search/vectorSearchEmbeddingsManager.ts | Updated logic to use embeddingsValidation with inverted boolean check and removed redundant validation check in embed method |
| tests/unit/common/config.test.ts | Updated test expectations to use new field name and added comprehensive tests for boolean CLI argument parsing |
| tests/unit/common/search/vectorSearchEmbeddingsManager.test.ts | Updated test fixtures to use new field name with inverted boolean values |
| server.json | Updated configuration metadata with renamed field and reordered entries alphabetically |
| scripts/generateArguments.ts | Removed assertion that required array descriptions to start with "An array of" |
| README.md | Updated documentation to reflect renamed configuration field |
| cli: ["--readOnly", "FALSE"], | ||
| // This is yargs-parser default | ||
| expected: { readOnly: true }, |
Copilot
AI
Nov 25, 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 test expects uppercase 'FALSE' to result in true, but the parseBoolean function converts to lowercase and checks for 'false', which would return false. This test case doesn't match the actual implementation behavior.
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.
you're understandably confused but this isn't actually hitting the string case, yargs-parser gives a boolean-based situation
Pull Request Test Coverage Report for Build 19676499266Details
💛 - Coveralls |
himanshusinghs
left a comment
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.
Looks good 👍
This is actually largely irrelevant for CLI-based parsing because yargs-parser takes care of this for us but it's generally better to have this for other types of input.
So...
Two steps:
chore: add tests and pre-processor for other cases
chore: disableEmbeddingsValidation -> embeddingsValidation