fix: truncate transaction and vertex messages (#7893)

* add pyinstrument and fastapi wrapper

* Truncate vertex build responses

* Truncate vertex response and transactions

* [autofix.ci] apply automated fixes

* Update test for vertex response structure to reflect new truncation logic

* Refactor profiling middleware to use environment variable for configuration

* Update test for vertex response structure to correct truncation logic

* move pyinstrument to dev dependencies

* Update serialization test to include max_items parameter for list truncation

* remove profiling from this PR, fix constants

* [autofix.ci] apply automated fixes

* Add asyncio configuration options to pyproject.toml

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org>
This commit is contained in:
Jordan Frazier 2025-05-05 17:03:13 -07:00 committed by GitHub
commit 2c6ea9c98f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 2915 additions and 2915 deletions

View file

@ -63,7 +63,7 @@ def test_vertex_response_structure_when_truncate_applies():
("size", "expected"),
[
(0, 0),
(42, 42),
(8, 8),
(MAX_ITEMS_LENGTH, MAX_ITEMS_LENGTH),
(MAX_ITEMS_LENGTH + 1000, MAX_ITEMS_LENGTH + 1),
(MAX_ITEMS_LENGTH + 2000, MAX_ITEMS_LENGTH + 1),

View file

@ -92,7 +92,7 @@ class TestSerializationHypothesis:
@settings(max_examples=100)
@given(lst=list_strategy)
def test_list_truncation(self, lst: list) -> None:
result: list = serialize(lst)
result: list = serialize(lst, max_items=MAX_ITEMS_LENGTH)
if len(lst) > MAX_ITEMS_LENGTH:
assert len(result) == MAX_ITEMS_LENGTH + 1
assert f"... [truncated {len(lst) - MAX_ITEMS_LENGTH} items]" in result