Something went wrong. Try again.
Personal fork of prime agent. Mirror of: https://mnemosyne.sigilzero.dev/sigilzero/prime-agent
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115# Non-blocking, PR-only guidance for files growing past 2,000 lines.name: codebase-healthon: pull_request:permissions: contents: readjobs: # The contributor-trust gate (ported from main's ci.yml — the vouch # mechanism): unvouched PR authors never bill a runner minute, not even # for guidance-only jobs. allow-fail keeps the job green; the gate is the # `allowed` output the loc job keys on. trust: name: contributor trust runs-on: ubuntu-latest outputs: # merge_group auto-allows: the queued candidate already passed the # vouch-gated pull_request wave; the merge-group run is the # full-selection validation of the already-vouched candidate. allowed: ${{ github.event_name == 'push' || github.event_name == 'merge_group' || steps.vouch.outputs.vouched == 'true' }} steps: - name: Check pull request author id: vouch if: github.event_name == 'pull_request' uses: mitchellh/vouch/action/check-user@d66fa29a64600490892131ad87597c30c91fcac4 # v1 with: user: ${{ github.event.pull_request.user.login }} allow-fail: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} loc: needs: trust if: needs.trust.result == 'success' && needs.trust.outputs.allowed == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: persist-credentials: false - name: Report growing Rust files over 2,000 lines continue-on-error: true env: BASE_SHA: ${{ github.event.pull_request.base.sha }} run: | git -C "$GITHUB_WORKSPACE" fetch --no-tags --depth=1 origin "$BASE_SHA" python3 - <<'PY' import os import subprocess from pathlib import Path
root = Path(os.environ['GITHUB_WORKSPACE']) base = os.environ['BASE_SHA'] git = ['git', '-C', str(root)] # --name-status -z -M keeps rename/copy sources, so a rename counts # from the source path, not from zero. out = subprocess.check_output(git + ['diff', '--name-status', '-z', '-M', '--diff-filter=ACMR', base, 'HEAD', '--', '*.rs']) tokens = [os.fsdecode(t) for t in out.split(b'\0')] changed = [] i = 0 while i < len(tokens): status = tokens[i] if not status: i += 1 continue if status[0] in ('R', 'C'): changed.append((tokens[i + 2], tokens[i + 1])) i += 3 else: changed.append((tokens[i + 1], None)) i += 2 findings = [] for path, source in changed: if path == 'crates/pa-ai/src/models_generated.rs': continue before_path = source or path old = subprocess.run(git + ['show', f'{base}:{before_path}'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout before = len(old.splitlines()) # both counts come from git blobs, not the working tree: bounded # reads, immune to symlinks in the checkout after = len(subprocess.check_output( git + ['show', f'HEAD:{path}']).splitlines()) if after > 2000 and after > before: findings.append((path, before, after)) # Annotations are capped at 10 per job by GitHub; the log carries the # full list either way. for path, before, after in findings[:10]: print(f'::warning file={path},line=1,title=File size guidance::' f'{before} -> {after} lines; consider splitting this module') if len(findings) > 10: print('remaining findings beyond the annotation cap:') for path, before, after in findings[10:]: print(f' {before} -> {after} lines: {path}') print(f'{len(findings)} changed Rust file(s) grew beyond 2,000 lines (guidance only).') PY
# The trust gate's own failure made visible (see ci.yml's trust-audit # for the full rationale): always() runs even when the loc job skips or # the trust job itself fails, and this audit fails the required-check # set when the trust gate did not conclude cleanly. trust-audit: name: trust gate audit needs: [trust, loc] if: always() runs-on: ubuntu-24.04 timeout-minutes: 10 steps: - name: Audit the contributor-trust gate's own outcome run: | set -euo pipefail if [ "${{ needs.trust.result }}" != "success" ]; then echo "::error::the contributor-trust gate did not conclude cleanly (result: ${{ needs.trust.result }}) - the wave is NOT trustworthy: the loc gates skipped" exit 1 fi echo "trust gate concluded cleanly (the allowed verdict: ${{ needs.trust.outputs.allowed }})"