Skip to content

Fixing SessionMessageHandler to handle multiple session tokens.#5521

Merged
v-isyamauchi-gh merged 1 commit intomainfrom
personal/v-isyamauchi/189767
Apr 27, 2026
Merged

Fixing SessionMessageHandler to handle multiple session tokens.#5521
v-isyamauchi-gh merged 1 commit intomainfrom
personal/v-isyamauchi/189767

Conversation

@v-isyamauchi-gh
Copy link
Copy Markdown
Contributor

@v-isyamauchi-gh v-isyamauchi-gh commented Apr 24, 2026

Description

We noticed that some tests recently started failing in AKS - FHIR Prod E2E test pipeline with an error, "InvalidOperationException: Sequence contains more than one element" in SessionMessageHandler.

SessionMessageHandler code incorrectly assumes a "x-ms-session-token" response header contains only one session token. (Note: Session tokens are partition-bound and the response may contain multiple session tokens when a request spans multiple partitions according to the source below. Also, we recently increased RU for the Gen1 test services to 20k.)

The change will update SessionMessageHandler to be able to handle multiple session tokens in the response.

Source:
https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-manage-consistency?tabs=portal%2Cdotnetv2%2Capi-async#utilize-session-tokens

https://learn.microsoft.com/en-us/azure/cosmos-db/partitioning#physical-partitions

https://stackoverflow.com/questions/79335139/passing-session-token-for-querying-multiple-items-in-cosmosdb

Related issues

Addresses [issue #189767].

Bug 189767: FHIR PaaS Gen1: More than one "x-ms-session-token" are added in the response headers.

Testing

Tested by running existing tests (though best to test with running AKS - FHIR Prod E2E test pipeline)

FHIR Team Checklist

  • Update the title of the PR to be succinct and less than 65 characters
  • Add a milestone to the PR for the sprint that it is merged (i.e. add S47)
  • Tag the PR with the type of update: Bug, Build, Dependencies, Enhancement, New-Feature or Documentation
  • Tag the PR with Open source, Azure API for FHIR (CosmosDB or common code) or Azure Healthcare APIs (SQL or common code) to specify where this change is intended to be released.
  • Tag the PR with Schema Version backward compatible or Schema Version backward incompatible or Schema Version unchanged if this adds or updates Sql script which is/is not backward compatible with the code.
  • When changing or adding behavior, if your code modifies the system design or changes design assumptions, please create and include an ADR.
  • CI is green before merge Build Status
  • Review squash-merge requirements

Semver Change (docs)

Patch|Skip|Feature|Breaking (reason)

@v-isyamauchi-gh v-isyamauchi-gh added this to the FY26\Q4\2Wk\2Wk22 milestone Apr 24, 2026
@v-isyamauchi-gh v-isyamauchi-gh added the Bug Bug bug bug. label Apr 24, 2026
@v-isyamauchi-gh v-isyamauchi-gh requested a review from a team as a code owner April 24, 2026 20:50
@v-isyamauchi-gh v-isyamauchi-gh added No-Issue-Activity This issue is now considered stale and will be closed soon Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Open source This change is only relevant to the OSS code or release. No-PaaS-breaking-change No-ADR ADR not needed labels Apr 24, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@f23ce65). Learn more about missing BASE report.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #5521   +/-   ##
=======================================
  Coverage        ?   77.02%           
=======================================
  Files           ?      982           
  Lines           ?    35813           
  Branches        ?     5396           
=======================================
  Hits            ?    27585           
  Misses          ?     6905           
  Partials        ?     1323           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@v-isyamauchi-gh v-isyamauchi-gh merged commit db5677e into main Apr 27, 2026
57 checks passed
@v-isyamauchi-gh v-isyamauchi-gh deleted the personal/v-isyamauchi/189767 branch April 27, 2026 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Azure API for FHIR Label denotes that the issue or PR is relevant to the Azure API for FHIR Bug Bug bug bug. No-ADR ADR not needed No-Issue-Activity This issue is now considered stale and will be closed soon No-PaaS-breaking-change Open source This change is only relevant to the OSS code or release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants