fix: cypher prefix matching in embeddings query#301
fix: cypher prefix matching in embeddings query#301portwebdesign wants to merge 2 commits intovitali87:mainfrom
Conversation
Summary of ChangesHello @portwebdesign, 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 resolves a bug in the Cypher query responsible for retrieving embeddings by adjusting how project name prefixes are handled. By eliminating an internal string concatenation within the Cypher query and instead relying on the Python application to provide the complete prefix, the change significantly improves the query's stability and prevents specific type-related errors, ensuring more dependable data retrieval. Highlights
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
|
Greptile OverviewGreptile Summary
Confidence Score: 2/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant GU as GraphUpdater
participant CS as constants.py
participant DB as Neo4j/Ingestor
GU->>CS: uses CYPHER_QUERY_EMBEDDINGS
GU->>DB: fetch_all(query, {project_name: project_name + "."})
DB-->>DB: MATCH Module->DEFINES->Function/Method
DB-->>DB: WHERE m.qualified_name STARTS WITH $project_name
DB-->>GU: results rows
GU-->>GU: embed_code() + store_embedding() for each row
|
There was a problem hiding this comment.
Code Review
This pull request aims to fix a type error in a Cypher query by removing string concatenation. While the intention is good, the change as-is could lead to incorrect query results by matching unintended projects. I've suggested a more robust query logic that handles edge cases correctly and prevents ambiguity. This proposed change relies on fixing the root cause of the type error in the calling Python code, which is the recommended approach.
There was a problem hiding this comment.
Pull request overview
Updates the embeddings Cypher query to avoid string concatenation inside STARTS WITH, preventing Cypher type/precedence errors and relying on Python to pass the complete module-qualified-name prefix.
Changes:
- Remove Cypher-side concatenation (
$project_name + '.') fromCYPHER_QUERY_EMBEDDINGS. - Make
STARTS WITHcompare directly against the provided parameter value.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0281c40 to
0ba3b65
Compare
9b88a0b to
8370545
Compare
This change avoids string concatenation inside the Cypher query by passing the fully-formed prefix from Python.
It prevents type errors like Invalid types: bool and string for '+' when m.qualified_name contains unexpected values.