Skip to content

[Enhancement] Implement Persistent Saga for Capsule Linking Consistency #9

@santhoshh-kumar

Description

@santhoshh-kumar

Problem

The current linkCapsules(...) method performs two separate lightweight transactions (LWTs) with manual rollback. If the service crashes between these operations or if the rollback fails, it can leave capsules in an inconsistent state (e.g., capsule A points to B, but B does not point back to A).

This inconsistency breaks chain navigation and can lead to incorrect application behavior.

Proposed Solution

Implement a Persistent Saga to ensure reliable and recoverable capsule linking:

  • Persist saga state before and after each LWT operation
  • Track which steps have completed
  • On failure or application restart, detect and resume incomplete sagas
  • Add appropriate logging and recovery mechanisms

Affected Components

  • CapsuleChainService
  • CapsuleChainRepository
  • New: Saga state entity, repository, and recovery logic

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions