Skip to content

Fix edge cases in conversions, padding, and percent literals - #110

Merged
djhoese merged 6 commits into
pytroll:mainfrom
djhoese:bugfix-claude-finds
Sep 18, 2026
Merged

djhoese merged 6 commits into
pytroll:mainfrom
djhoese:bugfix-claude-finds

Conversation

@djhoese

@djhoese djhoese commented Sep 8, 2026

Copy link
Copy Markdown
Member

This is on top of #108. Claude identified various bugs in the code or things that were not yet implemented. Claude wrote most of the code here with review and suggestions from me. Each commit after the ones in #108 are deliberately separate for each issue that Claude identified. All the issues are edge cases where we're very unlikely to run into these things in our main use cases (i.e. satpy). Here is my summary:

  1. If a fill character is the same as a type letter. So if someone formatted a string and wanted it shifted over 12 characters and to fill any empty space with a "d". That "d" is also the format type for integer and trollsift didn't handle that properly...but how often are people using d/x/f/etc as fill characters?
  2. Fix parsing of values with 0s on the left. See test cases.
  3. If someone used %% in a date format it was sometimes mishandled. Like %Y%%m%d. That %% should be turned into a single % as per the strftime/datetime spec, but trollsift would match the %m instead. The result is a difference between "2026%m08" (correct) versus "2026%0908". Again, who does this? But it was wrong. This was also the most annoying as far as how much code change had to happen for such a simple fix.

@djhoese
djhoese requested review from mraspaud and pnuu September 8, 2026 14:57
@djhoese djhoese self-assigned this Sep 8, 2026
@djhoese djhoese added the bug label Sep 8, 2026
@codecov

codecov Bot commented Sep 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.47%. Comparing base (15a65f4) to head (3cabb01).
⚠️ Report is 27 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
+ Coverage   95.92%   96.47%   +0.54%     
==========================================
  Files           5        5              
  Lines         614      652      +38     
==========================================
+ Hits          589      629      +40     
+ Misses         25       23       -2     
Flag Coverage Δ
unittests 96.47% <100.00%> (+0.54%) ⬆️

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

☔ 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.

@pnuu pnuu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@djhoese
djhoese merged commit a33e451 into pytroll:main Sep 18, 2026
14 checks passed
@djhoese
djhoese deleted the bugfix-claude-finds branch September 18, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants