-
-
Notifications
You must be signed in to change notification settings - Fork 369
test: add event filtering and non-code file tests for realtime updater #485
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
Changes from all commits
bc89241
f6670b7
dd22616
aa354ac
11ac4e6
1f159d8
21ebacb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -487,7 +487,7 @@ | |
| file_path, root_node, language, self.queries | ||
| ) | ||
|
|
||
| def _prune_orphan_nodes(self) -> None: | ||
|
Check failure on line 490 in codebase_rag/graph_updater.py
|
||
| """Remove graph nodes whose files/folders no longer exist on disk.""" | ||
| if not isinstance(self.ingestor, QueryProtocol): | ||
| return | ||
|
|
@@ -495,20 +495,33 @@ | |
| logger.info(ls.PRUNE_START) | ||
| total_pruned = 0 | ||
|
|
||
| project_prefix = self.project_name + "." | ||
| repo_abs = self.repo_path.resolve().as_posix() | ||
| prune_specs: list[tuple[str, str, str]] = [ | ||
| (cs.CYPHER_ALL_FILE_PATHS, cs.CYPHER_DELETE_FILE, "File"), | ||
| (cs.CYPHER_ALL_MODULE_PATHS, cs.CYPHER_DELETE_MODULE, "Module"), | ||
| ( | ||
| cs.CYPHER_ALL_MODULE_PATHS_INTERNAL, | ||
| cs.CYPHER_DELETE_MODULE, | ||
| "Module", | ||
| ), | ||
| (cs.CYPHER_ALL_FOLDER_PATHS, cs.CYPHER_DELETE_FOLDER, "Folder"), | ||
| ] | ||
|
|
||
| for query_all, delete_query, label in prune_specs: | ||
| rows = self.ingestor.fetch_all(query_all) | ||
| orphans = [ | ||
| r["path"] | ||
| for r in rows | ||
| if r.get("path") | ||
| and not (self.repo_path / r["path"]).exists() | ||
| ] | ||
| orphans = [] | ||
| for r in rows: | ||
| path = r.get("path") | ||
| if not isinstance(path, str) or not path: | ||
| continue | ||
| abs_path = r.get("absolute_path") | ||
| qn = r.get("qualified_name", "") | ||
| if isinstance(abs_path, str) and not abs_path.startswith(repo_abs): | ||
| continue | ||
| if isinstance(qn, str) and qn and not qn.startswith(project_prefix): | ||
| continue | ||
| if not (self.repo_path / path).exists(): | ||
| orphans.append(path) | ||
|
Comment on lines
500
to
+524
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change removes the pruning logic for orphan Consider reintroducing pruning for prune_specs: list[tuple[str, str, str]] = [
(
cs.CYPHER_ALL_MODULE_PATHS_INTERNAL,
cs.CYPHER_DELETE_MODULE,
"Module",
),
(
cs.CYPHER_ALL_FOLDER_PATHS,
cs.CYPHER_DELETE_FOLDER,
"Folder",
),
]
for query_all, delete_query, label in prune_specs:
rows = self.ingestor.fetch_all(query_all)
orphans = []
for r in rows:
path = r.get("path")
if not isinstance(path, str) or not path:
continue
# The project prefix check is only applicable to Modules
if label == "Module":
qn = r.get("qualified_name", "")
if isinstance(qn, str) and qn and not qn.startswith(project_prefix):
continue
if not (self.repo_path / path).exists():
orphans.append(path) |
||
|
|
||
| if orphans: | ||
| logger.info(ls.PRUNE_FOUND, count=len(orphans), label=label) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.