Skip to content

ci: add attribution guard - #117

Merged
jsugg merged 1 commit into
mainfrom
ci/attribution-guard
Nov 10, 2026
Merged

jsugg merged 1 commit into
mainfrom
ci/attribution-guard

Conversation

@jsugg

@jsugg jsugg commented Nov 10, 2026

Copy link
Copy Markdown
Owner

Summary

Adds the attribution guard: a required Attribution Guard status check plus local commit-msg and pre-push hooks. The owner rule bans tool attribution (co-author trailers, "made with" footers, session links, tool-namespaced refs, tool emails, tool-named labels), not naming a provider or dependency as the subject of a change.

Server-side check

  • .github/workflows/attribution-guard.yml, job name Attribution Guard.
  • Triggers: pull_request (opened, reopened, synchronize, edited, labeled, unlabeled, ready_for_review) and push to main. No pull_request_target, no path filters, no skip conditions, no actor exemptions.
  • Permissions contents: read, pull-requests: read; every checkout uses persist-credentials: false.
  • PR events refetch the PR through the API (title, body, head ref, labels, and every commit's message and author/committer email, paginated, failing closed if the listing is incomplete). Pushes to main audit before..after only, so existing history is not re-judged.
  • The helper runs from the base commit; only this bootstrap PR falls back to the PR head because the base has no helper yet.
  • After merge, Attribution Guard is added as its own required context on the main ruleset next to required-ci. It stays out of the required-ci aggregate so metadata-only events (edits, labels) re-evaluate it without new commits.

Local hooks

  • commit-msg: pre-commit hook (default_install_hook_types: [commit-msg]), installed by scripts/install_git_hooks.sh. Comment lines and the verbose-diff tail are ignored, as git does.
  • pre-push: the installer's hook feeds git's pushed-ref lines to the guard before the existing gate (it checks each remote ref name and every introduced commit). The pre-commit pre-push-stage hook reads PRE_COMMIT_* refs when present, otherwise the current branch and its unpushed commits.

Patterns and tests

  • The pattern block is vendored byte-for-byte from the shared source and pinned by a SHA-256 test; every shared golden vector is asserted, plus label cases.
  • Behavioral tests use real git repositories (commit-msg, pre-push via stdin and via pre-commit env, new-branch and deletion handling, push-range scoping) and a stub GitHub API (pagination, every offending field reported, fail-closed on incomplete listings).
  • Workflow contract test covers triggers, permissions, job name, credentials, and separation from the CI aggregate.

Validation

make lock-check, make fmt (no changes), make lint, make type, make prepush-check, make type-completeness, make workflow-lint, make ci-contracts (23 passed), make test-cov (1269 passed, 79.99%). The commit and push of this branch went through the new local hooks.

Adds a required "Attribution Guard" check that refetches pull request
metadata (title, body, head ref, labels, every commit message and
author/committer email) on every PR event, including edits and label
changes, and audits each push to main. The helper runs from the base
commit, falling back to the PR head only while bootstrapping.

Local layer: a pre-commit commit-msg hook and a pre-push check of the
pushed refs and introduced commits. The pattern block is vendored
byte-for-byte from the shared source and pinned by a digest test, and
every golden vector is asserted.
@jsugg
jsugg merged commit 0b0fa8a into main Nov 10, 2026
14 checks passed
@jsugg
jsugg deleted the ci/attribution-guard branch November 10, 2026 06:44
jsugg added a commit that referenced this pull request Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant