Skip to content

AI-3368: publish Kotlin only from a release PR merge - #2092

Merged
kanat merged 4 commits into
mainfrom
ai-3368-kotlin-release-only
Nov 19, 2026
Merged

kanat merged 4 commits into
mainfrom
ai-3368-kotlin-release-only

Conversation

@kanat

@kanat kanat commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Why

publish-sdk-kotlin.yml published on any push to main whose gradle.properties held a new non-SNAPSHOT version, so a refactor PR that bumped the version published a release (AI-3368). The release flow stays as it is: the merge of a PR from release-kotlin-X.Y.Z publishes and tags.

How it works

push to main
 └─ gh api commits/$GITHUB_SHA/pulls -> merged PRs into main
     ├─ head = release-kotlin-X.Y.Z -> existing checks (version == branch, newer, unpublished) -> releases + tag
     └─ anything else (direct push, other PR) -> ::notice + channel=none

e2f68ff28 (#2072, the 0.7.0 release) is still associated with its PR through the API: head release-kotlin-0.7.0, base main, merged.

Changes

  • version job: pull-requests: read (this job only), GH_TOKEN, and the PR lookup before the version checks. The old "main with a SNAPSHOT or already-tagged version" branch is gone: every non-release push exits earlier.
  • Workflow header and sdks/kotlin/README.md say the same, and say how to recover a release merge whose run says nothing is published: re-run all its jobs (the PR lookup can lag right after the merge). Reasoned from the step, not run live.
  • Behaviour change: a release merge whose version is already tagged now fails already released (red, nothing published) instead of ending green with none.
  • Closes the comment part of AI-3364: the two environment: release comments name the secrets as GetStream organization secrets that the environment does not limit. The environment: release lines are unchanged; AI-3372 tracks limiting the secrets to the release jobs.

Validation

No local workflow run exists, so the step's own run: block is extracted from the YAML and run with gh (real --jq filter over a fixture) and curl stubbed. actionlint is clean.

Case (push to main unless noted) Base Head
PR head release-kotlin-0.8.0, version 0.8.0 releases releases
PR head feature/refactor, version 0.8.0 releases none
no PR (direct push) releases none
release PR not merged / base not main / head release-kotlin-0.8.0x / SNAPSHOT head n/a none
head release-kotlin-0.9.0, version 0.8.0 releases error (mismatch)
pull_request event, release branch releases releases

Mutations (drop the gate, drop merged_at, drop base == main, unanchor or loosen the branch regex, drop exit 0 after none, drop || true, wrong event, keep BRANCH): all 9 killed by the case table.

Unverified: the real workflow on GitHub (the API can lag right after a merge: the lookup then gives none and publishes nothing; unverified), and that the pull-requests: read job permission is enough for commits/{sha}/pulls (documented so; not run).

🤖 Generated with Claude Code

A push to main published whenever gradle.properties held a new non-SNAPSHOT
version. It now asks the API for the pull request that the pushed commit
merged, and publishes only when its head is release-kotlin-X.Y.Z.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

For pushes to main, the Kotlin publishing workflow checks for a merged pull request targeting main from a release-kotlin-X.Y.Z branch. If none matches, it sets channel=none. If one matches, it uses that branch for version checks. Snapshot versions proceed through snapshot validation and timestamping, and versions that match an existing release reach the already-released error path. The README documents the publishing condition and rerun behavior.

Merge Risk: Low · up to 36554

Kotlin releases now publish only when a release-kotlin-X.Y.Z PR merges into main. If another push to main queues while a release run is still pending, that run can be replaced and the release not published. The window is narrow, and the release can be recovered by rerunning the workflow, so the risk is low and the owner should be aware of it.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 976c5d9 and 3655443.

Files selected for processing: 1

  • .github/workflows/publish-sdk-kotlin.yml
Files skipped from review as they are similar to previous changes: 1

  • .github/workflows/publish-sdk-kotlin.yml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 3 remain after this review.

Finishing Touches
Fix failing CI checks

  • Commit to this branch
  • Create a new PR

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Reviewed 1c03f443b merged onto main at bbff046b5 (actionlint clean; the step's run: block run with stubbed gh/curl, including the live API answer for e2f68ff28/#2072, which still resolves to release-kotlin-0.7.0 and publishes).

[Question] R1.2 .github/workflows/publish-sdk-kotlin.yml:40: a non-release PR can still set version=X.Y.Z. It now publishes nothing, but the usual release PR (#2072 changes only gradle.properties) then has no diff, so releasing X.Y.Z needs some other change under sdks/kotlin/**. Failing a non-release PR that sets a new non-SNAPSHOT version would prevent that. This is a separate decision, so it goes to a ticket.

Checked and sound: pull-requests: read is on the version job only and the other jobs are unchanged. A failed gh api call fails the step (red). Snapshot pushes and release PR checks never call gh. The new "already released" error on a release merge is reachable only by re-running a successful release run, or by merging a release PR whose own check already failed (no checks are required on main). Nothing is published in either case, and red is right there. 15 mutations of the step: all non-equivalent ones are killed by the case tables.

Verdict: request changes, for R1.1.

Comment thread sdks/kotlin/README.md
published. Merging it publishes the release and tags the commit `sdk-kotlin-vX.Y.Z`.

Other merges into `main` publish nothing.
Other merges into `main` publish nothing, even one that sets a new `version`: only the merge of a

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Should fix] R1.1 If the commit-to-PR lookup comes back empty right after a release merge (API lag), the run ends green. It shows only a ::notice and creates no tag. Nothing here, in the workflow header or in the notice tells the owner what to do. The fix is to re-run all jobs of that run: a re-run keeps GITHUB_SHA, queries the API again, and finds version above the last tag and not published, so it publishes and tags. Please add one sentence here and in the header (publish-sdk-kotlin.yml:12-13), e.g. "If the run of a release merge says Nothing is published, re-run all its jobs". Please also say in the PR body that a release merge whose version is already tagged now fails "already released" where it used to give none.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 7c35b15: the README (sdks/kotlin/README.md:385-387) and the workflow header (:13-14) say a release merge whose run says nothing is published is recovered by re-running all its jobs, and the notice (:70) names the same re-run. Test: author's run-cases.sh pins the notice text in 6 cases; reverting the added sentence changes those 6 notice lines (killed). Header and README wording are text only, so no mutation applies to them.

--jq '.[] | select(.base.ref == "main" and .merged_at != null) | .head.ref')
release=$(grep -xE 'release-kotlin-[0-9]+\.[0-9]+\.[0-9]+' <<< "$heads" | head -1 || true)
if [ -z "$release" ]; then
echo "::notice::Nothing is published: this push is not the merge of a release-kotlin-X.Y.Z pull request."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

[Should fix] R1.1 (same finding) Please name the recovery in this notice too, e.g. ... pull request. If it was one, re-run this workflow. The person who just merged a release only sees this line on a green run.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Fixed in 7c35b15: the README (sdks/kotlin/README.md:385-387) and the workflow header (:13-14) say a release merge whose run says nothing is published is recovered by re-running all its jobs, and the notice (:70) names the same re-run. Test: author's run-cases.sh pins the notice text in 6 cases; reverting the added sentence changes those 6 notice lines (killed). Header and README wording are text only, so no mutation applies to them.

kanat and others added 3 commits November 19, 2026 10:55
A release merge's run can find no pull request (the API lags right after the merge), and then publishes nothing. Re-running all its jobs recovers it. Say so in the workflow header, the README and the notice.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The workflow comments said the signing key and the repository endpoint live in the release environment. They are GetStream organization secrets, which the environment does not limit; moving them into it is AI-3372.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to GitHub limitations.

⚠️ Outside diff range comments (1)

Minor · Keep pending release runs in the queue. · publish-sdk-kotlin.yml:31-33

.github/workflows/publish-sdk-kotlin.yml:31-33
Minor · Stability & Availability · Quick win

Keep pending release runs in the queue.

If a main run is active, a release merge waits behind it. A subsequent Kotlin push cancels that pending release run, even with cancel-in-progress: false. (docs.github.com) The later non-release run now selects channel=none, so it does not publish the release. Use a queue that retains pending runs while preserving serialization.

Review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 1c03f44 and 976c5d9.

Files selected for processing: 2

  • .github/workflows/publish-sdk-kotlin.yml
  • sdks/kotlin/README.md
Files skipped from review as they are similar to previous changes: 1

  • .github/workflows/publish-sdk-kotlin.yml

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

@kanat kanat left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

VERDICT: GO (delta round 2, head 3655443, merged onto main bbff046)

Prior findings:

  • R1.1 (re-run recovery wording, notice, PR body behaviour change): fixed. Header, README and the ::notice all name the re-run. Mutation: removing the notice sentence changes 7 lines of the case output (killed). PR body states the already-released behaviour change.
  • D1 (environment: release comments): fixed. The org secrets SIGNING_, STREAM_REPO_ are listed for this repo; the repo-level secret list has none of them; the release environment has no branch policy, no protection rules, no environment secrets. Comments now say so. environment: release lines unchanged.
  • D2 (AI-3372 wording in the two comments): accepted. I could not read AI-3372 from Linear in this run, so its title is unverified.

New findings: none blocking.

  • Nit (PR body): "Closes the comment part of AI-3364" is not a Linear close keyword pattern (words not adjacent), but rewording it avoids doubt.

Checks: actionlint clean on publish-sdk-kotlin.yml. Author's run-cases.sh and mutate.sh re-run at head: identical outputs, 9/9 mutants killed. #2072 still maps to its PR through the API. Re-run recovery and API lag are reasoned, not run live (stated in the PR body).

@kanat
kanat marked this pull request as ready for review November 19, 2026 10:01
@kanat
kanat merged commit 048ce4e into main Nov 19, 2026
35 of 36 checks passed
@kanat
kanat deleted the ai-3368-kotlin-release-only branch November 19, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant