spark-debugger
Native runtime state inspector and execution debugger
Brought by drakestapleton
spark-debugger / .github / workflows / sovereign-reviewer.yml
| 1 | name: Sovereign Gatekeeper & Automated Reviewer |
| 2 | |
| 3 | on: |
| 4 | pull_request_target: |
| 5 | types: [opened, synchronize] |
| 6 | issues: |
| 7 | types: [opened] |
| 8 | issue_comment: |
| 9 | types: [created] |
| 10 | |
| 11 | permissions: |
| 12 | pull-requests: write |
| 13 | issues: write |
| 14 | contents: read |
| 15 | |
| 16 | jobs: |
| 17 | pr-reviewer: |
| 18 | if: github.event_name == 'pull_request_target' |
| 19 | runs-on: ubuntu-latest |
| 20 | steps: |
| 21 | - name: Checkout Repository |
| 22 | uses: actions/checkout@v4 |
| 23 | |
| 24 | - name: Checkout Sovereign Inquisitor Core |
| 25 | uses: actions/checkout@v4 |
| 26 | with: |
| 27 | repository: aien-dev/aien-sovereign-core |
| 28 | path: sovereign-core |
| 29 | |
| 30 | - name: Build Sovereign Inquisitor |
| 31 | run: cargo build --release --manifest-path sovereign-core/Cargo.toml -p spark-inquisitor |
| 32 | |
| 33 | - name: Verify Cargo Test Suite |
| 34 | run: cargo test --verbose |
| 35 | |
| 36 | - name: Fetch PR Diff |
| 37 | env: |
| 38 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | run: | |
| 40 | gh pr diff "${{ github.event.pull_request.number }}" > pr.diff |
| 41 | |
| 42 | - name: Execute Sovereign Code Review |
| 43 | id: review |
| 44 | continue-on-error: true |
| 45 | run: | |
| 46 | ./sovereign-core/target/release/spark-inquisitor review --author "${{ github.event.pull_request.user.login }}" --pr "${{ github.event.pull_request.number }}" --title "${{ github.event.pull_request.title }}" --diff pr.diff --output comment.md --output-labels labels.txt |
| 47 | |
| 48 | - name: Post PR Review Comment |
| 49 | if: always() && steps.review.conclusion != 'skipped' |
| 50 | env: |
| 51 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | run: | |
| 53 | if [ -f comment.md ]; then |
| 54 | gh pr comment "${{ github.event.pull_request.number }}" --body-file comment.md |
| 55 | fi |
| 56 | |
| 57 | - name: Apply Review Labels |
| 58 | if: always() && steps.review.conclusion != 'skipped' |
| 59 | env: |
| 60 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 61 | run: | |
| 62 | if [ -f labels.txt ]; then |
| 63 | LABELS=$(cat labels.txt) |
| 64 | if [ -n "$LABELS" ]; then |
| 65 | gh pr edit "${{ github.event.pull_request.number }}" --add-label "$LABELS" || true |
| 66 | fi |
| 67 | fi |
| 68 | |
| 69 | - name: Verify Audit Invariants |
| 70 | run: | |
| 71 | if [ "${{ steps.review.outcome }}" != "success" ]; then |
| 72 | echo "Constitutional diff audit detected violations. See PR comment for details." |
| 73 | exit 1 |
| 74 | fi |
| 75 | |
| 76 | issue-triage: |
| 77 | if: github.event_name == 'issues' && github.event.action == 'opened' |
| 78 | runs-on: ubuntu-latest |
| 79 | steps: |
| 80 | - name: Checkout Sovereign Inquisitor Core |
| 81 | uses: actions/checkout@v4 |
| 82 | with: |
| 83 | repository: aien-dev/aien-sovereign-core |
| 84 | |
| 85 | - name: Build Sovereign Inquisitor |
| 86 | run: cargo build --release -p spark-inquisitor |
| 87 | |
| 88 | - name: Extract Issue Payload Safely |
| 89 | run: | |
| 90 | jq -r '.issue.body // ""' "$GITHUB_EVENT_PATH" > issue_body.txt |
| 91 | |
| 92 | - name: Execute Sovereign Issue Triage |
| 93 | run: | |
| 94 | ./target/release/spark-inquisitor triage-issue --author "${{ github.event.issue.user.login }}" --issue "${{ github.event.issue.number }}" --title "${{ github.event.issue.title }}" --body issue_body.txt --output-comment issue_reply.md --output-labels issue_labels.txt |
| 95 | |
| 96 | - name: Post Issue Triage Comment |
| 97 | env: |
| 98 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 99 | run: | |
| 100 | if [ -f issue_reply.md ]; then |
| 101 | gh issue comment "${{ github.event.issue.number }}" --body-file issue_reply.md |
| 102 | fi |
| 103 | |
| 104 | - name: Apply Issue Labels |
| 105 | env: |
| 106 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 107 | run: | |
| 108 | if [ -f issue_labels.txt ]; then |
| 109 | LABELS=$(cat issue_labels.txt) |
| 110 | if [ -n "$LABELS" ]; then |
| 111 | gh issue edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 112 | fi |
| 113 | fi |
| 114 | |
| 115 | comment-evaluator: |
| 116 | if: github.event_name == 'issue_comment' && github.event.action == 'created' && github.event.issue.pull_request != null && github.event.comment.user.login != 'github-actions[bot]' && github.event.comment.user.login != 'aien-dev' |
| 117 | runs-on: ubuntu-latest |
| 118 | steps: |
| 119 | - name: Checkout Sovereign Inquisitor Core |
| 120 | uses: actions/checkout@v4 |
| 121 | with: |
| 122 | repository: aien-dev/aien-sovereign-core |
| 123 | |
| 124 | - name: Build Sovereign Inquisitor |
| 125 | run: cargo build --release -p spark-inquisitor |
| 126 | |
| 127 | - name: Extract Comment Payload Safely |
| 128 | run: | |
| 129 | jq -r '.comment.body // ""' "$GITHUB_EVENT_PATH" > comment_body.txt |
| 130 | |
| 131 | - name: Evaluate Contributor Testimony |
| 132 | id: eval |
| 133 | continue-on-error: true |
| 134 | run: | |
| 135 | ./target/release/spark-inquisitor evaluate --testimony comment_body.txt --author "${{ github.event.comment.user.login }}" --output-comment verdict.md --output-labels verdict_labels.txt |
| 136 | |
| 137 | - name: Post Verdict Comment |
| 138 | if: always() && steps.eval.conclusion != 'skipped' |
| 139 | env: |
| 140 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 141 | run: | |
| 142 | if [ -f verdict.md ]; then |
| 143 | gh pr comment "${{ github.event.issue.number }}" --body-file verdict.md |
| 144 | fi |
| 145 | |
| 146 | - name: Update PR Labels |
| 147 | if: always() && steps.eval.conclusion != 'skipped' |
| 148 | env: |
| 149 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 150 | run: | |
| 151 | if [ -f verdict_labels.txt ]; then |
| 152 | LABELS=$(cat verdict_labels.txt) |
| 153 | if [ -n "$LABELS" ]; then |
| 154 | gh pr edit "${{ github.event.issue.number }}" --add-label "$LABELS" || true |
| 155 | fi |
| 156 | fi |