Skip to content

Conversation

@d-chambers
Copy link
Contributor

@d-chambers d-chambers commented Oct 4, 2025

This PR fixes #529 by truncating the patch representation in history strings.

Description

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • New Features
    • History displays now truncate Patch objects to a concise “Patch...” placeholder, improving readability and preventing overly long, noisy entries.
  • Tests
    • Added tests to confirm Patch arguments are shortened in history output, exclude detailed patch contents, and keep entries within a compact length.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

Modified _format_values in dascore/utils/patch.py to truncate Patch object representations to "Patch..." in history strings. Added a unit test asserting truncation, absence of detailed content, and a maximum length constraint.

Changes

Cohort / File(s) Summary of Changes
Patch history formatting
dascore/utils/patch.py
Added a branch in _format_values to detect Patch instances and return a shortened placeholder ("Patch...") instead of the full string representation.
Tests for truncation
tests/test_utils/test_patch_utils.py
Introduced test_patch_argument_truncated to verify that history strings truncate patch arguments, omit detailed contents, and stay under 100 characters.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The Pull Request description leaves the ‘## Description’ section empty and retains placeholder comments, and none of the checklist items have been checked off to reference the issue, document docstrings, confirm tests, or mark the PR as ready for review. Please replace the placeholder comments under ‘## Description’ with an actual summary of the changes and their purpose, and complete the checklist by referencing issue #529, adding docstrings, confirming that tests are included, and tagging the PR as ready for review.
Title Check ❓ Inconclusive The title ‘fix 529’ only references the issue number and does not concisely describe the core change of truncating patch representations in history strings, making it vague and unclear what the PR actually does. Please update the title to clearly summarize the change rather than using only the issue number, for example: ‘Truncate patch representation in history strings for patch-to-patch operations’.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The PR implements the core requirement from issue #529 by adding a branch in _format_values to truncate Patch instances to ‘Patch…’ and includes a unit test that verifies truncated history entries, fully satisfying the expected behavior.
Out of Scope Changes Check ✅ Passed The changes are focused solely on truncating patch representations in history and adding a corresponding test, with no unrelated modifications introduced.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_529

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8d7949 and ae7c71d.

📒 Files selected for processing (2)
  • dascore/utils/patch.py (1 hunks)
  • tests/test_utils/test_patch_utils.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
dascore/utils/patch.py (1)
dascore/core/patch.py (1)
  • Patch (28-510)
tests/test_utils/test_patch_utils.py (2)
tests/conftest.py (2)
  • random_patch (282-284)
  • patch (375-377)
dascore/utils/patch.py (1)
  • patch_function (183-289)
🪛 Ruff (0.13.3)
tests/test_utils/test_patch_utils.py

196-196: Unused function argument: other_patch

(ARG001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: test_code (ubuntu-latest, 3.10)
  • GitHub Check: test_code (windows-latest, 3.10)
  • GitHub Check: test_code (windows-latest, 3.11)
  • GitHub Check: test_code (windows-latest, 3.12)
  • GitHub Check: test_code (windows-latest, 3.13)
  • GitHub Check: test_code (macos-latest, 3.12)
  • GitHub Check: test_code (ubuntu-latest, 3.13)
  • GitHub Check: test_code (macos-latest, 3.11)
  • GitHub Check: test_code (macos-latest, 3.10)
  • GitHub Check: test_code (ubuntu-latest, 3.12)
  • GitHub Check: test_code (ubuntu-latest, 3.11)
  • GitHub Check: test_code_min_deps (ubuntu-latest, 3.13)
  • GitHub Check: test_code_min_deps (windows-latest, 3.12)
  • GitHub Check: test_code_min_deps (ubuntu-latest, 3.12)
  • GitHub Check: test_code_min_deps (windows-latest, 3.13)
  • GitHub Check: test_code_min_deps (macos-latest, 3.12)
  • GitHub Check: test_code_min_deps (macos-latest, 3.13)
  • GitHub Check: Run benchmarks
🔇 Additional comments (2)
dascore/utils/patch.py (1)

70-72: LGTM! Effective fix for verbose history entries.

The truncation logic correctly addresses issue #529 by replacing the full Patch string representation with a concise "Patch..." placeholder. This change:

  • Prevents overly verbose history entries when Patch objects are passed as arguments
  • Works correctly with nested structures (lists/tuples of Patches) due to recursive handling in lines 60-62
  • Maintains backward compatibility since it only affects history string formatting
tests/test_utils/test_patch_utils.py (1)

189-211: LGTM! Comprehensive test for patch argument truncation.

The test thoroughly verifies the truncation behavior:

  • Confirms "Patch..." appears in history (line 205)
  • Ensures verbose patch details are excluded (lines 207-208)
  • Validates reasonable length constraint (line 210)

Note on static analysis hint: The Ruff warning about unused other_patch argument at line 196 is a false positive. The argument is intentionally included to test that patch arguments are properly truncated in history strings by the @patch_function decorator machinery, even though the function body doesn't directly reference it.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.92%. Comparing base (f8d7949) to head (ae7c71d).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #565   +/-   ##
=======================================
  Coverage   99.92%   99.92%           
=======================================
  Files         127      127           
  Lines       10622    10624    +2     
=======================================
+ Hits        10614    10616    +2     
  Misses          8        8           
Flag Coverage Δ
unittests 99.92% <100.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.

@d-chambers d-chambers merged commit 9d6b3ae into master Oct 4, 2025
22 checks passed
@d-chambers d-chambers deleted the fix_529 branch October 4, 2025 17:12
@codspeed-hq
Copy link

codspeed-hq bot commented Oct 4, 2025

CodSpeed Performance Report

Merging #565 will not alter performance

Comparing fix_529 (ae7c71d) with master (f8d7949)

Summary

✅ 50 untouched

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.

Patch to patch operations store overly verbose history

2 participants