Skip to content

Add optimistic locking based on versions #569

Description

@solenuk

As a developer I want to add optimistic versioning to TaskAssignment so that two concurrent updates to the same assignment can't silently overwrite each other.

Assumptions & Constraints

  • Uses the standard JPA version field.
  • This is purely a concurrency safeguard, it doesn't change any business rule or existing field.

Preconditions

  1. TaskAssignment entity and its migration already exist.

Business rules

  1. Every update to a TaskAssignment row increments its version.
  2. An update based on a stale version is rejected, not silently applied.
  3. Creating a new TaskAssignment starts at the initial version, no special handling needed there.

Acceptance Criteria

  • task_assignments has a version column, not null, defaulting to 0.
  • The entity has a version field mapped to that column.
  • Updating a TaskAssignment with a stale version results in a clear exception.
  • A normal, non concurrent update still works exactly as before.

Out of scope

  • Any UI handling for a version conflict.
  • Adding versioning to any entity other than TaskAssignment.

Epic link
Epic #385 - EPIC: Tasks linkage to tours

Tasks

  • Add the version column migration for task_assignments.
  • Add the version field to TaskAssignment.
  • Confirm a normal update still works and a stale update is rejected.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions