-
Notifications
You must be signed in to change notification settings - Fork 1
fix(adhoc-sweep-fixes): CU-86akdypw4 7 review findings across 6 files #50
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
3448012
485a2cc
d2898d1
618334c
d6af69c
ce3c461
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 |
|---|---|---|
|
|
@@ -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 | ||
|
Comment on lines
23
to
32
Author
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. 𦩠π APIErrorHandler.handle_api_error's fail_fast parameter is accepted but never used inside the method In π€ Prompt for AI agentsfix confidence: π‘ 60 medium β react π/π to teach the reviewer |
||
|
|
@@ -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 | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"] | ||
|
Author
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. 𦩠π΅ Large commented-out README-reading block left in _read_readme_file alongside the active replacement implementation Removed the commented-out dead code block (old unsafe README-reading implementation) from π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
| # 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.""" | ||
|
Comment on lines
337
to
343
Author
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. 𦩠π _get_supported_languages() omits go/rust/csharp despite _filter_supported_languages() including them Updated π€ Prompt for AI agentsfix confidence: π’ 95 high β react π/π to teach the reviewer |
||
|
|
@@ -396,3 +384,4 @@ def analyze_repository_structure_only( | |
| github_url, include_patterns, exclude_patterns | ||
| ) | ||
| return result, None | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: | ||
|
Author
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. 𦩠π Sparse-checkout exclusion patterns contain suspicious hardcoded hash-like path fragments In π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| 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, | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Author
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. 𦩠π job_id used to construct filesystem/cache paths without sanitization, potential path traversal In π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| 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] | ||
| del self.background_worker.job_status[job_id] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,10 @@ | |
| from codewiki.src.config import Config | ||
|
|
||
| # Test repo | ||
|
Author
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. 𦩠π΄ Hardcoded absolute developer path leaked into checked-in test script Replaced the hardcoded absolute path π€ Prompt for AI agentsfix confidence: π’ 92 high β react π/π to teach the reviewer |
||
| 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") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π logger used before assignment in _run_backend_generation when verbose=True at first use site
In
_run_backend_generation(codewiki/cli/adapters/doc_generator.py), movedlogger = logging.getLogger(__name__)out of the two conditionalif self.verbose:blocks (Stage 1 and Stage 2 sections) and placed a single unconditional assignment at the very top of the function, immediately after the docstring. Removed the now-redundantlogger = logging.getLogger(__name__)lines that previously appeared inside the Stage 1 and Stage 2if self.verbose:blocks, sinceloggeris now always bound before any use. This eliminates the fragile pattern entirely: every subsequent reference tologgerin the function (verbose-gated or not) is now guaranteed to be safe, closing off the UnboundLocalError risk described in the finding for any future edit.π€ Prompt for AI agents
fix confidence: π’ 95 high β react π/π to teach the reviewer