Skip to content

Conversation

@Naragod
Copy link
Contributor

@Naragod Naragod commented Oct 9, 2025

Proposed Changes

This is a 🐛 Bug fix.

We are unable to swap two records within the same transaction. Built in validators run into the issue of constraint infractions. This happens when an attempt is made to swap two values wthin the same transaction. Each record is compared against the database before the second has had a chance to update. More information about this specific issue and how it can be reproduced can be found here.

Implementation

Our issue can be resolved by implementing custom validators, which have access to in memory data and can be used to validate final state changes. By contrast, built-in rails uniqueness validators query the database, their information limited, to pre-updated records.

Screenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)

Type of Change

(Write an X or a brief description next to the type or types that best describe your changes.)

Type Applies?
🚨 Breaking change (fix or feature that would cause existing functionality to change)
New feature (non-breaking change that adds functionality)
🐛 Bug fix (non-breaking change that fixes an issue) X
🎨 User interface change (change to user interface; provide screenshots)
♻️ Refactoring (internal change to codebase, without changing functionality)
🚦 Test update (change that only adds or modifies tests)
📦 Dependency update (change that updates a dependency)
🔧 Internal (change that only affects developers or continuous integration)

Checklist

(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the [ ] into a [x] in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)

Before opening your pull request:

  • I have performed a self-review of my changes.
    • Check that all changed files included in this pull request are intentional changes.
    • Check that all changes are relevant to the purpose of this pull request, as described above.
  • I have added tests for my changes, if applicable.
    • This is required for all bug fixes and new features.
  • I have updated the project documentation, if applicable.
    • This is required for new features.
  • If this is my first contribution, I have added myself to the list of contributors.

After opening your pull request:

  • I have updated the project Changelog (this is required for all changes).
  • I have verified that the pre-commit.ci checks have passed.
  • I have verified that the CI tests have passed.
  • I have reviewed the test coverage changes reported by Coveralls.
  • I have requested a review from a project maintainer.

Questions and Comments

(Include any questions or comments you have regarding your changes.)

@Naragod Naragod marked this pull request as draft October 9, 2025 17:07
@Naragod Naragod marked this pull request as ready for review October 9, 2025 17:09
@Naragod Naragod force-pushed the ISSUE-7687_remove_criteria_level_naming_conflicts branch 3 times, most recently from 4640397 to 137a7b4 Compare October 14, 2025 14:51
@coveralls
Copy link
Collaborator

coveralls commented Oct 14, 2025

Pull Request Test Coverage Report for Build 18546551874

Details

  • 24 of 24 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 91.523%

Totals Coverage Status
Change from base Build 18541419932: 0.003%
Covered Lines: 42513
Relevant Lines: 45665

💛 - Coveralls

@Naragod Naragod force-pushed the ISSUE-7687_remove_criteria_level_naming_conflicts branch 3 times, most recently from 65309dd to 6d6c9a4 Compare October 15, 2025 14:39
@Naragod Naragod force-pushed the ISSUE-7687_remove_criteria_level_naming_conflicts branch from 6d6c9a4 to a003fc4 Compare October 16, 2025 00:29
@Naragod Naragod force-pushed the ISSUE-7687_remove_criteria_level_naming_conflicts branch from f26ecfa to faaf70c Compare October 16, 2025 00:32
@Naragod Naragod requested a review from david-yz-liu October 16, 2025 13:50
Copy link
Collaborator

@david-yz-liu david-yz-liu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @Naragod 👍

@david-yz-liu david-yz-liu merged commit 6817ac2 into master Oct 16, 2025
11 checks passed
@donny-wong donny-wong added this to the v2.8.3 milestone Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants