Skip to content

Commit e30948b

Browse files
jsbattigclaude
andcommitted
fix: Dashboard Total Traces count inflated by CIDX vector index files (v9.3.89)
_get_langfuse_folder_stats() counted all *.json files under langfuse_* folders including .code-indexer/ vector store files (88K+), inflating the trace count ~22x (showed 92K instead of ~4K). Fixed by excluding .code-indexer from path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c6f02c0 commit e30948b

5 files changed

Lines changed: 37 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## v9.3.89
9+
10+
### Bug Fixes
11+
12+
- fix: Dashboard "Total Traces" count inflated by CIDX vector index files. The _get_langfuse_folder_stats() method used folder.glob("**/*.json") which counted .code-indexer/ vector store JSON files (88K+) alongside actual trace files (4K), inflating the reported count ~22x. Fixed by excluding files with .code-indexer in their path components.
13+
814
## v9.3.88
915

1016
### Enhancements

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
AI-powered semantic code search for your codebase. Find code by meaning, not just keywords.
44

5-
**Version 9.3.88** - [Changelog](CHANGELOG.md) | [Migration Guide](docs/migration-to-v8.md) | [Architecture](docs/architecture.md)
5+
**Version 9.3.89** - [Changelog](CHANGELOG.md) | [Migration Guide](docs/migration-to-v8.md) | [Architecture](docs/architecture.md)
66

77
## Quick Navigation
88

src/code_indexer/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
HNSW graph indexing (O(log N) complexity).
77
"""
88

9-
__version__ = "9.3.88"
9+
__version__ = "9.3.89"
1010
__author__ = "Seba Battig"

src/code_indexer/server/services/dashboard_service.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,9 @@ def _get_langfuse_folder_stats(self, server_dir: Path) -> dict:
605605
if folder.is_dir() and folder.name.startswith("langfuse_"):
606606
user_folders += 1
607607

608-
# Count JSON files and sizes
608+
# Count JSON files and sizes (exclude CIDX index files)
609609
for trace_file in folder.glob("**/*.json"):
610-
if trace_file.is_file():
610+
if trace_file.is_file() and ".code-indexer" not in trace_file.parts:
611611
total_traces += 1
612612
total_size_bytes += trace_file.stat().st_size
613613

tests/unit/server/test_langfuse_dashboard.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,33 @@ def test_count_trace_files(self):
264264
# Size should be > 0 (small files are rounded to 0.0, check >= 0)
265265
assert stats["total_size_mb"] >= 0.0
266266

267+
def test_code_indexer_files_excluded_from_count(self):
268+
"""JSON files under .code-indexer/ dirs must not count as traces."""
269+
from code_indexer.server.services.dashboard_service import DashboardService
270+
271+
with tempfile.TemporaryDirectory() as tmpdir:
272+
server_dir = Path(tmpdir)
273+
golden_repos = server_dir / "data" / "golden-repos"
274+
golden_repos.mkdir(parents=True)
275+
276+
user_folder = golden_repos / "langfuse_user1"
277+
user_folder.mkdir()
278+
279+
# Real trace files
280+
(user_folder / "trace1.json").write_text('{"id": "1"}')
281+
(user_folder / "trace2.json").write_text('{"id": "2"}')
282+
283+
# CIDX index files — must NOT be counted
284+
cidx_dir = user_folder / ".code-indexer" / "index" / "langfuse_traces"
285+
cidx_dir.mkdir(parents=True)
286+
(cidx_dir / "vector_0001.json").write_text('{"vec": [0.1, 0.2]}')
287+
(cidx_dir / "vector_0002.json").write_text('{"vec": [0.3, 0.4]}')
288+
289+
service = DashboardService()
290+
stats = service._get_langfuse_folder_stats(server_dir)
291+
assert stats["user_folders"] == 1
292+
assert stats["total_traces"] == 2 # only real traces, not CIDX files
293+
267294
def test_calculate_storage_size(self):
268295
"""Should calculate total storage size in MB."""
269296
from code_indexer.server.services.dashboard_service import DashboardService

0 commit comments

Comments
 (0)