-
Notifications
You must be signed in to change notification settings - Fork 138
[BUG] Add DaprInternalError.as_json_safe_dict for actors #765
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Add DaprInternalError.as_json_safe_dict for actors #765
Conversation
The FastAPI and Flask extensions for actors serialise the value of any raised DaprInternalError to JSON, which fails if the error contains bytes in its `_raw_response_bytes` field. This change adds a new `as_json_safe_dict` method and uses it in place of the `as_dict` method in the FastAPI and Flask extensions. Two unit tests for the `as_json_safe_dict` method are included. Signed-off-by: Billy Brown <druidofluhn@gmail.com>
|
@holopin-bot @Druid-of-Luhn Thanks for your contribution! |
|
Looks like @elena-kolevska is trying to award a sticker, but something went wrong while doing so. See this page for more information. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #765 +/- ##
==========================================
- Coverage 86.63% 86.13% -0.50%
==========================================
Files 84 89 +5
Lines 4473 4978 +505
==========================================
+ Hits 3875 4288 +413
- Misses 598 690 +92 ☔ View full report in Codecov by Sentry. |
|
Thanks @elena-kolevska for your suggested approach in the original issue! It was also quite a nice codebase to contribute to. |
|
@holopin-bot @Druid-of-Luhn Thank you! Here's a digital badge as a small token of appreciation. |
|
Congratulations @Druid-of-Luhn, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/cm5qyr2bl55350clbu2bfdb2u This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
The FastAPI and Flask extensions for actors serialise the value of any raised DaprInternalError to JSON, which fails if the error contains bytes in its `_raw_response_bytes` field. This change adds a new `as_json_safe_dict` method and uses it in place of the `as_dict` method in the FastAPI and Flask extensions. Two unit tests for the `as_json_safe_dict` method are included. Signed-off-by: Billy Brown <druidofluhn@gmail.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com>
* Removes support for 3.8 and adds 3.13 to test version matrix (#763) Signed-off-by: Elena Kolevska <elena@kolevska.com> * Updates protos and fixes grpc-tools for protos generation (#766) * Updates protos and fixes grpc-tools for protos generation Signed-off-by: Elena Kolevska <elena@kolevska.com> * bumps grpcio tools version Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Elena Kolevska <elena@kolevska.com> * Add DaprInternalError.as_json_safe_dict for actors (#765) The FastAPI and Flask extensions for actors serialise the value of any raised DaprInternalError to JSON, which fails if the error contains bytes in its `_raw_response_bytes` field. This change adds a new `as_json_safe_dict` method and uses it in place of the `as_dict` method in the FastAPI and Flask extensions. Two unit tests for the `as_json_safe_dict` method are included. Signed-off-by: Billy Brown <druidofluhn@gmail.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * workflows: update durabletask dependency (#757) * Bump codecov/codecov-action from 4 to 5 (#753) Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4 to 5. - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](codecov/codecov-action@v4...v5) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * update durabletask to use fork Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * add purge workflow function Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * support reuse id policy Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * support set custom status Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Update ext/dapr-ext-workflow/tests/test_workflow_client.py Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_client.py Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * update test, grpc version and lint Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Adds missing arguments in FakeTaskHubGrpcClient Signed-off-by: Elena Kolevska <elena@kolevska.com> * linter Signed-off-by: Elena Kolevska <elena@kolevska.com> * remove alpha for workflow stable release (#760) Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Replace deprecated tox.ini option (#762) This option was replaced in 2020, deprecated, and eventually removed in tox 4. The correct option already appears elseware in this tox.ini file. This fix is necessary to run `tox -e doc` per the README.md instructions on tox 4. Signed-off-by: Eric Searcy <eric@linuxfoundation.org> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Add Actor Mocks (#750) * Moved files to new branch to avoid weird git bug Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * requested documentation changes Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * forgot to move file back to starting point Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * result of ruff format Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * fixed minor formatting issues, fixed type issues Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * minor test fix Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * fixes try_add_state Signed-off-by: Elena Kolevska <elena@kolevska.com> Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * Revert "fixes try_add_state" This reverts commit 254ad17. Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * Update dapr/actor/runtime/mock_state_manager.py Fixing bug in try_add_state as mentioned in PR #756 Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * Update dapr/actor/runtime/mock_actor.py Whoops missed this Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * minor error in docs Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * fixed and added more unit tests. Added example Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * unittest fix Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * Update examples/demo_actor/README.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * concentrated some tests Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * removed unnecessary type hint Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * Update daprdocs/content/en/python-sdk-docs/python-actor.md didnt see this earlier whoops Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * Update examples/demo_actor/README.md Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> * documentation changes Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * now requires #type: ignore Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> * small docs change Signed-off-by: Elena Kolevska <elena@kolevska.com> * examples test fix Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Co-authored-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> Co-authored-by: Elena Kolevska <elena@kolevska.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Fixes try_add_state in actor state manger (#756) Signed-off-by: Elena Kolevska <elena@kolevska.com> * Integration test for http invocation (#758) Signed-off-by: Elena Kolevska <elena@kolevska.com> * fixes missing state store in test (#759) Signed-off-by: Elena Kolevska <elena@kolevska.com> * Mark workflows API functions as deprecated (#749) * workflows, remove deprecated functions Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> * revert changes to example Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> * update warning messages Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> * Typos Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> * fixes linter Signed-off-by: Elena Kolevska <elena@kolevska.com> * Apply suggestions from code review Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> * Apply suggestions from code review Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> --------- Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Co-authored-by: Elena Kolevska <elena@kolevska.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> * Removes support for 3.8 and adds 3.13 to test version matrix (#763) Signed-off-by: Elena Kolevska <elena@kolevska.com> * Updates dapr email to dapr.io (#764) Signed-off-by: Elena Kolevska <elena@kolevska.com> * Reverts grpc bump Signed-off-by: Elena Kolevska <elena@kolevska.com> * Updates protos and fixes grpc-tools for protos generation (#766) * Updates protos and fixes grpc-tools for protos generation Signed-off-by: Elena Kolevska <elena@kolevska.com> * bumps grpcio tools version Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Elena Kolevska <elena@kolevska.com> * Bump dapr/durabletask version Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Elena Kolevska <elena@kolevska.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com> Signed-off-by: Eric Searcy <eric@linuxfoundation.org> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Co-authored-by: Elena Kolevska <elena@kolevska.com> Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Co-authored-by: Eric Searcy <emsearcy@gmail.com> Co-authored-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Co-authored-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> Signed-off-by: Elena Kolevska <elena@kolevska.com> --------- Signed-off-by: Elena Kolevska <elena@kolevska.com> Signed-off-by: Billy Brown <druidofluhn@gmail.com> Signed-off-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Signed-off-by: Hannah Hunter <hannahhunter@microsoft.com> Signed-off-by: Eric Searcy <eric@linuxfoundation.org> Signed-off-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Signed-off-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com> Signed-off-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Co-authored-by: Billy Brown <Druid-of-Luhn@users.noreply.github.com> Co-authored-by: Fabian Martinez <46371672+famarting@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Hannah Hunter <94493363+hhunter-ms@users.noreply.github.com> Co-authored-by: Eric Searcy <emsearcy@gmail.com> Co-authored-by: Lorenzo Curcio <Lorenzocurcio2@gmail.com> Co-authored-by: Lorenzo Curcio <Lorenzo.curcio@valuecuberesearch.com>
The FastAPI and Flask extensions for actors serialise the value of any raised DaprInternalError to JSON, which fails if the error contains bytes in its `_raw_response_bytes` field. This change adds a new `as_json_safe_dict` method and uses it in place of the `as_dict` method in the FastAPI and Flask extensions. Two unit tests for the `as_json_safe_dict` method are included. Signed-off-by: Billy Brown <druidofluhn@gmail.com> Co-authored-by: Elena Kolevska <elena-kolevska@users.noreply.github.com> Signed-off-by: Elena Kolevska <elena@kolevska.com>
Description
The FastAPI and Flask extensions for actors serialise the value of any raised DaprInternalError to JSON, which fails if the error contains bytes in its
_raw_response_bytesfield.This change adds a new
as_json_safe_dictmethod and uses it in place of theas_dictmethod in the FastAPI and Flask extensions.Two unit tests for the
as_json_safe_dictmethod are included.Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #761
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
Release Note
RELEASE NOTE: FIX When calling an actor method results in an InternalDaprError being raised, the exception details are properly returned instead of a json serialisation error