Skip to content

SET of several list elements past the end applies them in expression order and loses values #74

Closed

Description

@fctl-sh

Priority: high. SET l[4] = :b, l[3] = :a on l = [x, y, z] stores [x, y, z, a]: b is appended at index 3 and then overwritten. DynamoDB stores [x, y, z, a, b]. Likewise SET l[9] = :b, l[5] = :a stores [..., b, a] where DynamoDB stores [..., a, b].

Where: crates/dynamoxy-core/src/expr/update.rs: the SET actions are assigned in expression order, and assign pushes whenever the index is at or past the length.

Why it matters beyond the in-memory backend: repository._evaluate uses the same evaluator (_core._apply_update) to compute derived attributes and to refresh instances after a transaction, so on AWS too the local instance can differ from the stored item.

DynamoDB: the update expressions guide says "If you add multiple elements in a single SET operation, the elements are sorted in order by element number."

Fix: apply the SET actions that append past the end of the same list in order of their index.

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
    rust
    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

    bugrust

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions