Skip to content

feat(jolt-prover): generated stage drivers via prover-owned StageProver and universal PrepareKernel #1443

feat(jolt-prover): generated stage drivers via prover-owned StageProver and universal PrepareKernel

feat(jolt-prover): generated stage drivers via prover-owned StageProver and universal PrepareKernel #1443

Workflow file for this run

name: Spec Workflow
on:
pull_request_target:
types: [opened, synchronize, ready_for_review, reopened]
permissions:
contents: read
pull-requests: write
jobs:
spec-labels:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
fetch-depth: 0
- name: Fetch PR head
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: git fetch origin "+refs/pull/${PR_NUMBER}/head"
- name: Detect spec and code changes
id: detect
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
CHANGED=$(git diff --name-only "$BASE"..."$HEAD")
HAS_SPEC=false
HAS_CODE=false
while IFS= read -r file; do
[ -z "$file" ] && continue
case "$file" in
specs/*.md)
# Exclude README and TEMPLATE
basename=$(basename "$file")
if [ "$basename" != "README.md" ] && [ "$basename" != "TEMPLATE.md" ]; then
HAS_SPEC=true
fi
;;
*)
HAS_CODE=true
;;
esac
done <<< "$CHANGED"
echo "has_spec=$HAS_SPEC" >> "$GITHUB_OUTPUT"
echo "has_code=$HAS_CODE" >> "$GITHUB_OUTPUT"
- name: Ensure labels exist
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh label create "spec" --description "PR contains a spec" --color "0E8A16" 2>/dev/null || true
gh label create "no-spec" --description "PR has no spec file" --color "E4E669" 2>/dev/null || true
gh label create "implementation" --description "PR contains implementation of a spec" --color "1D76DB" 2>/dev/null || true
gh label create "claude-spec-review-request" --description "Triggers Claude spec analysis" --color "D4C5F9" 2>/dev/null || true
gh label create "claude-spec-approved" --description "Claude analysis found no ambiguities" --color "5319E7" 2>/dev/null || true
- name: Apply labels
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
HAS_SPEC: ${{ steps.detect.outputs.has_spec }}
HAS_CODE: ${{ steps.detect.outputs.has_code }}
run: |
if [ "$HAS_SPEC" = "true" ]; then
gh pr edit "$PR_NUMBER" --add-label "spec" --remove-label "no-spec" 2>/dev/null || true
else
gh pr edit "$PR_NUMBER" --add-label "no-spec" --remove-label "spec" 2>/dev/null || true
fi
if [ "$HAS_SPEC" = "true" ] && [ "$HAS_CODE" = "true" ]; then
gh pr edit "$PR_NUMBER" --add-label "implementation"
fi
large-pr-warning:
runs-on: ubuntu-latest
if: github.event.action == 'opened' || github.event.action == 'synchronize'
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6
with:
fetch-depth: 0
- name: Fetch PR head
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: git fetch origin "+refs/pull/${PR_NUMBER}/head"
- name: Check PR size
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE: ${{ github.event.pull_request.base.sha }}
HEAD: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
# Count changed lines (additions + deletions), excluding spec files.
# Three-dot diff (`BASE...HEAD`) diffs the merge-base against HEAD so
# unrelated progress on the base branch isn't counted as PR changes.
LINES=$(git diff --numstat "$BASE"..."$HEAD" -- . ':!specs/' | \
awk '$1 != "-" && $2 != "-" { added += $1; removed += $2 } END { print (added + removed) ? added + removed : 0 }')
# Check if any spec file exists in the diff. Pathspec excludes
# README/TEMPLATE directly so the pipeline has no `grep -v`
# (which exits 1 on empty input and would trip `pipefail`).
HAS_SPEC=$(git diff --name-only "$BASE"..."$HEAD" -- 'specs/*.md' ':!specs/README.md' ':!specs/TEMPLATE.md' | head -1)
if [ "$LINES" -gt 500 ] && [ -z "$HAS_SPEC" ]; then
EXISTING=$(gh pr view "$PR_NUMBER" --json comments --jq '.comments[].body' | grep -c "more than 500 changed lines" || true)
if [ "$EXISTING" -eq 0 ]; then
BODY="> [!WARNING]"
BODY="$BODY
> This PR has **more than 500 changed lines** and does not include a spec."
BODY="$BODY
>"
BODY="$BODY
> Large features and architectural changes benefit from a spec-driven workflow."
BODY="$BODY
> See [CONTRIBUTING.md](https://github.com/a16z/jolt/blob/main/CONTRIBUTING.md) for details on how to create a spec."
BODY="$BODY
>"
BODY="$BODY
> If this PR is a bug fix, refactor, or doesn't warrant a spec, feel free to ignore this message."
gh pr comment "$PR_NUMBER" --body "$BODY"
fi
fi