Skip to content

fix: add comprehensive tests for TTL extension idempotency - #628

Open
NneOdogwu wants to merge 1 commit into
zintarh:mainfrom
NneOdogwu:fix/ttl-extension-idempotent
Open

fix: add comprehensive tests for TTL extension idempotency#628
NneOdogwu wants to merge 1 commit into
zintarh:mainfrom
NneOdogwu:fix/ttl-extension-idempotent

Conversation

@NneOdogwu

@NneOdogwu NneOdogwu commented Aug 12, 2026

Copy link
Copy Markdown

Issue

Repeated TTL extension should be idempotent and should not modify wrap contents.

Issue ID: fa64bb7d-3028-401d-8f82-777d0ca2a420

Changes

Added comprehensive test suite for extend_ttl function to verify idempotent behavior:

Tests Added

  1. test_extend_ttl_idempotent - Core test verifying that calling extend_ttl multiple times does not modify any wrap data:

    • Mints a single wrap
    • Calls extend_ttl three times
    • Asserts that all wrap fields remain unchanged after each call
    • Verifies balance and latest period are preserved
  2. test_extend_ttl_nonexistent_wrap_does_not_panic - Ensures graceful handling of nonexistent wraps:

    • Calls extend_ttl on a wrap that doesn't exist
    • Verifies no panic occurs
    • Confirms balance remains 0
  3. test_extend_ttl_preserves_all_fields - Comprehensive field preservation check:

    • Verifies every field in WrapRecord is unchanged after TTL extension
  4. test_extend_ttl_multiple_wraps - Tests idempotency across multiple wraps:

    • Mints two wraps with different periods
    • Extends both wraps multiple times
    • Verifies both wraps remain unchanged

Test Results

All 4 tests pass ✅

Acceptance Criteria ✅

  • ✅ Mint one wrap and call extend_ttl multiple times
  • ✅ Assert record data, balance, and latest period remain unchanged
  • ✅ Verify TTL extension is idempotent

Key Findings

The extend_ttl function is already idempotent and does not modify wrap contents.
closes #257

- test_extend_ttl_idempotent: Verify multiple extend_ttl calls don't modify wrap data
- test_extend_ttl_nonexistent_wrap_does_not_panic: Ensure nonexistent wraps handle gracefully
- test_extend_ttl_preserves_all_fields: Assert all wrap fields remain unchanged
- test_extend_ttl_multiple_wraps: Test idempotency across multiple wraps

This ensures that repeated TTL extensions are idempotent and don't modify
wrap contents, fixing the issue described in fa64bb7d-3028-401d-8f82-777d0ca2a420.
@drips-wave

drips-wave Bot commented Aug 12, 2026

Copy link
Copy Markdown

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

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.

test: Cover repeated extend_ttl calls

1 participant