Skip to content

crate repackaging#42

Merged
Sajjon merged 5 commits intomainfrom
crate_repackaging
Feb 25, 2026
Merged

crate repackaging#42
Sajjon merged 5 commits intomainfrom
crate_repackaging

Conversation

@Sajjon
Copy link
Copy Markdown
Owner

@Sajjon Sajjon commented Feb 24, 2026

  • merge render-pdf into render-typst
  • refactor, moving logic from core-invoice which need not be there, into foundation instead
  • refactor more file system code into foundation from core-invoice
  • move encryption and rate fetcher into foundation
  • move more models into foundation

Copy link
Copy Markdown
Contributor

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 performs a major crate reorganization to consolidate functionality and reduce dependencies:

Purpose: Merge render-pdf into render-typst and move reusable logic from core-invoice into foundation to create a cleaner separation of concerns.

Changes:

  • Merges the render-pdf crate into render-typst, eliminating the intermediate dependency
  • Moves encryption, exchange rate fetching, calendar logic, and common models from core-invoice to foundation
  • Refactors file system utilities and RON serialization helpers into foundation

Reviewed changes

Copilot reviewed 75 out of 89 changed files in this pull request and generated no comments.

Show a summary per file
File Description
crates/render-typst/src/* Absorbs PDF rendering logic from render-pdf, adds typst context modules
crates/foundation/src/encryption/* Encryption utilities moved from core-invoice
crates/foundation/src/exchange_rates.rs Exchange rate fetching moved from core-invoice
crates/foundation/src/calendar_logic.rs Calendar calculations moved from core-invoice
crates/foundation/src/models/* Common models (Date, Day, Month, Year, etc.) moved from core-invoice
crates/foundation/src/ron.rs RON serialization utilities extracted
crates/foundation/src/runtime.rs Runtime/filesystem utilities extracted
crates/core-invoice/src/* Updated to use foundation types with error mapping
crates/cli/src/migration_guides.rs Migration guide logic extracted into separate module
Cargo.toml Removed render-pdf workspace member

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

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 98.06034% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.88%. Comparing base (69fc569) to head (422c584).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
crates/cli/src/migration_guides.rs 89.28% 3 Missing ⚠️
...-invoice/src/models/deserialize_contents_of_ron.rs 57.14% 3 Missing ⚠️
...rates/core-invoice/src/logic/create_invoice_pdf.rs 77.77% 2 Missing ⚠️
...-invoice/src/models/data/submodels/service_fees.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #42      +/-   ##
==========================================
+ Coverage   95.06%   96.88%   +1.82%     
==========================================
  Files         101      102       +1     
  Lines        2207     2217      +10     
==========================================
+ Hits         2098     2148      +50     
+ Misses        109       69      -40     

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

… and functions from `core-invoice` which arent invoice specific into `foundation` crate, including encryption and rate fetching, which are put behind feature flag
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 76 out of 89 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

crates/foundation/src/models/decimal.rs:56

  • TryFrom<Decimal> for f64 now uses expect(...) on to_f64(), which can legitimately return None for values outside the representable f64 range. This introduces a potential panic in normal code paths (including Serialize), and also makes ModelError::InvalidDecimalToF64Conversion effectively unused. Prefer returning Err(ModelError::InvalidDecimalToF64Conversion { ... }) when to_f64() returns None instead of panicking.

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

Comment on lines +16 to +29
bon.workspace = true
chrono.workspace = true
derive_more.workspace = true
indexmap.workspace = true
log.workspace = true
serde_json.workspace = true
getset.workspace = true
dirs-next.workspace = true
thiserror.workspace = true
typst = "0.13.1"
typst-kit = "0.13.1"
typst-pdf = "0.13.1"
image = { version = "0.25", default-features = false, features = ["png"] }
image-compare = "0.4.2"
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

Several dependencies appear to be test-only or unused in this crate: image/image-compare are only referenced from src/compare_images.rs (compiled under #[cfg(test)] via lib.rs), and typst-kit, serde_json, bon, and dirs-next don't appear to be referenced in src/. Consider moving image-related crates (and any other test-only crates) to [dev-dependencies] and removing genuinely unused deps to keep the dependency graph minimal for consumers.

Copilot uses AI. Check for mistakes.
@Sajjon Sajjon merged commit e5ebdb3 into main Feb 25, 2026
7 checks passed
@Sajjon Sajjon deleted the crate_repackaging branch February 25, 2026 08:29
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.

2 participants