Test/insurance batch pay partial results#795
Merged
Baskarayelu merged 2 commits intoJun 19, 2026
Merged
Conversation
Contributor
|
deterministic partial-result accounting for batch_pay_premiums - that path needed the atomicity guarantee. merging 👍 |
Closed
5 tasks
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
Adds comprehensive coverage and documentation for
Insurance::batch_pay_premiumspartial-result behavior and payment accounting.This PR pins and documents deterministic batch semantics for mixed policy batches and ensures payment state transitions remain scoped only to successfully processed policies.
Changes
Tests
Added coverage for mixed batches containing:
PolicyInactive)PolicyNotFound)Added assertions for documented batch processing behavior and returned
u32semantics.Added verification that
next_payment_dateadvances only for successfully paid policies.Added owner-scoping tests to ensure callers cannot pay premiums for policies they do not own.
Added duplicate policy ID coverage to verify deterministic handling (duplicates counted once).
Added empty batch coverage to ensure:
0Added all-invalid batch coverage (returns
0).Added coverage for already-paid-this-period scenarios.
Exercised behavior under larger batch inputs to validate consistency at scale.
Documentation
batch_pay_premiumsbehavior indocs/.Documented Batch Semantics
batch_pay_premiumsfollows skip-and-continue processing.For each policy ID:
Return value:
u32= number of unique policies successfully paid.State updates:
next_payment_dateadvances only for successfully paid policies.Validation
Executed:
cargo test -p insurance batch_pay_premiums -- --nocapture
cargo test -p insurance
cargo clippy
All tests passing with no panics on failure paths and aligned with typed
InsuranceErrorhandling.closes #763