fix multi-query agent workspace searches

This commit is contained in:
Hamza Ayed
2026-10-04 17:42:57 +03:00
parent b3dc6154e5
commit a62a831e90
6 changed files with 253 additions and 17 deletions
@@ -0,0 +1,32 @@
import unittest
from pathlib import Path
from app import workspace
class WorkspaceSearchTests(unittest.TestCase):
def test_search_excerpt_returns_numbered_matching_lines_from_deep_in_file(self) -> None:
project_root = Path(__file__).resolve().parents[1]
results = workspace.retrieve("timeout_seconds=600.0", project_root, limit=10)
path, excerpt = next(
(path, excerpt)
for path, excerpt in results
if path == "app/main.py"
)
self.assertRegex(excerpt, r"\d+: .*timeout_seconds=600\.0")
self.assertNotIn("from __future__ import annotations", excerpt)
def test_search_ranks_requested_flutter_timeout_code_before_docs(self) -> None:
project_root = Path(__file__).resolve().parents[1]
results = workspace.retrieve(
"مهلة عميل Flutter لمسار run/stream", project_root, limit=3
)
path, excerpt = results[0]
self.assertEqual(path, "flutter_app/lib/core/network/api_repository.dart")
self.assertIn("minutes: 10", excerpt)
if __name__ == "__main__":
unittest.main()