Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ async def _append_txn(transaction: firestore.AsyncTransaction) -> int:
for k, v in session.state.items()
if not k.startswith(State.APP_PREFIX)
and not k.startswith(State.USER_PREFIX)
and not k.startswith(State.TEMP_PREFIX)
}
transaction.update(
session_ref,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,15 @@ async def test_append_event_with_temp_state(mock_firestore_client):
assert "temp:k1" not in event_data["actions"]["state_delta"]
assert event_data["actions"]["state_delta"]["session_key"] == "session_val"

# 3. Verify temp keys are NOT written to session state in Firestore
transaction.update.assert_called_once()
update_args, _ = transaction.update.call_args
persisted_state = update_args[1]["state"]
assert "temp:k1" not in persisted_state, (
"temp: keys must not be persisted to Firestore session state"
)
assert "session_key" in persisted_state


@pytest.mark.asyncio
async def test_list_sessions_with_user_id(mock_firestore_client):
Expand Down