Skip to content

Conversation

@bearomorphism
Copy link
Collaborator

@bearomorphism bearomorphism commented Feb 9, 2026

Description

Checklist

Was generative AI tooling used to co-author this PR?

  • Yes (please specify the tool below)

Used cursor to generate tests.

Code Changes

  • Add test cases to all the changes you introduce
  • Run uv run poe all locally to ensure this change passes linter check and tests
  • Manually test the changes:
    • Verify the feature/bug fix works as expected in real-world scenarios
    • Test edge cases and error conditions
    • Ensure backward compatibility is maintained
    • Document any manual testing steps performed
  • Update the documentation for the changes

Documentation Changes

  • Run uv run poe doc locally to ensure the documentation pages renders correctly
  • Check and fix any broken links (internal or external)

Expected Behavior

Steps to Test This Pull Request

Check if the new tests are good enough.

https://github.com/commitizen-tools/commitizen/actions/runs/21816593200/job/62939564716?pr=1858

Additional Context

Fixes #1636

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.98%. Comparing base (fbafcaf) to head (681e8ae).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1857   +/-   ##
=======================================
  Coverage   97.98%   97.98%           
=======================================
  Files          60       60           
  Lines        2684     2686    +2     
=======================================
+ Hits         2630     2632    +2     
  Misses         54       54           

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

@bearomorphism
Copy link
Collaborator Author

let me check whether the new tests are strong enough. I expect some of the new tests should fail before the base_provider change

@bearomorphism bearomorphism marked this pull request as ready for review February 9, 2026 07:52
@bearomorphism
Copy link
Collaborator Author

bearomorphism commented Feb 9, 2026

The new test indeed fails in #1858
sweet

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates file-based version providers to respect the configured encoding when reading version files, addressing Windows decode errors for UTF-8 pyproject.toml and other non-ASCII content (Fixes #1636).

Changes:

  • Add FileProvider._get_encoding() and use it for read_text(...) in JsonProvider and TomlProvider.
  • Add provider tests and UTF-8 fixture data covering JSON/TOML reads with non-ASCII content.
  • Add new test data files for composer.json and pyproject.toml encoding scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
commitizen/providers/base_provider.py Reads JSON/TOML using config.settings["encoding"] via _get_encoding()
tests/providers/test_base_provider.py Adds tests validating providers can read UTF-8 files with non-ASCII content
tests/data/encoding_test_pyproject.toml UTF-8 TOML fixture with non-ASCII strings to reproduce/guard the bug
tests/data/encoding_test_composer.json UTF-8 JSON fixture with non-ASCII strings to reproduce/guard the bug

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI commented Feb 9, 2026

@bearomorphism I've opened a new pull request, #1859, to work on those changes. Once the pull request is ready, I'll request review from you.

@bearomorphism bearomorphism merged commit 3b310af into master Feb 9, 2026
20 checks passed
@bearomorphism bearomorphism deleted the fix-provider-encoding branch February 9, 2026 11:47
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.

Сommitizen does not read pyproject in utf-8 correctly.

3 participants