Skip to content

Unique attributes: conditional deletes of missing items skip the condition, and stale instances fail unexplained #81

Closed

Description

@fctl-sh

Priority: medium. Two gaps in deletes and updates of models with unique attributes (repository.py, _plan_delete; transactions.py):

  • A conditional delete of a missing item ignores the condition. For unique models, the delete reads the stored item for its guards and returns None when there is none, without sending the caller's condition; in a transaction the step is dropped. Plain models raise ConditionalCheckFailedError or cancel the transaction. So tx.delete(User.key(...), model=User, condition=...), used as a guard of the transaction, lets the rest commit.
  • Unversioned unique models raise an unexplained ConditionalCheckFailedError when the stored unique values changed since the instance was loaded: delete() of a loaded instance after the item was deleted elsewhere (plain models return None), or after another writer changed a unique value, says "the condition of delete failed" though no condition was given; update(handle.set(...)) fails the same way. put() and save() already read the stored item again in this case (_write).

Fix: keep the caller's condition when the item is missing (send a ConditionCheck, or fail the delete), and re-read and re-plan deletes and updates of unversioned unique models like put()/save() do.

Found in a review of the library for bugs (fctl session); the fixes that fit in its ten pull requests are #61 to #65, #67 to #70 and #72.

Activity

  1. added
    bug
    on Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions