Skip to content

Conversation

tvaron3
Copy link
Member

@tvaron3 tvaron3 commented Aug 20, 2025

Description

Some of our tests were flaky with what seemed like we couldn't read our own write using session consistency. There was a bug where a container named with spaces and other special characters would fall back to eventual consistency because the session container would store container names without url encoding but the container name that is passed in to the session container to set the session token is url encoded.

@Copilot Copilot AI review requested due to automatic review settings August 20, 2025 16:51
@tvaron3 tvaron3 requested a review from a team as a code owner August 20, 2025 16:51
Copilot

This comment was marked as outdated.

@tvaron3 tvaron3 requested a review from Copilot August 20, 2025 17:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug where containers with spaces or special characters in their names would incorrectly fall back to eventual consistency instead of using session consistency. The issue occurred because container names were stored without URL encoding in the session container, but were passed URL-encoded when retrieving session tokens.

  • Added URL decoding of container paths before session token retrieval
  • Added test cases to verify session consistency works with special characters in container names
  • Updated import statements to improve organization

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
azure/cosmos/_base.py Added URL decoding of paths before session token retrieval to fix the core bug
tests/test_session.py Added synchronous test case for containers with spaces in names
tests/test_session_async.py Added asynchronous test case and reorganized imports
tests/test_crud_async.py Added proper async context manager setup
CHANGELOG.md Documented the bug fix

@tvaron3
Copy link
Member Author

tvaron3 commented Aug 20, 2025

/azp run python - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tvaron3
Copy link
Member Author

tvaron3 commented Aug 21, 2025

/azp run python - cosmos - tests

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simorenoh simorenoh merged commit ae93966 into Azure:main Aug 22, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants