Repository navigation
ci: add workflow to keep flutter_rust_bridge versions in sync - #773
Conversation
Add a weekly and manually triggered workflow that picks the newest stable flutter_rust_bridge release available on pub.dev and crates.io, updates both manifests, both lockfiles and the generated bridge code together, runs checks and opens a single pull request. Adapted from the workflow in pslab-app: the checks mirror this repo's common action, and the system packages that only pslab-app needs are removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G1asXnagFkLjd5fGfWPbfe
Reviewer's GuideImplementationResolve the newest stable version shared by pub.dev and the two crates.io packages so the workflow can update compatible dependencies together.
ConfigurationSchedule and configure the upgrade workflow, and update Dependabot comments to explain that the workflow keeps the ignored package versions in sync.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Linked issuesChecked at commit 3486524 #755 Keep flutter_rust_bridge versions in sync · 5 of 5 met
|
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/flutter_rust_bridge_upgrade.yml" line_range="179" />
<code_context>
+ - name: Commit, open PR, and clean up older upgrade PRs
+ if: steps.verify-latest.outputs.still_latest == 'true'
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ TARGET: ${{ needs.check-and-prepare.outputs.latest_version }}
+ run: |
</code_context>
<issue_to_address>
**Upgrade PRs miss platform checks**
When the workflow creates an upgrade PR with GITHUB_TOKEN, `gh pr create` uses `GITHUB_TOKEN`, so GitHub suppresses the `pull_request` workflows in `pull_request.yml`. The platform build jobs do not run, leaving the upgrade PR without its normal platform checks.
Create the PR with a token that triggers `pull_request` workflows, or explicitly trigger the required checks.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:180`, `.github/workflows/flutter_rust_bridge_upgrade.yml:222`.
</issue_to_address>
### Comment 2
<location path=".github/workflows/flutter_rust_bridge_upgrade.yml" line_range="202" />
<code_context>
+ if git -c "http.https://github.com/.extraheader=${AUTH_HEADER}" ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then
+ echo "Remote branch ${BRANCH_NAME} already exists; verifying upgrade contents before opening PR."
+ git -c "http.https://github.com/.extraheader=${AUTH_HEADER}" fetch --depth=1 origin "refs/heads/${BRANCH_NAME}:refs/remotes/origin/${BRANCH_NAME}"
+ if git diff --quiet HEAD "origin/${BRANCH_NAME}" -- pubspec.yaml pubspec.lock rust/Cargo.toml rust/Cargo.lock lib/src/rust/ rust/src/; then
+ echo "Remote branch ${BRANCH_NAME} verified; skipping push."
+ else
</code_context>
<issue_to_address>
**Untrusted branch becomes bot PR**
When a repository writer pre-creates the predictable upgrade branch with the expected update files plus unrelated changes, the workflow compares the remote branch only on the listed upgrade paths, so unrelated changes on a pre-created branch pass verification and are included when it opens the PR from that branch. The existing-PR lookup also accepts any same-repository PR with that branch name, making untrusted content appear to be the bot's upgrade.
Only reuse a branch or PR after verifying its provenance and that its full diff exactly matches the generated upgrade patch; otherwise abort or recreate it safely.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:184`.
</issue_to_address>
### Comment 3
<location path=".github/workflows/flutter_rust_bridge_upgrade.yml" line_range="185" />
<code_context>
+ BRANCH_NAME="flutter-rust-bridge-upgrade-${TARGET}"
+
+ PR_URL=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$BRANCH_NAME" --state open --json url,headRepositoryOwner | jq -r --arg owner "$GITHUB_REPOSITORY_OWNER" '[.[] | select((.headRepositoryOwner.login // "") == $owner)] | .[0].url // empty')
+ if [ -z "$PR_URL" ]; then
+ git config user.name "dependabot[bot]"
+ git config user.email "49699333+dependabot[bot]@users.noreply.github.com"
</code_context>
<issue_to_address>
**Existing upgrade PR stays stale**
When an upgrade PR for the target version is already open and a later run produces a different patch, `PR_URL` skips the block that applies and pushes the generated patch, and the existing-PR branch only logs that the PR exists. The branch is not refreshed, so the PR omits the new patch and its contents can be out of sync with `main`.
Update and push the newly generated patch to the existing upgrade branch.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:229`.
</issue_to_address>
### Comment 4
<location path=".github/workflows/flutter_rust_bridge_upgrade.yml" line_range="262" />
<code_context>
+ run: |
+ OLD_PRS=$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls?state=open&per_page=100" | jq -r \
+ --arg repo "$GITHUB_REPOSITORY" \
+ --arg exclude_branch "flutter-rust-bridge-upgrade-${LATEST}" \
+ '.[] | select(
+ ((.head.ref // "") | startswith("flutter-rust-bridge-upgrade-"))
</code_context>
<issue_to_address>
**Synced upgrade PR remains open**
When main is synced to the latest version while a bot PR for that version is still open, the cleanup filter excludes the latest-version branch, so the cleanup job leaves its now-obsolete PR open alongside the synced main branch.
Allow cleanup to close the latest-version PR when main is already synced to that release.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:265`.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 4 findings to address first, and if version resolution or generated output is wrong, the workflow can push a branch and open an incorrect upgrade PR; it does not merge that change automatically. The branch and PR can remain after reverting this workflow, but they are bounded and can be closed and deleted.
Blocking findings: .github/workflows/flutter_rust_bridge_upgrade.yml:179, .github/workflows/flutter_rust_bridge_upgrade.yml:202, .github/workflows/flutter_rust_bridge_upgrade.yml:185, .github/workflows/flutter_rust_bridge_upgrade.yml:262
| - name: Commit, open PR, and clean up older upgrade PRs | ||
| if: steps.verify-latest.outputs.still_latest == 'true' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
🟠 High · Upgrade PRs miss platform checks
When the workflow creates an upgrade PR with GITHUB_TOKEN, gh pr create uses GITHUB_TOKEN, so GitHub suppresses the pull_request workflows in pull_request.yml. The platform build jobs do not run, leaving the upgrade PR without its normal platform checks.
Create the PR with a token that triggers pull_request workflows, or explicitly trigger the required checks.
Also at .github/workflows/flutter_rust_bridge_upgrade.yml:180, .github/workflows/flutter_rust_bridge_upgrade.yml:222.
Prompt for AI agents
In `.github/workflows/flutter_rust_bridge_upgrade.yml` at line 179:
**Upgrade PRs miss platform checks**
When the workflow creates an upgrade PR with GITHUB_TOKEN, `gh pr create` uses `GITHUB_TOKEN`, so GitHub suppresses the `pull_request` workflows in `pull_request.yml`. The platform build jobs do not run, leaving the upgrade PR without its normal platform checks.
Create the PR with a token that triggers `pull_request` workflows, or explicitly trigger the required checks.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:180`, `.github/workflows/flutter_rust_bridge_upgrade.yml:222`.| if git -c "http.https://github.com/.extraheader=${AUTH_HEADER}" ls-remote --exit-code --heads origin "$BRANCH_NAME" >/dev/null 2>&1; then | ||
| echo "Remote branch ${BRANCH_NAME} already exists; verifying upgrade contents before opening PR." | ||
| git -c "http.https://github.com/.extraheader=${AUTH_HEADER}" fetch --depth=1 origin "refs/heads/${BRANCH_NAME}:refs/remotes/origin/${BRANCH_NAME}" | ||
| if git diff --quiet HEAD "origin/${BRANCH_NAME}" -- pubspec.yaml pubspec.lock rust/Cargo.toml rust/Cargo.lock lib/src/rust/ rust/src/; then |
There was a problem hiding this comment.
🟡 Medium · Untrusted branch becomes bot PR
When a repository writer pre-creates the predictable upgrade branch with the expected update files plus unrelated changes, the workflow compares the remote branch only on the listed upgrade paths, so unrelated changes on a pre-created branch pass verification and are included when it opens the PR from that branch. The existing-PR lookup also accepts any same-repository PR with that branch name, making untrusted content appear to be the bot's upgrade.
Only reuse a branch or PR after verifying its provenance and that its full diff exactly matches the generated upgrade patch; otherwise abort or recreate it safely.
Also at .github/workflows/flutter_rust_bridge_upgrade.yml:184.
Prompt for AI agents
In `.github/workflows/flutter_rust_bridge_upgrade.yml` at line 202:
**Untrusted branch becomes bot PR**
When a repository writer pre-creates the predictable upgrade branch with the expected update files plus unrelated changes, the workflow compares the remote branch only on the listed upgrade paths, so unrelated changes on a pre-created branch pass verification and are included when it opens the PR from that branch. The existing-PR lookup also accepts any same-repository PR with that branch name, making untrusted content appear to be the bot's upgrade.
Only reuse a branch or PR after verifying its provenance and that its full diff exactly matches the generated upgrade patch; otherwise abort or recreate it safely.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:184`.| BRANCH_NAME="flutter-rust-bridge-upgrade-${TARGET}" | ||
|
|
||
| PR_URL=$(gh pr list --repo "$GITHUB_REPOSITORY" --head "$BRANCH_NAME" --state open --json url,headRepositoryOwner | jq -r --arg owner "$GITHUB_REPOSITORY_OWNER" '[.[] | select((.headRepositoryOwner.login // "") == $owner)] | .[0].url // empty') | ||
| if [ -z "$PR_URL" ]; then |
There was a problem hiding this comment.
🟡 Medium · Existing upgrade PR stays stale
When an upgrade PR for the target version is already open and a later run produces a different patch, PR_URL skips the block that applies and pushes the generated patch, and the existing-PR branch only logs that the PR exists. The branch is not refreshed, so the PR omits the new patch and its contents can be out of sync with main.
Update and push the newly generated patch to the existing upgrade branch.
Also at .github/workflows/flutter_rust_bridge_upgrade.yml:229.
Prompt for AI agents
In `.github/workflows/flutter_rust_bridge_upgrade.yml` at line 185:
**Existing upgrade PR stays stale**
When an upgrade PR for the target version is already open and a later run produces a different patch, `PR_URL` skips the block that applies and pushes the generated patch, and the existing-PR branch only logs that the PR exists. The branch is not refreshed, so the PR omits the new patch and its contents can be out of sync with `main`.
Update and push the newly generated patch to the existing upgrade branch.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:229`.| run: | | ||
| OLD_PRS=$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls?state=open&per_page=100" | jq -r \ | ||
| --arg repo "$GITHUB_REPOSITORY" \ | ||
| --arg exclude_branch "flutter-rust-bridge-upgrade-${LATEST}" \ |
There was a problem hiding this comment.
🟡 Medium · Synced upgrade PR remains open
When main is synced to the latest version while a bot PR for that version is still open, the cleanup filter excludes the latest-version branch, so the cleanup job leaves its now-obsolete PR open alongside the synced main branch.
Allow cleanup to close the latest-version PR when main is already synced to that release.
Also at .github/workflows/flutter_rust_bridge_upgrade.yml:265.
Prompt for AI agents
In `.github/workflows/flutter_rust_bridge_upgrade.yml` at line 262:
**Synced upgrade PR remains open**
When main is synced to the latest version while a bot PR for that version is still open, the cleanup filter excludes the latest-version branch, so the cleanup job leaves its now-obsolete PR open alongside the synced main branch.
Allow cleanup to close the latest-version PR when main is already synced to that release.
Also at `.github/workflows/flutter_rust_bridge_upgrade.yml:265`.|
Build Status: Build workflow failed. Please check the Actions logs for details. Build artifacts to test(Available before failure)
Screenshots |







Fixes #755
Adds a scheduled workflow that keeps the
flutter_rust_bridgeversions in sync. It is adapted from fossasia/pslab-app#3750, with the checks matching this repository's CI and without the system packages that are specific to pslab-app.Dependabot already ignores this package, so only the comments in
.github/dependabot.ymlchanged.Testing
Tested on a fork:
flutter testandcargo check, and opened an upgrade PR.Not tested: the weekly schedule, closing a superseded upgrade PR, platform builds, and a separate lint of the workflow file.
Notes for reviewers
mainare out of date compared withrust/src/api/simple.rs. The first upgrade PR will therefore also include regenerated changes such as function order, IDs and the content hash, plus small lockfile changes.GITHUB_TOKEN. In the fork test, normal PR CI did not run automatically. A run was created awaiting approval and later failed without running any jobs, and I have not determined why. Please say if you would prefer a different token.🤖 Generated with Claude Code
https://claude.ai/code/session_01G1asXnagFkLjd5fGfWPbfe
Summary by Sourcery
Automate synchronized
flutter_rust_bridgeupgrades and keep upgrade pull requests current.New Features:
flutter_rust_bridgeversions are out of sync, validates updates, and opens an upgrade pull request.CI:
flutter_rust_bridgeupdates.Summary by CodeRabbit