Skip to content

Commit 8ca51e7

Browse files
rustyconoverclaude
andcommitted
fixtures: serialize filter_str so HTTP state round-trips preserve it
FilterEchoState / _FilterEchoPartitionedState marked filter_str as Transient(). The framework's HTTP rehydrate path deserializes user state but never re-invokes initial_state(), so after the first state-token round-trip filter_str silently reverted to "(none)" — every batch a partitioned scan produced post-resume lost the pushed-filter echo. table/filter_echo_partitioned.test caught this over HTTP transport. The string is tiny and the state token is AEAD-encrypted anyway, so just serialize it (drop the Transient annotation). The now-unused Transient import is removed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 15aea03 commit 8ca51e7

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

‎vgi/_test_fixtures/table/filters.py‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from typing import Annotated, ClassVar
99

1010
import pyarrow as pa
11-
from vgi_rpc import ArrowSerializableDataclass, Transient
11+
from vgi_rpc import ArrowSerializableDataclass
1212
from vgi_rpc.rpc import OutputCollector
1313

1414
from vgi._test_fixtures.table._common import (
@@ -78,11 +78,17 @@ class FilterEchoFunctionArgs:
7878

7979
@dataclass(kw_only=True)
8080
class FilterEchoState(ArrowSerializableDataclass):
81-
"""Mutable state tracking remaining rows, position, and cached filter string."""
81+
"""Mutable state tracking remaining rows, position, and cached filter string.
82+
83+
``filter_str`` is serialized (not Transient): the framework's HTTP
84+
rehydrate path deserializes user state but does not re-invoke
85+
``initial_state``, so a Transient filter string would silently revert
86+
to ``"(none)"`` after the first state-token round-trip.
87+
"""
8288

8389
remaining: int
8490
current_index: int = 0
85-
filter_str: Annotated[str, Transient()] = "(none)"
91+
filter_str: str = "(none)"
8692

8793

8894
@init_single_worker
@@ -539,12 +545,19 @@ class _FilterEchoPartitionedArgs:
539545

540546
@dataclass(kw_only=True)
541547
class _FilterEchoPartitionedState(ArrowSerializableDataclass):
542-
"""Per-worker state. Re-derives filter_str from init_call after rehydrate."""
548+
"""Per-worker state.
549+
550+
``filter_str`` is serialized (not Transient): the framework's HTTP
551+
rehydrate path deserializes user state but does not re-invoke
552+
``initial_state``, so a Transient filter string would silently revert
553+
to ``"(none)"`` after the first state-token round-trip — losing the
554+
pushed-filter echo on every batch produced after a resume.
555+
"""
543556

544557
current_start: int | None = None
545558
current_end: int | None = None
546559
current_idx: int = 0
547-
filter_str: Annotated[str, Transient()] = "(none)"
560+
filter_str: str = "(none)"
548561

549562

550563
@bind_fixed_schema

0 commit comments

Comments
 (0)