Skip to content

Conversation

Sajjon
Copy link
Owner

@Sajjon Sajjon commented Jul 9, 2025

Important

Breaking API change, you MUST re-run klirr data init and input your info again. But before you do you can run klirr data dump to print it out in the terminal for easier copy paste.

New Features

  • You can now invoice bi-weekly instead of monthly, using Cadence::BiWeekly.
  • You can now invoice fixed rate per month, per fortnight or per hour instead of being forced to use daily rate.
  • klirr data dump to see your data - even if it fails validation, useful for re-init

Infra

  • Replace TypedBuilder crate with Bon since TypedBuilder is not so actively maintained and the author recommended Bon - Bon has the advantage that custom validation (build returning Result<T> is very easily added). However, Bon has the disadvantage of worse Into impl, resulting in me having to sprinkle into() all over the place.
  • Split tui.rs into smaller parts
  • Add sample_other function to HasSample,
  • Let all types impl HasSample
  • Add more unit tests to previously untested types

@Sajjon Sajjon requested a review from Copilot July 9, 2025 18:14
Copilot

This comment was marked as outdated.

Copy link

codecov bot commented Jul 9, 2025

Codecov Report

Attention: Patch coverage is 96.81529% with 25 lines in your changes missing coverage. Please review.

Project coverage is 95.74%. Comparing base (5173ed2) to head (b044a46).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/core/src/models/data/data.rs 80.85% 9 Missing ⚠️
crates/core/src/logic/calendar_logic.rs 96.00% 4 Missing ⚠️
crates/core/src/logic/command/command.rs 84.61% 4 Missing ⚠️
.../models/data/submodels/year_month_and_fortnight.rs 94.54% 3 Missing ⚠️
...ates/core/src/models/data/submodels/period_anno.rs 94.73% 2 Missing ⚠️
...tes/core/src/models/data/submodels/service_fees.rs 88.23% 2 Missing ⚠️
crates/cli/src/input/time_off_input.rs 90.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #21      +/-   ##
==========================================
- Coverage   96.90%   95.74%   -1.17%     
==========================================
  Files          76       92      +16     
  Lines        1650     2113     +463     
==========================================
+ Hits         1599     2023     +424     
- Misses         51       90      +39     

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

* WIP: cadence and rate logic

* sample_other

* Implement proper elapsed_periods_since for YearMonthAndFortnight

* more tests

* more tests

* set MSRV and README badges

* make it possible to pass time off in hours.

* Refactor TUI, removed superflous generics
@Sajjon Sajjon requested a review from Copilot July 13, 2025 19:16
Copilot

This comment was marked as outdated.

@Sajjon Sajjon requested a review from Copilot July 14, 2025 15:13
Copilot

This comment was marked as outdated.

@Sajjon Sajjon requested a review from Copilot July 15, 2025 08:46
Copilot

This comment was marked as outdated.

@Sajjon Sajjon requested a review from Copilot July 16, 2025 08:23
Copy link

@Copilot 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

This PR introduces invoice cadence and granularity features, allowing bi-weekly invoicing and flexible rate structures (hourly, daily, per fortnight, or monthly). It also replaces the TypedBuilder crate with Bon across the codebase and adds comprehensive testing infrastructure.

Key changes include:

  • Added support for bi-weekly invoice cadence alongside existing monthly cadence
  • Introduced granular rate structures (hourly, daily, fortnight, monthly) instead of forcing daily rates
  • Replaced TypedBuilder with Bon builder pattern throughout the codebase
  • Added extensive unit testing with sample_other() implementations for better test coverage

Reviewed Changes

Copilot reviewed 152 out of 155 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/render/src/typst_context/content.rs Updated builder derive from TypedBuilder to Builder
crates/render/src/render_test_helpers.rs Added generic period type support and mocked exchange rate fetcher
crates/render/src/render.rs Updated test cases to use new period types and rate structures
crates/render/src/lib.rs Replaced TypedBuilder import with Bon Builder
crates/render/Cargo.toml Updated dependencies: removed typed-builder, added bon and derive_more
crates/core/src/models/*.rs Comprehensive updates replacing TypedBuilder with Builder throughout model definitions
Comments suppressed due to low confidence (3)

crates/render/src/render_test_helpers.rs:50

  • [nitpick] The generic parameter name 'Period' is ambiguous. Consider using a more descriptive name like 'TPeriod' or 'InvoicePeriod' to clearly indicate this is a type parameter for period types.
pub fn compare_image_against_expected<Period: IsPeriod>(

crates/render/src/render_test_helpers.rs:136

  • [nitpick] The generic parameter name 'Period' is ambiguous. Consider using a more descriptive name like 'TPeriod' or 'InvoicePeriod' to match the naming convention used in the public function above.
fn generate_pdf_into_png_image<Period: IsPeriod>(

crates/core/src/models/data/submodels/year_month_and_fortnight.rs:742

  • The test validates parsing but doesn't verify that the parsed values are correctly assigned to the struct fields. Consider adding assertions to check that sut.year, sut.month, and sut.half contain the expected values after parsing.
    fn from_str_valid() {

@Sajjon Sajjon requested a review from 0xOmarA July 16, 2025 08:27
@Sajjon Sajjon merged commit 74a56db into main Jul 18, 2025
5 of 7 checks passed
@Sajjon Sajjon deleted the invoice_cadence_and_granularity branch July 18, 2025 12:26
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.

1 participant