Skip to content

fix batched snapshot db commits - #781

Merged
sgsunder merged 1 commit into
rr-:masterfrom
sgsunder:fix-780
Jul 27, 2026
Merged

fix batched snapshot db commits#781
sgsunder merged 1 commit into
rr-:masterfrom
sgsunder:fix-780

Conversation

@sgsunder

Copy link
Copy Markdown
Collaborator

Closes #780

Fixes a regression caused by the SQLAlchemy 2.0 migration. Not an expert on SA so apologies if I butcher this explanation:

SA2.0 introduced a feature where it "bundles" multiple statements into a single transaction. For most queries, that works perfectly fine, but for insertions into the snapshots table, that can cause issues because posts and tags have different identifiers (int vs str) and when combined together in the same transaction, SA/Postgres doesn't auto-cast the int to a str anymore.

The way to trigger this is to create a new post and tag simultaneously in the same REST query. The web UI never does this so it wasn't caught.

It's also not covered in the existing unit tests, so I added one for it.

@sgsunder
sgsunder requested a review from rr- July 26, 2026 22:14
@sgsunder sgsunder self-assigned this Jul 26, 2026
@sgsunder sgsunder added the bug label Jul 26, 2026

@rr- rr- left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Well we do have tests for it so that's enough for me to greenlight it 👍 Thanks.

@sgsunder
sgsunder merged commit 10ac850 into rr-:master Jul 27, 2026
1 check passed
@sgsunder
sgsunder deleted the fix-780 branch July 27, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Importing with szuruchrome with a page that has new tag causes a save failure in api

2 participants