Keep sanction snapshots in sync#4
Open
CptDeclarium wants to merge 1 commit into
arshsingh:masterarshsingh/sanctions:masterfrom
CptDeclarium:fix/sanctions-snapshot-syncCptDeclarium/sanctions:fix/sanctions-snapshot-syncCopy head branch name to clipboard
Open
Keep sanction snapshots in sync#4CptDeclarium wants to merge 1 commit intoarshsingh:masterarshsingh/sanctions:masterfrom CptDeclarium:fix/sanctions-snapshot-syncCptDeclarium/sanctions:fix/sanctions-snapshot-syncCopy head branch name to clipboard
CptDeclarium wants to merge 1 commit into
arshsingh:masterarshsingh/sanctions:masterfrom
CptDeclarium:fix/sanctions-snapshot-syncCptDeclarium/sanctions:fix/sanctions-snapshot-syncCopy head branch name to clipboard
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.
Summary
Implementation
create_sanctionsnow treats each successful non-empty fetch as the complete snapshot for one source:ON CONFLICT (source, source_id) DO UPDATErefreshestarget_type,names,positions,listed_on, andremarks.source_idis absent from the fetched snapshot.idandcreated_atis not overwritten.Validation
Validation was run on 23 July 2026 against a disposable PostgreSQL 17 instance loaded with the real repository schema, not only mocks:
ON CONFLICTstatement.created_atwere preserved.These checks execute the actual PostgreSQL SQL through psycopg, including Python-list adaptation for
ANY(%s), conflict updates, deletion, and rollback behavior. Together with the live full-size SECO resynchronization, they provide confidence that the snapshot replacement works as intended.Relationship to PR #3
This branch was created independently from
masterand changes onlyworker/db.pyplus its dedicated test file. PR #3 changes separate files. GitHub reports both PRs clean and mergeable, and a local three-way merge of both heads completed without conflicts, so they can merge in either order.