Skip to content

fix: add tests for issues #283, #294, #298 and enforce CHANGELOG updates in CI - #330

Merged
icentedward76-sketch merged 2 commits into
SoroWill:mainfrom
adeniran19-maker:fix/issues-283-294-298-288-test-coverage-and-changelog-ci
Aug 30, 2026
Merged

fix: add tests for issues #283, #294, #298 and enforce CHANGELOG updates in CI#330
icentedward76-sketch merged 2 commits into
SoroWill:mainfrom
adeniran19-maker:fix/issues-283-294-298-288-test-coverage-and-changelog-ci

Conversation

@adeniran19-maker

Copy link
Copy Markdown

Closes #283
Closes #294
Closes #298
Closes #288

Summary

This PR adds missing test coverage and a CI guard to ensure behavior changes are properly documented in CHANGELOG.md.

Issue #283close_will must reject already-settled wills

No test previously verified that calling close_will twice on the same will panics with WillError::WillNotReleased on the second call.

Fix: Added test_close_will_rejects_already_settled in issue_298_283_294_test.rs. The test creates a will, triggers it, releases it, closes it once, and then asserts that a second close_will returns WillError::WillNotReleased.

Issue #294batch_check_in must be atomic on invalid IDs

batch_check_in loops over will IDs and panics on the first invalid one, but no test explicitly verified that valid wills in the same batch were not checked in when an invalid ID appeared in the middle.

Fix: Added test_batch_check_in_atomicity_on_invalid_id in issue_298_283_294_test.rs. The test passes a batch containing two valid will IDs and one invalid ID, asserts the call panics/returns an error, and then confirms both valid wills' last_checkin timestamps are unchanged.

Issue #298guardian_trigger keeper bounty behavior

distribute() excludes the owner from receiving a keeper bounty (k != &will.owner), but guardian_trigger calls distribute(&env, &mut will, &None), meaning keeper bounties are never paid on guardian-triggered releases regardless of keeper_bounty_bps.

Fix:

  • Updated guardian_trigger's rustdoc to explicitly state that keeper bounties are never paid on guardian-triggered releases.
  • Added test_guardian_trigger_does_not_pay_keeper_bounty in issue_298_283_294_test.rs that creates a will with keeper_bounty_bps = 50, releases it via guardian quorum, and asserts the beneficiary receives the full balance (no bounty deducted).

Issue #288 — Enforce CHANGELOG.md updates in CI

CHANGELOG.md exists but nothing in CI checks that a PR modifying contracts/will/src/lib.rs in a way that changes CONTRACT_VERSION also updates CHANGELOG.md.

Fix:

  • Added .github/scripts/check-changelog.sh which compares the PR's changed files against origin/main and fails if contracts/will/src/lib.rs was modified with a CONTRACT_VERSION change but CHANGELOG.md was not.
  • Wired the script into .github/workflows/test.yml so it runs on every pull_request to main.

Additional fixes (pre-existing CI breakers)

While implementing the above, several pre-existing compilation errors that prevented cargo test --workspace and cargo clippy -- -D warnings from passing were also fixed:

  • Missing GuardianConsent type: Added the GuardianConsent enum to types.rs and exported it from lib.rs.
  • Outdated merge_wills call sites: Updated merge_active_count_test.rs, merge_fixed_amount_test.rs, and merge_rounding_test.rs to use the current (owner, will_id_a, will_id_b) signature.
  • Outdated get_wills_by_beneficiary call sites: Updated fuzz_harness.rs and profile.rs to pass the required cursor and limit arguments.
  • Comparison bug in merge_beneficiaries: Fixed a == addr where a was &Address and addr was Address by dereferencing a.
  • Move semantics in merge_beneficiaries: Cloned beneficiary.allocation before the inner loop and bound the Percentage match arm to a named pattern to avoid borrow-checker errors.
  • Unused variable warnings: Prefixed unused total_fixed with _, removed unused DAY/advance in merge_active_count_test.rs, and removed unused tokens in event_snapshot_test.rs.
  • Broken merge_preserves_all_fixed_amounts test: Fixed test data so fixed amounts sum exactly to the will balance (required by assert_valid_allocations).
  • Broken profile_public_entry_points test: Added missing accept_guardian_role calls before guardian_trigger.

Verification

  • cargo test --workspace60 passed, 0 failed
  • cargo clippy --all-targets -- -D warningspassed

Files changed

  • .github/scripts/check-changelog.sh (new)
  • .github/workflows/test.yml
  • contracts/will/src/issue_298_283_294_test.rs (new)
  • contracts/will/src/lib.rs
  • contracts/will/src/types.rs
  • contracts/will/src/event_snapshot_test.rs
  • contracts/will/src/fuzz_harness.rs
  • contracts/will/src/merge_active_count_test.rs
  • contracts/will/src/merge_fixed_amount_test.rs
  • contracts/will/src/merge_rounding_test.rs
  • contracts/will/src/profile.rs

…d enforce CHANGELOG updates in CI

Issue SoroWill#283 - close_will double-close rejection:
- Add test_close_will_rejects_already_settled that asserts a second
  close_will call on an already-Settled will returns WillError::WillNotReleased.

Issue SoroWill#294 - batch_check_in atomicity:
- Add test_batch_check_in_atomicity_on_invalid_id that mixes valid and
  invalid will ids in a single batch_check_in call, asserts the entire
  transaction aborts, and verifies none of the valid wills were checked in.

Issue SoroWill#298 - guardian_trigger keeper bounty behavior:
- Document in guardian_trigger's rustdoc that keeper bounties are never
  paid on guardian-triggered releases because distribute is called with
  keeper = None.
- Add test_guardian_trigger_does_not_pay_keeper_bounty that creates a
  will with a nonzero keeper_bounty_bps, releases it via guardian quorum,
  and asserts the beneficiary receives the full balance (no bounty deducted).

Issue SoroWill#288 - CHANGELOG CI enforcement:
- Add .github/scripts/check-changelog.sh that fails a PR when
  contracts/will/src/lib.rs changes CONTRACT_VERSION without also
  updating CHANGELOG.md.
- Wire the script into .github/workflows/test.yml so it runs on every
  pull_request.

Additionally fixes pre-existing compilation errors that prevented CI from
passing:
- Add missing GuardianConsent enum to types.rs and export it from lib.rs.
- Update merge_wills call sites in merge_*_test.rs to match the current
  (owner, will_id_a, will_id_b) signature.
- Update get_wills_by_beneficiary call sites in fuzz_harness.rs and
  profile.rs to pass the required cursor and limit arguments.
- Fix comparison in merge_beneficiaries where addr types mismatched.
- Fix move semantics in merge_beneficiaries match by cloning allocation
  and binding the Percentage arm to a named pattern.
- Fix unused variable warnings and dead code in merge_active_count_test.rs.
- Fix FixedAmount-only test data in merge_fixed_amount_test.rs so fixed
  amounts sum exactly to the will balance.
- Add missing accept_guardian_role calls in profile::profile_public_entry_points.

All cargo test --workspace and cargo clippy --all-targets -- -D warnings
pass after these changes.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@adeniran19-maker Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@icentedward76-sketch
icentedward76-sketch merged commit df1f5f3 into SoroWill:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment