Skip to content

Implementation of in-memory-emulator with external endpoint#4786

Open
FabianMeiswinkel wants to merge 50 commits into
mainfrom
users/fabianm/ExternalInMemoryEmulator_02
Open

Implementation of in-memory-emulator with external endpoint#4786
FabianMeiswinkel wants to merge 50 commits into
mainfrom
users/fabianm/ExternalInMemoryEmulator_02

Conversation

@FabianMeiswinkel

@FabianMeiswinkel FabianMeiswinkel commented Jul 15, 2026

Copy link
Copy Markdown
Member

Adds an out-of-process Cosmos DB in-memory emulator with Gateway V1 and cleartext Gateway 2.0 support.

Changes:

  • Adds the emulator host, configuration, management API, and RNTBD bridge.
  • Extends driver emulator functionality and integration coverage.
  • Adds non-blocking CI legs for both gateway modes.

See spec at sdk\cosmos\azure_data_cosmos_emulator\docs

FabianMeiswinkel and others added 30 commits July 14, 2026 12:24
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…-008

Address reviewer feedback: key/entra auth must require HTTPS (else
credentials leak over plaintext h2c), and entra mode must define the
full set of JWT validation trust inputs (JWKS source, issuer, audience,
allowed OIDs) rather than rely on an allow-list alone.

Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com>
Normalize ADR-003 to the repository's canonical Gateway 2.0 terminology.
This keeps the document aligned with the Cosmos Gateway naming guidance
without changing any other ADR content.

Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com>
Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com>
Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com>
Co-authored-by: FabianMeiswinkel <19165014+FabianMeiswinkel@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@FabianMeiswinkel

Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

This comment was marked as spam.

Copilot AI review requested due to automatic review settings July 17, 2026 23:06

This comment was marked as spam.

@FabianMeiswinkel

Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

Copilot AI review requested due to automatic review settings July 17, 2026 23:13
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

This comment was marked as spam.

Copilot AI review requested due to automatic review settings July 18, 2026 10:07
@FabianMeiswinkel

Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Comments suppressed due to low confidence (3)

sdk/cosmos/azure_data_cosmos_driver/tests/in_memory_emulator_tests/split_merge.rs:186

  • This reads from the source region, where the item was written before replication, so the test still passes if the deferred replication is lost during the split. Read from ctx.west_url as the merge test does; that makes the assertion actually verify replication into the target region.
    sdk/cosmos/ci.yml:74
  • The PR promises non-blocking emulator legs, but ci.tests.yml:28-31 defaults jobs to blocking unless their matrix sets ContinueOnError. The new in-memory matrix omits it, and this PR also removes it from the existing vnext matrix, so emulator failures now block the build. Restore "ContinueOnError": ["true"] in both emulator matrices (or update the stated intent if blocking is deliberate).
    sdk/cosmos/azure_data_cosmos_driver/src/driver/transport/gateway_v2_dispatch.rs:501
  • These mappings make additional Gateway 2.0 metadata visible through public response headers, which is customer-visible driver behavior. The Cosmos changelog rule requires every customer-visible change to be recorded (sdk/cosmos/.github/instructions/cosmos.changelog.instructions.md:6-12), but this PR has no unreleased changelog entry; add one describing the newly surfaced Gateway 2.0 metadata.
    if let Some(item_count) = response.item_count {
        headers.insert(response_header_names::ITEM_COUNT, item_count.to_string());
    }
    if let Some(query_metrics) = response.query_metrics {
        headers.insert(response_header_names::QUERY_METRICS, query_metrics);
  • Files reviewed: 60/61 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

Copilot AI review requested due to automatic review settings July 20, 2026 08:16
@FabianMeiswinkel

Copy link
Copy Markdown
Member Author

/azp run rust - cosmos - weekly

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review details

Comments suppressed due to low confidence (1)

sdk/cosmos/ci.yml:75

  • The PR description promises non-blocking emulator CI legs, but this change explicitly makes both hosted-emulator jobs blocking and also moves the vNext leg out of AdditionalMatrixConfigs after removing its ContinueOnError setting. This changes release gating rather than merely adding non-blocking coverage. Please either restore the non-blocking matrix configuration or update the stated requirement if blocking CI is intentional.
  • Files reviewed: 61/62 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

@analogrelay analogrelay moved this from In Progress to Needs Review in CosmosDB Rust SDK and Driver Jul 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You might consider naming this AGENTS.md and putting it in the crate root. Gets discovered automatically. I used to do this whole plan.md thing as well, but you have to remember to refer to it each time...unless that's your intention.

complete design (configuration schema, management REST API, Gateway 2.0
support, and CI integration).

`publish = false` — this crate is never published to crates.io.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems like something that should be in AGENTS.md, not a customer-focused README.md.

Comment on lines +34 to +35
cargo build -p azure_data_cosmos_emulator
./target/debug/azure_data_cosmos_emulator --config sdk/cosmos/azure_data_cosmos_emulator/config/ci-gateway-v1.json

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggestion: depends on PWD, path delimiter (depending on your shell), etc. As long as you're config path is normalizing paths (it should), just the following would work more universally:

Suggested change
cargo build -p azure_data_cosmos_emulator
./target/debug/azure_data_cosmos_emulator --config sdk/cosmos/azure_data_cosmos_emulator/config/ci-gateway-v1.json
cargo run -p azure_data_cosmos_emulator -- --config sdk/cosmos/azure_data_cosmos_emulator/config/ci-gateway-v1.json

`"emulator_inmemory_gateway_v2"` for Gateway 2.0-specific tests). See
`sdk/cosmos/eng/scripts/Invoke-CosmosTestSetup.ps1`
for how CI builds, starts, and health-checks the host process before running
those suites.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Even though you're not publishing, the README should still probably have the security, license, etc. footers as other READMEs generally do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cosmos The azure_cosmos crate

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

5 participants