Skip to content

[ci] updates update-release-info to support batch release#10958

Open
chunhtai wants to merge 4 commits intoflutter:mainfrom
chunhtai:release-info
Open

[ci] updates update-release-info to support batch release#10958
chunhtai wants to merge 4 commits intoflutter:mainfrom
chunhtai:release-info

Conversation

@chunhtai
Copy link
Contributor

@chunhtai chunhtai commented Feb 3, 2026

As title

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

await for (final PackageEnumerationEntry entry in getPackagesToProcess()) {
if ((entry.package.parseCIConfig()?.isBatchRelease ?? false) &&
(entry.package.parsePubspec().version?.isPreRelease ?? false)) {
throw UsageException(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note to myself, will need to add checks in #10859 to enforce this

@chunhtai chunhtai marked this pull request as ready for review February 4, 2026 17:57
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request modifies the update-release-info command to support batch releases. For packages configured for batch release, the command now creates a pending changelog YAML file in a pending_changelogs directory instead of directly updating the pubspec.yaml and CHANGELOG.md files. The implementation separates the logic for direct updates and batch release updates into distinct methods. A check has been added to prevent running the command on batch release packages with pre-release versions. New tests have been added to verify the batch release functionality. I have one suggestion to improve code readability.

@stuartmorgan-g stuartmorgan-g changed the title [ci] updates release info command to support batch release [ci] updates update-release-info to support batch release Feb 5, 2026
throw UnimplementedError('Unimplemented version change type');
}

await for (final PackageEnumerationEntry entry in getPackagesToProcess()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this being done here instead of runForPackage? The whole idea of the package-looping-command structure is that things that are evaluated per package are done there.

final Version? version = entry.package.parsePubspec().version;
if ((entry.package.parseCIConfig()?.isBatchRelease ?? false) &&
(version?.isPreRelease ?? false)) {
throw UsageException(
Copy link
Collaborator

Choose a reason for hiding this comment

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

And then it can fail an individual package instead of throwing and canceling the entire command.

nextVersionString = 'NEXT';
final CIConfig? ciConfig = package.parseCIConfig();
if (ciConfig?.isBatchRelease ?? false) {
return _createPendingChangelog(package, versionChange: versionChange);
Copy link
Collaborator

Choose a reason for hiding this comment

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

_createPendingBatchChangelog

A pending changelog in general could refer to either this, or to a NEXT in a changelog file.

}

return PackageResult.success();
return _updateReleaseDirectly(package, versionChange: versionChange);
Copy link
Collaborator

Choose a reason for hiding this comment

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

_updatePubspecAndChangelog

}
}

Future<PackageResult> _updateReleaseDirectly(
Copy link
Collaborator

Choose a reason for hiding this comment

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

These new helpers should have declaration comments explaining what they do; it's not necessarily obvious from the name.

type = VersionChange.patch;
case _VersionIncrementType.build:
throw UnimplementedError(
'Build version changes should not happen in batch mode. Please file an issue if you see this.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not clear to me what this instruction means. If it's not supposed to happen, why should the person file an issue? What would that issue say/request?

If you mean that it's not supported, then it should say that it's not currently supported and that if that's an issue they should file an issue requesting support for build versions in batch changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It can't logically happen because otherwise the tool should have throw UsageError in the earlier stage. If this line is reached, that mean something is wrong with the code

final content =
'''
changelog: |
${changelogEntry.split('\n').map((line) => ' - $line').join('\n')}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't $line need to be quoted in case it has characters that have special meaning in YAML?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is text block after a |, a quick search shows the there is no need to escape yaml special character

''';

final Directory pendingDirectory = package.pendingChangelogsDirectory;
if (!pendingDirectory.existsSync()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this a CI failure in the repo metadata validator? If so, why does this command need to handle it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you are right, will change it to just throw

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