Accept inline durable-operation dispatch in the spend composition test

Merged
MP
3mo ago
+15-4

Summary

pydantic-ai 2.37.0 routes capability operations inline when no durable container is active, so composing SpendLimits with TemporalDurability outside a workflow no longer raises temporalio's Not in workflow event loop. The composition test added by #748 asserted that raise and went red on test on latest pydantic-ai, taking check down with it on every branch including main.

The test now accepts both contracts:

  • on pydantic-ai-slim 2.37 and newer, the run completes and the assertion checks that the accrual landed (spent.usd == Decimal('1')), a stronger postcondition than the old stop-at-the-error probe;
  • on the pinned 2.36 floor, the original dispatch-error assertion stays.

Verified against both lines with the CI job's exact lock upgrade: 19/19 in TestCompositionWarning, 224/224 in tests/spend/, ruff and pyright clean. No source or docs changes: only this test leaned on the old raise. Merging this turns test on latest pydantic-ai and check green on main and on the open PRs that inherit them.

Linked Issue

Fixes #765

Checklist

  • Linked issue exists and is referenced above
  • Tests added/updated for new behavior (this is the test change)
  • make lint && make typecheck && make test passes locally (ruff, pyright, and the focused suite verified against both 2.36.0 and 2.37.0)
  • pyproject.toml and uv.lock are unchanged
  • Docstrings use single backticks (n/a: no docstrings changed)