-
Notifications
You must be signed in to change notification settings - Fork 1
fix(CODEWIKI-009): CU-86akn96pk 4 review findings across 4 files #99
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
base: main
Are you sure you want to change the base?
Changes from all commits
9eaf29a
b287376
9833c4b
7f1b41a
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 |
|---|---|---|
|
|
@@ -10,6 +10,32 @@ | |
| from codewiki.src.be.dependency_analyzer.models.core import Node | ||
| from codewiki.src.config import Config | ||
|
|
||
|
|
||
| class TestResults: | ||
| def __init__(self): | ||
| self.tests = [] | ||
|
|
||
| def add_test(self, name, passed, message=""): | ||
| self.tests.append((name, passed, message)) | ||
|
|
||
| def print_summary(self): | ||
| print("\n" + "=" * 80) | ||
| print("π TEST SUMMARY") | ||
| print("=" * 80) | ||
| for name, passed, message in self.tests: | ||
| status = "β PASS" if passed else "β FAIL" | ||
| print(f"{status}: {name}") | ||
| if message: | ||
| print(f" {message}") | ||
| total = len(self.tests) | ||
| passed_count = sum(1 for _, passed, _ in self.tests if passed) | ||
| print(f"\n{passed_count}/{total} tests passed") | ||
| print("=" * 80) | ||
| return all(passed for _, passed, _ in self.tests) | ||
|
|
||
|
|
||
| results = TestResults() | ||
|
|
||
| test_repo = os.getenv("TEST_REPO_PATH", os.path.dirname(os.path.abspath(__file__))) | ||
|
|
||
| config = Config( | ||
|
|
@@ -78,22 +104,30 @@ | |
| print("\nπ RESULTS:\n") | ||
|
|
||
| if len(module_tree) == 0: | ||
|
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. 𦩠π test_clustering_proof.py uses print()/sys.exit() ad-hoc instead of the TestResults accumulator pattern Replaced the ad-hoc print()/sys.exit() pass/fail reporting at the bottom of the script with a local TestResults class (add_test()/print_summary()) mirroring the pattern in test_clustering_validation.py, and recorded the single clustering outcome (empty/one/multiple modules) as a test case via add_test(); the script now exits based on print_summary()'s aggregated result instead of branching sys.exit() calls. Risk: TestResults is defined locally in this file rather than imported from a shared module, since no such shared module currently exists in the repo to import from safely; if test_clustering_validation.py's TestResults is later extracted to a shared module, this file should be updated to import it instead of duplicating the class. π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| print("β FAILED: Empty module tree") | ||
| print(" LLM did NOT follow <GROUPED_COMPONENTS> format") | ||
| sys.exit(1) | ||
| results.add_test( | ||
| "clustering_produces_modules", | ||
| False, | ||
| "Empty module tree - LLM did NOT follow <GROUPED_COMPONENTS> format" | ||
| ) | ||
| elif len(module_tree) == 1: | ||
| print("β οΈ LLM returned 1 module (rejected as too small)") | ||
| print(" But LLM DID follow the tag format correctly!") | ||
| print(f" Module: {list(module_tree.keys())[0]}") | ||
| sys.exit(0) | ||
| results.add_test( | ||
| "clustering_produces_modules", | ||
| True, | ||
| f"LLM returned 1 module (rejected as too small) but followed tag format correctly. " | ||
| f"Module: {list(module_tree.keys())[0]}" | ||
| ) | ||
| else: | ||
| print(f"β β β SUCCESS! {len(module_tree)} modules created β β β ") | ||
| print("\nπ THE FIX IS PROVEN TO WORK! π\n") | ||
| print("Modules generated:") | ||
| modules_desc = [] | ||
| for name, info in module_tree.items(): | ||
| comp_count = len(info.get('components', [])) | ||
| comp_list = info.get('components', [])[:5] | ||
| more = len(info.get('components', [])) - 5 | ||
| print(f" - {name}: {comp_count} components {comp_list}{'...' if more > 0 else ''}") | ||
| sys.exit(0) | ||
| modules_desc.append(f"{name}: {comp_count} components {comp_list}{'...' if more > 0 else ''}") | ||
| results.add_test( | ||
| "clustering_produces_modules", | ||
| True, | ||
| f"{len(module_tree)} modules created. Modules generated:\n - " + "\n - ".join(modules_desc) | ||
| ) | ||
|
|
||
| all_passed = results.print_summary() | ||
| sys.exit(0 if all_passed else 1) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,6 +17,33 @@ | |
| from codewiki.src.be.dependency_analyzer.models.core import Node | ||
| from codewiki.src.config import Config | ||
|
|
||
|
|
||
| class TestResults: | ||
| def __init__(self): | ||
| self.tests = [] | ||
|
|
||
| def add_test(self, name, passed, message=""): | ||
| self.tests.append((name, passed, message)) | ||
|
|
||
| def print_summary(self): | ||
| print("\n" + "=" * 80) | ||
| print("TEST SUMMARY") | ||
| print("=" * 80) | ||
| failed = 0 | ||
| for name, passed, message in self.tests: | ||
| status = "β PASS" if passed else "β FAIL" | ||
| print(f"{status}: {name}") | ||
| if message: | ||
| print(f" {message}") | ||
| if not passed: | ||
| failed += 1 | ||
| print("=" * 80) | ||
| print(f"Total: {len(self.tests)}, Passed: {len(self.tests) - failed}, Failed: {failed}") | ||
| return failed == 0 | ||
|
|
||
|
|
||
| results = TestResults() | ||
|
|
||
| # Test repo | ||
| test_repo = os.getenv("TEST_REPO_PATH", os.path.join(os.path.dirname(os.path.abspath(__file__)), "openframe-oss-tenant")) | ||
|
|
||
|
|
@@ -97,13 +124,21 @@ | |
| print("=" * 80) | ||
|
|
||
| if len(module_tree) == 0: | ||
|
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. 𦩠π test_clustering_simple.py uses ad-hoc print/sys.exit instead of TestResults pattern Replaced the ad-hoc print()/sys.exit() pass/fail reporting at the end of the script (previously π€ Prompt for AI agentsfix confidence: π‘ 75 medium β react π/π to teach the reviewer |
||
| print("\nβ FAILED: Empty module tree") | ||
| print(" LLM did not follow the <GROUPED_COMPONENTS> tag format") | ||
| sys.exit(1) | ||
| results.add_test( | ||
| "clustering produces module tree", | ||
| False, | ||
| "Empty module tree - LLM did not follow the <GROUPED_COMPONENTS> tag format" | ||
| ) | ||
| else: | ||
| print(f"\nβ SUCCESS: {len(module_tree)} modules created") | ||
| detail_lines = [f"{len(module_tree)} modules created"] | ||
| for module_name, module_info in module_tree.items(): | ||
| comp_count = len(module_info.get("components", [])) | ||
| print(f" - {module_name}: {comp_count} components") | ||
| sys.exit(0) | ||
| detail_lines.append(f" - {module_name}: {comp_count} components") | ||
| results.add_test( | ||
| "clustering produces module tree", | ||
| True, | ||
| "\n".join(detail_lines) | ||
| ) | ||
|
|
||
| success = results.print_summary() | ||
| sys.exit(0 if success else 1) | ||
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.
𦩠π test_clustering_local.py test function does not call results.add_test() for every failure path (e.g. exception branch inside try lacks per-assertion granularity) and uses raw sys.exit without full pass/fail bookkeeping for the API-key check
In the
if __name__ == "__main__":block,test_results = TestResults()is now created before the API-key check; the missing-key branch now callstest_results.add_test("api_key_configured", False, ...)andtest_results.print_summary()beforesys.exit(1), and the success branch callstest_results.add_test("api_key_configured", True)so the bookkeeping and summary output reflect the API-key check in all paths.π€ Prompt for AI agents
fix confidence: π’ 90 high β react π/π to teach the reviewer