fix: open per-job child container for modern-di 3.x mandatory-open - #5
Merged
Conversation
Bumps the modern-di dependency floor to >=3,<4, dropping support for modern-di 2.x.
…y-open) modern-di 3.0 requires a container to be opened before use. on_job_start built the per-job Scope.REQUEST child but never opened it, so any @inject-decorated task raised ContainerClosedError. Build and close happen in two different hooks (on_job_start / on_job_end), so a with block can't span them; fix with a bare child.open() right after building the child.
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.
Brings
modern-di-arqonto modern-di 3.x. Part of the 12-package wave; mirrorsmodern-di-litestar3.0.0.modern-dito>=3,<4(drops 2.x support).ContainerClosedErroron resolution.on_job_startbuilt the per-jobScope.REQUESTchild but never opened it, so any@inject-decorated task raised. Fix: a barechild.open()right afterbuild_child_container, before stashing the child inctx— build and close happen in two different hooks (on_job_start/on_job_end), so they can't share awithblock.Release notes in
planning/releases/3.0.0.md.🤖 Generated with Claude Code