Repository navigation
fix: run synchronous test jobs after the outermost transaction commits (CKAN 2.12) - #6
Open
paulmueller-agent wants to merge 1 commit into
Open
paulmueller-agent wants to merge 1 commit into
paulmueller-agent wants to merge 1 commit into
Conversation
CKAN 2.12 runs package_update in a nested transaction. Jobs that commit the session closed it (ResourceClosedError) when executed inline. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6 +/- ##
==========================================
- Coverage 96.99% 94.70% -2.29%
==========================================
Files 12 12
Lines 566 586 +20
==========================================
+ Hits 549 555 +6
- Misses 17 31 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
CKAN 2.12 runs
package_updatein a nested transaction (session.begin_nested()) and commits it after theIPackageControllerhooks ran. Withckan.plugins.toolkit.enqueue_jobmocked bysynchronous_enqueue_job, the background jobs ran inline insideafter_dataset_update. Their commits closed the nested transaction, so most tests that create datasets failed withsqlalchemy.exc.ResourceClosedError: This transaction is closedon CKAN 2.12.synchronous_enqueue_jobnow:after_commit/after_transaction_end), and drops it if that transaction is rolled back. This is what happens in production, where an RQ worker runs the job with its own session.Testing:
This only affects test helpers, not production code.
🤖 Generated with Claude Code