Skip to content

[Task]: Make governance lifecycle transitions atomic #10

Description

@rian-be

Summary

Make governance lifecycle transitions atomic so concurrent request updates cannot both succeed against the same stale request snapshot.

Goal

Ensure governed mutation requests move through lifecycle transitions with explicit concurrency protection instead of Get + validate + Store race windows.

Scope

What should be implemented?

  • Define optimistic concurrency or compare and swap semantics for governance request updates
  • Extend MutationRequest with a revision, version, or equivalent transition guard
  • Update governance lifecycle runtime so transition validation and persistence happen atomically
  • Prevent concurrent transitions such as Approve and Cancel from both succeeding against the same prior state
  • Define failure behavior when a transition loses the race
  • Add regression coverage for stale snapshot transition attempts

Acceptance Criteria

  • Governance lifecycle transitions do not rely on non atomic Get + Store sequences
  • Concurrent transitions against one request cannot both succeed silently
  • The runtime exposes clear outcome when a transition loses optimistic concurrency
  • Test coverage proves the stale snapshot race is closed
  • The implementation remains inside ModularityKit.Mutator.Governance

Notes

Implemented through:

  • MutationRequest.Revision
  • IMutationRequestStore.TryStore(...)
  • MutationRequestConcurrencyException
  • guarded transitions in MutationRequestLifecycleManager
  • regression coverage in MutationRequestLifecycleAtomicityTests

The characterization test was inverted from reproducing the race to asserting that stale transitions are rejected.

Metadata

Metadata

Assignees

Labels

runtimeRuntime implementation and execution flow

Type

Fields

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions