Skip to content

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

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 between the base tip and the merge commit, with the rules the regen used: a removed method, or one whose arguments were renamed, 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 src/ except src/GeneratedModels, whose constructors take named arguments only.
  • The regen no longer compares the generated methods itself. It writes breaking footers from the wire lines and its own getstream-php 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 README describes the new split.

How to verify

  1. This PR changes no PHP code, so the new step prints "the public API stays compatible".
  2. Locally, against merge commits built the way actions/checkout builds them: v13.1.0 to master (31 commits) reported nothing; v12.1.1 to v13.0.0 reported the major's breaks; renaming Client::getBaseUrl() failed; adding an optional argument passed; adding a required one passed only with !.
  3. The regen's footer function, fed specs with getstream-php and stream-py sdk lines, wrote footers for the getstream-php lines only. The awk 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