Skip to content

test(dispute): add timeline ordering and monotonicity property tests#1286

Merged
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
Agbasimere:codex/dispute-timeline-properties
Jun 2, 2026
Merged

test(dispute): add timeline ordering and monotonicity property tests#1286
Baskarayelu merged 1 commit into
QuickLendX:mainfrom
Agbasimere:codex/dispute-timeline-properties

Conversation

@Agbasimere
Copy link
Copy Markdown
Contributor

Description

Adds a doc-backed dispute timeline property-test harness and tightens the dispute state machine so timeline ordering, timestamp monotonicity, and terminal resolution are enforced consistently.

Closes #1210

What changed

  • added docs/dispute-timeline-invariants.md as the executable source of truth for dispute timeline ordering
  • added quicklendx-contracts/src/test_dispute_timeline_props.rs
  • added doc-sync assertions so drift between the invariant doc and the test model fails the suite
  • persisted an exact UnderReview timestamp for disputes so the timeline can be strictly monotonic
  • enforced forward-only dispute transitions:
    • create only from None
    • update_dispute_evidence only while Disputed
    • put_dispute_under_review only from Disputed
    • resolve_dispute only from UnderReview
  • exposed get_dispute_timeline through the contract surface
  • documented the audit-trail interplay note that the user-facing timeline is not a replacement for the append-only audit trail

Invariants covered

  • Opened -> UnderReview -> Resolved is the only visible timeline order
  • no duplicate lifecycle entries can appear in the returned timeline
  • accepted transitions produce strictly increasing timeline timestamps when ledger timestamps increase
  • illegal orderings are rejected deterministically
  • Resolved is terminal and cannot be re-reviewed, re-resolved, or have evidence rewritten

Testing

Validated locally with:

  • cargo check --lib
  • cargo check --tests

I also ran cargo test test_dispute_timeline_props --lib far enough to confirm the new tests themselves passed:

  • test_dispute_timeline_props_doc_sync
  • test_dispute_timeline_props_resolve_is_terminal
  • test_dispute_timeline_props_randomized_sequences

The full command could not complete cleanly in this Windows GNU environment because linking/artifact generation eventually ran into local disk-space exhaustion in quicklendx-contracts/target.

Notes

  • the randomized harness covers at least 20,000 generated action sequences
  • unrelated local modifications in:
    • quicklendx-contracts/tests/backup_retention_validation.rs
    • quicklendx-contracts/tests/invoice_lifecycle_e2e.rs
      were left untouched and are not part of this commit

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 2, 2026

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

@Baskarayelu Baskarayelu merged commit bf603be into QuickLendX:main Jun 2, 2026
1 check failed
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.

Add dispute timeline ordering and timestamp-monotonicity property tests

2 participants