Skip to content

ci(automerge): restrict openapi auto-merge to generator-only PRs - #726

Merged
LinoGiger merged 1 commit into
mainfrom
ci(automerge)/restrict-openapi-auto-merge-to-generator-commits
Jul 28, 2026
Merged

ci(automerge): restrict openapi auto-merge to generator-only PRs#726
LinoGiger merged 1 commit into
mainfrom
ci(automerge)/restrict-openapi-auto-merge-to-generator-commits

Conversation

@RapidPoseidon

@RapidPoseidon RapidPoseidon commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Why

The OpenAPI client auto-merge gate (automerge-openapi-client.yml) trusted the branch name as its only trust anchor — its comment read "only a write-access actor can push openapi-generation-main, so the branch name is a sufficient trust anchor."

But that set includes every human and every Poseidon vessel. A hand-written push to that branch can turn the pyright check green and get squash-merged to main with no human review — the gate only asks "is pyright green?", not "is this actually only generated code?".

This exact thing just happened: a Poseidon session pushed a hand-written fix to the branch to unblock a genuinely-broken pyright run, and it auto-merged. The change was correct, but it reached main unreviewed — which is not what auto-merge is supposed to allow.

Notably, pushing a commit to the branch does not change the PR author (it stays the generator app), so an author-of-PR check would not catch this.

What

Before merging, re-verify the PR is genuinely generator-only:

  1. Every commit is authored by the generator identity (login@rapidata.ai). A push from a human or a Poseidon vessel shows up as a foreign commit author.
  2. No files changed outside the generated paths (openapi/schemas/, src/rapidata/api_client/, src/rapidata/api_client_README.md) — exactly the add-paths the generator writes.

If either guard fails, the workflow skips the merge and comments on the PR explaining it needs a human — which also fixes the "why is this PR silently stuck on my board?" confusion.

Legitimate generator PRs (generator-authored commits, generated paths only) still auto-merge unchanged, so this adds no false negatives for the normal case.

Testing

  • YAML parses cleanly.
  • Simulated both guards against real data from the incident: mixed-author / hand-written-path PR → blocked; generator-only commits + paths → merges.

🔗 Session: https://poseidon.rapidata.internal/chat/session-c6c9db5e


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

The auto-merge gate trusted the branch name alone ("only a write-access
actor can push openapi-generation-main"), but that's every human and every
Poseidon vessel — a hand-written push to that branch could turn pyright
green and merge to main with no review. Before merging, re-verify the PR is
genuinely generator-only: every commit authored by the generator identity
and no files changed outside the generated paths. If either fails, skip the
merge and comment on the PR so it's clear it needs a human.

Co-Authored-By: lino <68745352+LinoGiger@users.noreply.github.com>
@LinoGiger
LinoGiger marked this pull request as ready for review July 28, 2026 08:21
@LinoGiger
LinoGiger self-requested a review as a code owner July 28, 2026 08:21
@LinoGiger
LinoGiger merged commit cb697fd into main Jul 28, 2026
1 check passed
@LinoGiger
LinoGiger deleted the ci(automerge)/restrict-openapi-auto-merge-to-generator-commits branch July 28, 2026 08:22
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.

2 participants