Skip to content

fix(download_lt): emit a warning when no checksum available#216

Merged
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:fix/no_hash_warn
Jul 2, 2026
Merged

fix(download_lt): emit a warning when no checksum available#216
mdevolde merged 1 commit into
jxmorris12:masterfrom
mdevolde:fix/no_hash_warn

Conversation

@mdevolde

@mdevolde mdevolde commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

fix(download_lt): emit a warning when no checksum available

Why the pull request was made

To ensure that users are warned when they download a LanguageTool zip for which there isn't any available checksum.

Summary of changes

  • Add a warn in language_tool_python.download_lt._get_zip_hash when no checksum is found.
  • Add language_tool_python.download_lt._external_stacklevel to adapt stacklevel of warnings in language_tool_python.download_lt._get_zip_hash, according to which class the user is using.
  • Adapted doc and tests.

Screenshots (if appropriate):

Not applicable.

How has this been tested?

Applied local tests, looked at the warning issued.

Resources

Not applicable.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (changes to documentation only)
  • Refactor / code style update (non-breaking change that improves code structure or readability)
  • Tests / CI improvement (adding or updating tests or CI configuration only)
  • Chore / maintenance (non-breaking change that does not affect functionality, such as updating dependencies or fixing typos)
  • Other (please describe):

Checklist

  • Followed the project's contributing guidelines.
  • Updated any relevant tests.
  • Updated any relevant documentation.
  • Added comments to your code where necessary.
  • Formatted your code, run the linters, checked types and tests.
  • Added your changes to the CHANGELOG file, if applicable.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR improves the UX and safety signaling of LanguageTool ZIP downloads by warning users when an integrity checksum is unavailable, and adjusts warning attribution so it points to the external caller rather than internal library frames.

Changes:

  • Emit a RuntimeWarning from _get_zip_hash() when no SHA-256 checksum is available for the requested LanguageTool version.
  • Add _external_stacklevel() to dynamically compute warnings.warn(..., stacklevel=...) based on the call chain.
  • Update docs/tests and add a changelog entry for the new warning behavior.

Reviewed changes

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

File Description
tests/unit/test_download_unit.py Adds/updates unit tests to assert warning behavior for missing vs known checksums.
src/language_tool_python/download_lt.py Implements missing-checksum warning and dynamic warning stacklevel computation.
docs/source/references/env_vars.rst Documents that missing checksums now produce a RuntimeWarning and how to configure per-version checksums.
CHANGELOG.md Records the user-visible warning behavior change for downloads without checksums.

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

Comment thread src/language_tool_python/download_lt.py Outdated
Comment thread tests/unit/test_download_unit.py
Comment thread docs/source/references/env_vars.rst
Comment thread CHANGELOG.md Outdated
@codecov-commenter

codecov-commenter commented Jul 2, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (75c7d1e) to head (3a0ba5e).
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #216   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           13        13           
  Lines         1696      1713   +17     
=========================================
+ Hits          1696      1713   +17     

☔ View full report in Codecov by Harness.
📢 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.

@mdevolde mdevolde force-pushed the fix/no_hash_warn branch 2 times, most recently from c33b39a to 0aa4221 Compare July 2, 2026 20:40
Comment thread src/language_tool_python/download_lt.py Dismissed
@mdevolde mdevolde force-pushed the fix/no_hash_warn branch from 0aa4221 to 3a0ba5e Compare July 2, 2026 20:42
@mdevolde mdevolde merged commit 746b41d into jxmorris12:master Jul 2, 2026
13 checks passed
@mdevolde mdevolde deleted the fix/no_hash_warn branch July 2, 2026 20:49
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