-
Notifications
You must be signed in to change notification settings - Fork 42
librarian: Correctly parse nested commits within BEGIN_COMMIT_OVERRIDE blocks #2120
Description
The librarian release init command currently does not handle commit messages with nested conventional commits as expected. When a commit message includes a BEGIN_COMMIT_OVERRIDE block containing multiple conventional commit messages, the parser should treat each nested message as a separate change.
Current Behavior:
The parser seems to be incorrectly merging parts of the subject of the first nested commit with the bodies of subsequent ones. For example, given a nested commit like:
chore: Update generation configuration at Tue Aug 26 02:31:23 UTC 2025 (#11734)
This pull request is generated with proto changes between
[googleapis/googleapis@525c95a](https://github.com/googleapis/googleapis/commit/525c95a7a122ec2869ae06cd02fa5013819463f6)
(exclusive) and
[googleapis/googleapis@b738e78](https://github.com/googleapis/googleapis/commit/b738e78ed63effb7d199ed2d61c9e03291b6077f)
(inclusive).
BEGIN_COMMIT_OVERRIDE
BEGIN_NESTED_COMMIT
feat: [texttospeech] Support promptable voices by specifying a model
name and a prompt
feat: [texttospeech] Add enum value M4A to enum AudioEncoding
docs: [texttospeech] A comment for method 'StreamingSynthesize' in
service 'TextToSpeech' is changed
docs: [texttospeech] A comment for enum value
'AUDIO_ENCODING_UNSPECIFIED' in enum 'AudioEncoding' is changed
docs: [texttospeech] A comment for enum value 'OGG_OPUS' in enum
'AudioEncoding' is changed
docs: [texttospeech] A comment for enum value 'PCM' in enum
'AudioEncoding' is changed
docs: [texttospeech] A comment for field 'low_latency_journey_synthesis'
in message '.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions' is
changed
docs: [texttospeech] A comment for enum value 'PHONETIC_ENCODING_IPA' in
enum 'PhoneticEncoding' is changed
docs: [texttospeech] A comment for enum value
'PHONETIC_ENCODING_X_SAMPA' in enum 'PhoneticEncoding' is changed
docs: [texttospeech] A comment for field 'phrase' in message
'.google.cloud.texttospeech.v1beta1.CustomPronunciationParams' is
changed
docs: [texttospeech] A comment for field 'pronunciations' in message
'.google.cloud.texttospeech.v1beta1.CustomPronunciations' is changed
docs: [texttospeech] A comment for message 'MultiSpeakerMarkup' is
changed
docs: [texttospeech] A comment for field 'custom_pronunciations' in
message '.google.cloud.texttospeech.v1beta1.SynthesisInput' is changed
docs: [texttospeech] A comment for field 'voice_clone' in message
'.google.cloud.texttospeech.v1beta1.VoiceSelectionParams' is changed
docs: [texttospeech] A comment for field 'speaking_rate' in message
'.google.cloud.texttospeech.v1beta1.AudioConfig' is changed
docs: [texttospeech] A comment for field 'audio_encoding' in message
'.google.cloud.texttospeech.v1beta1.StreamingAudioConfig' is changed
docs: [texttospeech] A comment for field 'text' in message
'.google.cloud.texttospeech.v1beta1.StreamingSynthesisInput' is changed
PiperOrigin-RevId: 799242210
Source Link:
[googleapis/googleapis@b738e78](https://github.com/googleapis/googleapis/commit/b738e78ed63effb7d199ed2d61c9e03291b6077f)
END_NESTED_COMMIT
END_COMMIT_OVERRIDE
The current parser generates the following changes in release-init-request.json.
"changes": [
{
"type": "feat",
"subject": "[texttospeech] Support promptable voices by specifying a model",
"body": "name and a prompt\nfeat: [texttospeech] Add enum value M4A to enum AudioEncoding\ndocs: [texttospeech] A comment for method 'StreamingSynthesize' in\nservice 'TextToSpeech' is changed\ndocs: [texttospeech] A comment for enum value\n'AUDIO_ENCODING_UNSPECIFIED' in enum 'AudioEncoding' is changed\ndocs: [texttospeech] A comment for enum value 'OGG_OPUS' in enum\n'AudioEncoding' is changed\ndocs: [texttospeech] A comment for enum value 'PCM' in enum\n'AudioEncoding' is changed\ndocs: [texttospeech] A comment for field 'low_latency_journey_synthesis'\nin message '.google.cloud.texttospeech.v1beta1.AdvancedVoiceOptions' is\nchanged\ndocs: [texttospeech] A comment for enum value 'PHONETIC_ENCODING_IPA' in\nenum 'PhoneticEncoding' is changed\ndocs: [texttospeech] A comment for enum value\n'PHONETIC_ENCODING_X_SAMPA' in enum 'PhoneticEncoding' is changed\ndocs: [texttospeech] A comment for field 'phrase' in message\n'.google.cloud.texttospeech.v1beta1.CustomPronunciationParams' is\nchanged\ndocs: [texttospeech] A comment for field 'pronunciations' in message\n'.google.cloud.texttospeech.v1beta1.CustomPronunciations' is changed\ndocs: [texttospeech] A comment for message 'MultiSpeakerMarkup' is\nchanged\ndocs: [texttospeech] A comment for field 'custom_pronunciations' in\nmessage '.google.cloud.texttospeech.v1beta1.SynthesisInput' is changed\ndocs: [texttospeech] A comment for field 'voice_clone' in message\n'.google.cloud.texttospeech.v1beta1.VoiceSelectionParams' is changed\ndocs: [texttospeech] A comment for field 'speaking_rate' in message\n'.google.cloud.texttospeech.v1beta1.AudioConfig' is changed\ndocs: [texttospeech] A comment for field 'audio_encoding' in message\n'.google.cloud.texttospeech.v1beta1.StreamingAudioConfig' is changed\ndocs: [texttospeech] A comment for field 'text' in message\n'.google.cloud.texttospeech.v1beta1.StreamingSynthesisInput' is changed",
"source_commit_hash": "fdf2bf4442656f126b12a7cfef7bcea2f7da6d2d",
"piper_cl_number": "799242210\nSource Link:\n[googleapis/googleapis@b738e78](https://github.com/googleapis/googleapis/commit/b738e78ed63effb7d199ed2d61c9e03291b6077f)"
}
],
Expected Behavior:
For commits with BEGIN_COMMIT_OVERRIDE:
- The top-level commit message (e.g.,
chore: Update generation configuration...) should be disregarded for thechangesarray inrelease-init-request.json. - Each conventional commit message within the
BEGIN_NESTED_COMMIT...END_NESTED_COMMITblocks should be parsed as an individual item in thechangesarray. - Each of these derived changes should share the same
source_commit_hashandpiper_cl_numberfrom the overall commit. - The
subjectfor each change should be the complete line after the type/scope prefix, and thebodyshould be empty if there's no body content in the nested commit.
Example from Chat:
For the nested commit:
feat: [texttospeech] Support promptable voices by specifying a model name and a prompt
The expected output in changes is:
{
"type": "feat",
"subject": "[texttospeech] Support promptable voices by specifying a model name and a prompt",
"body": "",
"piper_cl_number": "799242210",
"source_commit_hash": "959b17616c36a6e4779516ab27c53dcf985b723b"
}And similarly for all other feat: and docs: lines within the block.
Impact:
This bug causes incorrect release-init-request.json generation, breaking the contract with language containers and causing E2E test failures as seen in #2078 (comment).