Make final score penalties configurable#718
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the flexibility of the Watchman search functionality by making key final score penalty multipliers configurable via environment variables. This change allows operators to fine-tune search behavior, particularly for scenarios involving low coverage, minimum required fields, and name-only queries, without needing to modify the application's source code. The default behavior remains unchanged unless these new environment variables are explicitly set. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces configurability for several final score penalty multipliers through environment variables, which is a useful enhancement for operators. The changes include updating the documentation and modifying the scoring logic to use these new variables.
My review focuses on improving the robustness of the configuration loading and the maintainability of the code. Specifically:
- In
pkg/search/similarity.go, I've suggested adding a warning log when an environment variable for a penalty multiplier cannot be parsed as a float. This will prevent silent failures and make debugging easier for operators. - I've also pointed out that using package-level variables for configuration can impact testability and suggested a potential refactoring to use a configuration struct.
- In
docs/config.md, I've recommended a minor formatting fix to the documentation table for consistency.
Overall, the changes are good, and with these suggested improvements, the feature will be more robust and maintainable.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
|
Thanks. Good idea. |
Adds env vars to configure final-score penalty multipliers in Watchman search.
This change makes these final aggregation penalties configurable:
FINAL_SCORE_LOW_COVERAGE_MULTIPLIERFINAL_SCORE_MIN_REQUIRED_FIELDS_MULTIPLIERFINAL_SCORE_NAME_ONLY_MULTIPLIERThese apply in the final entity score calculation in
pkg/search/similarity.go. They do not change the underlying Jaro-Winkler or token matching algorithms.Why
For name-only searches, strong or exact matches can still be reduced by hardcoded final-score penalties. Making these multipliers configurable allows operators to tune behavior without modifying code.
Notes
This does not change default behavior. Existing installations keep the same scoring unless the new env vars are set.