fix: Add missing comment argument to Activity constructor#7
Merged
loganthomas merged 1 commit intodevfrom Jan 7, 2026
Merged
Conversation
The utt library's Activity class now requires a 'comment' parameter. This change updates the _entries_to_activities method to pass next_entry.comment when creating Activity objects. Also updates all Entry constructor calls in tests to include the comment parameter (now required by the utt API) and adds regression tests to ensure the comment is properly passed through.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a
TypeErrorthat occurs when runningutt balancedue to a missingcommentargument in theActivityconstructor call.Problem
When running
utt balance, users encounter the following error:Root Cause
The
uttlibrary's API has been updated. BothEntryandActivityclasses now include acommentparameter:Entry.__init__(self, entry_datetime, name, is_current_entry, comment: Optional[str])Activity.__init__(self, name, start, end, is_current_activity, comment: Optional[str])The balance plugin was creating
Activityobjects with only 4 arguments, missing the requiredcommentparameter.Solution
Code Fix
Updated
_entries_to_activities()insrc/utt/plugins/balance.pyto pass the entry's comment through to the Activity:Test Updates
Updated all
Entryconstructor calls intests/test_balance.pyto include thecommentparameter (32 instances), as it is now required by the utt API.Added regression tests to ensure this issue doesn't recur:
test_activity_preserves_entry_comment: Verifies that comments are properly passed from Entry to Activitytest_activity_handles_none_comment: Verifies thatNonecomments are handled gracefullyTesting
All 47 tests pass with 100% coverage:
The
utt balancecommand now works correctly:Background: What is the comment field?
The
commentfield is a utt feature that allows users to add annotations to time entries:This provides additional context without cluttering the task name, and comments appear in
utt reportoutput.