Skip to content

Conversation

@taladar
Copy link

@taladar taladar commented Dec 17, 2025

see #1318

Basically the Commit serialization was missing the new azure_devops field entirely in its manual Serialize implementation and the Release serialization applied its renaming of all fields to camel case only on serialization, the other fields that would have been affected by that had manual rename attributes on the field level. It might make sense to rethink if renaming all fields to camel case makes sense at all if all fields with multiple words manually revert that anyway.

@taladar taladar requested a review from orhun as a code owner December 17, 2025 11:38
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 43.49%. Comparing base (3ddfb1e) to head (d5ae4a0).

Files with missing lines Patch % Lines
git-cliff-core/src/commit.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1319      +/-   ##
==========================================
+ Coverage   43.48%   43.49%   +0.01%     
==========================================
  Files          23       23              
  Lines        2245     2247       +2     
==========================================
+ Hits          976      977       +1     
- Misses       1269     1270       +1     
Flag Coverage Δ
unit-tests 43.49% <50.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@orhun
Copy link
Owner

orhun commented Dec 17, 2025

The CI seems to be failing, can you look into it?

@taladar
Copy link
Author

taladar commented Dec 17, 2025

I have no idea what your tests are supposed to do, all I did is add the serialization of the field to Commit and change the serde attribute on the field in Release, not sure what any of that would have to do with the three failing tests that also produce no output. Not familiar with the GitHub interface for tests.

@orhun
Copy link
Owner

orhun commented Dec 17, 2025

Seems like there is a breaking change:

Variable azureDevops.contributors not found in context while rendering 'body'

This variable is now azure_devops...

Why are we renaming this to snake_case again?

@taladar
Copy link
Author

taladar commented Dec 17, 2025

You used the annotation

#[serde(rename_all(serialize = "camelCase"))]

on the Release struct. This renames all the fields to camelCase but only on serialization, not deserialization.

All the other fields with multiple words (commit_id, commit_ranges, submodule_commits) have

#[serde(rename = "submodule_commits")]

annotations so I added one of those to this field too since I had to get it to use the same renaming on serialization and deserialization somehow and that was the way that affected the smallest number of fields.

@taladar
Copy link
Author

taladar commented Dec 17, 2025

Obviously another option would be to replace the rename_all with something like

#[serde(rename_all = "camelCase")]

to affect both serialization and deserialization but I don't know if that would affect any backwards compatibility or future plans for how you want to evolve this struct, it seems you are in the middle of a transition to camelCase?

Copy link
Contributor

@ognis1205 ognis1205 left a comment

Choose a reason for hiding this comment

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

I will reserve my judgment on whether this PR should be merged. However, I do think there is some merit in @taladar 's point regarding the inconsistency in the naming of the context field.
That said, the changes in this PR are not backward compatible, which poses a problem for git-cliff's SemVer practices. If the change is truly reasonable, I would recommend discussing it in an issue or discussion, including the timing of a potential release.

Regarding @orhun 's points:

  1. Continuous Integration / Check NodeJS tarball:

This was already addressed in PR #1322, so it can be ignored here.

  1. Test fixtures:

.github/fixtures/test-azure-devops-integration-custom-range/cliff.toml#L31
.github/fixtures/test-azure-devops-integration/cliff.toml#L31

These two test fixtures should be updated to reflect the changes introduced in this PR.

@taladar
Copy link
Author

taladar commented Dec 20, 2025

Technically the original change to expect a new field in the context JSON was not semver compatible either. I would assume any compatibility here should primarily be between the JSON generate by --context and consumed by --from-context within any given version which is currently not compatible. I don't particularly care which bits are renamed to resolve this but the current solution of producing camelCase and consuming snake_case is not sensible.

And of course the other fix should be included either way, the one where Commit does not serialize the field at all currently.

Copy link
Contributor

@ognis1205 ognis1205 left a comment

Choose a reason for hiding this comment

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

Technically the original change to expect a new field in the context JSON was not semver compatible either. I would assume any compatibility here should primarily be between the JSON generate by --context and consumed by --from-context within any given version which is currently not compatible. I don't particularly care which bits are renamed to resolve this but the current solution of producing camelCase and consuming snake_case is not sensible.

And of course the other fix should be included either way, the one where Commit does not serialize the field at all currently.

Thanks for the clarification. Without concrete logs shared earlier in an issue, it took me some time to fully grasp the situation, but I think I now understand what the problem is.

From what I can see, the core issue is that the custom serializer for Commit does not serialize the azure_devops field correctly. Therefore, as mentioned in my review, I believe the required fix is confined to that single place.

UPDATE (22/12/2025):

@orhun

I've reviewed this PR again, taking into account the existing conventions, and I believe the changes in this PR are consistent with them.

That said, the variable previously used as azureDevops in templates should be azure_devops to match the existing conventions. Consequently, the relevant test fixtures will need to be updated accordingly. See:

#1319 (review)

#[cfg(feature = "bitbucket")]
commit.serialize_field("bitbucket", &self.bitbucket)?;
#[cfg(feature = "azure_devops")]
commit.serialize_field("azure_devops", &self.azure_devops)?;
Copy link
Contributor

@ognis1205 ognis1205 Dec 21, 2025

Choose a reason for hiding this comment

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

Using Camel Case in JSON is the established convention. Can we change this to azureDevops instead?

This looks good to me.

pub bitbucket: RemoteReleaseMetadata,
/// Contributors.
#[cfg(feature = "azure_devops")]
#[serde(rename = "azure_devops")]
Copy link
Contributor

@ognis1205 ognis1205 Dec 21, 2025

Choose a reason for hiding this comment

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

Do we really need this change?

This looks good to me.

@taladar
Copy link
Author

taladar commented Dec 21, 2025

It is actually two separate fixes. The one you mention and the other problem is that the Release struct has a rename_all annotation that only applies to the derived Serialize but not to the derived Deserialize implementation, keeping the snake_case name for Deserialize while using the camelCase name in Serialize.

@ognis1205
Copy link
Contributor

ognis1205 commented Dec 21, 2025

It is actually two separate fixes. The one you mention and the other problem is that the Release struct has a rename_all annotation that only applies to the derived Serialize but not to the derived Deserialize implementation, keeping the snake_case name for Deserialize while using the camelCase name in Serialize.

Ah, right. Thanks for the clarification, @taladar .

@orhun , why was this implemented asymmetrically? I would have expected something like:

#[serde(rename_all = "camelCase")]

so that both Serialize and Deserialize use the same naming.

See:

#1319 (review)

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.

4 participants