Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .ceremony-divergences.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Declared divergences from the skeleton ceremony template.
#
# The consumer-parity workflow in runedeck/skeleton renders templates/base
# at the consumer's recorded release and at skeleton main, then compares
# every rendered file with the consumer's copy. A difference is drift
# unless an entry here declares it. An entry names one path, the reason,
# and the SHA-256 of both sides at approval time; when either side moves,
# the entry expires and the difference is drift again until re-approved.
#
# The central copy in skeleton lists the differences every consumer is
# allowed to carry. A consumer appends its own entries to this file; the
# workflow accepts a consumer entry only when the central file approves the
# consumer's copy of this file by digest, so a consumer cannot waive its own
# drift unilaterally.
version: 1
entries: []
8 changes: 4 additions & 4 deletions .cursor/BUGBOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ owner-signed release tags attesting the merged history.
Suppressions, learned from past rounds:

- Pagination on deliberately bounded sets (a repo's own workflows, a
manifest's file list) is not a finding; flag pagination only where the set
manifest's file list) is not a finding. Flag pagination only where the set
genuinely grows without bound.
- Do not re-report a finding another reviewer already posted on this pull
request, and do not re-report a finding already addressed by a later
commit; check the commit history first.
- Severity floor: report medium and above inline; fold nits into one
commit. Check the commit history first.
- Severity floor: report medium and above inline. Fold nits into one
comment.
- `language: system` prek hooks assume the tool is installed by INSTALL.md
or CI; a missing-binary scenario is a finding only when no install path
or CI. A missing-binary scenario is a finding only when no install path
documents the tool.
7 changes: 4 additions & 3 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ scan_tracked_files() {
local scan_failed=false

if ! command -v gitleaks >/dev/null 2>&1; then
echo " ⚠ gitleaks is required for the tracked-file scan" >&2
echo " error: gitleaks is required for the tracked-file scan" >&2
echo " run: make install" >&2
return 1
fi

Expand Down Expand Up @@ -97,7 +98,7 @@ elif [ "$all_files" = "true" ]; then
elif command -v gitleaks >/dev/null 2>&1; then
gitleaks git --staged --pre-commit --no-banner
else
echo " ⚠ neither prek nor gitleaks found — commit checks cannot run" >&2
echo " install: brew install prek gitleaks" >&2
echo " error: neither prek nor gitleaks is available; commit checks cannot run" >&2
echo " run: make install" >&2
exit 1
fi
12 changes: 9 additions & 3 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

# Git exports repository variables into hooks. Child git commands in prek
# hooks and test suites must not inherit them, or they target this
# repository instead of the fixture repositories they create.
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE GIT_PREFIX

zero=0000000000000000000000000000000000000000
hook_directory=$(dirname "$0")

Expand All @@ -18,16 +23,17 @@ check_range() {
local to_revision=$2

if [ -z "$from_revision" ] && command -v prek >/dev/null 2>&1 && [ -f .pre-commit-config.yaml ]; then
GITLEAKS_PUSH_TO_REF="$to_revision" prek run --stage pre-push --all-files
PRE_COMMIT_TO_REF="$to_revision" GITLEAKS_PUSH_TO_REF="$to_revision" \
prek run --stage pre-push --all-files
elif [ -z "$from_revision" ] && command -v gitleaks >/dev/null 2>&1; then
gitleaks git --no-banner --log-opts "$to_revision"
elif command -v prek >/dev/null 2>&1 && [ -f .pre-commit-config.yaml ]; then
prek run --stage pre-push --from-ref "$from_revision" --to-ref "$to_revision"
elif command -v gitleaks >/dev/null 2>&1; then
gitleaks git --no-banner --log-opts "$from_revision..$to_revision"
else
echo " ⚠ neither prek nor gitleaks found — push checks cannot run" >&2
echo " install: brew install prek gitleaks" >&2
echo " error: neither prek nor gitleaks is available; push checks cannot run" >&2
echo " run: make install" >&2
return 1
fi
}
Expand Down
40 changes: 40 additions & 0 deletions .github/rulesets/ceremony-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "ceremony-base",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"include": ["refs/heads/main"],
"exclude": []
}
},
"bypass_actors": [],
"rules": [
{ "type": "deletion" },
{ "type": "non_fast_forward" },
{
"type": "pull_request",
"parameters": {
"allowed_merge_methods": ["merge"],
"dismiss_stale_reviews_on_push": false,
"require_code_owner_review": false,
"require_extra_approval_for_unattributed_changes": true,
"require_last_push_approval": false,
"required_approving_review_count": 0,
"required_review_thread_resolution": true
}
},
{
"type": "required_status_checks",
"parameters": {
"do_not_enforce_on_create": false,
"strict_required_status_checks_policy": false,
"required_status_checks": [
{ "context": "quality", "integration_id": 15368 },
{ "context": "owner-seal", "integration_id": 15368 },
{ "context": "review/correctness", "integration_id": 15368 }
]
}
}
]
}
28 changes: 28 additions & 0 deletions .github/rulesets/owner-veto.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "owner-veto",
"target": "branch",
"enforcement": "active",
"conditions": {
"ref_name": {
"include": ["refs/heads/main"],
"exclude": []
}
},
"bypass_actors": [
{ "actor_id": 5, "actor_type": "RepositoryRole", "bypass_mode": "pull_request" }
],
"rules": [
{
"type": "pull_request",
"parameters": {
"allowed_merge_methods": ["merge"],
"dismiss_stale_reviews_on_push": true,
"require_code_owner_review": true,
"require_extra_approval_for_unattributed_changes": true,
"require_last_push_approval": false,
"required_approving_review_count": 1,
"required_review_thread_resolution": true
}
}
]
}
29 changes: 17 additions & 12 deletions .github/workflows/attestations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Attestations

# Deterministic attestation checks: every commit answers who wrote it,
# and machinery changes carry their specification or the owner's
# explicit waiver. Label events re-evaluate the spec gate, so applying
# spec:none recomputes the check without a push. pull_request_target
# keeps both checks base-defined; the head enters only as fetched
# history and file listings, never as executed code.
# recorded allowed defect. Label events re-evaluate the spec gate, so
# applying ignore:spec recomputes the check without a push.
# pull_request_target keeps both checks base-defined; the head enters
# only as fetched history and file listings, never as executed code.
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled, unlabeled]
Expand All @@ -24,11 +24,16 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# The trusted base enters the worktree. The fetched head supplies
# commit metadata only.
# nosemgrep: yaml.github-actions.security.pull-request-target-code-checkout.pull-request-target-code-checkout
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
# The checker, helper, and policy share the trusted base.
# Both the checker and identity file must come from the base.
# A pull request cannot change either input for its own check.
ref: ${{ github.event.pull_request.base.sha }}
fetch-depth: 0
persist-credentials: false
- name: Verify commit authorship
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
Expand Down Expand Up @@ -63,8 +68,8 @@ jobs:
files=$(gh api --paginate "repos/${{ github.repository }}/pulls/$PR_NUMBER/files?per_page=100" \
--jq '[.[] | .filename, (.previous_filename // empty)]' | jq -s -r 'add // [] | .[]') \
|| { echo "could not read the changed files; rerun the check"; exit 1; }
protected='^(\.github/workflows/|\.githooks/|templates/|schemas/|\.macroscope/)|^(\.pre-commit-config\.yaml|\.gitleaks\.toml|authors\.yaml|scripts/check-authorship|scripts/author-identity\.py)$'
spec_tree='^docs/(specs|openspec)/'
protected='^(\.github/workflows/|\.githooks/|templates/|schemas/|\.macroscope/|\.vale/|scripts/)|^(\.pre-commit-config\.yaml|\.gitleaks\.toml|\.vale\.ini|\.rumdl\.toml|typos\.toml|\.github/zizmor\.yml|\.ceremony-divergences\.yaml|authors\.yaml)$'
spec_tree='^docs/(specs|openspec)/|^docs/changes/[^/]+/specs/[^/]+/spec\.md$'
touched=$(printf '%s\n' "$files" | grep -E "$protected" || true)
if [ -z "$touched" ]; then
echo "no protected paths touched; no specification is required."
Expand All @@ -77,16 +82,16 @@ jobs:
labels=$(gh api --paginate "repos/${{ github.repository }}/issues/$PR_NUMBER/labels?per_page=100" \
--jq '[.[].name]' | jq -s -r 'add // [] | .[]') \
|| { echo "could not read the live labels; rerun the check"; exit 1; }
if printf '%s\n' "$labels" | grep -qx 'spec:none'; then
if printf '%s\n' "$labels" | grep -qx 'ignore:spec'; then
body=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" --jq '.body // ""') \
|| { echo "could not read the pull request body; rerun the check"; exit 1; }
if printf '%s\n' "$body" | grep -qE '^spec:none: .+'; then
echo "spec:none waiver present with its reason."
if printf '%s\n' "$body" | grep -qE '^ignore:spec: .+'; then
echo "ignore:spec allowed defect present with its reason."
exit 0
fi
echo "spec:none is applied but the body carries no 'spec:none: <reason>' line."
echo "ignore:spec is applied but the body carries no 'ignore:spec: <reason>' line."
exit 1
fi
echo "these protected paths change without a specification or a spec:none waiver:"
echo "these protected paths change without a specification or an ignore:spec allowed defect:"
printf '%s\n' "$touched"
exit 1
143 changes: 143 additions & 0 deletions .github/workflows/draft-open.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
name: Draft Open

# The app opens a draft pull request on the first push of a ceremony branch
# that passes the deterministic checks (docs/specs/review-ceremony, Draft by
# the App, Ready by the Owner). The `checks` job calls quality.yaml on the
# pushed head, and the draft opens only when it passes. The draft carries the
# session's ceremony body from docs/changes/<id>/pull-request.md when the
# branch has one, else a placeholder body that passes
# schemas/PULL_REQUEST.mdschema (tests/draft-open-body proves the
# placeholder). A branch that ever had a pull request gets no second draft
# and runs no second quality pass here. Nothing here flips a draft to
# ready: that is the owner's `rune sign open`. The runewright token is
# minted for the create call alone, so the pull request opens under the
# app identity.
on:
push:
branches:
- "change/**"
- "codex/**"
- "fable/**"

permissions: {}

# Two pushes to one branch in quick succession must not race to two
# drafts. The group serializes them and the second finds the first's draft.
concurrency:
group: draft-open-${{ github.ref }}
cancel-in-progress: false

jobs:
existing:
if: github.ref_name != github.event.repository.default_branch && !github.event.deleted
runs-on: ubuntu-latest
timeout-minutes: 2
permissions:
pull-requests: read
outputs:
found: ${{ steps.existing.outputs.found }}
steps:
- name: Find an existing pull request
id: existing
env:
GH_TOKEN: ${{ github.token }}
REPOSITORY: ${{ github.repository }}
OWNER: ${{ github.repository_owner }}
BRANCH: ${{ github.ref_name }}
run: |
set -o pipefail
# state=all: a closed or merged pull request also spends
# the branch's first push. Pages merge through jq -s.
count=$(gh api --paginate "repos/$REPOSITORY/pulls?state=all&head=$OWNER:$BRANCH&per_page=100" \
--jq '[.[].number]' | jq -s 'add // [] | length') \
|| { echo "could not read the pull requests for $BRANCH; rerun the workflow"; exit 1; }
if [ "$count" != "0" ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
echo "$BRANCH already has a pull request, so no second draft opens."
else
echo "found=false" >> "$GITHUB_OUTPUT"
fi

# The deterministic checks on the pushed head. A head that fails them
# gets no draft, so no lane runs on a head the ceremony rejects.
checks:
needs: existing
if: needs.existing.outputs.found == 'false'
uses: ./.github/workflows/quality.yaml
permissions:
contents: read
pull-requests: read

open:
needs: [existing, checks]
if: needs.existing.outputs.found == 'false' && needs.checks.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false

- name: Compose the body
id: body
env:
BRANCH: ${{ github.ref_name }}
HEAD_MESSAGE: ${{ github.event.head_commit.message }}
run: |
set -euo pipefail
change_id=${BRANCH#*/}
title=$(printf '%s\n' "$HEAD_MESSAGE" | head -n 1)
[ -n "$title" ] || title="Draft: $BRANCH"
body="$RUNNER_TEMP/pull-request.md"
if [ -f "docs/changes/$change_id/pull-request.md" ]; then
cp "docs/changes/$change_id/pull-request.md" "$body"
echo "body from docs/changes/$change_id/pull-request.md"
else
cat > "$body" <<EOF
Draft for \`$BRANCH\`: the session agent fills this body before \`rune sign open\`.

## Plan

Why this shape, one or two sentences.

## Changes

- Fill in: verb-first, file-anchored claims the diff upholds.

## Testing

- [ ] Fill in: the command run and its outcome.

## Release Notes

- N/A
EOF
echo "body from the placeholder template"
fi
printf 'title=%s\n' "$title" >> "$GITHUB_OUTPUT"
printf 'body=%s\n' "$body" >> "$GITHUB_OUTPUT"

- id: runewright
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v2
with:
app-id: ${{ secrets.RUNEWRIGHT_APP_ID }}
private-key: ${{ secrets.RUNEWRIGHT_APP_KEY }}
permission-contents: read
permission-pull-requests: write

- name: Open the draft
env:
GH_TOKEN: ${{ steps.runewright.outputs.token }}
REPOSITORY: ${{ github.repository }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
BRANCH: ${{ github.ref_name }}
TITLE: ${{ steps.body.outputs.title }}
BODY: ${{ steps.body.outputs.body }}
run: |
set -euo pipefail
gh pr create --repo "$REPOSITORY" --draft \
--base "$DEFAULT_BRANCH" --head "$BRANCH" \
--title "$TITLE" --body-file "$BODY"
Loading
Loading