Skip to content

[pull] main from apache:main - #156

Merged
pull[bot] merged 3 commits into
sudoevans:mainfrom
apache:main
Mar 29, 2026
Merged

[pull] main from apache:main#156
pull[bot] merged 3 commits into
sudoevans:mainfrom
apache:main

Conversation

@pull

@pull pull Bot commented Mar 29, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

* fix: support `async with` on async persister factory methods

`AsyncSQLitePersister.from_values()` and `AsyncPostgreSQLPersister.from_values()`
were async classmethods returning coroutines, which cannot be used directly
with `async with`. This wraps them in `_AsyncPersisterContextManager` that
supports both `await` (backwards compatible) and `async with` protocols.

Closes #546

* refactor: move _AsyncPersisterContextManager to burr/common/async_utils.py and add tests

Address review feedback:
- Move _AsyncPersisterContextManager from b_aiosqlite.py to
  burr/common/async_utils.py to avoid cross-dependency between
  unrelated integrations
- Add type annotation to coro parameter
- Add tests for async with pattern on from_values and from_config

* fix: guard against __aexit__ crash and double consumption in context manager wrapper

- __aexit__ now returns False when __aenter__ failed (persister is None),
  preventing AttributeError that would mask the original exception
- Add _consumed flag to prevent silent coroutine reuse, raising
  RuntimeError with clear message on second await/async with
- Add tests for both edge cases

* docs: fix async persister examples and remove redundant test helpers

- Add missing `await` to from_values() calls in parallelism.rst docs
- Remove AsyncSQLiteContextManager helper class from both test files,
  now that from_values() natively supports async with
- Replace deprecated .close() calls with .cleanup() in test fixtures

* style: fix black formatting and isort import order

* style: reformat with black 23.11.0 (project version)

* ci: trigger workflow rerun
* core: add flexible_api decorator to fix mypy override errors on class-based actions

Adds a `flexible_api` decorator that users can apply to `run`,
`stream_run`, or `run_and_update` overrides that use explicit
parameters instead of `**run_kwargs`. This prevents mypy [override]
errors caused by narrowing the base-class signature.

Closes #457

* style: apply black formatting

* Rename flexible_api to type_eraser and fix async support

Address review feedback: rename decorator per maintainer suggestion.
Fix critical bug where @wraps on async/generator functions broke
is_async() detection. Add tests for all function types.
* fix: allow streaming actions to gracefully handle raised exceptions

When a streaming action catches an exception and yields a final state
in a try/except/finally block, the stream now completes gracefully
instead of propagating the exception and killing the connection.

If the generator yields a valid state_update before the exception
propagates, the exception is suppressed and the stream terminates
normally. If no state was yielded, the exception propagates as before.

Closes #581

* fix: add logging for suppressed exceptions and tests for streaming graceful shutdown

- Add logger.warning with exc_info in all 4 streaming except blocks
- Remove dead caught_exc variable in multi-step functions
- Fix count increment asymmetry between sync and async single-step
- Add 8 tests covering graceful exception handling and propagation

* style: apply black formatting

* style: apply pre-commit formatting (black 23.11.0, isort 5.12.0)
@pull pull Bot locked and limited conversation to collaborators Mar 29, 2026
@pull pull Bot added the ⤵️ pull label Mar 29, 2026
@pull
pull Bot merged commit 2c5abdb into sudoevans:main Mar 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant