Skip to content

test: mutation testing for order/trade logic modules #630

@mostronatorcoder

Description

@mostronatorcoder

Context

Follow-up from #618. Implement mutation testing coverage for the order and trade logic modules — the most critical area in Mostro since it handles real money.

Scope

Target these modules in src/app/:

  • order.rs — Order creation, validation, state transitions
  • orders.rs — Order listing, filtering
  • take_buy.rs — Taking buy orders
  • take_sell.rs — Taking sell orders
  • fiat_sent.rs — Fiat sent confirmation
  • release.rs — Payment release logic
  • cancel.rs — Order cancellation
  • trade_pubkey.rs — Trade key management
  • last_trade_index.rs — Trade index tracking

Goal

  • Run cargo mutants --file src/app/order.rs --file src/app/take_buy.rs ... on each module
  • Document baseline mutation score per module
  • Kill surviving mutants by writing targeted tests
  • Target: >70% mutation score for order/trade modules

Priority Mutants to Kill

  • State transition logic (e.g., activependingsuccess)
  • Price/amount validation boundaries
  • Fee calculation correctness
  • Expiration checks
  • Double-spend prevention guards

Acceptance Criteria

  • Baseline mutation report for each module
  • All critical mutants in state transitions killed
  • All critical mutants in amount/fee validation killed
  • Mutation score documented in PR
  • No regression in existing tests

Ref: #618

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions