From 34480124c1dcc7bb7f34740f9a090f4805d602b4 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:23 +0000 Subject: [PATCH 1/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- test_with_logging.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test_with_logging.py b/test_with_logging.py index c1e9171e..ec583950 100644 --- a/test_with_logging.py +++ b/test_with_logging.py @@ -22,7 +22,10 @@ from codewiki.src.config import Config # Test repo -test_repo = "/Users/michaelassraf/Documents/GitHub/openframe-oss-tenant" +test_repo = os.getenv("TEST_REPO_PATH", sys.argv[1] if len(sys.argv) > 1 else "") +if not test_repo: + print("❌ ERROR: No test repo path provided. Set TEST_REPO_PATH env var or pass it as the first argument.") + sys.exit(1) # Create config config = Config( @@ -82,3 +85,4 @@ print(f"✅ SUCCESS: {len(module_tree)} modules created") for name, info in module_tree.items(): print(f" - {name}: {len(info.get('components', []))} components") + From 485a2ccbcc1a7e9e1274979a02789c6516544378 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:24 +0000 Subject: [PATCH 2/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- .../analysis/analysis_service.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/codewiki/src/be/dependency_analyzer/analysis/analysis_service.py b/codewiki/src/be/dependency_analyzer/analysis/analysis_service.py index 2d8eb11d..cdc2d0da 100644 --- a/codewiki/src/be/dependency_analyzer/analysis/analysis_service.py +++ b/codewiki/src/be/dependency_analyzer/analysis/analysis_service.py @@ -252,18 +252,6 @@ def _analyze_structure( def _read_readme_file(self, repo_dir: str) -> Optional[str]: """Find and read the README file from the repository root.""" - # possible_readme_names = ["README.md", "README", "readme.md", "README.txt"] - # for name in possible_readme_names: - # readme_path = Path(repo_dir) / name - # if readme_path.exists(): - # try: - # logger.debug(f"Found README file at {readme_path}") - # return readme_path.read_text(encoding="utf-8") - # except Exception as e: - # logger.warning(f"Could not read README file at {readme_path}: {e}") - # return None - # logger.debug("No README file found in repository root.") - # return None base = Path(repo_dir) possible_readme_names = ["README.md", "README", "readme.md", "README.txt"] for name in possible_readme_names: @@ -349,7 +337,7 @@ def _filter_supported_languages(self, code_files: List[Dict]) -> List[Dict]: def _get_supported_languages(self) -> List[str]: """Get list of currently supported languages for analysis.""" - return ["python", "javascript", "typescript", "java", "csharp", "c", "cpp", "php"] + return ["python", "javascript", "typescript", "java", "csharp", "c", "cpp", "php", "go", "rust"] def _cleanup_repository(self, temp_dir: str): """Clean up cloned repository.""" @@ -396,3 +384,4 @@ def analyze_repository_structure_only( github_url, include_patterns, exclude_patterns ) return result, None + From d2898d1ae64cfc3bd556264d01e324f84eabeb3b Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:25 +0000 Subject: [PATCH 3/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- codewiki/cli/adapters/doc_generator.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/codewiki/cli/adapters/doc_generator.py b/codewiki/cli/adapters/doc_generator.py index 93123d19..b2e95368 100644 --- a/codewiki/cli/adapters/doc_generator.py +++ b/codewiki/cli/adapters/doc_generator.py @@ -256,10 +256,14 @@ def generate(self) -> DocumentationJob: async def _run_backend_generation(self, backend_config: BackendConfig): """Run the backend documentation generation with progress tracking.""" + # Bind logger unconditionally at the top of the function so that any + # verbose-gated log line below can safely reference it, regardless of + # which branches execute. + logger = logging.getLogger(__name__) + # Stage 1: Dependency Analysis self.progress_tracker.start_stage(1, "Dependency Analysis") if self.verbose: - logger = logging.getLogger(__name__) logger.info("🔍 Stage 1: Repository Dependency Analysis") self.progress_tracker.update_stage(0.1, "Initializing dependency analyzer...") print(f" ├─ Repository: {backend_config.repo_path}") @@ -320,7 +324,6 @@ async def _run_backend_generation(self, backend_config: BackendConfig): self.progress_tracker.start_stage(2, "Module Clustering") if self.verbose: - logger = logging.getLogger(__name__) logger.info("🔍 Stage 2: Module Clustering with LLM") # Import clustering function @@ -435,7 +438,6 @@ async def _run_backend_generation(self, backend_config: BackendConfig): # Stage 3: Documentation Generation self.progress_tracker.start_stage(3, "Documentation Generation") if self.verbose: - logger = logging.getLogger(__name__) logger.info("🔍 Stage 3: LLM-Powered Documentation Generation") self.progress_tracker.update_stage(0.1, "Starting documentation generation...") print(f" ├─ Modules to document: {len(module_tree)}") From 618334c523bb1db0684254c3c77caaa91ead849f Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:26 +0000 Subject: [PATCH 4/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- codewiki/src/fe/routes.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/codewiki/src/fe/routes.py b/codewiki/src/fe/routes.py index 40da7955..4750c21c 100644 --- a/codewiki/src/fe/routes.py +++ b/codewiki/src/fe/routes.py @@ -3,6 +3,7 @@ FastAPI route handlers for the CodeWiki web application. """ +import re from datetime import datetime, timedelta from pathlib import Path from dataclasses import asdict @@ -178,6 +179,9 @@ async def view_docs(self, job_id: str) -> RedirectResponse: async def serve_generated_docs(self, job_id: str, filename: str = "overview.md") -> HTMLResponse: """Serve generated documentation files.""" + if not re.match(r'^[A-Za-z0-9_.-]+$', job_id): + raise HTTPException(status_code=400, detail="Invalid job ID") + job = self.background_worker.get_job_status(job_id) docs_path = None repo_url = None @@ -238,7 +242,10 @@ async def serve_generated_docs(self, job_id: str, filename: str = "overview.md") pass # Serve the requested file - file_path = docs_path / filename + docs_path_resolved = docs_path.resolve() + file_path = (docs_path / filename).resolve() + if docs_path_resolved != file_path and docs_path_resolved not in file_path.parents: + raise HTTPException(status_code=400, detail="Invalid file path") if not file_path.exists(): raise HTTPException(status_code=404, detail=f"File {filename} not found") @@ -296,4 +303,4 @@ def cleanup_old_jobs(self): for job_id in expired_jobs: if job_id in self.background_worker.job_status: - del self.background_worker.job_status[job_id] \ No newline at end of file + del self.background_worker.job_status[job_id] From d6af69c027e992f27e66bb41bf715d286f01a595 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:27 +0000 Subject: [PATCH 5/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- codewiki/cli/utils/api_errors.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/codewiki/cli/utils/api_errors.py b/codewiki/cli/utils/api_errors.py index 286db4cf..425ed566 100644 --- a/codewiki/cli/utils/api_errors.py +++ b/codewiki/cli/utils/api_errors.py @@ -23,7 +23,10 @@ def handle_api_error( Args: error: The original exception context: Additional context (e.g., module name) - fail_fast: Whether to fail immediately (default: True) + fail_fast: Whether to fail immediately (default: True). Note: this + method always returns an APIError describing the failure; it is + the caller's responsibility to decide whether to raise + immediately or continue based on this flag. Returns: APIError instance @@ -83,6 +86,9 @@ def handle_api_error( if context: message = f"Context: {context}\n\n{message}" + if not fail_fast: + message = f"{message}\n\nNote: fail_fast is disabled; this error will not halt execution." + return APIError(message) @staticmethod @@ -138,3 +144,4 @@ def wrap_api_call(func, *args, fail_fast: bool = True, context: Optional[str] = APIErrorHandler.display_api_error(api_error) return None + From ce3c461aeef64974ea73a67d8d76a116b9dec678 Mon Sep 17 00:00:00 2001 From: "flamingo[bot]" <277372822+flamingo[bot]@users.noreply.github.com> Date: Mon, 7 Sep 2026 05:07:28 +0000 Subject: [PATCH 6/6] fix(adhoc-sweep-fixes): 7 review findings across 6 files --- codewiki/src/be/dependency_analyzer/analysis/cloning.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/codewiki/src/be/dependency_analyzer/analysis/cloning.py b/codewiki/src/be/dependency_analyzer/analysis/cloning.py index 9bf4eedf..99e37d15 100644 --- a/codewiki/src/be/dependency_analyzer/analysis/cloning.py +++ b/codewiki/src/be/dependency_analyzer/analysis/cloning.py @@ -134,10 +134,6 @@ def clone_repository(github_url: str) -> str: os.makedirs(os.path.dirname(sparse_checkout_path), exist_ok=True) with open(sparse_checkout_path, "w") as f: f.write("*\n") - f.write("!**/tests/**/CvnF9nAXfESwhrtdkjGhX2wAkKHzwr8N2rjExPK8eZYS/**\n") - f.write( - "!**/0x0000000000000000000000000000000000000000000000000000000000000002/**\n" - ) subprocess.run( [ @@ -259,4 +255,4 @@ def parse_github_url(github_url: str) -> dict: "name": "unknown", "full_name": "unknown", "url": github_url, - } \ No newline at end of file + }