From dc0c75cb0403c2e9a91f6820c78010199aa5563c Mon Sep 17 00:00:00 2001 From: AIOSAI Date: Thu, 14 May 2026 20:50:59 -0700 Subject: [PATCH] fix: move seedgo audit to script file (inline Python broke YAML parsing) --- .github/scripts/seedgo_audit.py | 41 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 34 +-------------------------- 2 files changed, 42 insertions(+), 33 deletions(-) create mode 100644 .github/scripts/seedgo_audit.py diff --git a/.github/scripts/seedgo_audit.py b/.github/scripts/seedgo_audit.py new file mode 100644 index 00000000..86cae082 --- /dev/null +++ b/.github/scripts/seedgo_audit.py @@ -0,0 +1,41 @@ +"""CI gate: run seedgo standards audit across all branches.""" + +import sys +from pathlib import Path + +from aipass.seedgo.apps.handlers.audit.branch_audit import audit_branch +from aipass.seedgo.apps.handlers.bypass.bypass_handler import load_bypass_rules + +THRESHOLD = 80 + +src = Path("src/aipass") +pack = src / "seedgo/apps/handlers/aipass_standards" + +branches = [] +for d in sorted(src.iterdir()): + if d.is_dir() and (d / "apps").is_dir(): + entry = d / "apps" / f"{d.name}.py" + branches.append( + { + "name": d.name, + "path": str(d), + "entry_file": str(entry) if entry.exists() else "", + } + ) + +failed = [] +for branch in branches: + bypass_rules = load_bypass_rules(branch["path"]) + result = audit_branch(branch, bypass_rules, pack_path=pack) + avg = result.get("average", 0) + print(f" {branch['name']:>12}: {avg:.0f}%") + if avg < THRESHOLD: + failed.append((branch["name"], avg)) + +if failed: + print(f"\nFAILED: {len(failed)} branch(es) below {THRESHOLD}%") + for name, score in failed: + print(f" {name}: {score:.0f}%") + sys.exit(1) +else: + print(f"\nAll {len(branches)} branches pass (>={THRESHOLD}%)") diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 792e03ac..59fd1f87 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,39 +49,7 @@ jobs: python -m pip install --upgrade pip pip install -e ".[dev]" - name: Run seedgo standards audit - run: python -c " - import sys - from pathlib import Path - from aipass.seedgo.apps.handlers.audit.branch_audit import audit_branch - from aipass.seedgo.apps.handlers.bypass.bypass_handler import load_bypass_rules - - src = Path('src/aipass') - pack = src / 'seedgo/apps/handlers/aipass_standards' - - branches = [] - for d in sorted(src.iterdir()): - if d.is_dir() and (d / 'apps').is_dir(): - entry = d / 'apps' / f'{d.name}.py' - branches.append({'name': d.name, 'path': str(d), - 'entry_file': str(entry) if entry.exists() else ''}) - - failed = [] - for branch in branches: - bypass_rules = load_bypass_rules(branch['path']) - result = audit_branch(branch, bypass_rules, pack_path=pack) - avg = result.get('average', 0) - print(f\" {branch['name']:>12}: {avg:.0f}%\") - if avg < 80: - failed.append((branch['name'], avg)) - - if failed: - print(f\"\nFAILED: {len(failed)} branch(es) below 80%\") - for name, score in failed: - print(f\" {name}: {score:.0f}%\") - sys.exit(1) - else: - print(f\"\nAll {len(branches)} branches pass (>=80%)\") - " + run: python .github/scripts/seedgo_audit.py coverage: name: coverage