From ea1bfe9470da965ff9eec23dc27c1cda21cb10d2 Mon Sep 17 00:00:00 2001 From: Harshit Sharma <66710144+harshitethic@users.noreply.github.com> Date: Thu, 5 Nov 2026 06:06:55 +0530 Subject: [PATCH] Include go.mod and Gemfile in searchable repository manifests --- backend/services/github.py | 2 +- backend/tests/test_manifest_retrieval.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 backend/tests/test_manifest_retrieval.py diff --git a/backend/services/github.py b/backend/services/github.py index e544c3d..c581ded 100644 --- a/backend/services/github.py +++ b/backend/services/github.py @@ -431,7 +431,7 @@ def iter_files(root: Path): try: size = p.stat().st_size except OSError: continue if size > 300_000: continue - if p.suffix.lower() in TEXT_EXTENSIONS or p.name.lower().endswith(".env.example") or p.name.lower() in {"dockerfile","makefile",".gitignore"}: + if p.suffix.lower() in TEXT_EXTENSIONS or p.name.lower().endswith(".env.example") or p.name.lower() in {"dockerfile","makefile",".gitignore","go.mod","gemfile"}: yield p def read_text(path: Path): return path.read_text(encoding="utf-8", errors="replace") diff --git a/backend/tests/test_manifest_retrieval.py b/backend/tests/test_manifest_retrieval.py new file mode 100644 index 0000000..ae7a0b8 --- /dev/null +++ b/backend/tests/test_manifest_retrieval.py @@ -0,0 +1,23 @@ +import tempfile +import unittest +from pathlib import Path + +from services.analyzer import analyze, build_context, search_code + + +class ManifestRetrievalTests(unittest.TestCase): + def test_go_and_ruby_manifests_are_available_to_repository_tools(self): + for name, declaration in [ + ("go.mod", "module example.test/sprocket"), + ("Gemfile", 'gem "sprocket"'), + ]: + with self.subTest(name=name), tempfile.TemporaryDirectory() as directory: + root = Path(directory) + (root / name).write_text(declaration, encoding="utf-8") + (root / "unrelated.mod").write_bytes(b"unrelated") + + analysis = analyze(root) + self.assertTrue(analysis["signals"]["manifest"]) + self.assertEqual([row["path"] for row in analysis["files"]], [name]) + self.assertEqual(search_code(root, "sprocket")[0]["text"], declaration) + self.assertIn(declaration, build_context(root, "sprocket"))