Skip to content

Conversation

@jcommelin
Copy link
Member

@jcommelin jcommelin commented Jan 7, 2026

This PR adds a CI workflow that verifies PRs correctly use transient commits.
This is intended as a stepping stone towards verifying auto-generated commits, see #33707.

What this PR adds:

  • scripts/verify_commits.sh - Main verification script
  • .github/workflows/commit_verification.yml - GitHub Actions workflow

Testing locally

The commit at HEAD^^ contains test branch creation scripts. These can be used for testing the functionality of the two shell scripts. To test:

# Checkout the commit with test scripts
git checkout HEAD^^

# Create a test branch based on your current branch (before checkout)
# Save your branch name first:
BASE_BRANCH=$(git rev-parse --abbrev-ref HEAD)
git checkout HEAD^
./scripts/create_test_branch.sh $BASE_BRANCH

# Run verification (should pass)
./scripts/verify_commits.sh $BASE_BRANCH

# Clean up and return
git checkout $BASE_BRANCH && git branch -D ci-x-test-*

Available test scripts:

  • create_test_branch.sh - Creates a branch with valid transient commits (should pass)
  • create_test_branch_fail_conflict.sh - Transient commits cause cherry-pick conflicts (should fail)
  • create_test_branch_fail_transient.sh - Transient commits have net effect (should fail)

🤖 Generated with Claude Code

jcommelin and others added 9 commits January 7, 2026 08:46
…ndling

- Add show_diff_stat() helper to display file changes on verification failure
- Remove spurious `git add -A` in transient verification (cherry-pick stages)
- Track untracked files before/after auto-commit command to exclude
  pre-existing files from tree comparison
- Restore state between transient and auto verification phases
- Improve error messages with human-readable diff stats

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Allows --json output to be piped directly without log messages
corrupting the JSON.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Cherry-pick conflicts indicate that transient commits don't cleanly
separate from substantive commits, which means they have side effects.
Remove the -X theirs fallback and fail immediately on any conflict.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions
Copy link

github-actions bot commented Jan 7, 2026

PR summary 15f6691e7a

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference

Declarations diff

No declarations were harmed in the making of this PR! 🐙

You can run this locally as follows
## summary with just the declaration names:
./scripts/declarations_diff.sh <optional_commit>

## more verbose report:
./scripts/declarations_diff.sh long <optional_commit>

The doc-module for script/declarations_diff.sh contains some details about this script.


No changes to technical debt.

You can run this locally as

./scripts/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

@github-actions github-actions bot added the CI Modifies the continuous integration setup or other automation label Jan 7, 2026
name: Commit Verification

on:
pull_request:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pull_request:
pull_request_target:

I think that it is ok to leave it as pull_request for testing, but it should probably become pull_request_target before merging.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if pull_request_target is better here. On the one hand it means we won't need to manually approve workflow runs, on the other hand, the workflow will have access to secrets so we need to be more careful about security.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll trust your judgement on this: I only have a superficial understanding of the security implications.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's start out with pull_request, I think.

Co-authored-by: damiano <adomani@gmail.com>

# Check if any commits have transient prefix
HAS_TRANSIENT=$(git log --format="%s" "$BASE_SHA..$HEAD_SHA" | \
grep -E "^transient" || true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the prefix transient or transient: (with a colon and space)? Not that it's a particularly common word, but it'd be best to make this check as specific as possible.

Copy link
Collaborator

@adomani adomani Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Later on, there is

TRANSIENT_PREFIX: "transient"

and it would be good to connect the two: would adding them inside an

env:
  TRANSIENT_PREFIX="transient"

avoid repetition? (Or "transient: ", or whatever other string we agree on.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

jcommelin and others added 2 commits January 7, 2026 19:11
Co-authored-by: damiano <adomani@gmail.com>
@adomani
Copy link
Collaborator

adomani commented Jan 7, 2026

Thanks!

My view with anything CI-related is that it is easier and quicker to merge-and-test rapidly. In this case, the workflow is a separate one from the main build, so the main concern may be that there will be some CI error, but not much else.

In case @bryangingechen wants to suggest something more, I'll delegate to him!

bors d=bryangingechen

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 7, 2026

✌️ bryangingechen can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). label Jan 7, 2026
Copy link
Contributor

@bryangingechen bryangingechen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Excited to see how this goes!
bors d+

@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 7, 2026

✌️ jcommelin can now approve this pull request. To approve and merge a pull request, simply reply with bors r+. More detailed instructions are available here.

Co-authored-by: Bryan Gin-ge Chen <bryangingechen@gmail.com>
Copy link
Member Author

@jcommelin jcommelin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

@leanprover-community-mathlib4-bot leanprover-community-mathlib4-bot added the ready-to-merge This PR has been sent to bors. label Jan 7, 2026
mathlib-bors bot pushed a commit that referenced this pull request Jan 7, 2026
This PR adds a CI workflow that verifies PRs correctly use transient commits.
This is intended as a stepping stone towards verifying auto-generated commits, see #33707.

What this PR adds:

- `scripts/verify_commits.sh` - Main verification script
- `.github/workflows/commit_verification.yml` - GitHub Actions workflow
@mathlib-bors
Copy link
Contributor

mathlib-bors bot commented Jan 7, 2026

Pull request successfully merged into master.

Build succeeded:

@mathlib-bors mathlib-bors bot changed the title ci: add commit verification for transient commits [Merged by Bors] - ci: add commit verification for transient commits Jan 7, 2026
@mathlib-bors mathlib-bors bot closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Modifies the continuous integration setup or other automation delegated This pull request has been delegated to the PR author (or occasionally another non-maintainer). ready-to-merge This PR has been sent to bors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants