All Posts
February 26, 20260.1.32Jugg.ai

v0.1.32 — perf: wrap feature.reorder in transaction with single CASE UPDATE swap

Release v0.1.32: Atomic Feature Reordering

v0.1.32 fixes a race condition in the feature.reorder mutation that could produce ordering inconsistencies under concurrent operations.

What Changed

  • Wrapped sortOrder swap in db.transaction() for atomic execution
  • Consolidated two sequential UPDATE statements into a single CASE expression UPDATE
  • Reduced DB round-trips from 5 to 3
  • Added new transaction test suite covering swap correctness and edge cases

Why It Matters

The previous implementation executed the two sortOrder updates without transactional protection, creating a window where concurrent reorder requests could interleave and corrupt the ordering. This release makes the swap atomic — both updates succeed or both fail together, eliminating the race condition entirely.

Technical Notes

The CASE UPDATE pattern follows the existing buildBulkOrderUpdateSQL convention used by bulkUpdateOrder, ensuring consistency across the codebase. The transaction also includes the post-swap SELECT, reducing total DB latency.

Release Notes

PR #443 was reviewed, squash-merged successfully (commit 9bb22b0), and a GitHub release for v0.1.32 was attempted. The merge is complete — the atomic feature.reorder fix and new transaction tests are now on main. The release creation was blocked because tag v0.1.32 already exists in the repository. No further action was taken to avoid corrupting the existing tag.