Skip to content

fix: open per-job child container for modern-di 3.x mandatory-open - #5

Merged
lesnik512 merged 3 commits into
mainfrom
chore/modern-di-3x
Jul 20, 2026
Merged

fix: open per-job child container for modern-di 3.x mandatory-open#5
lesnik512 merged 3 commits into
mainfrom
chore/modern-di-3x

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Brings modern-di-arq onto modern-di 3.x. Part of the 12-package wave; mirrors modern-di-litestar 3.0.0.

  • Bumps modern-di to >=3,<4 (drops 2.x support).
  • Fixes a real adapter break: modern-di 3.0's mandatory-open lifecycle means an unopened container raises ContainerClosedError on resolution. on_job_start built the per-job Scope.REQUEST child but never opened it, so any @inject-decorated task raised. Fix: a bare child.open() right after build_child_container, before stashing the child in ctx — build and close happen in two different hooks (on_job_start / on_job_end), so they can't share a with block.

Release notes in planning/releases/3.0.0.md.

🤖 Generated with Claude Code

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.
@lesnik512
lesnik512 merged commit ab3bfc9 into main Jul 20, 2026
6 checks passed
@lesnik512
lesnik512 deleted the chore/modern-di-3x branch July 20, 2026 18:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant