Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion scripts/history_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@ def collect_metrics(workspace: str, scan_result: Dict[str, Any]) -> Dict[str, An
try:
from circular_engine import detect_circular
circ = detect_circular(workspace)
metrics["circular_deps_count"] = circ.get("cycle_count", 0)
# Bug: detect_circular() returns "total_cycles", never "cycle_count" —
# this always silently fell back to the 0 default regardless of how
# many cycles were actually found (found via real-codebase validation:
# circular_deps_count read 0 while the circular_deps list right below
# had 5 entries populated from the same detect_circular() call).
metrics["circular_deps_count"] = circ.get("total_cycles", 0)
metrics["circular_deps"] = []
cycles = circ.get("cycles", circ.get("chains", {}))
if isinstance(cycles, dict):
Expand Down
13 changes: 12 additions & 1 deletion scripts/impact_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,19 @@ def analyze_impact(
test_patterns = [
f"{base}.test.ts", f"{base}.test.js", f"{base}.spec.ts", f"{base}.spec.js",
f"{base}.test.tsx", f"{base}.spec.tsx",
f.replace(".rs", "_test.rs").replace(".py", "_test.py"),
]
# Rust/Python "_test" suffix convention — only applicable to files of
# that extension. Bug: str.replace() is a no-op when the extension
# doesn't match (e.g. a .ts file has no ".rs"/".py" substring), so the
# "pattern" silently degenerated into the original filename `f` itself
# — which trivially exists on disk, causing EVERY affected file to be
# misclassified as its own test file (found via real-codebase
# validation: impact --name signInWithGoogle listed calculator_widget.ts,
# errors.ts, sidepanel.ts as "tests", none of which are test files).
if f.endswith(".rs"):
test_patterns.append(f[:-3] + "_test.rs")
elif f.endswith(".py"):
test_patterns.append(f[:-3] + "_test.py")
for tf in test_patterns:
full_path = os.path.join(workspace, tf)
if os.path.exists(full_path):
Expand Down
Loading