-
Notifications
You must be signed in to change notification settings - Fork 53
[feat]: add codegraph support by FalkorDB for repo indexing #138
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds end-to-end repository code-graph support: new RepoService, repo_support tooling and prompt updates, schema/model for indexed repositories, Discord commands, FalkorDB service and a full code-graph-backend (Flask API, analyzers, graph layer, LLM prompts, tests, and configs). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant DiscordBot as Discord Bot
participant DevRel as DevRelCommands
participant RepoSvc as RepoService
participant Supabase as Supabase DB
participant CG as Code-Graph Backend
User->>DiscordBot: /index_repository owner/repo
DiscordBot->>DevRel: interaction
DevRel->>RepoSvc: index_repo(owner/repo, discord_id)
RepoSvc->>RepoSvc: _parse_repo_url
RepoSvc->>Supabase: upsert/find indexed_repositories
RepoSvc->>CG: POST /analyze_repo
alt analyze OK
CG-->>RepoSvc: 200 + counts
RepoSvc->>Supabase: mark completed, set counts
RepoSvc-->>DevRel: {status: success}
DevRel-->>DiscordBot: update embed (completed)
else analyze error
CG-->>RepoSvc: error
RepoSvc->>Supabase: mark failed
RepoSvc-->>DevRel: {status: failed}
DevRel-->>DiscordBot: update embed (error)
end
sequenceDiagram
autonumber
actor User
participant Agent as GitHub Agent
participant Toolkit as github_toolkit
participant Tool as repo_support.handle_repo_support
participant RepoSvc as RepoService
participant Supabase as Supabase DB
participant CG as Code-Graph Backend
User->>Agent: natural-language repo query (includes owner/repo)
Agent->>Toolkit: classify → repo_support
Toolkit->>Tool: handle_repo_support(query)
Tool->>RepoSvc: query_repo(question, repo_full_name)
RepoSvc->>Supabase: fetch indexed_repositories status
alt indexing == completed
RepoSvc->>CG: POST /chat (graph_name, question)
CG-->>RepoSvc: answer, cypher?
RepoSvc-->>Tool: {status: success, repository: repo_full_name, answer: ...}
else not indexed / pending / failed
RepoSvc-->>Tool: {status: not_indexed|pending|failed, message: ...}
end
Tool-->>Toolkit: response JSON
Toolkit-->>Agent: return raw JSON
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Hey @chandansgowda, I wanted a bit of help in structuring the codegraph's repository. As of now, I have added their codebase directly to our codebase as a vendor. Should I remove this and add it as a submodule? I faced a few issues in their original codebase when indexing our codebase and made a few changes; still not very sure on this part, whether they were because of some versioning problems or bugs. Having a few tests around them, and will update in this thread itself. Thanks a lot !! PS: I think it got in as a submodule on its own; don't know how and why. I ensured to remove .git and then commit. NVM, I think a can have a few trials after merging and will fix in a separate PR. |
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.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
backend/app/database/supabase/scripts/create_db.sql (1)
158-195
: Remove duplicate trigger function definition.The
update_updated_at_column()
function is defined twice (lines 159-165 and 184-190), which is confusing and unnecessary. Additionally, the second definition uses deprecated syntaxlanguage 'plpgsql'
(line 190) instead ofLANGUAGE plpgsql
.Apply this diff to consolidate into a single function used by both triggers:
-- AUTO-UPDATE TRIGGER CREATE OR REPLACE FUNCTION update_updated_at_column() RETURNS TRIGGER AS $$ BEGIN NEW.updated_at = now(); RETURN NEW; END; -$$ LANGUAGE plpgsql; +$$ LANGUAGE plpgsql; CREATE TRIGGER update_indexed_repositories_updated_at BEFORE UPDATE ON indexed_repositories FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); COMMENT ON TABLE indexed_repositories IS 'Tracks GitHub repositories indexed in FalkorDB'; COMMENT ON COLUMN indexed_repositories.repository_full_name IS 'Full repository name: owner/repo (e.g., AOSSIE-Org/Devr.AI)'; COMMENT ON COLUMN indexed_repositories.graph_name IS 'Graph name in FalkorDB (just the repo name, e.g., Devr.AI)'; COMMENT ON COLUMN indexed_repositories.is_deleted IS 'Soft delete flag - allows re-indexing the same repo later'; COMMENT ON INDEX unique_active_repo IS 'Ensures only one active (non-deleted) version of each repo exists'; --- Add a trigger to update 'updated_at' timestamp -CREATE OR REPLACE FUNCTION update_updated_at_column() -RETURNS TRIGGER AS $$ -BEGIN - NEW.updated_at = now(); - RETURN NEW; -END; -$$ language 'plpgsql'; - CREATE TRIGGER update_conversation_context_updated_at BEFORE UPDATE ON conversation_context FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
🧹 Nitpick comments (9)
backend/docker-compose.yml (1)
45-58
: Pin the FalkorDB image to a concrete version.Using the
latest
tag makes deployments non-repeatable and can silently pull breaking changes. Please pin to a tested FalkorDB release (and update deliberately when needed).Consider updating this stanza once you pick the right tag:
- image: falkordb/falkordb:latest + image: falkordb/falkordb:<tested-version>backend/app/models/database/supabase.py (2)
197-203
: Constrainindexing_status
to known values.Use an Enum (or Literal) to prevent invalid states.
Add this Enum near the top:
from enum import Enum class IndexingStatus(str, Enum): pending = "pending" completed = "completed" failed = "failed"Then change the field:
- indexing_status: str # 'pending', 'completed', 'failed' + indexing_status: IndexingStatus
195-197
: Optional: validate repository identifiers.Add lightweight regex constraints to fail fast on invalid names.
Example (requires
from pydantic import constr
):- repository_full_name: str - graph_name: str + repository_full_name: constr(pattern=r'^[A-Za-z0-9][-A-Za-z0-9]*/[A-Za-z0-9._-]+$') + graph_name: constr(pattern=r'^[A-Za-z0-9._-]+$')pyproject.toml (1)
30-41
: Pin VCS dependency and note system prereqs.
- Pin
multilspy
to a commit SHA for reproducible and secure builds; branches/tags can move.pygit2
needs libgit2 on the host/container; document/install it in Docker/CI to avoid build failures.- Verify that both FastAPI and Flask are intentionally required (avoid unnecessary surface area).
Example change:
- "multilspy @ git+https://github.com/AviAvni/multilspy.git@python-init-params", + "multilspy @ git+https://github.com/AviAvni/multilspy.git@<commit-sha>",Consider adding setup notes (libgit2 version) in README/Dockerfile.
backend/app/agents/devrel/github/tools/repo_support.py (2)
31-33
: Remove unused exception variable.
e
isn’t used; keeplogger.exception
and drop the binding.- except Exception as e: + except Exception: logger.exception("Repository support error")
39-43
: Make repo extraction accept GitHub URLs and.git
suffix.Handle inputs like
https://github.com/org/repo
ororg/repo.git
, and strip trailing punctuation.-def _extract_repo_name(query: str) -> Optional[str]: - """Extract repository name from query (owner/repo format)""" - pattern = r'\b([a-zA-Z0-9][-a-zA-Z0-9]*)/([a-zA-Z0-9_.-]+)\b' - match = re.search(pattern, query) - return match.group(0) if match else None +def _extract_repo_name(query: str) -> Optional[str]: + """Extract repository name from free-form text. + Supports owner/repo, https://github.com/owner/repo, and optional .git.""" + pattern = re.compile( + r'(?:https?://github\.com/)?' # optional URL prefix + r'([A-Za-z0-9][-A-Za-z0-9]*)/' # owner + r'([A-Za-z0-9_.-]+?)' # repo + r'(?:\.git)?' # optional .git + r'(?:[^\w./-]|$)' # boundary (end or punctuation/space) + ) + m = pattern.search(query) + return f"{m.group(1)}/{m.group(2)}" if m else NoneOptional: expose a shared parse helper in RepoService (public) and reuse it here to avoid regex duplication.
backend/integrations/discord/cogs.py (1)
373-375
: Uselogger.exception
and explicit conversion flag.Align with Ruff hints and improve traceability.
- logger.error(f"List command error: {e}") - await interaction.followup.send(f"Error: {str(e)}") + logger.exception("List command error") + await interaction.followup.send(f"Error: {e!s}")backend/app/services/codegraph/repo_service.py (2)
42-45
: Consider extracting the error message to a constant.The error message is descriptive but defined inline, which static analysis flags (TRY003). While not critical, extracting it to a module-level constant would improve maintainability.
Example:
+INVALID_REPO_FORMAT_MSG = ( + "Invalid repository format: '{}'. " + "Expected: 'owner/repo' or 'https://github.com/owner/repo'" +) + def _parse_repo_url(self, repo_input: str) -> Dict[str, str]: """Parse repository URL or owner/repo format""" # ... existing code ... - raise ValueError( - f"Invalid repository format: '{repo_input}'. " - "Expected: 'owner/repo' or 'https://github.com/owner/repo'" - ) + raise ValueError(INVALID_REPO_FORMAT_MSG.format(repo_input))
62-76
: Clarify the re-indexing logic for failed repositories.The comment at line 76 states "If failed, we'll allow re-indexing" but the code implicitly handles this by falling through when status is neither
'completed'
nor'pending'
. While correct, explicitly checking for'failed'
status would make the intent clearer and more maintainable.Consider making the status check explicit:
if status == 'completed': return { "status": "error", "message": f"Repository already indexed. Graph: `{repo_data['graph_name']}`" } elif status == 'pending': return { "status": "error", "message": "Repository indexing in progress. Please wait." } - # If failed, we'll allow re-indexing by updating the existing record + elif status == 'failed': + # Allow re-indexing by updating the existing record + logger.info(f"Re-indexing previously failed repository: {repo_info['full_name']}")
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
poetry.lock
is excluded by!**/*.lock
📒 Files selected for processing (12)
backend/app/agents/devrel/github/github_toolkit.py
(2 hunks)backend/app/agents/devrel/github/prompts/intent_analysis.py
(2 hunks)backend/app/agents/devrel/github/tools/repo_support.py
(1 hunks)backend/app/database/falkor/code-graph-backend
(1 hunks)backend/app/database/supabase/scripts/create_db.sql
(1 hunks)backend/app/models/database/supabase.py
(1 hunks)backend/app/services/codegraph/__init__.py
(1 hunks)backend/app/services/codegraph/repo_service.py
(1 hunks)backend/docker-compose.yml
(2 hunks)backend/integrations/discord/cogs.py
(4 hunks)backend/main.py
(2 hunks)pyproject.toml
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
backend/app/services/codegraph/__init__.py (1)
backend/app/services/codegraph/repo_service.py (1)
RepoService
(12-285)
backend/app/models/database/supabase.py (1)
backend/app/models/database/weaviate.py (1)
Config
(66-129)
backend/app/agents/devrel/github/tools/repo_support.py (1)
backend/app/services/codegraph/repo_service.py (2)
RepoService
(12-285)query_repo
(157-237)
backend/app/services/codegraph/repo_service.py (1)
backend/app/database/supabase/client.py (1)
get_supabase_client
(9-13)
backend/app/agents/devrel/github/github_toolkit.py (1)
backend/app/agents/devrel/github/tools/repo_support.py (1)
handle_repo_support
(9-37)
backend/integrations/discord/cogs.py (1)
backend/app/services/codegraph/repo_service.py (4)
RepoService
(12-285)index_repo
(47-155)delete_repo
(239-272)list_repos
(274-285)
🪛 Ruff (0.13.3)
backend/app/agents/devrel/github/tools/repo_support.py
31-31: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
backend/app/services/codegraph/repo_service.py
42-45: Avoid specifying long messages outside the exception class
(TRY003)
151-151: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
153-153: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
233-233: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
235-235: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
268-268: Consider moving this statement to an else
block
(TRY300)
270-270: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
281-281: Consider moving this statement to an else
block
(TRY300)
backend/integrations/discord/cogs.py
373-373: Do not catch blind exception: Exception
(BLE001)
374-374: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
375-375: Use explicit conversion flag
Replace with conversion flag
(RUF010)
🔇 Additional comments (7)
backend/app/database/falkor/code-graph-backend (1)
1-1
: Submodule bump needs verification.This file only updates the FalkorDB submodule pointer, so I can’t review the underlying changes. Please double-check that commit 2d71c190f3720ab83dc9983022f3cf4d153da202 has been vetted and aligns with our expectations before merging.
backend/app/agents/devrel/github/github_toolkit.py (1)
14-14
: LGTM: repo_support path is correctly wired and awaited.Also applies to: 118-118
backend/app/services/codegraph/__init__.py (1)
1-3
: Public export looks good.backend/app/agents/devrel/github/prompts/intent_analysis.py (1)
1-56
: LGTM! Clear classification guidelines added.The updated prompt provides comprehensive guidance for distinguishing between
github_support
(repository metadata/stats) andrepo_support
(code structure queries), with concrete examples that reduce classification ambiguity. The structured guidelines will help improve intent detection accuracy.backend/app/services/codegraph/repo_service.py (2)
15-21
: Verify the 1-hour indexing timeout is intentional.The indexing timeout is set to 3600 seconds (1 hour). While this may be necessary for very large repositories, it could lead to resource exhaustion or hanging connections.
Consider adding:
- Progress monitoring or heartbeat mechanism for long-running indexing operations
- Documentation about expected indexing times for different repository sizes
- A maximum repository size limit if not already enforced by the backend
Is this timeout value based on observed requirements from large repositories?
274-285
: LGTM!The
list_repos
method correctly queries and returns user repositories, with appropriate error handling that returns an empty list on failure.backend/app/database/supabase/scripts/create_db.sql (1)
107-156
: LGTM! Well-designed schema for indexed repositories.The
indexed_repositories
table has:
- Appropriate fields for tracking repository indexing status
- Soft delete support via
is_deleted
flag- CHECK constraint for valid status values
- Proper unique partial indexes for active (non-deleted) records
- Additional indexes for common query patterns (discord_id, status, full_name, graph_name)
This design allows re-indexing previously deleted repositories while maintaining data integrity.
Working on the coderabbit's suggested changes... |
5716150
to
8e38834
Compare
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.
Actionable comments posted: 31
🧹 Nitpick comments (19)
backend/app/database/falkor/code-graph-backend/README.md (1)
13-16
: Wrap MD034 bare URL in Markdown linkMarkdownlint flagged the plain URL here. Wrap it in standard Markdown link syntax to satisfy MD034. (Based on static analysis hints)
backend/app/database/falkor/code-graph-backend/.github/workflows/python-app.yml (1)
23-25
: Consider upgrading toactions/setup-python@v5
.v5 is the current maintenance line and includes newer runner optimizations and bug fixes; staying on v3 could miss future improvements.
backend/app/database/falkor/code-graph-backend/api/git_utils/__init__.py (1)
1-1
: Consider explicit imports for better maintainability.Wildcard imports make it difficult to track the public API surface and reduce IDE/linter effectiveness. Explicit imports improve code clarity and refactoring safety.
If the intent is to re-export specific symbols, consider listing them explicitly:
-from .git_utils import * +from .git_utils import ( + # List specific functions/classes to export +)backend/app/database/falkor/code-graph-backend/api/code_coverage/__init__.py (1)
1-1
: Consider explicit imports for better maintainability.Wildcard imports reduce clarity about the package's public API and hinder IDE support. Explicit imports make the interface clearer and refactoring safer.
Consider listing specific exports:
-from .lcov import * +from .lcov import ( + # List specific functions/classes to export, e.g.: + # process_lcov, +)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_get_neighbors.py (2)
29-29
: Rename test function to match its behavior.The function is named
test_graph_entities
but it tests theget_neighbors
endpoint.-def test_graph_entities(client): +def test_get_neighbors(client):
63-64
: Tighten assertion bounds for more meaningful validation.The assertions
len(nodes) < 1000
andlen(edges) < 1000
are very loose and don't validate the correctness of the response structure or content. Consider asserting expected ranges based on the known structure of the GraphRAG-SDK repository.backend/app/database/falkor/code-graph-backend/pyproject.toml (1)
23-23
: Use tomli (and tomli-w) instead of toml for Python 3.10+
Thetoml
package is legacy; for Python 3.10 installtomli
(andtomli-w
if you need writing support), and for Python 3.11+ use stdlibtomllib
. Updatepyproject.toml
and imports accordingly.backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py (3)
4-4
: Remove unusedpathlib.Path
import.
Path
frompathlib
is imported but never used, and is immediately shadowed byPath
fromfalkordb
on line 7.Apply this diff to remove the unused import:
-from pathlib import Path
17-17
: Consider using environment variables for Redis connection.The Redis connection uses default values (localhost:6379 with no auth). For consistency with the FalkorDB connection configuration (lines 54-57), consider using environment variables to configure the Redis connection.
Apply this diff to align Redis connection configuration:
- redis.Redis().flushall() + redis.Redis( + host=os.getenv('REDIS_HOST', 'localhost'), + port=os.getenv('REDIS_PORT', 6379), + username=os.getenv('REDIS_USERNAME', None), + password=os.getenv('REDIS_PASSWORD', None) + ).flushall()
40-41
: Consider using a local test repository instead of cloning from GitHub.The test clones an external repository from GitHub, which introduces a network dependency and makes the test slow and brittle. For more reliable and faster tests, consider using a local fixture repository or mocking the Project.from_git_repository call.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_auto_complete.py (2)
14-14
: Consider using environment variables for Redis connection.The Redis connection uses default values. For consistency and configurability, consider using environment variables similar to other database connections in the codebase.
Apply this diff:
- redis.Redis().flushall() + redis.Redis( + host=os.getenv('REDIS_HOST', 'localhost'), + port=os.getenv('REDIS_PORT', 6379) + ).flushall()Also add the
os
import if not present:+import os import redis
37-39
: Consider using a local test repository and verify if git history processing is required.The test clones an external GitHub repository, introducing a network dependency. Additionally, line 39 calls
process_git_history()
, but the auto-complete functionality may only requireanalyze_sources()
. Verify if git history processing is necessary for this test.backend/app/database/falkor/code-graph-backend/tests/endpoints/test_graph_entities.py (2)
15-15
: Consider parameterizing Redis connection and extracting common fixtures.The Redis connection pattern is duplicated across multiple test files (test_find_paths.py, test_auto_complete.py, test_graph_entities.py). Consider:
- Using environment variables for Redis configuration
- Extracting common fixtures (app, client, runner) into a conftest.py file
38-39
: Consider using a local test repository.The test clones an external GitHub repository, introducing a network dependency and making tests slower and potentially flaky. Consider using a local fixture repository for faster, more reliable tests.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_commits.py (1)
16-16
: Consider using environment variables for Redis connection.For consistency with other database connections and better configurability, consider using environment variables for Redis host, port, and credentials.
backend/app/database/falkor/code-graph-backend/api/__init__.py (1)
1-9
: Consider using explicit imports instead of star imports.While star imports are convenient for consolidating a package's public API, they make it difficult to track which symbols are exported, can lead to namespace conflicts, and reduce IDE and static analysis effectiveness. Consider explicitly listing the symbols to export.
Example refactor pattern:
-from .info import * +from .info import ( + get_repo_info, + save_repo_info, + set_repo_commit, + # ... other exported symbols +)Alternatively, define
__all__
in each module to explicitly control what*
exports.backend/app/database/falkor/code-graph-backend/tests/endpoints/test_repo_info.py (2)
16-16
: Consider using environment variables for Redis connection.For consistency and configurability, consider using environment variables for Redis connection settings.
39-41
: Consider using a local test repository.The test clones an external GitHub repository, introducing a network dependency. Consider using a local fixture repository for more reliable tests.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_repos.py (1)
15-15
: Consider extracting common fixtures and parameterizing Redis connection.The fixture pattern (app, client, runner with Redis flush) is duplicated across multiple test files. Consider:
- Extracting common fixtures to
conftest.py
- Using environment variables for Redis configuration
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
backend/app/database/falkor/code-graph-backend/poetry.lock
is excluded by!**/*.lock
poetry.lock
is excluded by!**/*.lock
📒 Files selected for processing (57)
backend/app/agents/devrel/github/github_toolkit.py
(2 hunks)backend/app/agents/devrel/github/prompts/intent_analysis.py
(2 hunks)backend/app/agents/devrel/github/tools/repo_support.py
(1 hunks)backend/app/database/falkor/code-graph-backend/.env.template
(1 hunks)backend/app/database/falkor/code-graph-backend/.github/dependabot.yml
(1 hunks)backend/app/database/falkor/code-graph-backend/.github/workflows/python-app.yml
(1 hunks)backend/app/database/falkor/code-graph-backend/.github/workflows/release-image.yml
(1 hunks)backend/app/database/falkor/code-graph-backend/.gitignore
(1 hunks)backend/app/database/falkor/code-graph-backend/LICENSE
(1 hunks)backend/app/database/falkor/code-graph-backend/README.md
(1 hunks)backend/app/database/falkor/code-graph-backend/api/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/c/analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/auto_complete.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/code_coverage/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/entities/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/entities/entity.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/entities/file.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/git_utils/__init__.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/graph.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/index.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/info.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/llm.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/project.py
(1 hunks)backend/app/database/falkor/code-graph-backend/api/prompts.py
(1 hunks)backend/app/database/falkor/code-graph-backend/pyproject.toml
(1 hunks)backend/app/database/falkor/code-graph-backend/requirements.txt
(1 hunks)backend/app/database/falkor/code-graph-backend/static/index.html
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_auto_complete.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_get_neighbors.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_graph_entities.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_commits.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_repos.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_repo_info.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/index.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/source_files/c/src.c
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/source_files/py/src.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/test_c_analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/test_git_history.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/test_graph_ops.py
(1 hunks)backend/app/database/falkor/code-graph-backend/tests/test_py_analyzer.py
(1 hunks)backend/app/database/falkor/code-graph-backend/vercel.json
(1 hunks)backend/app/services/codegraph/__init__.py
(1 hunks)backend/app/services/codegraph/repo_service.py
(1 hunks)backend/integrations/discord/cogs.py
(4 hunks)backend/main.py
(2 hunks)pyproject.toml
(2 hunks)
✅ Files skipped from review due to trivial changes (4)
- backend/app/database/falkor/code-graph-backend/LICENSE
- backend/app/database/falkor/code-graph-backend/.gitignore
- backend/main.py
- backend/app/database/falkor/code-graph-backend/api/analyzers/c/analyzer.py
🚧 Files skipped from review as they are similar to previous changes (1)
- backend/app/agents/devrel/github/github_toolkit.py
🧰 Additional context used
🧬 Code graph analysis (34)
backend/app/database/falkor/code-graph-backend/api/analyzers/__init__.py (1)
backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (1)
SourceAnalyzer
(33-209)
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/__init__.py (1)
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py (1)
process_lcov
(127-213)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py (2)
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
create_app
(35-446)backend/app/database/falkor/code-graph-backend/api/project.py (3)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)
backend/app/database/falkor/code-graph-backend/api/info.py (2)
backend/app/database/falkor/code-graph-backend/api/index.py (1)
repo_info
(207-248)backend/app/database/falkor/code-graph-backend/tests/index.py (1)
repo_info
(201-242)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_commits.py (2)
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
create_app
(35-446)backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_local_repository
(64-78)analyze_sources
(80-95)process_git_history
(97-113)
backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
backend/app/database/falkor/code-graph-backend/api/entities/entity.py (1)
Entity
(5-31)
backend/app/database/falkor/code-graph-backend/tests/test_c_analyzer.py (5)
backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (2)
SourceAnalyzer
(33-209)analyze_local_folder
(173-187)backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)backend/app/database/falkor/code-graph-backend/api/graph.py (6)
Graph
(34-627)get_file
(428-466)get_struct_by_name
(517-524)get_function_by_name
(315-322)function_calls
(372-380)function_called_by
(382-390)backend/app/database/falkor/code-graph-backend/tests/test_py_analyzer.py (1)
test_analyzer
(8-60)backend/app/database/falkor/code-graph-backend/tests/source_files/c/src.c (2)
add
(1-8)main
(16-19)
backend/app/database/falkor/code-graph-backend/tests/test_py_analyzer.py (3)
backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)backend/app/database/falkor/code-graph-backend/api/graph.py (4)
get_file
(428-466)get_function_by_name
(315-322)function_calls
(372-380)function_called_by
(382-390)backend/app/database/falkor/code-graph-backend/tests/source_files/py/src.py (2)
log
(3-4)abort
(12-14)
backend/app/database/falkor/code-graph-backend/api/entities/__init__.py (3)
backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)backend/app/database/falkor/code-graph-backend/api/entities/entity.py (1)
Entity
(5-31)backend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py (4)
encode_node
(3-5)encode_edge
(7-8)encode_path
(10-14)encode_graph_entity
(16-24)
backend/app/database/falkor/code-graph-backend/api/llm.py (2)
backend/app/database/falkor/code-graph-backend/api/graph.py (1)
add_entity
(243-267)backend/app/database/falkor/code-graph-backend/api/index.py (1)
chat
(307-328)
backend/app/services/codegraph/__init__.py (1)
backend/app/services/codegraph/repo_service.py (1)
RepoService
(12-292)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_repo_info.py (2)
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
create_app
(35-446)backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)process_git_history
(97-113)
backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py (4)
backend/app/database/falkor/code-graph-backend/api/entities/entity.py (1)
Entity
(5-31)backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py (7)
add_dependencies
(22-38)get_entity_label
(40-51)get_entity_name
(53-56)get_entity_docstring
(58-63)get_entity_types
(65-66)add_symbols
(68-98)resolve_symbol
(128-134)backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (7)
add_dependencies
(21-44)get_entity_label
(46-51)get_entity_name
(53-56)get_entity_docstring
(58-65)get_entity_types
(67-68)add_symbols
(70-92)resolve_symbol
(124-130)
backend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
backend/app/database/falkor/code-graph-backend/api/graph.py (2)
Graph
(34-627)prefix_search
(324-357)
backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (4)
backend/app/database/falkor/code-graph-backend/api/graph.py (8)
Graph
(34-627)clone
(64-83)enable_backlog
(92-98)delete_files
(408-426)clear_backlog
(108-135)disable_backlog
(100-106)delete
(86-90)rerun_query
(539-544)backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (9)
GitGraph
(11-177)add_commit
(45-57)connect_commits
(99-113)set_parent_transition
(116-127)get_child_commit
(87-97)set_child_transition
(130-141)get_commits
(69-85)get_parent_transitions
(144-159)get_child_transitions
(162-177)backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (2)
supported_types
(37-40)analyze_files
(161-163)backend/app/database/falkor/code-graph-backend/api/info.py (2)
get_repo_commit
(48-66)set_repo_commit
(32-45)
backend/integrations/discord/cogs.py (1)
backend/app/services/codegraph/repo_service.py (3)
RepoService
(12-292)index_repo
(47-155)delete_repo
(239-279)
backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py (3)
backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py (11)
add_dependencies
(57-66)get_entity_label
(69-79)get_entity_name
(82-92)get_entity_docstring
(95-105)get_entity_types
(108-116)add_symbols
(119-127)is_dependency
(21-32)resolve_path
(35-47)resolve
(49-54)find_parent
(15-18)resolve_symbol
(130-144)backend/app/database/falkor/code-graph-backend/api/entities/entity.py (2)
Entity
(5-31)add_symbol
(12-15)backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)
backend/app/database/falkor/code-graph-backend/tests/test_graph_ops.py (2)
backend/app/database/falkor/code-graph-backend/api/graph.py (5)
get_function
(360-370)add_file
(392-406)get_file
(428-466)connect_entities
(482-497)function_calls_function
(499-515)backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py (1)
backend/app/database/falkor/code-graph-backend/api/graph.py (4)
Graph
(34-627)set_file_coverage
(470-480)get_functions_in_file
(307-313)set_functions_metadata
(291-304)
backend/app/database/falkor/code-graph-backend/api/index.py (8)
backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (3)
SourceAnalyzer
(33-209)analyze_local_folder
(173-187)analyze_sources
(165-171)backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (2)
GitGraph
(11-177)list_commits
(59-67)backend/app/database/falkor/code-graph-backend/api/graph.py (6)
Graph
(34-627)prefix_search
(324-357)get_sub_graph
(173-194)get_neighbors
(197-241)stats
(592-609)find_paths
(546-590)backend/app/database/falkor/code-graph-backend/api/info.py (1)
get_repo_info
(90-119)backend/app/database/falkor/code-graph-backend/api/llm.py (1)
ask
(261-269)backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)process_git_history
(97-113)backend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
prefix_search
(3-6)backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (2)
switch_commit
(260-333)GitRepoName
(17-19)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_repos.py (2)
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
create_app
(35-446)backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_local_repository
(64-78)analyze_sources
(80-95)process_git_history
(97-113)
backend/app/database/falkor/code-graph-backend/tests/test_git_history.py (4)
backend/app/database/falkor/code-graph-backend/api/graph.py (2)
Graph
(34-627)get_file
(428-466)backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_local_repository
(64-78)analyze_sources
(80-95)process_git_history
(97-113)backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (1)
switch_commit
(260-333)backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (1)
get_commits
(69-85)
backend/app/database/falkor/code-graph-backend/api/__init__.py (4)
backend/app/database/falkor/code-graph-backend/api/llm.py (1)
ask
(261-269)backend/app/database/falkor/code-graph-backend/api/index.py (1)
auto_complete
(148-182)backend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
prefix_search
(3-6)backend/app/database/falkor/code-graph-backend/api/graph.py (1)
prefix_search
(324-357)
backend/app/database/falkor/code-graph-backend/tests/index.py (7)
backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)process_git_history
(97-113)backend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
prefix_search
(3-6)backend/app/database/falkor/code-graph-backend/api/graph.py (8)
prefix_search
(324-357)graph_exists
(12-18)Graph
(34-627)get_sub_graph
(173-194)get_neighbors
(197-241)get_repos
(20-32)stats
(592-609)find_paths
(546-590)backend/app/database/falkor/code-graph-backend/api/info.py (1)
get_repo_info
(90-119)backend/app/database/falkor/code-graph-backend/api/llm.py (1)
ask
(261-269)backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (3)
SourceAnalyzer
(33-209)analyze_local_folder
(173-187)analyze_sources
(165-171)backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (1)
switch_commit
(260-333)
backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (1)
backend/app/database/falkor/code-graph-backend/api/index.py (1)
list_commits
(456-489)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_graph_entities.py (3)
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
create_app
(35-446)backend/app/database/falkor/code-graph-backend/api/project.py (3)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)backend/app/database/falkor/code-graph-backend/tests/endpoints/test_get_neighbors.py (3)
app
(8-19)client
(22-23)test_graph_entities
(29-64)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_auto_complete.py (1)
backend/app/database/falkor/code-graph-backend/api/project.py (4)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)process_git_history
(97-113)
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (3)
backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py (12)
AbstractAnalyzer
(10-144)add_dependencies
(57-66)get_entity_label
(69-79)get_entity_name
(82-92)get_entity_docstring
(95-105)get_entity_types
(108-116)add_symbols
(119-127)is_dependency
(21-32)resolve_path
(35-47)resolve
(49-54)find_parent
(15-18)resolve_symbol
(130-144)backend/app/database/falkor/code-graph-backend/api/entities/entity.py (2)
Entity
(5-31)add_symbol
(12-15)backend/app/database/falkor/code-graph-backend/api/entities/file.py (1)
File
(7-36)
backend/app/agents/devrel/github/tools/repo_support.py (1)
backend/app/services/codegraph/repo_service.py (1)
query_repo
(157-237)
backend/app/services/codegraph/repo_service.py (1)
backend/app/database/supabase/client.py (1)
get_supabase_client
(9-13)
backend/app/database/falkor/code-graph-backend/api/project.py (5)
backend/app/database/falkor/code-graph-backend/api/graph.py (1)
Graph
(34-627)backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (3)
SourceAnalyzer
(33-209)analyze_sources
(165-171)analyze_local_folder
(173-187)backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (1)
build_commit_graph
(73-258)backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (1)
GitGraph
(11-177)backend/app/database/falkor/code-graph-backend/api/info.py (2)
save_repo_info
(69-88)set_repo_commit
(32-45)
backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (7)
backend/app/database/falkor/code-graph-backend/api/entities/entity.py (3)
Entity
(5-31)add_child
(22-24)resolved_symbol
(26-31)backend/app/database/falkor/code-graph-backend/api/entities/file.py (2)
File
(7-36)add_entity
(25-27)backend/app/database/falkor/code-graph-backend/api/graph.py (4)
Graph
(34-627)add_entity
(243-267)connect_entities
(482-497)add_file
(392-406)backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py (9)
AbstractAnalyzer
(10-144)get_entity_types
(108-116)get_entity_label
(69-79)get_entity_name
(82-92)get_entity_docstring
(95-105)is_dependency
(21-32)add_symbols
(119-127)add_dependencies
(57-66)resolve_symbol
(130-144)backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py (8)
get_entity_types
(65-66)get_entity_label
(40-51)get_entity_name
(53-56)get_entity_docstring
(58-63)is_dependency
(100-101)add_symbols
(68-98)add_dependencies
(22-38)resolve_symbol
(128-134)backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (8)
get_entity_types
(67-68)get_entity_label
(46-51)get_entity_name
(53-56)get_entity_docstring
(58-65)is_dependency
(94-95)add_symbols
(70-92)add_dependencies
(21-44)resolve_symbol
(124-130)backend/app/database/falkor/code-graph-backend/api/project.py (1)
analyze_sources
(80-95)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_get_neighbors.py (1)
backend/app/database/falkor/code-graph-backend/api/project.py (3)
Project
(40-113)from_git_repository
(51-61)analyze_sources
(80-95)
backend/app/database/falkor/code-graph-backend/api/graph.py (3)
backend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py (2)
encode_node
(3-5)encode_edge
(7-8)backend/app/database/falkor/code-graph-backend/api/entities/file.py (2)
add_entity
(25-27)File
(7-36)backend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
prefix_search
(3-6)
🪛 ast-grep (0.39.5)
backend/app/database/falkor/code-graph-backend/tests/index.py
[warning] 449-449: Detected Flask app with debug=True. Do not deploy to production with this flag enabled as it will leak sensitive information. Instead, consider using Flask configuration variables or setting 'debug' using system environment variables.
Context: app.run(debug=True)
Note: [CWE-489] Active Debug Code. [REFERENCES]
- https://labs.detectify.com/2015/10/02/how-patreon-got-hacked-publicly-exposed-werkzeug-debugger/
(debug-enabled-python)
🪛 dotenv-linter (3.3.0)
backend/app/database/falkor/code-graph-backend/.env.template
[warning] 4-4: [UnorderedKey] The FALKORDB_PASSWORD key should go before the FALKORDB_PORT key
(UnorderedKey)
[warning] 6-6: [UnorderedKey] The GEMINI_API_KEY key should go before the OPENAI_API_KEY key
(UnorderedKey)
🪛 Gitleaks (8.28.0)
backend/app/database/falkor/code-graph-backend/README.md
[high] 35-41: Discovered a potential authorization token provided in a curl command header, which could compromise the curl accessed resource.
(curl-auth-header)
🪛 markdownlint-cli2 (0.18.1)
backend/app/database/falkor/code-graph-backend/README.md
13-13: Bare URL used
(MD034, no-bare-urls)
🪛 Ruff (0.13.3)
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py
7-7: Redefinition of unused Path
from line 4
(F811)
backend/app/database/falkor/code-graph-backend/api/code_coverage/__init__.py
1-1: from .lcov import *
used; unable to detect undefined names
(F403)
backend/app/database/falkor/code-graph-backend/api/info.py
28-28: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
44-44: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
62-62: Consider moving this statement to an else
block
(TRY300)
65-65: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
87-87: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
115-115: Consider moving this statement to an else
block
(TRY300)
118-118: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
backend/app/database/falkor/code-graph-backend/api/git_utils/__init__.py
1-1: from .git_utils import *
used; unable to detect undefined names
(F403)
backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py
53-53: Do not catch blind exception: Exception
(BLE001)
53-53: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
backend/app/database/falkor/code-graph-backend/tests/source_files/py/src.py
12-12: Unused method argument: delay
(ARG002)
backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py
5-5: from ..info import *
used; unable to detect undefined names
(F403)
275-275: Avoid specifying long messages outside the exception class
(TRY003)
278-278: Avoid specifying long messages outside the exception class
(TRY003)
287-287: get_repo_commit
may be undefined, or defined from star imports
(F405)
301-301: Avoid specifying long messages outside the exception class
(TRY003)
323-323: zip()
without an explicit strict=
parameter
Add explicit value for parameter strict=
(B905)
324-324: zip()
without an explicit strict=
parameter
Add explicit value for parameter strict=
(B905)
332-332: set_repo_commit
may be undefined, or defined from star imports
(F405)
backend/integrations/discord/cogs.py
290-290: Store a reference to the return value of asyncio.create_task
(RUF006)
387-387: Do not catch blind exception: Exception
(BLE001)
388-388: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
389-389: Use explicit conversion flag
Replace with conversion flag
(RUF010)
backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py
4-4: from ...entities import *
used; unable to detect undefined names
(F403)
25-25: subprocess
call: check for execution of untrusted input
(S603)
25-25: Starting a process with a partial executable path
(S607)
26-26: Using xml
to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml
equivalents
(S314)
36-36: subprocess
call: check for execution of untrusted input
(S603)
36-36: Starting a process with a partial executable path
(S607)
37-37: subprocess
call: check for execution of untrusted input
(S603)
37-37: Starting a process with a partial executable path
(S607)
51-51: Avoid specifying long messages outside the exception class
(TRY003)
56-56: Avoid specifying long messages outside the exception class
(TRY003)
63-63: Avoid specifying long messages outside the exception class
(TRY003)
68-68: Entity
may be undefined, or defined from star imports
(F405)
110-110: File
may be undefined, or defined from star imports
(F405)
110-110: Entity
may be undefined, or defined from star imports
(F405)
118-118: File
may be undefined, or defined from star imports
(F405)
118-118: Entity
may be undefined, or defined from star imports
(F405)
128-128: File
may be undefined, or defined from star imports
(F405)
128-128: Entity
may be undefined, or defined from star imports
(F405)
134-134: Avoid specifying long messages outside the exception class
(TRY003)
backend/app/database/falkor/code-graph-backend/tests/test_graph_ops.py
4-4: from api import *
used; unable to detect undefined names
(F403)
11-11: Graph
may be undefined, or defined from star imports
(F405)
15-15: Function
may be undefined, or defined from star imports
(F405)
23-23: File
may be undefined, or defined from star imports
(F405)
29-29: File
may be undefined, or defined from star imports
(F405)
30-30: Function
may be undefined, or defined from star imports
(F405)
46-46: Function
may be undefined, or defined from star imports
(F405)
47-47: Function
may be undefined, or defined from star imports
(F405)
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py
24-24: Ambiguous variable name: l
(E741)
44-44: Ambiguous variable name: l
(E741)
49-49: Ambiguous variable name: l
(E741)
backend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py
24-24: Prefer TypeError
exception for invalid type
(TRY004)
24-24: Create your own exception
(TRY002)
24-24: Avoid specifying long messages outside the exception class
(TRY003)
backend/app/database/falkor/code-graph-backend/api/index.py
92-92: Do not catch blind exception: Exception
(BLE001)
93-93: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
475-475: f-string without any placeholders
Remove extraneous f
prefix
(F541)
backend/app/database/falkor/code-graph-backend/api/__init__.py
1-1: from .info import *
used; unable to detect undefined names
(F403)
3-3: from .graph import *
used; unable to detect undefined names
(F403)
4-4: from .project import *
used; unable to detect undefined names
(F403)
5-5: from .entities import *
used; unable to detect undefined names
(F403)
6-6: from .git_utils import *
used; unable to detect undefined names
(F403)
7-7: from .code_coverage import *
used; unable to detect undefined names
(F403)
8-8: from .analyzers.source_analyzer import *
used; unable to detect undefined names
(F403)
backend/app/database/falkor/code-graph-backend/tests/index.py
2-2: from api import *
used; unable to detect undefined names
(F403)
67-67: graph_exists
may be undefined, or defined from star imports
(F405)
73-73: Graph
may be undefined, or defined from star imports
(F405)
86-86: Do not catch blind exception: Exception
(BLE001)
87-87: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
120-120: graph_exists
may be undefined, or defined from star imports
(F405)
125-125: Graph
may be undefined, or defined from star imports
(F405)
156-156: f-string without any placeholders
Remove extraneous f
prefix
(F541)
161-161: f-string without any placeholders
Remove extraneous f
prefix
(F541)
164-164: graph_exists
may be undefined, or defined from star imports
(F405)
189-189: get_repos
may be undefined, or defined from star imports
(F405)
222-222: f-string without any placeholders
Remove extraneous f
prefix
(F541)
225-225: Graph
may be undefined, or defined from star imports
(F405)
229-229: get_repo_info
may be undefined, or defined from star imports
(F405)
268-268: f-string without any placeholders
Remove extraneous f
prefix
(F541)
273-273: f-string without any placeholders
Remove extraneous f
prefix
(F541)
280-280: f-string without any placeholders
Remove extraneous f
prefix
(F541)
284-284: graph_exists
may be undefined, or defined from star imports
(F405)
289-289: Graph
may be undefined, or defined from star imports
(F405)
308-308: f-string without any placeholders
Remove extraneous f
prefix
(F541)
313-313: f-string without any placeholders
Remove extraneous f
prefix
(F541)
315-315: ask
may be undefined, or defined from star imports
(F405)
362-362: Graph
may be undefined, or defined from star imports
(F405)
365-365: SourceAnalyzer
may be undefined, or defined from star imports
(F405)
395-395: f-string without any placeholders
Remove extraneous f
prefix
(F541)
428-428: f-string without any placeholders
Remove extraneous f
prefix
(F541)
433-433: f-string without any placeholders
Remove extraneous f
prefix
(F541)
backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py
32-33: try
-except
-pass
detected, consider logging the exception
(S110)
32-32: Do not catch blind exception: Exception
(BLE001)
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py
7-7: from ...entities import *
used; unable to detect undefined names
(F403)
24-24: Starting a process with a partial executable path
(S607)
26-26: Starting a process with a partial executable path
(S607)
28-28: Starting a process with a partial executable path
(S607)
35-35: Do not catch blind exception: Exception
(BLE001)
36-36: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
39-39: Starting a process with a partial executable path
(S607)
51-51: Avoid specifying long messages outside the exception class
(TRY003)
56-56: Avoid specifying long messages outside the exception class
(TRY003)
65-65: Avoid specifying long messages outside the exception class
(TRY003)
70-70: Entity
may be undefined, or defined from star imports
(F405)
97-97: Unused method argument: path
(ARG002)
100-100: File
may be undefined, or defined from star imports
(F405)
100-100: Entity
may be undefined, or defined from star imports
(F405)
110-110: File
may be undefined, or defined from star imports
(F405)
110-110: Entity
may be undefined, or defined from star imports
(F405)
124-124: File
may be undefined, or defined from star imports
(F405)
124-124: Entity
may be undefined, or defined from star imports
(F405)
130-130: Avoid specifying long messages outside the exception class
(TRY003)
backend/app/agents/devrel/github/tools/repo_support.py
31-31: Local variable e
is assigned to but never used
Remove assignment to unused variable e
(F841)
backend/app/services/codegraph/repo_service.py
42-45: Avoid specifying long messages outside the exception class
(TRY003)
151-151: Redundant exception object included in logging.exception
call
(TRY401)
233-233: Redundant exception object included in logging.exception
call
(TRY401)
275-275: Consider moving this statement to an else
block
(TRY300)
288-288: Consider moving this statement to an else
block
(TRY300)
backend/app/database/falkor/code-graph-backend/api/project.py
7-7: from .info import *
used; unable to detect undefined names
(F403)
36-36: Local variable result
is assigned to but never used
Remove assignment to unused variable result
(F841)
36-36: subprocess
call: check for execution of untrusted input
(S603)
48-48: save_repo_info
may be undefined, or defined from star imports
(F405)
54-54: Create your own exception
(TRY002)
54-54: Avoid specifying long messages outside the exception class
(TRY003)
69-69: Create your own exception
(TRY002)
69-69: Avoid specifying long messages outside the exception class
(TRY003)
90-90: set_repo_commit
may be undefined, or defined from star imports
(F405)
91-93: try
-except
-pass
detected, consider logging the exception
(S110)
91-91: Do not catch blind exception: Exception
(BLE001)
97-97: Do not use mutable data structures for argument defaults
Replace with None
; initialize within function
(B006)
backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py
145-145: Function definition does not bind loop variable file_path
(B023)
145-145: Function definition does not bind loop variable file_path
(B023)
145-145: Function definition does not bind loop variable file_path
(B023)
173-173: Do not use mutable data structures for argument defaults
Replace with None
; initialize within function
(B006)
backend/app/database/falkor/code-graph-backend/api/graph.py
3-3: from .entities import *
used; unable to detect undefined names
(F403)
55-56: try
-except
-pass
detected, consider logging the exception
(S110)
55-55: Do not catch blind exception: Exception
(BLE001)
61-62: try
-except
-pass
detected, consider logging the exception
(S110)
61-61: Do not catch blind exception: Exception
(BLE001)
74-74: Create your own exception
(TRY002)
74-74: Avoid specifying long messages outside the exception class
(TRY003)
173-173: Ambiguous variable name: l
(E741)
188-188: encode_node
may be undefined, or defined from star imports
(F405)
191-191: encode_edge
may be undefined, or defined from star imports
(F405)
192-192: encode_node
may be undefined, or defined from star imports
(F405)
212-212: Avoid specifying long messages outside the exception class
(TRY003)
234-234: encode_node
may be undefined, or defined from star imports
(F405)
235-235: encode_edge
may be undefined, or defined from star imports
(F405)
237-237: Consider moving this statement to an else
block
(TRY300)
239-239: Do not catch blind exception: Exception
(BLE001)
240-240: Use logging.exception
instead of logging.error
Replace with exception
(TRY400)
355-355: encode_node
may be undefined, or defined from star imports
(F405)
392-392: File
may be undefined, or defined from star imports
(F405)
428-428: File
may be undefined, or defined from star imports
(F405)
462-462: File
may be undefined, or defined from star imports
(F405)
480-480: Local variable res
is assigned to but never used
Remove assignment to unused variable res
(F841)
582-582: zip()
without an explicit strict=
parameter
Add explicit value for parameter strict=
(B905)
583-583: encode_node
may be undefined, or defined from star imports
(F405)
584-584: encode_edge
may be undefined, or defined from star imports
(F405)
587-587: encode_node
may be undefined, or defined from star imports
(F405)
625-625: encode_node
may be undefined, or defined from star imports
(F405)
🔇 Additional comments (12)
backend/app/database/falkor/code-graph-backend/.env.template (1)
1-8
: LGTM!The template clearly documents required environment variables with placeholder syntax. The ordering warnings from dotenv-linter are pedantic and don't affect functionality for template files.
backend/app/database/falkor/code-graph-backend/api/analyzers/__init__.py (1)
1-1
: LGTM!Explicit import clearly defines the public API surface. Good practice.
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/__init__.py (1)
1-1
: LGTM!Explicit import clearly defines the package's public API. Well done.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py (1)
76-80
: LGTM!The path validation logic correctly verifies that paths start at
src_id
, end atdest_id
, have odd length (alternating nodes/edges), and meet the minimum length constraint.backend/app/database/falkor/code-graph-backend/tests/endpoints/test_auto_complete.py (1)
49-50
: LGTM!The completion validation correctly checks that each result's name starts with the requested prefix.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_graph_entities.py (1)
49-50
: LGTM!The bounds validation (10 < count < 1000) provides reasonable sanity checks for the graph entities without being overly specific or brittle.
backend/app/database/falkor/code-graph-backend/tests/source_files/py/src.py (1)
1-14
: LGTM!This test fixture file provides sample Python code for analyzer testing. The unused
delay
parameter on line 12 may be intentional to test the analyzer's ability to detect method signatures and parameters.backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_commits.py (2)
40-47
: LGTM!Good use of a local test repository instead of cloning from GitHub, which makes the test faster and more reliable.
54-59
: Verify test data stability.The test uses hardcoded commit hashes, timestamps, and messages. Ensure the
git_repo
test fixture remains stable and is version-controlled. Any changes to the test repository will break these assertions.Consider documenting the test repository's expected state or including validation that the repository hasn't changed unexpectedly.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_repo_info.py (1)
48-52
: LGTM!The validation correctly checks for required fields (edge_count, node_count, repo_url) in the response.
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_list_repos.py (1)
40-46
: LGTM!Good use of a local test repository instead of cloning from GitHub, improving test speed and reliability.
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (1)
33-37
: Dependency globbing never finds any files
pyproject_data.get("tool").get("poetry").get("dependencies")
yields dependency names, but in the requirements.txt branch eachrequirement
is a two-element list (name + version). Using that list inside the f-string produces paths like"['requests', '2.32.3']"
which will never match any site-packages directory, so none of the dependencies are added. Please extract the package name before building the glob.Apply this diff:
- for requirement in requirements: - files.extend(Path(f"{path}/venv/lib/").rglob(f"**/site-packages/{requirement}/*.py")) + for requirement in requirements: + package = requirement[0] + files.extend(Path(f"{path}/venv/lib").rglob(f"**/site-packages/{package}/*.py"))Likely an incorrect or invalid review comment.
backend/app/database/falkor/code-graph-backend/.github/workflows/release-image.yml
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/api/analyzers/analyzer.py
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_repo_info.py
Show resolved
Hide resolved
backend/app/database/falkor/code-graph-backend/tests/test_py_analyzer.py
Show resolved
Hide resolved
@coderabbitai Please ignore all issues and suggestions for backend/app/database/falkor/code-graph-backend/. Please mark them as resolved or remove them if possible. |
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed:
Length of output: 558 🏁 Script executed:
Length of output: 263 🏁 Script executed:
Length of output: 186 @smokeyScraper, I checked for review comments in the However, since you've vendored FalkorDB's code-graph-backend into your repository and want to exclude it from future reviews, I recommend configuring path filters in your CodeRabbit configuration. This is the proper way to exclude directories from automated reviews. How to Configure Path FiltersYou can add a reviews:
path_filters:
- "!backend/app/database/falkor/code-graph-backend/**" The Additional Configuration OptionsIf you want more granular control, you can also: reviews:
path_filters:
# Exclude vendored code
- "!backend/app/database/falkor/code-graph-backend/**"
# Or exclude multiple patterns
- "!**/vendor/**"
- "!**/third_party/**" For more details on configuration options, you can refer to:
This approach ensures that the vendored FalkorDB code won't be reviewed in this or future PRs, which is cleaner than adding learnings or trying to resolve individual comments. |
facing this error when using the original code-graph backend repo (error cuz of some expected format issue in poetry). I'll check with their codebase a bit more in depth and will see if the error's really a problem (Will raise an issue.) Meantime, could you please review this @chandansgowda ? Thanks a lot! |
8e38834
to
b7fbdbf
Compare
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.
Actionable comments posted: 17
♻️ Duplicate comments (23)
backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (2)
87-97
: Allow multiple children; remove assertion and return a list.Merges yield multiple children. Current assert can raise on real graphs. Return all children and adjust annotation.
- def get_child_commit(self, parent) -> Optional[dict]: + def get_child_commit(self, parent: str) -> list[dict]: @@ - if len(res) > 0: - assert(len(res) == 1) - return self._commit_from_node(res[0][0]) - - return None + if not res: + return [] + return [self._commit_from_node(row[0]) for row in res]To find and audit call sites assuming a single child, run:
#!/bin/bash rg -n -C2 --type=py '\bget_child_commit\s*\('
144-177
: Guard empty results and fix invalid type annotations.
res[0]
access raises when no path exists; return empty lists.List[tuple[str: dict]]
is invalid typing (colon). Use a tuple of lists.- def get_parent_transitions(self, child: str, parent: str) -> List[tuple[str: dict]]: + def get_parent_transitions(self, child: str, parent: str) -> tuple[list, list]: @@ - res = self.g.query(q, {'child_hash': child, 'parent_hash': parent}).result_set - - return (res[0][0], res[0][1]) + res = self.g.query(q, {'child_hash': child, 'parent_hash': parent}).result_set + if not res: + return ([], []) + return (res[0][0], res[0][1]) @@ - def get_child_transitions(self, child: str, parent: str) -> List[tuple[str: dict]]: + def get_child_transitions(self, child: str, parent: str) -> tuple[list, list]: @@ - res = self.g.query(q, {'child_hash': child, 'parent_hash': parent}).result_set - - return (res[0][0], res[0][1]) + res = self.g.query(q, {'child_hash': child, 'parent_hash': parent}).result_set + if not res: + return ([], []) + return (res[0][0], res[0][1])backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py (2)
58-63
: Guardprev_sibling
before accessing.type
.Prevents AttributeError when no preceding comment exists.
- if node.type in ['class_declaration', 'interface_declaration', 'enum_declaration', 'method_declaration', 'constructor_declaration']: - if node.prev_sibling.type == "block_comment": - return node.prev_sibling.text.decode('utf-8') + if node.type in ['class_declaration', 'interface_declaration', 'enum_declaration', 'method_declaration', 'constructor_declaration']: + prev = node.prev_sibling + if prev is not None and prev.type == "block_comment": + return prev.text.decode('utf-8') return None
22-38
: Harden dependency loading: guard missing pom.xml, validate fields, and check subprocesses.
- Skip when
pom.xml
is absent.- Guard
groupId/artifactId/version
None cases.- Use
check=True
and quiet unzip (-o
) to fail fast and avoid prompts.def add_dependencies(self, path: Path, files: list[Path]): @@ - subprocess.run(["rm", "-rf", f"{path}/temp_deps"]) - pom = ElementTree.parse(str(path) + '/pom.xml') + subprocess.run(["rm", "-rf", f"{path}/temp_deps"], check=False) + pom_path = Path(path) / "pom.xml" + if not pom_path.is_file(): + logger.info("No pom.xml found at %s; skipping Java deps", pom_path) + return + pom = ElementTree.parse(str(pom_path)) for dependency in pom.findall('.//{http://maven.apache.org/POM/4.0.0}dependency'): - groupId = dependency.find('{http://maven.apache.org/POM/4.0.0}groupId').text.replace('.', '/') - artifactId = dependency.find('{http://maven.apache.org/POM/4.0.0}artifactId').text - version = dependency.find('{http://maven.apache.org/POM/4.0.0}version').text + g = dependency.find('{http://maven.apache.org/POM/4.0.0}groupId') + a = dependency.find('{http://maven.apache.org/POM/4.0.0}artifactId') + v = dependency.find('{http://maven.apache.org/POM/4.0.0}version') + if g is None or a is None or v is None or not g.text or not a.text or not v.text: + continue + groupId = g.text.replace('.', '/') + artifactId = a.text + version = v.text @@ - subprocess.run(["cp", jar_path, f"{artifactId}-{version}.jar"], cwd=f"{path}/temp_deps/{artifactId}-{version}") - subprocess.run(["unzip", f"{artifactId}-{version}.jar"], cwd=f"{path}/temp_deps/{artifactId}-{version}") + subprocess.run(["cp", jar_path, f"{artifactId}-{version}.jar"], cwd=f"{path}/temp_deps/{artifactId}-{version}", check=True) + subprocess.run(["unzip", "-o", f"{artifactId}-{version}.jar"], cwd=f"{path}/temp_deps/{artifactId}-{version}", check=True)backend/app/database/falkor/code-graph-backend/README.md (1)
35-42
: Use a placeholder token in the exampleStatic analysis flagged "OpenSesame" as a potential secret. Replace it with a clearly fake placeholder like
<YOUR_AUTH_TOKEN>
or<SECRET_TOKEN>
to avoid encouraging real tokens in docs.Apply this diff:
-curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "<FULL_PATH_TO_FOLDER>", "ignore": [<OPTIONAL_IGNORE_LIST>]}' -H "Authorization: <.ENV_SECRET_TOKEN>" +curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "<FULL_PATH_TO_FOLDER>", "ignore": [<OPTIONAL_IGNORE_LIST>]}' -H "Authorization: <YOUR_SECRET_TOKEN>"-curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "/Users/roilipman/Dev/GraphRAG-SDK", "ignore": ["./.github", "./build"]}' -H "Authorization: OpenSesame" +curl -X POST http://127.0.0.1:5000/analyze_folder -H "Content-Type: application/json" -d '{"path": "/Users/roilipman/Dev/GraphRAG-SDK", "ignore": ["./.github", "./build"]}' -H "Authorization: <YOUR_SECRET_TOKEN>"backend/app/database/falkor/code-graph-backend/tests/endpoints/test_get_neighbors.py (2)
15-15
: Add environment-based Redis configuration.
redis.Redis()
uses default localhost:6379 without considering test environment configuration, which could fail in CI/CD or different deployment environments.Apply this diff to use environment variables:
- redis.Redis().flushall() + import os + redis_client = redis.Redis( + host=os.getenv('REDIS_HOST', 'localhost'), + port=int(os.getenv('REDIS_PORT', 6379)) + ) + redis_client.flushall()
29-64
: Critical: HTTP method mismatch with endpoint.The test uses GET requests (lines 31, 42, 47, 56), but the
/get_neighbors
endpoint expects POST with JSON body containing"repo"
and"node_ids"
fields (see backend/app/database/falkor/code-graph-backend/tests/index.py lines 34-111). These tests will fail.Apply this diff to fix all four requests:
- response = client.get("/get_neighbors?repo=GraphRAG-SDK&node_id=0").json + response = client.post("/get_neighbors", json={"repo": "GraphRAG-SDK", "node_ids": [0]}).json- response = client.get("/get_neighbors?repo=GraphRAG-SDK&node_id=invalid").json + response = client.post("/get_neighbors", json={"repo": "GraphRAG-SDK", "node_ids": ["invalid"]}).json- response = client.get("/get_neighbors?repo=GraphRAG-SDK&node_id=99999999").json + response = client.post("/get_neighbors", json={"repo": "GraphRAG-SDK", "node_ids": [99999999]}).json- response = client.get("/get_neighbors?repo=GraphRAG-SDK&node_id=0").json + response = client.post("/get_neighbors", json={"repo": "GraphRAG-SDK", "node_ids": [0]}).jsonbackend/app/database/falkor/code-graph-backend/api/auto_complete.py (1)
3-6
: Correct the return type annotation.The function returns
Graph.prefix_search(prefix)
, which returns alist
of encoded nodes (see backend/app/database/falkor/code-graph-backend/api/graph.py lines 323-356). The type hint-> str
is incorrect.Apply this diff:
-def prefix_search(repo: str, prefix: str) -> str: +def prefix_search(repo: str, prefix: str) -> list: """ Returns a list of all entities in the repository that start with the given prefix. """Or for better type precision:
-def prefix_search(repo: str, prefix: str) -> str: +from typing import List + +def prefix_search(repo: str, prefix: str) -> List[dict]: """ Returns a list of all entities in the repository that start with the given prefix. """backend/app/database/falkor/code-graph-backend/tests/test_py_analyzer.py (1)
26-27
: Fix the deprecated File constructor.This test still uses
File('', 'src.py', '.py')
which is incompatible with the refactoredFile(path: Path, tree: Tree)
constructor and will raiseTypeError
. Instead of constructing an expected File instance for comparison, assert on the returned object's attributes:- f = g.get_file('', 'src.py', '.py') - self.assertEqual(File('', 'src.py', '.py'), f) + f = g.get_file('', 'src.py', '.py') + self.assertIsNotNone(f) + self.assertEqual(f.path.name, 'src.py') + self.assertEqual(f.path.suffix, '.py')backend/app/database/falkor/code-graph-backend/tests/test_c_analyzer.py (1)
26-27
: Fix the deprecated File constructor.This test uses
File('', 'src.c', '.c')
with the old three-argument signature, which is incompatible with the refactoredFile(path: Path, tree: Tree)
and will raiseTypeError
. Assert on the returned object's attributes instead:- f = g.get_file('', 'src.c', '.c') - self.assertEqual(File('', 'src.c', '.c'), f) + f = g.get_file('', 'src.c', '.c') + self.assertIsNotNone(f) + self.assertEqual(f.path.name, 'src.c') + self.assertEqual(f.path.suffix, '.c')backend/app/database/falkor/code-graph-backend/tests/test_graph_ops.py (1)
23-23
: Fix the deprecated File constructor.
File('/path/to/file', 'file', 'txt')
uses the old signature and will raiseTypeError
with the refactoredFile(path: Path, tree: Tree)
. Update to use the new API:- file = File('/path/to/file', 'file', 'txt') + from pathlib import Path + # Create a minimal tree fixture or mock + file = File(Path('/path/to/file/file.txt'), tree=None) # Adjust tree as neededAlternatively, retrieve and inspect the File from the graph without constructing an expected instance.
Also applies to: 29-29
backend/app/database/falkor/code-graph-backend/tests/index.py (1)
375-378
: Remove@public_access
from/analyze_repo
(blocks private mode).As previously flagged, this returns 401 unless CODE_GRAPH_PUBLIC=1, making indexing unusable by default. Remove it or ensure token check runs first.
Apply:
- @public_access # Apply public access decorator - @token_required # Apply token authentication decorator + @token_required # Apply token authentication decoratorbackend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py (1)
3-5
: Don’t mutate nodes; guard missing label.Current remove() raises when 'Searchable' absent and mutates input.
-def encode_node(n: Node) -> dict: - n.labels.remove('Searchable') - return vars(n) +def encode_node(n: Node) -> dict: + attrs = vars(n).copy() + labels = list(attrs.get('labels', [])) + if 'Searchable' in labels: + labels.remove('Searchable') + attrs['labels'] = labels + return attrsbackend/app/database/falkor/code-graph-backend/api/llm.py (1)
59-67
: Dropunique=True
for entity names to avoid node merges.Names aren’t globally unique; uniqueness corrupts the KG.
- unique=True, + unique=False,Apply for Function.name, File.name, Class.name, Interface.name.
Also applies to: 108-114, 139-144, 176-180
backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py (2)
143-151
: Guard path normalization and zero-line division.Avoid corrupting paths and ZeroDivisionError.
- file_path = r['file'] - file_path = file_path[len(prefix):] + file_path = r['file'] + if file_path.startswith(prefix): + file_path = file_path[len(prefix):] @@ - hit_percentage = hit / lines + if lines == 0: + continue + hit_percentage = hit / lines
198-203
: Only count lines with hits when computing function coverage.Zero-hit lines should not inflate coverage.
- while idx < n and src_start <= lines[idx][0] and src_end >= lines[idx][0]: - idx += 1 - hit_count += 1 + while idx < n and src_start <= lines[idx][0] and src_end >= lines[idx][0]: + if lines[idx][1] > 0: + hit_count += 1 + idx += 1backend/app/database/falkor/code-graph-backend/api/project.py (3)
31-37
: Fixgit clone
invocation and unused variable.Don’t quote args; drop unused
result
.- cmd = ["git", "clone", quote(url), path] - - # Run the git clone command and wait for it to finish - result = subprocess.run(cmd, check=True, capture_output=True, text=True) + cmd = ["git", "clone", url, str(path)] + subprocess.run(cmd, check=True, capture_output=True, text=True)
71-78
: Handle repos without remotes.Avoid IndexError on remotes[0].
- url = Repository(path).remotes[0].url - url = url.replace("git@", "https://").replace(":", "/").replace(".git", "") + repo = Repository(path) + remote = next(iter(repo.remotes), None) + if remote is None or remote.url is None: + url = str(path.resolve()) + else: + url = remote.url.replace("git@", "https://").replace(":", "/").replace(".git", "")
97-113
: Stabilize git history processing (mutable default, analyzer init, restore CWD).Prevent leakage and ensure analyzer exists.
- def process_git_history(self, ignore: Optional[List[str]] = []) -> GitGraph: + def process_git_history(self, ignore: Optional[List[str]] = None) -> GitGraph: logging.info(f"processing {self.name} git commit history") - - # Save original working directory for later restore - original_dir = Path.cwd() - - # change working directory to local repository - logging.info(f"Switching current working directory to: {self.path}") - os.chdir(self.path) - - git_graph = build_commit_graph(self.path, self.analyzer, self.name, ignore) - - # Restore original working directory - logging.info(f"Restoring current working directory to: {original_dir}") - os.chdir(original_dir) - - return git_graph + if not hasattr(self, "analyzer") or self.analyzer is None: + self.analyzer = SourceAnalyzer() + ignore = ignore or [] + original_dir = Path.cwd() + logging.info(f"Switching current working directory to: {self.path}") + os.chdir(self.path) + try: + return build_commit_graph(self.path, self.analyzer, self.name, ignore) + finally: + logging.info(f"Restoring current working directory to: {original_dir}") + os.chdir(original_dir)backend/app/database/falkor/code-graph-backend/api/analyzers/source_analyzer.py (2)
141-146
: Guard against unanalyzed paths before resolving symbols.
first_pass
deliberately skips ignored/unsupported files, soself.files
never gets populated for those entries. Insecond_pass
we still iterate the originalfiles
list and immediately indexself.files[file_path]
, which raisesKeyError
and aborts symbol resolution as soon as we hit one of the skipped paths. Please filter the loop (e.g. iterateself.files.items()
orcontinue
when the key is missing) before dereferencing.- for i, file_path in enumerate(files): - file = self.files[file_path] + for i, file_path in enumerate(files): + if file_path not in self.files: + continue + file = self.files[file_path]
189-209
: Repairanalyze_local_repository
before release.This method still calls
analyze_local_folder(path, ignore)
without supplying the requiredGraph
, raisingTypeError
immediately. Even if it ran, it writes toself.graph
, which is never defined on the instance, so theset_graph_commit
/return path crashes withAttributeError
. Align it withProject.analyze_sources
: create (or accept) aGraph
, pass it toanalyze_local_folder
, then persist the commit on that local variable and return it.- self.analyze_local_folder(path, ignore) - - # Save processed commit hash to the DB - repo = Repository(path) - head = repo.commit("HEAD") - self.graph.set_graph_commit(head.short_id) - - return self.graph + graph = Graph(Path(path).name) + self.analyze_local_folder(path, graph, ignore) + + repo = Repository(path) + head = repo.commit("HEAD") + graph.set_graph_commit(head.short_id) + + return graphbackend/app/database/falkor/code-graph-backend/api/graph.py (1)
459-466
: Incorrect File() constructor; raises at runtimeSame issue previously flagged: File(path, name, ext) doesn’t match File(Path, Tree).
- ext = node.properties['ext'] - path = node.properties['path'] - name = node.properties['name'] - file = File(path, name, ext) - - file.id = node.id - - return file + node = res.result_set[0][0] + return { + "id": node.id, + **node.properties, + }Adjust call sites to handle a dict or instantiate File with a real Tree when available.
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (1)
70-93
: Tree-sitter captures are misused; symbols never recordedcaptures() returns (node, capture_name) tuples. Current dict-like checks always fail. Iterate and match capture names.
- if entity.node.type == 'class_definition': - superclasses = entity.node.child_by_field_name("superclasses") - if superclasses: - base_classes_query = self.language.query("(argument_list (_) @base_class)") - base_classes_captures = base_classes_query.captures(superclasses) - if 'base_class' in base_classes_captures: - for base_class in base_classes_captures['base_class']: - entity.add_symbol("base_class", base_class) + if entity.node.type == 'class_definition': + superclasses = entity.node.child_by_field_name("superclasses") + if superclasses: + base_classes_query = self.language.query("(argument_list (_) @base_class)") + for node, cap in base_classes_query.captures(superclasses): + if cap == 'base_class': + entity.add_symbol("base_class", node) elif entity.node.type == 'function_definition': - query = self.language.query("(call) @reference.call") - captures = query.captures(entity.node) - if 'reference.call' in captures: - for caller in captures['reference.call']: - entity.add_symbol("call", caller) - query = self.language.query("(typed_parameter type: (_) @parameter)") - captures = query.captures(entity.node) - if 'parameter' in captures: - for parameter in captures['parameter']: - entity.add_symbol("parameters", parameter) + query = self.language.query("(call) @reference.call") + for node, cap in query.captures(entity.node): + if cap == 'reference.call': + entity.add_symbol("call", node) + query = self.language.query("(typed_parameter type: (_) @parameter)") + for node, cap in query.captures(entity.node): + if cap == 'parameter': + entity.add_symbol("parameters", node) return_type = entity.node.child_by_field_name('return_type') if return_type: entity.add_symbol("return_type", return_type)
🧹 Nitpick comments (33)
backend/app/database/falkor/code-graph-backend/tests/source_files/py/src.py (1)
12-14
: Consider using or removing the unuseddelay
parameter.The
delay
parameter is declared but not used in the method body. If this is intentional test data for the analyzer, consider adding a comment explaining why. Otherwise, you could remove it or incorporate it into the logic.backend/app/database/falkor/code-graph-backend/api/git_utils/git_graph.py (4)
21-25
: Use an int port and avoid silent exception swallowing.
- Cast FALKORDB_PORT to int.
- Replace bare
except Exception: pass
with a narrow catch and log at debug.- self.db = FalkorDB(host=os.getenv('FALKORDB_HOST', 'localhost'), - port=os.getenv('FALKORDB_PORT', 6379), + self.db = FalkorDB(host=os.getenv('FALKORDB_HOST', 'localhost'), + port=int(os.getenv('FALKORDB_PORT', 6379)), username=os.getenv('FALKORDB_USERNAME', None), password=os.getenv('FALKORDB_PASSWORD', None)) @@ - try: - self.g.create_node_range_index("Commit", "hash") - except Exception: - pass + try: + self.g.create_node_range_index("Commit", "hash") + except Exception as e: + logging.debug("Index creation skipped/failed: %s", e)
8-10
: Avoid global logging.basicConfig in a library module.Initialize a module logger and use it, letting the application configure handlers/format.
59-67
: Return type mismatch.
list_commits
returns dicts, but the annotation isList[Node]
. Update toList[dict]
.- def list_commits(self) -> List[Node]: + def list_commits(self) -> List[dict]:
49-57
: Prefer full commit hash over short_id.Short hashes can collide; store the full OID string. Also ensures consistent lookups.
- hexsha = commit.short_id + hexsha = str(commit.id)backend/app/database/falkor/code-graph-backend/api/analyzers/java/analyzer.py (2)
4-6
: Avoid star imports; import only what’s used.Replace
from ...entities import *
with explicit imports (e.g.,Entity
,File
) to satisfy linters and improve readability.-from ...entities import * +from ...entities.entity import Entity +from ...entities.file import File
13-14
: Use a safe XML parser; ElementTree on untrusted input is risky.Prefer defusedxml with a fallback if unavailable.
-from xml.etree import ElementTree +try: + from defusedxml import ElementTree as ElementTree +except Exception: + from xml.etree import ElementTree # fallbackbackend/app/database/falkor/code-graph-backend/api/git_utils/__init__.py (1)
1-1
: Avoidfrom .git_utils import *
.Prefer explicit imports and an
__all__
list to define the public API. Keeps linters happy and prevents namespace leaks.backend/app/database/falkor/code-graph-backend/api/code_coverage/__init__.py (1)
1-1
: Consider explicit imports for better code clarity.Wildcard imports make it difficult to track what's being exported and can cause namespace collisions. While common in
__init__.py
files, explicit imports improve maintainability.If the lcov module has a limited public API, consider listing explicit imports:
-from .lcov import * +from .lcov import lcovparse, process_lcov, _part, _lineOr define
__all__
in the lcov module to control what gets exported.backend/app/database/falkor/code-graph-backend/api/__init__.py (1)
1-9
: Consider explicit imports over wildcard imports.While wildcard imports provide convenience, they obscure the public API surface and can lead to namespace pollution and import conflicts. Consider listing explicit imports in
__all__
or importing specific symbols:from .info import func_a, func_b from .graph import Graph, encode_node # ... etc.This improves maintainability and helps IDEs with autocomplete.
backend/app/agents/devrel/github/tools/repo_support.py (1)
31-37
: Remove unused exception variable.The exception
e
on line 31 is caught but never used. Remove it to clean up the code:- except Exception as e: + except Exception: logger.exception("Repository support error")Note:
logger.exception()
automatically includes exception details, so the variable is unnecessary.backend/integrations/discord/cogs.py (2)
181-290
: Store the background task reference.While the background task approach correctly prevents interaction token expiry, consider storing the task reference to enable proper lifecycle management:
- asyncio.create_task(_run_index_and_update()) + task = asyncio.create_task(_run_index_and_update()) + # Optional: track active tasks or add done callback + task.add_done_callback(lambda t: logger.info(f"Indexing task completed for {repository}"))This enables monitoring and prevents the task from being silently cancelled if needed.
387-389
: Use logging.exception and explicit string conversion.Apply these improvements for better error handling:
except Exception as e: - logger.error(f"List command error: {e}") - await interaction.followup.send(f"Error: {str(e)}") + logger.exception("List command error") + await interaction.followup.send(f"Error: {e!s}")
logger.exception()
automatically includes the traceback, and!s
is the explicit conversion flag.pyproject.toml (1)
38-38
: Pin the multilspy git reference.Using a git dependency with a branch reference (
@python-init-params
) can lead to non-reproducible builds if the branch is updated:- "multilspy @ git+https://github.com/AviAvni/multilspy.git@python-init-params", + "multilspy @ git+https://github.com/AviAvni/multilspy.git@<commit-sha>",Consider pinning to a specific commit SHA or using a tagged release for reproducibility.
backend/app/database/falkor/code-graph-backend/tests/index.py (4)
2-2
: Avoidfrom api import *
(shadowing, lint errors).Import explicit symbols to prevent TDZ/namespace collisions like the
switch_commit
bug.Example:
-from api import * +from api.graph import Graph, get_repos, graph_exists +from api.info import get_repo_info +from api.llm import ask +from api.analyzers.source_analyzer import SourceAnalyzer
86-88
: Log full traceback on exceptions.Use logging.exception for better diagnostics.
- except Exception as e: - logging.error(f"Error retrieving sub-graph for repo '{repo}': {e}") + except Exception: + logging.exception(f"Error retrieving sub-graph for repo '{repo}'")
156-156
: Remove unnecessary f-strings without placeholders.These trigger lint warnings; use plain strings.
- return jsonify({'status': f'Missing mandatory parameter "repo"'}), 400 + return jsonify({'status': 'Missing mandatory parameter "repo"'}), 400Repeat for the listed lines.
Also applies to: 161-161, 222-222, 268-268, 273-273, 280-280, 308-308, 313-313, 395-395, 428-428, 433-433
150-152
: Guard against missing/invalid JSON body.request.get_json() can return None; add a check before data.get().
- data = request.get_json() + data = request.get_json(silent=True) or {}Apply to the POST handlers.
Also applies to: 216-218, 262-264, 300-304, 337-339, 392-394, 422-424
backend/app/database/falkor/code-graph-backend/api/entities/entity_encoder.py (1)
16-24
: Raise a precise error and format the message.Use TypeError and an f-string.
- else: - raise Exception("Unable to encode graph entity, unknown graph entity type: {type(e)}") + else: + raise TypeError(f"Unable to encode graph entity, unknown graph entity type: {type(e)}")backend/app/database/falkor/code-graph-backend/api/llm.py (2)
264-268
: Remove prints; rely on logging.Avoid stdout noise in server contexts.
- print(f"Question: {question}") - response = chat.send_message(question) - logging.debug(f"Response: {response}") - print(f"Response: {response['response']}") + response = chat.send_message(question) + logging.debug(f"Response: {response}")
249-251
: Ensure port is an int.Env vars are strings; cast to int.
- port=os.getenv('FALKORDB_PORT', 6379), + port=int(os.getenv('FALKORDB_PORT', 6379)),backend/app/database/falkor/code-graph-backend/api/code_coverage/lcov/lcov.py (1)
44-44
: Rename ambiguous loop variablel
.Minor readability nit.
-for l in lines: - _line(l, report) +for line_str in lines: + _line(line_str, report)Also applies to: 49-49
backend/app/database/falkor/code-graph-backend/api/project.py (1)
86-93
: Don’t swallow exceptions silently.Log traceback when commit extraction fails.
- except Exception: - # Probably not .git folder is missing - pass + except Exception: + logging.exception("Failed to save current commit (missing .git?)")backend/app/services/codegraph/repo_service.py (2)
53-55
: Graph name collision risk across owners.Using only repo name can collide (e.g., org1/app vs org2/app). Prefer owner_repo.
- graph_name = repo_info['repo'] + graph_name = f"{repo_info['owner']}_{repo_info['repo']}"
151-151
: Nit: don’t include exception object inlogger.exception
message.logger.exception captures it automatically.
- logger.exception(f"Network error indexing {repo_input}: {e}") + logger.exception(f"Network error indexing {repo_input}")(Apply similarly in query_repo.)
Also applies to: 233-233
backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py (5)
5-5
: Avoid star import; import explicit namesPrevents hidden names and resolves Ruff F405.
-from ..info import * +from ..info import get_repo_commit, set_repo_commit
56-67
: Use Path joins instead of string concatenationSafer and OS‑agnostic.
- file_path = Path(f"{repo.workdir}/{change.new_file.path}") + file_path = Path(repo.workdir) / change.new_file.path ... - file_path = Path(f"{repo.workdir}/{change.old_file.path}") + file_path = Path(repo.workdir) / change.old_file.path ... - file_path = Path(f"{repo.workdir}/{change.new_file.path}") + file_path = Path(repo.workdir) / change.new_file.path
100-100
: Don’t rely on cwd; open the repo at the provided pathUsing Repository(path) makes build_commit_graph context‑independent.
- repo = Repository('.') + repo = Repository(path)
323-324
: Add strict to zip to catch mismatch between queries/paramsHelps surface data corruption early.
- for q, p in zip(queries, params): - for _q, _p in zip(q, p): + for q, p in zip(queries, params, strict=True): + for _q, _p in zip(q, p, strict=True):
14-15
: Library code should not set global logging configbasicConfig at import time can clobber app logging. Prefer a module logger.
Consider:
- Remove basicConfig here.
- Use
logger = logging.getLogger(__name__)
andlogger.info/debug(...)
.backend/app/database/falkor/code-graph-backend/api/index.py (1)
93-95
: Log exceptions with tracebackImproves diagnostics.
- except Exception as e: - logging.error("Error retrieving sub-graph for repo '%s': %s", repo, e) + except Exception: + logging.exception("Error retrieving sub-graph for repo '%s'", repo)backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py (1)
35-37
: Preserve traceback when dependency discovery failsUse logger.exception inside broad except.
- except Exception as e: - logger.error(f"Error adding dependencies: {e}") - pass + except Exception: + logger.exception("Error adding dependencies")backend/app/database/falkor/code-graph-backend/api/graph.py (1)
582-585
: Make zip intent explicitAvoid silent truncation.
- for n, e in zip(nodes, edges): + for n, e in zip(nodes, edges, strict=False):
with open(f"{path}/requirements.txt", 'r') as file: | ||
requirements = [line.strip().split("==") for line in file if line.strip()] | ||
for requirement in requirements: | ||
files.extend(Path(f"{path}/venv/lib/").rglob(f"**/site-packages/{requirement}/*.py")) | ||
|
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.
requirements.txt parsing is broken (using list as path fragment)
split("==")
yields lists; then used in f-string causing bad globs. Extract package name first.
- with open(f"{path}/requirements.txt", 'r') as file:
- requirements = [line.strip().split("==") for line in file if line.strip()]
- for requirement in requirements:
- files.extend(Path(f"{path}/venv/lib/").rglob(f"**/site-packages/{requirement}/*.py"))
+ with open(f"{path}/requirements.txt", 'r') as file:
+ for raw in file:
+ spec = raw.strip()
+ if not spec or spec.startswith("#"):
+ continue
+ # extract package name before any version/extras
+ name = spec.split("==", 1)[0].split(">=", 1)[0].split("<=", 1)[0] \
+ .split("~=", 1)[0].split("!=", 1)[0].split("[", 1)[0].strip()
+ if name:
+ files.extend(Path(f"{path}/venv/lib").rglob(f"**/site-packages/{name}/**/*.py"))
🤖 Prompt for AI Agents
In
backend/app/database/falkor/code-graph-backend/api/analyzers/python/analyzer.py
around lines 41 to 45, the requirements parsing calls split("==") which returns
a list and then uses that list in the f-string glob causing invalid path
fragments; change the parsing to extract the package name (e.g., pkg =
line.split("==",1)[0].strip() or handle other specifiers/comments), skip
blank/comment lines, and use the package name string when building the
Path.rglob pattern so the glob uses the package identifier rather than a list.
if current_hash == to: | ||
logging.debug("Current commit: {current_hash} is the requested commit") | ||
# No change remain at the current commit | ||
return |
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.
Missing f-string in log
Currently prints literal braces.
- logging.debug("Current commit: {current_hash} is the requested commit")
+ logging.debug(f"Current commit: {current_hash} is the requested commit")
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if current_hash == to: | |
logging.debug("Current commit: {current_hash} is the requested commit") | |
# No change remain at the current commit | |
return | |
if current_hash == to: | |
logging.debug(f"Current commit: {current_hash} is the requested commit") | |
# No change remain at the current commit | |
return |
🤖 Prompt for AI Agents
In backend/app/database/falkor/code-graph-backend/api/git_utils/git_utils.py
around lines 290 to 293, the logging.debug call uses a string with braces but
not an f-string, so it prints literal "{current_hash}" instead of the variable;
change the logging.debug to interpolate the variable (e.g., use an f-string or
.format) so it logs the actual current_hash value while keeping the message text
the same.
def unreachable_entities(self, lbl: Optional[str], rel: Optional[str]) -> list[dict]: | ||
lbl = f": {lbl}" if lbl else "" | ||
rel = f": {rel}" if rel else "" | ||
|
||
q = f""" MATCH (n {lbl}) | ||
WHERE not ()-[{rel}]->(n) | ||
RETURN n |
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.
Fix label/relationship formatting in Cypher
Extra space after ':' likely breaks label/rel syntax.
- lbl = f": {lbl}" if lbl else ""
- rel = f": {rel}" if rel else ""
+ lbl = f":{lbl}" if lbl else ""
+ rel = f":{rel}" if rel else ""
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
def unreachable_entities(self, lbl: Optional[str], rel: Optional[str]) -> list[dict]: | |
lbl = f": {lbl}" if lbl else "" | |
rel = f": {rel}" if rel else "" | |
q = f""" MATCH (n {lbl}) | |
WHERE not ()-[{rel}]->(n) | |
RETURN n | |
def unreachable_entities(self, lbl: Optional[str], rel: Optional[str]) -> list[dict]: | |
- lbl = f": {lbl}" if lbl else "" | |
lbl = f":{lbl}" if lbl else "" | |
rel = f":{rel}" if rel else "" | |
q = f""" MATCH (n {lbl}) | |
WHERE not ()-[{rel}]->(n) | |
RETURN n |
🤖 Prompt for AI Agents
In backend/app/database/falkor/code-graph-backend/api/graph.py around lines
611-617, the label and relationship strings are being built with a leading space
(" : {lbl}" / " : {rel}") which produces invalid Cypher (extra space after ':').
Change the formatting to omit the space so labels become f":{lbl}" when present
(otherwise empty string) and relationship types become f":{rel}" when present
(used inside the [...] pattern), ensuring you only add the colon when the value
exists.
data = request.get_json() | ||
url = data.get('repo_url') | ||
if url is None: | ||
return jsonify({'status': 'Missing mandatory parameter "url"'}), 400 | ||
logger.debug('Received repo_url: %s', url) | ||
|
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.
Fix parameter name in error message
Mismatch: expects repo_url but error mentions url.
- if url is None:
- return jsonify({'status': 'Missing mandatory parameter "url"'}), 400
+ if url is None:
+ return jsonify({'status': 'Missing mandatory parameter "repo_url"'}), 400
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
data = request.get_json() | |
url = data.get('repo_url') | |
if url is None: | |
return jsonify({'status': 'Missing mandatory parameter "url"'}), 400 | |
logger.debug('Received repo_url: %s', url) | |
data = request.get_json() | |
url = data.get('repo_url') | |
if url is None: | |
return jsonify({'status': 'Missing mandatory parameter "repo_url"'}), 400 | |
logger.debug('Received repo_url: %s', url) |
🤖 Prompt for AI Agents
In backend/app/database/falkor/code-graph-backend/api/index.py around lines 401
to 406, the handler reads request.get_json() and checks data.get('repo_url') but
the 400 error message refers to "url"; change the error response to reference
the correct parameter name "repo_url" (e.g., return jsonify({'status': 'Missing
mandatory parameter \"repo_url\"'}), 400) so the message matches the expected
input key.
from pathlib import Path | ||
from index import create_app | ||
from api import Project | ||
from falkordb import FalkorDB, Path, Node, QueryResult |
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.
Critical: Import shadowing causes namespace collision.
Path
from falkordb
(line 7) overwrites pathlib.Path
(line 4), making pathlib.Path
inaccessible. Line 4 imports Path
for file path operations, but line 7's import shadows it.
Apply this diff to use an alias for FalkorDB's Path:
-from falkordb import FalkorDB, Path, Node, QueryResult
+from falkordb import FalkorDB, Path as FalkorPath, Node, QueryResult
Then update line 59 if it uses FalkorDB's Path (though the snippet doesn't show usage, so you may need to verify).
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
from falkordb import FalkorDB, Path, Node, QueryResult | |
from pathlib import Path | |
from falkordb import FalkorDB, Path as FalkorPath, Node, QueryResult |
🧰 Tools
🪛 Ruff (0.14.0)
7-7: Redefinition of unused Path
from line 4
(F811)
🤖 Prompt for AI Agents
In
backend/app/database/falkor/code-graph-backend/tests/endpoints/test_find_paths.py
around line 7, the import "Path" from falkordb is shadowing the earlier "Path"
import from pathlib; change the FalkorDB Path import to use an alias (e.g.,
import FalkorDB's Path as FalkorPath) and then update any usage of FalkorDB's
Path in this file (notably around line 59) to use the new alias so pathlib.Path
remains available for filesystem operations.
char data[]; | ||
}; | ||
|
||
int main(const char **argv, int argc) { |
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.
Non-standard main signature with swapped parameters.
The main function signature uses (const char **argv, int argc)
with parameters in the wrong order. The standard C signatures are int main(void)
, int main(int argc, char *argv[])
, or int main(int argc, char **argv)
. If this is intentional test data for the analyzer, consider documenting it.
🤖 Prompt for AI Agents
In backend/app/database/falkor/code-graph-backend/tests/source_files/c/src.c
around line 16, the main function signature is non-standard: parameters are
declared as (const char **argv, int argc) with the order swapped; change the
signature to a standard form such as int main(int argc, char **argv) or int
main(int argc, char *argv[]) (or int main(void) if no args are needed). If this
unusual signature is intentional for test coverage, add a comment above the
function explaining it is deliberate test data rather than production code.
self.backend_url = os.getenv("CODEGRAPH_BACKEND_URL", "http://localhost:5000") | ||
self.secret_token = os.getenv("SECRET_TOKEN", "DevRAI_CodeGraph_Secret") | ||
self.indexing_timeout = aiohttp.ClientTimeout(total=3600, connect=60) |
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.
Align auth defaults; omit header when no token.
Backend defaults to SECRET_TOKEN=None; sending a non-empty default breaks auth.
- self.secret_token = os.getenv("SECRET_TOKEN", "DevRAI_CodeGraph_Secret")
+ self.secret_token = os.getenv("SECRET_TOKEN") # None if unset
And build headers conditionally:
- headers={
- "Content-Type": "application/json",
- "Authorization": self.secret_token
- }
+ headers=dict({"Content-Type": "application/json"}, **(
+ {"Authorization": self.secret_token} if self.secret_token else {}
+ ))
Apply similarly to /chat and /delete_graph calls.
Also applies to: 111-115, 204-208, 253-261
🤖 Prompt for AI Agents
In backend/app/services/codegraph/repo_service.py around lines 17-19 (and
similarly at 111-115, 204-208, 253-261), the service sets a non-empty default
SECRET_TOKEN and always sends an Authorization header, which breaks auth when
the backend expects None; change the default to None (os.getenv("SECRET_TOKEN")
with no fallback) and update header construction so Authorization is only added
when secret_token is truthy (build headers conditionally for requests including
/chat and /delete_graph and the other call sites), ensuring no Authorization
header is sent when there is no token.
repo_input = repo_input.strip().rstrip('/').rstrip('.git') | ||
|
||
patterns = [ | ||
(r'github\.com[:/]([^/]+)/([^/]+?)(?:\.git)?$', 'url'), | ||
(r'^([a-zA-Z0-9][-a-zA-Z0-9]*)/([a-zA-Z0-9._-]+)$', 'short') | ||
] |
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.
Bug: rstrip('.git')
corrupts repo names.
rstrip removes any trailing chars from set {.,g,i,t}. Use removesuffix or explicit check.
- repo_input = repo_input.strip().rstrip('/').rstrip('.git')
+ repo_input = repo_input.strip().rstrip('/')
+ if repo_input.endswith('.git'):
+ repo_input = repo_input[:-4]
(Or use str.removesuffix('.git') on Python 3.9+.)
🤖 Prompt for AI Agents
In backend/app/services/codegraph/repo_service.py around lines 25 to 30, the use
of repo_input.strip().rstrip('/').rstrip('.git') incorrectly strips any trailing
characters in the set {.,g,i,t} and can corrupt repo names; replace the final
rstrip('.git') with a safe suffix removal—either use
repo_input.removesuffix('.git') (Python 3.9+) or explicitly check if
repo_input.endswith('.git') and then strip the last 4 characters—so only the
exact ".git" suffix is removed while preserving other valid trailing characters.
if response.status == 200: | ||
data = await response.json() if await response.text() else {} | ||
|
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.
Avoid double-reading the response body.
Calling text() then json() consumes the stream. Parse once.
- data = await response.json() if await response.text() else {}
+ try:
+ data = await response.json(content_type=None)
+ except Exception:
+ data = {}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if response.status == 200: | |
data = await response.json() if await response.text() else {} | |
if response.status == 200: | |
try: | |
data = await response.json(content_type=None) | |
except Exception: | |
data = {} | |
🤖 Prompt for AI Agents
In backend/app/services/codegraph/repo_service.py around lines 116-118, the code
reads the response body twice (await response.text() then await
response.json()), which consumes the stream; read the body once into a variable
(e.g., body = await response.text()), check if body is empty, and if not parse
it with json.loads(body) (add an import json if missing) or use response.json()
only and handle exceptions for empty responses—replace the double-read with the
single-read-and-parse approach.
authors = [{ name = "Kartik Bhatt", email = "kartikbhtt7@gmail.com" }] | ||
readme = "README.md" | ||
requires-python = ">=3.10,<4.0" | ||
requires-python = ">=3.10,<3.14" |
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.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
Verify the Python 3.14 upper bound.
The Python constraint was changed from <4.0
to <3.14
, which excludes Python 3.14+. This is quite restrictive since Python 3.14 is expected in late 2025.
Is this intentional due to compatibility issues with the new dependencies, or should it be relaxed to <4.0
?
Check if any of the new dependencies have Python 3.14 compatibility issues:
🌐 Web query:
Do tree-sitter, falkordb, or multilspy have known Python 3.14 compatibility issues?
💡 Result:
Short answer:
-
tree-sitter: There have been compatibility/ABI and grammar-mismatch issues historically (e.g., ABI breaks and grammar mismatches reported in the py-tree-sitter / tree-sitter-python issue trackers and user reports), but the py-tree-sitter / tree-sitter ecosystem has published 3.14 wheels on PyPI (indicating official builds for CPython 3.14 are available). See below. (github.com)
-
FalkorDB: The FalkorDB Python package on PyPI publishes Python wheels/sdists (py3-none-any) (2024–2025 releases) and there are no widely reported Python 3.14-specific incompatibility issues in its issue/packaging metadata on PyPI. (pypi.org)
-
multilspy: multilspy releases on PyPI show recent py3 wheels (2024–2025) and I did not find reported Python 3.14-specific issues in its PyPI release history. (pypi.org)
Notes / recommendation: tree-sitter is the one with the most history of breakage (ABI/grammar mismatches across tree-sitter core / language grammars / host apps like Emacs), so test your exact platform (OS/arch) and the combination of tree-sitter + tree-sitter-language packages you use. If you want, I can search GitHub issues/CI logs for each project + your target OS/arch and report any linked failures.
Citations:
- 1: .so files built now throws error
ValueError: Incompatible Language version 12. Must not be between 9 and 11
tree-sitter/py-tree-sitter#38 - 2: https://pypi.org/project/FalkorDB/?utm_source=openai
- 3: https://pypi.org/project/multilspy/0.0.15/?utm_source=openai
Relax Python upper bound to <4.0
. All new dependencies publish Python 3.14+ wheels and have no known incompatibilities.
🤖 Prompt for AI Agents
In pyproject.toml around line 7, the Python version upper bound is too strict
(">=3.10,<3.14"); update the requires-python spec to allow Python 3.14+ by
changing it to ">=3.10,<4.0". Make sure the value remains a valid TOML string
and run your package tooling (poetry/packaging validation) to confirm the
updated constraint is accepted.
closes #68 #95
Interactions attached
Summary by CodeRabbit
New Features
Documentation
Tests
Chores