Skip to content

Implement Request Idempotency for Critical Mutations #85

Description

@Mkalbani

Description

Add idempotency key support to critical state-changing endpoints — session submission, reward grants, and NFT minting — so that clients can safely retry requests without risking duplicate side effects. This is especially important given the on-chain integrations where double-processing a mint or reward could have real financial consequences.

Acceptance Criteria

  • An Idempotency-Key header is accepted on POST /sessions, POST /nft/mint, and reward endpoints
  • Idempotency keys are stored with the request hash and response in a IdempotencyRecord entity
  • Replaying a request with the same key returns the original cached response without re-executing
  • Keys expire after a configurable TTL (default 24 hours)
  • Missing idempotency keys on protected endpoints return a 400 with instructions
  • A NestJS interceptor handles idempotency check and cache uniformly across decorated routes
  • Concurrent requests with the same key are serialised — only one executes, others wait for the result
  • Unit tests cover first execution, replay, expiry, concurrency handling, and missing key enforcement

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions