@@ -363,8 +363,6 @@ jobs:
363363 python3 << 'EOF'
364364 import os
365365 import sys
366- import json
367- import re
368366 from pathlib import Path
369367 sys.path.insert(0, '.')
370368
@@ -399,76 +397,51 @@ jobs:
399397 print(f"Could not calculate completion percentage: {e}")
400398 completion_pct = None
401399
402- # Parse pyqual output for metrics and gates
400+ # Parse pyqual output for a simple success signal.
403401 log_file = Path(".pyqual/pyqual_output.log")
404402 pyqual_output = log_file.read_text() if log_file.exists() else ""
405-
406- # Check if all gates passed
403+
404+ # Check if all gates passed.
407405 all_gates_passed = "all_gates_passed: true" in pyqual_output or "result: all_gates_passed" in pyqual_output
408-
409- # Extract metrics from output
410- coverage_match = re.search(r'coverage:\s*(\d+)', pyqual_output)
411- cc_match = re.search(r'cc:\s*(\d+\.?\d*)', pyqual_output)
412- vallm_match = re.search(r'vallm_pass:\s*(\d+\.?\d*)', pyqual_output)
413-
414- coverage = float(coverage_match.group(1)) if coverage_match else None
415- cc = float(cc_match.group(1)) if cc_match else None
416- vallm = float(vallm_match.group(1)) if vallm_match else None
417-
418- # Check test results from log
419- tests_passed = "failed: 0" in pyqual_output or "passed:" in pyqual_output and "failed:" not in pyqual_output
420-
421- # Check pyqual.yaml thresholds
422- coverage_ok = coverage >= 55 if coverage else False
423- cc_ok = cc <= 15 if cc else False
424- vallm_ok = vallm >= 90 if vallm else False
425-
426- # Determine if we can close the issue
427- can_close = all_gates_passed and coverage_ok and cc_ok and vallm_ok and tests_passed
428-
429- print(f"Quality Gates Check:")
406+
407+ # The workflow only reaches this step when `pyqual run` exited 0.
408+ # Use the successful pipeline result as the close signal.
409+ can_close = all_gates_passed
410+
411+ print("Quality Gates Check:")
430412 print(f" all_gates_passed: {all_gates_passed}")
431- print(f" coverage: {coverage}% (threshold: 55%) - {'✓' if coverage_ok else '✗'}")
432- print(f" cc: {cc} (threshold: 15) - {'✓' if cc_ok else '✗'}")
433- print(f" vallm_pass: {vallm}% (threshold: 90%) - {'✓' if vallm_ok else '✗'}")
434- print(f" tests_passed: {tests_passed}")
435413 print(f" can_close_issue: {can_close}")
436-
437- # Check if changes were made
414+
415+ # Check if changes were made.
438416 import subprocess
439417 result = subprocess.run(["git", "status", "--porcelain"], capture_output=True, text=True)
440418 changes = result.stdout.strip()
441-
419+
442420 if can_close:
421+ sha = os.environ.get('GITHUB_SHA', 'unknown')[:8]
422+ pct_str = f"{completion_pct:.1f}%" if completion_pct else "N/A"
423+
443424 if changes:
444- sha = os.environ.get('GITHUB_SHA', 'unknown')[:8]
445- pct_str = f"{completion_pct:.1f}%" if completion_pct else "N/A"
446425 body = "## ✅ Task completed successfully\n\n"
447426 body += f"**Completion: {pct_str}**\n\n"
448- body += "All quality gates passed:\n"
449- body += f"- **Test coverage:** {coverage}% (≥55%)\n"
450- body += f"- **Cyclomatic complexity:** {cc} (≤15)\n"
451- body += f"- **VALLM pass rate:** {vallm}% (≥90%)\n"
452- body += f"- **All tests:** passed\n\n"
427+ body += "All quality gates passed and changes have been made.\n\n"
453428 body += "Changes have been made and pushed to the repository.\n\n"
454429 body += "### Files Modified\n<details>\n<summary>Click to see changes</summary>\n\n```\n"
455430 body += changes[:2000]
456431 body += f"\n```\n</details>\n\n"
457432 body += "---\n"
458433 body += "_Closing this issue as all requirements are met ✓_"
459434 else:
460- body = "## ℹ️ No changes required\n\n"
461- body += "The pipeline ran successfully. All quality gates passed:\n"
462- body += f"- **Test coverage:** {coverage}% (≥55%)\n"
463- body += f"- **Cyclomatic complexity:** {cc} (≤15)\n"
464- body += f"- **VALLM pass rate:** {vallm}% (≥90%)\n\n"
435+ body = "## ✅ Task completed successfully\n\n"
436+ body += f"**Completion: {pct_str}**\n\n"
437+ body += "The pipeline ran successfully and all quality gates passed.\n\n"
465438 body += "---\n"
466439 body += "_Closing this issue as requirements are already met ✓_"
467-
468- # Post success comment
440+
441+ # Post success comment.
469442 reporter.post_issue_comment(body, int(issue_number))
470-
471- # Close the issue
443+
444+ # Close the issue.
472445 if reporter.token and reporter.repo:
473446 import subprocess
474447 close_cmd = [
@@ -486,19 +459,16 @@ jobs:
486459 else:
487460 print(f"✗ Failed to close issue: {result.stderr[:200]}")
488461 else:
489- # Don't close - post status update with completion percentage
462+ # Don't close - post status update with completion percentage.
490463 sha = os.environ.get('GITHUB_SHA', 'unknown')[:8]
491464 pct_str = f"{completion_pct:.1f}%" if completion_pct else "N/A"
492465 body = f"## 📊 Quality Gates Status - {pct_str} Complete\n\n"
493466 body += "Pipeline completed but not all requirements met:\n\n"
494467 body += f"- **all_gates_passed:** {'✓' if all_gates_passed else '✗'}\n"
495- body += f"- **coverage:** {coverage}% {'✓' if coverage_ok else '✗ (need ≥55%)'}\n"
496- body += f"- **cc:** {cc} {'✓' if cc_ok else '✗ (need ≤15)'}\n"
497- body += f"- **vallm_pass:** {vallm}% {'✓' if vallm_ok else '✗ (need ≥90%)'}\n"
498- body += f"- **tests:** {'✓ passed' if tests_passed else '✗ failed'}\n\n"
468+ body += "- **pipeline:** completed, but manual review required\n\n"
499469 body += "Issue remains open - manual review required.\n\n"
500470 body += f"---\n_Processed at: {sha}_"
501-
471+
502472 reporter.post_issue_comment(body, int(issue_number))
503473 print(f"✗ Issue #{issue_number} remains open - quality gates not fully met")
504474
0 commit comments