fix: preserve concurrent application document and address updates - #1824
Draft
Jacky-Pham wants to merge 2 commits into
Draft
Jacky-Pham wants to merge 2 commits into
Jacky-Pham wants to merge 2 commits into
Conversation
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Two requests can load the same application JSON and then overwrite each other’s document or address changes. A later upload can revert a saved address, and an address save or second upload can remove an already saved document from the application’s document list.
Refresh the application JSON under a PostgreSQL row lock immediately before each document/address read-modify-write. The existing save commits and releases the lock. Address event history also reads the latest previous address. The upload route finishes remote file storage before acquiring this lock.
Validation: 12 new PostgreSQL tests use independent Flask/ORM sessions and real commits. They cover both upload/address orders, two uploads and two partial-address edits, with sequential controls, overlapping initial reads and a held in-flight write. Fresh reads verify persisted fields and event history; pending-writer cases observe PostgreSQL blocking directly. Eight cases fail on the review base; all four sequential controls pass. All 12 pass after the repair. Dedicated Python 3.12 CI passes 581 API tests with six existing skips. Standard PR CI passes the same tests, coverage and build; all seven PR checks pass. isort and black pass. Pylint still reports the same 39 existing findings with none introduced; the workflow ignores these failures. Combined CI passes 584 API tests with five existing skips, including all 12 new cases, plus the batch job (24), batch listener (54) and backfiller (47).
Stacked on #1799 for the previously verified Docker base repair. The review diff contains only the service change and regression tests. Database fixtures are synthetic and confined to disposable CI PostgreSQL. The dedicated Python 3.12 QA workflow is separate from this review branch. Approval/linking transitions during upload remain outside this regression’s coverage.