Skip to content

ci: check the public API for incompatible changes on every pull request - #158

Open
mogita wants to merge 1 commit into
masterfrom
ci/public-api-check
Open

mogita wants to merge 1 commit into
masterfrom
ci/public-api-check

Conversation

@mogita

@mogita mogita commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Problem

A hand-written PR can remove or change public API without a ! in its title and ship as a minor. The Breaking changes check only looks at .spec-version, so such a PR passes it untouched.

Solution

  • A new "Public API stays compatible" step in the Breaking changes check job compares the public methods and classes between the base tip and the merge commit, with the rules the regen used: a removed public method or class, or a method whose positional arguments moved, lost a default or gained a required one, fails unless the title has ! or the PR is labelled sdk-not-breaking. It now covers all of lib/, skips private and protected methods, and compares keyword arguments by name, since Ruby binds them by name.
  • The regen no longer compares the generated methods itself. It writes breaking footers from the wire lines and its own getstream-ruby sdk lines that chat allowlisted, as stream-sdk-java and getstream-net do, and the Breaking changes check counts those sdk tickets. A regen whose methods break callers in a way chat's check allows (chat matches optional arguments by name) now fails the new step, and the regen's existing "failing required check" heads-up brings a human.
  • The spec step reads the base .spec-version at the merge base, as stream-py does. Comparing against the base tip reported a downgrade on any branch cut before a regen merged.
  • The README describes the new split.

How to verify

  1. This PR changes no Ruby code, so the new step prints "the public API stays compatible".
  2. Locally, against merge commits built the way actions/checkout builds them: v13.3.0 to master reported nothing; v13.0.0 to master reported only the fork_message_i_ds and get_channel changes already judged on feat: regenerate client from openapi-v241.19.0 #119; renaming Client#feed_resource and ConfigurationError failed; renaming a private method passed; for Client#initialize, an optional positional or keyword argument passed, while a removed keyword, a keyword made required, or a moved positional argument failed.
  3. All of it gives the same output under mawk.

A hand-written change never moves .spec-version, so the Breaking changes
check passed it untouched. The surface comparison the regen ran moves into
the check, now over hand-written code too, and the regen writes breaking
footers from its own sdk lines, as stream-sdk-java and getstream-net do.
@getstream-metis

Copy link
Copy Markdown

👋 Hi 🌵, want a second pair of eyes on this?

I'm Jeffery, Stream's review agent. I look for bugs, regressions, missing tests and slow paths, and I only post findings I've checked against the code.

  • Review this PR

Or comment /jeffery review. I'll stay quiet unless you ask.

This branch has not been deployed

No deployments
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