{"id":13086,"date":"2026-10-23T05:33:30","date_gmt":"2026-10-23T12:33:30","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/cosmosdb\/?p=13086"},"modified":"2026-10-26T08:45:36","modified_gmt":"2026-10-26T15:45:36","slug":"from-local-development-to-ci-workflows-with-the-azure-cosmos-db-emulator","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cosmosdb\/from-local-development-to-ci-workflows-with-the-azure-cosmos-db-emulator\/","title":{"rendered":"From Local Development to CI Workflows with the Azure Cosmos DB Emulator"},"content":{"rendered":"<p>When you change a database-backed feature, a successful HTTP response isn&#8217;t enough. You need to know that the write reached storage, the application retrieved the updated record, and the next answer reflects it.<\/p>\n<p>The <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/emulator-linux\">Azure Cosmos DB Emulator<\/a> runs locally in Docker and lets us use the SDK we&#8217;ll use in production. We&#8217;ll develop against it first, then carry our tests into GitHub Actions. Each update to an open pull request must pass against a fresh emulator before we merge.<\/p>\n<p>Building on <a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/ai-agents-meet-the-azure-cosmos-db-vnext-emulator\/\">Theo van Kraay&#8217;s local development walkthrough<\/a>, we&#8217;ll use <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\">FleetCharge<\/a>, a Python demo built with Microsoft Agent Framework and FastAPI. <a href=\"https:\/\/ollama.com\">Ollama<\/a> runs <a href=\"https:\/\/ollama.com\/library\/phi3.5\">Phi-3.5<\/a> locally, so model inference stays local too.<\/p>\n<p>A depot will change where drivers collect their paperwork. Our test needs to prove the update reached the database and changed the application&#8217;s answer. An HTTP 200 alone won&#8217;t tell us either of those things.<\/p>\n<p><div class=\"alert alert-warning\"><p class=\"alert-divider\"><i class=\"fabric-icon fabric-icon--Warning\"><\/i><strong>Not for prod!<\/strong><\/p>FleetCharge is a demo application, not a production-ready service.<\/div><\/p>\n<p>Here&#8217;s a quick overview of the workflow before we try it:<\/p>\n<p><div style=\"width: 640px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-13086-1\" width=\"640\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/emulator-ci-45s.mp4?_=1\" \/><a href=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/emulator-ci-45s.mp4\">https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/emulator-ci-45s.mp4<\/a><\/video><\/div><\/p>\n<h2>Prerequisites and local setup<\/h2>\n<p>You&#8217;ll need Python 3.12, Git, uv and Docker running Linux containers. The commands use Bash, with <span style=\"font-family: terminal, monaco, monospace;\">curl<\/span> (including <span style=\"font-family: terminal, monaco, monospace;\">&#8211;fail-with-body<\/span> support) and <span style=\"font-family: terminal, monaco, monospace;\">jq<\/span> for the request examples. The GitHub CLI is handy for the pull request steps, though the GitHub website works too.<\/p>\n<p>The walkthrough is tested on Windows with Git Bash and on GitHub-hosted Ubuntu. The repository&#8217;s lockfile targets Windows and Linux, not native macOS.<\/p>\n<p>For optional command-line inspection,\u00a0<a title=\"\" draggable=\"false\" href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/shell\/install\" data-href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/shell\/install\">install Azure Cosmos DB Shell<\/a>. The .NET global tool installation requires the .NET SDK 10.0 or later. Shell isn&#8217;t required to run FleetCharge or its CI tests.<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dotnet tool install --global CosmosDBShell --prerelease\r\ncosmosdbshell --version<\/code><\/pre>\n<p>Start Docker and <a href=\"https:\/\/ollama.com\/download\">download Ollama<\/a>. If you aren&#8217;t using Ollama&#8217;s desktop application, leave <span style=\"font-family: terminal, monaco, monospace;\">ollama serve<\/span> running in another terminal. Then fork the demo repository and replace <span style=\"font-family: terminal, monaco, monospace;\">YOUR-OWNER<\/span> with your fork&#8217;s owner:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">repo=\"YOUR-OWNER\/fleetcharge-agent-cosmos-ci\"\r\ngit clone \"https:\/\/github.com\/$repo.git\"\r\ncd fleetcharge-agent-cosmos-ci\r\nuv venv --python 3.12\r\nuv sync --locked --extra test\r\ncp .env.example .env\r\nollama pull phi3.5:latest\r\nollama create fleetcharge-phi3.5 -f scripts\/Ollama.modelfile<\/code><\/pre>\n<p><span style=\"font-family: terminal, monaco, monospace;\">uv run<\/span> uses the <span style=\"font-family: terminal, monaco, monospace;\">.venv<\/span> we just created, so there&#8217;s no activation step. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/.env.example\"><span style=\"font-family: terminal, monaco, monospace;\">.env.example<\/span> template<\/a> already points at <span style=\"font-family: terminal, monaco, monospace;\">fleetcharge-phi3.5<\/span> and the database endpoint <span style=\"font-family: terminal, monaco, monospace;\">http:\/\/127.0.0.1:8081<\/span>, using the emulator&#8217;s standard database port. The model settings come from <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/Ollama.modelfile\"><span style=\"font-family: terminal, monaco, monospace;\">scripts\/Ollama.modelfile<\/span><\/a>.<\/p>\n<p>Keep this shell open so <span style=\"font-family: terminal, monaco, monospace;\">$repo<\/span> still identifies your fork for the GitHub commands. The sample already contains the completed feature and tests; we&#8217;ll follow that implementation. All source links point to its <span style=\"font-family: terminal, monaco, monospace;\">main<\/span> branch.<\/p>\n<h2>Start the emulator for local development<\/h2>\n<p>Pull the emulator image from Microsoft Container Registry and start it:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">image=mcr.microsoft.com\/cosmosdb\/linux\/azure-cosmos-emulator:vnext-latest\r\ndocker pull \"$image\"\r\ndocker run --rm --name fleetcharge-local-dev \\\r\n  -p 127.0.0.1:8081:8081 -p 127.0.0.1:8080:8080 \\\r\n  \"$image\" --protocol http<\/code><\/pre>\n<p>Leave that terminal running. Port 8081 is the database endpoint; port 8080 lets us check whether the emulator is ready. These are the emulator&#8217;s standard ports, mapped unchanged to the host and bound only to loopback. If either port or the container name is already in use, choose another and update the connection settings rather than stopping someone else&#8217;s container.<\/p>\n<p>In a second terminal, from the repository directory, wait for readiness, load the sample records and start the application:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">export COSMOS_ENDPOINT=\"http:\/\/127.0.0.1:8081\"\r\n\r\ncurl --fail --silent --show-error \\\r\n  --retry 60 --retry-delay 1 --retry-all-errors --retry-max-time 120 --max-time 2 \\\r\n  http:\/\/127.0.0.1:8080\/ready &amp;&amp;\r\nuv run --locked python -m scripts.seed_cosmos &amp;&amp;\r\nuv run --locked uvicorn app.api:app --host 127.0.0.1 --port 8001<\/code><\/pre>\n<p>If port 8001 is occupied, use <span style=\"font-family: terminal, monaco, monospace;\">&#8211;port 8002<\/span> instead; keep that base URL for requests to this server. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/seed_cosmos.py\">seeder<\/a> creates the containers and sample records after readiness succeeds. Then the <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/app\/api.py\">FastAPI application<\/a> connects through the async Azure Cosmos DB SDK using <span style=\"font-family: terminal, monaco, monospace;\">.env<\/span> and the <span style=\"font-family: terminal, monaco, monospace;\">COSMOS_ENDPOINT<\/span> override above. The exported value takes precedence in this terminal without overwriting your local configuration file, including if an older checkout still uses a custom port.<\/p>\n<p>Open <span style=\"font-family: terminal, monaco, monospace;\">http:\/\/127.0.0.1:8001\/docs<\/span> to try requests against the seeded database (use your chosen port if you changed it). There&#8217;s no Azure account to configure. The template supplies Microsoft&#8217;s public emulator key, but the <a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/emulator-linux#authentication\">vNext emulator doesn&#8217;t enforce authentication<\/a>, so we keep its ports on loopback.<\/p>\n<p>Keep the application and emulator running. In a third terminal, start Azure Cosmos DB Shell:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">cosmosdbshell<\/code><\/pre>\n<p>At the Shell prompt, connect to the local database endpoint. Shell recognizes the emulator and selects Microsoft&#8217;s well-known public emulator key and Gateway mode; no Azure account credential or connection string is needed. Enter these commands one at a time:<\/p>\n<pre class=\"prettyprint language-default\">connect http:\/\/127.0.0.1:8081\/\r\nls\r\ncd fleetchargetest-demo\r\nls\r\ncd dispatchUpdates\r\nprint current-dispatch SEA-01\r\nprint current-dispatch PDX-02<\/pre>\n<p>Bare <span style=\"font-family: terminal, monaco, monospace;\">connect<\/span> displays the current connection information. The <span style=\"font-family: terminal, monaco, monospace;\">print<\/span> command performs a point read using the document ID followed by the partition key. These commands were verified with Shell 1.1.280-preview and use the endpoint and database name from the sample&#8217;s default configuration. If you changed either value, use your configured endpoint or database name.<\/p>\n<p>Check these fields in the returned documents:<\/p>\n<div class=\"monaco-scrollable-element rendered-markdown-table-scroll-wrapper\" role=\"presentation\">\n<div>\n<table>\n<thead>\n<tr>\n<th>Partition key<\/th>\n<th>Document ID<\/th>\n<th>Pickup bay<\/th>\n<th>Update reference<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>SEA-01<\/code><\/td>\n<td><code>current-dispatch<\/code><\/td>\n<td><code>BAY-2<\/code><\/td>\n<td><code>dispatch-001<\/code><\/td>\n<\/tr>\n<tr>\n<td><code>PDX-02<\/code><\/td>\n<td><code>current-dispatch<\/code><\/td>\n<td><code>BAY-99<\/code><\/td>\n<td><code>dispatch-099<\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<div class=\"invisible scrollbar horizontal\" role=\"presentation\" aria-hidden=\"true\">\n<div class=\"slider\"><\/div>\n<\/div>\n<div class=\"invisible scrollbar vertical\" role=\"presentation\" aria-hidden=\"true\">\n<div class=\"slider\">Both documents have the same ID, but they belong to different logical partitions. Supplying the document ID and partition key identifies the snapshot to read.<\/div>\n<\/div>\n<\/div>\n<p>Use Shell to inspect the records, but leave them unchanged. The next steps submit updates through the application so the feed route remains part of the test.<\/p>\n<p>When you&#8217;re ready to move on, stop Uvicorn with <strong>Ctrl+C<\/strong> in the second terminal, then stop the emulator with <strong>Ctrl+C<\/strong> in the first. <span style=\"font-family: terminal, monaco, monospace;\">&#8211;rm<\/span> removes this disposable container and its data. CI will start with a clean database.<\/p>\n<h2>Give the change a database test in CI<\/h2>\n<p>That local setup is useful, but we don&#8217;t want to rebuild it by hand for every test run. From the repository directory, run:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">uv run --locked --extra test python -m scripts.ci --components-only\r\nuv build<\/code><\/pre>\n<p>A fresh environment can spend a few minutes type-checking dependencies before the emulator starts. The helper allows up to ten minutes for that phase.<\/p>\n<p><a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/ci.py\"><span style=\"font-family: terminal, monaco, monospace;\">scripts.ci<\/span><\/a> uses an <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/emulator.py\">emulator helper<\/a> to pull the image if needed, start an isolated container and wait for <span style=\"font-family: terminal, monaco, monospace;\">\/ready<\/span>. Docker chooses free loopback ports, and the helper passes the endpoint to the tests instead of using the fixed <span style=\"font-family: terminal, monaco, monospace;\">.env<\/span> address. The output shows each stage:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">[emulator] Check vNext image availability\r\n[emulator] Create isolated loopback container\r\n[emulator] Wait for http:\/\/127.0.0.1:PORT\/ready (&lt;=120s)\r\n[emulator] Ready: COSMOS_ENDPOINT=http:\/\/127.0.0.1:PORT<\/code><\/pre>\n<p>Locally, the helper reuses the downloaded image. A clean GitHub runner needs to pull it. Each test using the database fixture gets a separate seeded database, and cleanup removes only the run&#8217;s own container, including after a handled failure.<\/p>\n<p>These component tests exercise rules and SDK operations without calling Ollama. <span style=\"font-family: terminal, monaco, monospace;\">uv build<\/span> checks packaging too; the source distribution includes <span style=\"font-family: terminal, monaco, monospace;\">.env.example<\/span> but excludes local <span style=\"font-family: terminal, monaco, monospace;\">.env<\/span> overrides.<\/p>\n<p>GitHub-hosted Ubuntu runners already have Docker, so the workflow calls this same script. It doesn&#8217;t need separate emulator startup commands. The complete file below has a component job and an Ollama job, each on its own runner.<\/p>\n<p><strong>GitHub Actions workflow: <\/strong><a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/.github\/workflows\/emulator-ci.yml\"><strong><span style=\"font-family: terminal, monaco, monospace;\">.github\/workflows\/emulator-ci.yml<\/span><\/strong><\/a><\/p>\n<p>This is the whole YAML configuration GitHub uses to trigger and run the checks.<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">name: Cosmos emulator CI\r\n\r\non:\r\n  pull_request:\r\n    types: [opened, synchronize, reopened]\r\n  workflow_dispatch:\r\n\r\npermissions:\r\n  contents: read\r\n\r\nconcurrency:\r\n  group: emulator-ci-${{ github.workflow }}-${{ github.ref }}\r\n  cancel-in-progress: true\r\n\r\njobs:\r\n  integration:\r\n    name: Emulator component checks\r\n    runs-on: ubuntu-24.04\r\n    timeout-minutes: 20\r\n    env:\r\n      UV_PYTHON_DOWNLOADS: never\r\n      PIP_DISABLE_PIP_VERSION_CHECK: \"1\"\r\n    steps:\r\n      - name: Check out the tested revision\r\n        uses: actions\/checkout@v7\r\n        with:\r\n          persist-credentials: false\r\n      - name: Set up Python 3.12\r\n        uses: actions\/setup-python@v7\r\n        with:\r\n          python-version: \"3.12\"\r\n      - name: Install uv 0.13.0 from Microsoft\r\n        shell: bash\r\n        run: |\r\n          python -m pip install --no-deps \\\r\n            \"https:\/\/pkgs.dev.azure.com\/azure-sdk\/public\/_packaging\/azure-sdk-for-python\/pypi\/download\/uv\/0.13\/uv-0.13.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl\"\r\n      - name: Run the same local CI gate\r\n        run: uv run --locked --extra test python -m scripts.ci --components-only\r\n      - name: Build source and wheel distributions\r\n        run: uv build\r\n      - name: Publish component test report\r\n        if: always()\r\n        run: python -m scripts.ci_report --suite emulator\r\n      - name: Preserve test results and emulator diagnostics\r\n        if: always()\r\n        uses: actions\/upload-artifact@v7\r\n        with:\r\n          name: emulator-results-${{ github.run_attempt }}\r\n          path: .artifacts\/\r\n          include-hidden-files: true\r\n          if-no-files-found: warn\r\n          retention-days: 7\r\n\r\n  live-model:\r\n    name: Real agent, grounded answers and CRUD\r\n    runs-on: ubuntu-24.04\r\n    timeout-minutes: 55\r\n    env:\r\n      UV_PYTHON_DOWNLOADS: never\r\n      PIP_DISABLE_PIP_VERSION_CHECK: \"1\"\r\n      OLLAMA_HOST: 127.0.0.1:11434\r\n      OLLAMA_NO_CLOUD: \"1\"\r\n      OLLAMA_NUM_PARALLEL: \"1\"\r\n      OLLAMA_MAX_LOADED_MODELS: \"1\"\r\n    steps:\r\n      - name: Check out the tested revision\r\n        uses: actions\/checkout@v7\r\n        with:\r\n          persist-credentials: false\r\n      - name: Set up Python 3.12\r\n        uses: actions\/setup-python@v7\r\n        with:\r\n          python-version: \"3.12\"\r\n      - name: Install uv 0.13.0 from Microsoft\r\n        shell: bash\r\n        run: |\r\n          python -m pip install --no-deps \\\r\n            \"https:\/\/pkgs.dev.azure.com\/azure-sdk\/public\/_packaging\/azure-sdk-for-python\/pypi\/download\/uv\/0.13\/uv-0.13.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl\"\r\n      - name: Install locked test and local-model dependencies\r\n        run: uv sync --locked --extra test\r\n      - name: Install Ollama 0.40.6\r\n        shell: bash\r\n        run: |\r\n          mkdir -p .artifacts \"$RUNNER_TEMP\/fleetcharge-ollama\"\r\n          curl --fail --location --retry 2 --connect-timeout 15 --max-time 300 \\\r\n            https:\/\/github.com\/ollama\/ollama\/releases\/download\/v0.40.6\/ollama-linux-amd64.tar.zst \\\r\n            --output \"$RUNNER_TEMP\/ollama-linux-amd64.tar.zst\"\r\n          tar --zstd -xf \"$RUNNER_TEMP\/ollama-linux-amd64.tar.zst\" -C \"$RUNNER_TEMP\/fleetcharge-ollama\"\r\n          echo \"$RUNNER_TEMP\/fleetcharge-ollama\/bin\" &gt;&gt; \"$GITHUB_PATH\"\r\n          echo \"OLLAMA_MODELS=$RUNNER_TEMP\/fleetcharge-ollama-models\" &gt;&gt; \"$GITHUB_ENV\"\r\n      - name: Start isolated Ollama and poll readiness\r\n        shell: bash\r\n        run: |\r\n          ollama serve &gt; .artifacts\/ollama-server.log 2&gt;&amp;1 &amp;\r\n          echo \"$!\" &gt; \"$RUNNER_TEMP\/fleetcharge-ollama.pid\"\r\n          curl --fail --silent --show-error --retry 60 --retry-delay 1 \\\r\n            --retry-connrefused --retry-max-time 60 --max-time 2 \\\r\n            http:\/\/127.0.0.1:11434\/api\/version | tee .artifacts\/ollama-version.json\r\n          kill -0 \"$(cat \"$RUNNER_TEMP\/fleetcharge-ollama.pid\")\"\r\n      - name: Set up Microsoft Phi-3.5 for the available CPUs\r\n        shell: bash\r\n        timeout-minutes: 10\r\n        run: |\r\n          ollama pull phi3.5:latest 2&gt;&amp;1 | tee .artifacts\/ollama-pull.log\r\n          cp scripts\/Ollama.modelfile \"$RUNNER_TEMP\/Ollama.modelfile\"\r\n          printf '\\nPARAMETER num_thread %s\\n' \"$(nproc)\" &gt;&gt; \"$RUNNER_TEMP\/Ollama.modelfile\"\r\n          ollama create fleetcharge-phi3.5 -f \"$RUNNER_TEMP\/Ollama.modelfile\"\r\n      - name: Verify actual LLM expected responses and persisted output CRUD\r\n        run: uv run --no-sync python -m scripts.test_ollama --model fleetcharge-phi3.5:latest --review-timeout 900\r\n      - name: Stop only the job-owned Ollama process\r\n        if: always()\r\n        shell: bash\r\n        run: |\r\n          if [[ -f \"$RUNNER_TEMP\/fleetcharge-ollama.pid\" ]]; then\r\n            pid=\"$(cat \"$RUNNER_TEMP\/fleetcharge-ollama.pid\")\"\r\n            if kill -0 \"$pid\" 2&gt;\/dev\/null; then\r\n              kill \"$pid\"\r\n            fi\r\n          fi\r\n      - name: Publish actual model responses and test report\r\n        if: always()\r\n        run: python -m scripts.ci_report --suite ollama\r\n      - name: Preserve live-model results and diagnostics\r\n        if: always()\r\n        uses: actions\/upload-artifact@v7\r\n        with:\r\n          name: ollama-results-${{ github.run_attempt }}\r\n          path: .artifacts\/\r\n          include-hidden-files: true\r\n          if-no-files-found: warn\r\n          retention-days: 7<\/code><\/pre>\n<p><strong>Run the same local CI gate<\/strong> executes our local command: lint, formatting, types, then the emulator tests. The <span style=\"font-family: terminal, monaco, monospace;\">if: always()<\/span> steps save reports and logs even when a test fails. <span style=\"font-family: terminal, monaco, monospace;\">concurrency<\/span> cancels a superseded run.<\/p>\n<p>The <span style=\"font-family: terminal, monaco, monospace;\">pull_request<\/span> event starts CI when we open or reopen a PR. <span style=\"font-family: terminal, monaco, monospace;\">synchronize<\/span> runs it again each time we push a commit to that PR&#8217;s branch, whatever the branch is called. Nothing runs for a branch without an open PR, and there&#8217;s no separate run after the merge. Manual dispatch lets us test a selected revision.<\/p>\n<p>The jobs need only read access to the repository and no Azure credentials. They test database integration, not production authorization or cloud performance.<\/p>\n<p>Enable GitHub Actions in your fork&#8217;s <strong>Actions<\/strong> tab first. Then authenticate the CLI and check which account it is using:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">gh auth login\r\ngh api user --jq .login<\/code><\/pre>\n<p>Confirm the printed login is the account you intend to use and has write access to your fork. With multiple saved accounts, select one first with <span style=\"font-family: terminal, monaco, monospace;\">gh auth switch &#8211;hostname github.com &#8211;user YOUR-LOGIN<\/span>.<\/p>\n<p>Now start the completed workflow, including the real-model job:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">gh workflow run emulator-ci.yml --repo \"$repo\" --ref main\r\ngh run list --repo \"$repo\" --workflow emulator-ci.yml --event workflow_dispatch --limit 5<\/code><\/pre>\n<p>Watch the returned run ID with <span style=\"font-family: terminal, monaco, monospace;\">gh run watch RUN_ID &#8211;repo &#8220;$repo&#8221; &#8211;exit-status<\/span>, or open <strong>Cosmos emulator CI<\/strong> under <strong>Actions<\/strong>. Confirm the emulator became ready and both jobs passed. Fixing setup problems now will make later feature failures easier to diagnose.<\/p>\n<p>Check the repository&#8217;s <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/actions\/workflows\/emulator-ci.yml\">Cosmos emulator CI runs<\/a> for the results of both jobs on GitHub-hosted Ubuntu runners.<\/p>\n<p><img decoding=\"async\" width=\"320\" height=\"199\" class=\"wp-image-13094\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-completed-run-shows-both-the-component.png\" alt=\"An earlier completed run shows both the component checks and real-model job passing.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-completed-run-shows-both-the-component.png 320w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-completed-run-shows-both-the-component-300x187.png 300w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><\/p>\n<h2>Change the data the application needs<\/h2>\n<p>FleetCharge already recommends charging from depot data. The dispatch feature adds a question drivers ask before a delivery wave: where do we collect our paperwork?<\/p>\n<p>SEA-01 initially uses BAY-2. The depot publishes an update moving pickup to BAY-7, and the next answer needs to reflect that move. <span style=\"font-family: terminal, monaco, monospace;\">POST \/feeds\/dispatch-updates<\/span> accepts the update as a current snapshot, rather than keeping an event history. The reference identifies which update the answer used. Here&#8217;s the request:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">{\r\n  \"depotId\": \"SEA-01\",\r\n  \"updateId\": \"dispatch-007\",\r\n  \"pickupBay\": \"BAY-7\"\r\n}<\/code><\/pre>\n<p>The initial records come from <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/tests\/fixtures\/dispatchUpdates.json\"><span style=\"font-family: terminal, monaco, monospace;\">tests\/fixtures\/dispatchUpdates.json<\/span><\/a>. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/seed_cosmos.py\">seeder<\/a> loads SEA-01 as <span style=\"font-family: terminal, monaco, monospace;\">BAY-2 \/ dispatch-001<\/span> and PDX-02 as <span style=\"font-family: terminal, monaco, monospace;\">BAY-99 \/ dispatch-099<\/span> into the <span style=\"font-family: terminal, monaco, monospace;\">dispatchUpdates<\/span> container, partitioned by <span style=\"font-family: terminal, monaco, monospace;\">\/depotId<\/span>. Each depot has a document named <span style=\"font-family: terminal, monaco, monospace;\">current-dispatch<\/span> in its own partition.<\/p>\n<h3>Write the new location into the emulator<\/h3>\n<p>Posting that JSON to <span style=\"font-family: terminal, monaco, monospace;\">\/feeds\/dispatch-updates<\/span> changes the database. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/app\/api.py\">feed route<\/a> calls <span style=\"font-family: terminal, monaco, monospace;\">ingest_dispatch<\/span> in <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/app\/dispatch.py\"><span style=\"font-family: terminal, monaco, monospace;\">app\/dispatch.py<\/span><\/a>:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">async def ingest_dispatch(repository: CosmosRepository, request: DispatchFeed) -&gt; DispatchUpdate:\r\n    snapshot = DispatchUpdate(**request.model_dump())\r\n    stored = await repository.database.get_container_client(\"dispatchUpdates\").upsert_item(\r\n        snapshot.model_dump(by_alias=True)\r\n    )\r\n    acknowledged = parse_document(DispatchUpdate, stored)\r\n    if acknowledged != snapshot:\r\n        raise SourceDataError(\"Dispatch acknowledgement does not match the submitted snapshot\")\r\n    return acknowledged<\/code><\/pre>\n<p><span style=\"font-family: terminal, monaco, monospace;\">upsert_item<\/span> writes the snapshot through the SDK. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/app\/schemas.py\"><span style=\"font-family: terminal, monaco, monospace;\">DispatchUpdate<\/span> schema<\/a> supplies the <span style=\"font-family: terminal, monaco, monospace;\">current-dispatch<\/span> document ID. With the same ID and SEA-01 partition key, the write replaces the earlier snapshot while leaving PDX-02 alone. We&#8217;ll exercise this API, rather than editing the seed fixture.<\/p>\n<h3>Read the updated location for the answer<\/h3>\n<p><span style=\"font-family: terminal, monaco, monospace;\">POST \/agent\/ask-dispatch<\/span> reads the requested depot&#8217;s snapshot before asking the model to answer. It uses a point read with the document ID and partition key, keeping the read inside that depot&#8217;s partition. This function comes from <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/app\/dispatch.py\"><span style=\"font-family: terminal, monaco, monospace;\">app\/dispatch.py<\/span><\/a>; the full file includes the imports and model-answer path:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">async def read_dispatch(repository: CosmosRepository, depot_id: str) -&gt; DispatchUpdate:\r\n    document = await repository.read(\"dispatchUpdates\", \"current-dispatch\", depot_id)\r\n    update = parse_document(DispatchUpdate, document)\r\n    if update.depot_id != depot_id:\r\n        raise SourceDataError(\"Dispatch snapshot belongs to another depot\")\r\n    return update<\/code><\/pre>\n<p><img decoding=\"async\" width=\"1600\" height=\"900\" class=\"wp-image-13095\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora.png\" alt=\"The feed changes SEA-01 from BAY-2 to BAY-7. Storage, model context and the next answer are checked while PDX-02 remains unchanged.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora.png 1600w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora-1024x576.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora-768x432.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-feed-changes-sea-01-from-bay-2-to-bay-7-stora-1536x864.png 1536w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>The model receives that snapshot and the driver&#8217;s question. The application checks its returned bay and reference against storage, including their literal values in the generated sentence. It rejects a wrong or incomplete answer. Unlike the charging agent&#8217;s tool loop, this path needs one read and a completion.<\/p>\n<h2>Ask the same question before and after the update<\/h2>\n<p>In <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/tests\/live\/test_ollama_review.py\"><span style=\"font-family: terminal, monaco, monospace;\">tests\/live\/test_ollama_review.py<\/span><\/a>, <span style=\"font-family: terminal, monaco, monospace;\">test_real_agent_grounded_counts_and_output_crud<\/span> asks:<\/p>\n<p>Where should drivers collect dispatch paperwork? Include the update reference.<\/p>\n<p>We keep the question and depot fixed and expect the answer to change from <span style=\"font-family: terminal, monaco, monospace;\">BAY-2 \/ dispatch-001<\/span> to <span style=\"font-family: terminal, monaco, monospace;\">BAY-7 \/ dispatch-007<\/span>.<\/p>\n<p>This unchanged excerpt runs inside that test&#8217;s async function and HTTP-client context; it isn&#8217;t a standalone Python script:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">dispatch_question = {\r\n    \"depotId\": \"SEA-01\",\r\n    \"question\": \"Where should drivers collect dispatch paperwork? \"\r\n    \"Include the update reference.\",\r\n}\r\n\r\nasync def verify_dispatch(bay, update_id):\r\n    stored = await repo.read(\"dispatchUpdates\", \"current-dispatch\", \"SEA-01\")\r\n    assert stored[\"pickupBay\"] == bay and stored[\"updateId\"] == update_id\r\n    response = await http.post(\"\/agent\/ask-dispatch\", json=dispatch_question)\r\n    record_response(\r\n        f\"Stored dispatch update {update_id} directs drivers to {bay}\",\r\n        response,\r\n        {\"pickupBay\": bay, \"updateId\": update_id},\r\n        \"exact bay\/reference plus literal evidence in generated sentence\",\r\n        bucket=\"dispatch\",\r\n        body=dispatch_question,\r\n    )\r\n    assert response.status_code == 200, response.text\r\n    result = response.json()\r\n    assert result[\"pickupBay\"] == bay and result[\"updateId\"] == update_id\r\n    assert bay in result[\"answer\"] and update_id in result[\"answer\"]\r\n    context = json.loads(transcript[-1][\"messages\"][-1][\"text\"])\r\n    assert context[\"dispatchUpdate\"][\"pickupBay\"] == bay\r\n    assert context[\"dispatchUpdate\"][\"updateId\"] == update_id\r\n    assert context[\"dispatchUpdate\"][\"depotId\"] == \"SEA-01\"\r\n    assert context[\"question\"] == dispatch_question[\"question\"]\r\n    print(f\"[dispatch answer] {result['answer']}\", flush=True)\r\n\r\nawait verify_dispatch(\"BAY-2\", \"dispatch-001\")\r\nfeed = {\"depotId\": \"SEA-01\", \"updateId\": \"dispatch-007\", \"pickupBay\": \"BAY-7\"}\r\nreceipt = await http.post(\"\/feeds\/dispatch-updates\", json=feed)\r\nassert receipt.status_code == 200, receipt.text\r\nassert all(receipt.json()[key] == value for key, value in feed.items())\r\nassert (await repo.read(\"dispatchUpdates\", \"current-dispatch\", \"PDX-02\"))[\r\n    \"pickupBay\"\r\n] == \"BAY-99\"\r\nawait verify_dispatch(\"BAY-7\", \"dispatch-007\")<\/code><\/pre>\n<p>The write happens at <span style=\"font-family: terminal, monaco, monospace;\">await http.post(&#8220;\/feeds\/dispatch-updates&#8221;, json=feed)<\/span>. On each side of it, <span style=\"font-family: terminal, monaco, monospace;\">verify_dispatch<\/span> independently reads storage through the SDK, calls the endpoint and checks the actual model input and answer. PDX-02 must still have BAY-99.<\/p>\n<p>The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/tests\/conftest.py\"><span style=\"font-family: terminal, monaco, monospace;\">store<\/span> fixture<\/a> provides the seeded database. The full test sets up the in-process HTTP client, response recorder and provider transcript. Database calls reach the emulator; inference calls reach Ollama. The complete local gate below supplies this setup.<\/p>\n<p>These separate checks help locate failures. Missing stored data points to ingestion; a stale prompt points to retrieval; a correct prompt with a wrong answer points to the completion.<\/p>\n<p>During development, a real completion returned the right reference in its JSON field but left it out of the sentence. The guard rejected it. We clarified the prompt and response schema, kept the assertion, and reran the test.<\/p>\n<p><img decoding=\"async\" width=\"694\" height=\"204\" class=\"wp-image-13096\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-capture-of-the-dispatch-regression-show.png\" alt=\"An earlier capture of the dispatch regression shows the BAY-2 check, feed POST, PDX-02 isolation assertion and BAY-7 check.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-capture-of-the-dispatch-regression-show.png 694w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/an-earlier-capture-of-the-dispatch-regression-show-300x88.png 300w\" sizes=\"(max-width: 694px) 100vw, 694px\" \/><\/p>\n<p>You can try the same change over HTTP. Start the demo from the repository directory:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">FLEETCHARGE_TIMEOUT_SECONDS=900 uv run --locked python -m scripts.demo --port 8001<\/code><\/pre>\n<p>The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/demo.py\">demo script<\/a> starts its own emulator, seeds the database and starts the API. Wait for <span style=\"font-family: terminal, monaco, monospace;\">POST http:\/\/127.0.0.1:8001\/agent\/review-delivery-wave<\/span> in the terminal, then open a second Bash terminal. The <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/ask-dispatch.sh\"><span style=\"font-family: terminal, monaco, monospace;\">scripts\/ask-dispatch.sh<\/span> request script<\/a> asks the question, publishes the update and asks again. Run it from the repository directory:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">bash scripts\/ask-dispatch.sh<\/code><\/pre>\n<p>The script needs the <span style=\"font-family: terminal, monaco, monospace;\">curl<\/span> and <span style=\"font-family: terminal, monaco, monospace;\">jq<\/span> prerequisites above. In the script below, <span style=\"font-family: terminal, monaco, monospace;\">receipt=$(curl &#8230;)<\/span> posts the new BAY-7 record; the other requests only read:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">#!\/usr\/bin\/env bash\r\nset -euo pipefail\r\nbase=\"${1:-http:\/\/127.0.0.1:8001}\"\r\nquestion='{\r\n  \"depotId\": \"SEA-01\",\r\n  \"question\": \"Where should drivers collect dispatch paperwork? Include the update reference.\"\r\n}'\r\n\r\nbefore=$(curl --fail-with-body --silent --show-error --max-time 200 \\\r\n  -H 'Content-Type: application\/json' \\\r\n  --data \"$question\" \"$base\/agent\/ask-dispatch\")\r\nprintf '%s\\n' \"$before\" | jq .\r\nprintf '%s\\n' \"$before\" | jq -e '\r\n  .pickupBay == \"BAY-2\" and .updateId == \"dispatch-001\"\r\n  and (.answer | contains(\"BAY-2\"))\r\n  and (.answer | contains(\"dispatch-001\"))\r\n'\r\n\r\nreceipt=$(curl --fail-with-body --silent --show-error --max-time 60 \\\r\n  -H 'Content-Type: application\/json' \\\r\n  --data '{\"depotId\":\"SEA-01\",\"updateId\":\"dispatch-007\",\"pickupBay\":\"BAY-7\"}' \\\r\n  \"$base\/feeds\/dispatch-updates\")\r\nprintf '%s\\n' \"$receipt\" | jq -e '\r\n  .depotId == \"SEA-01\" and .pickupBay == \"BAY-7\" and .updateId == \"dispatch-007\"\r\n'\r\n\r\nafter=$(curl --fail-with-body --silent --show-error --max-time 200 \\\r\n  -H 'Content-Type: application\/json' \\\r\n  --data \"$question\" \"$base\/agent\/ask-dispatch\")\r\nprintf '%s\\n' \"$after\" | jq .\r\nprintf '%s\\n' \"$after\" | jq -e '\r\n  .pickupBay == \"BAY-7\" and .updateId == \"dispatch-007\"\r\n  and (.answer | contains(\"BAY-7\"))\r\n  and (.answer | contains(\"dispatch-007\"))\r\n'\r\nprintf '%s\\n' \"PASS: the same question now returns BAY-7 \/ dispatch-007.\"<\/code><\/pre>\n<p>If port 8001 is occupied, start the demo with <span style=\"font-family: terminal, monaco, monospace;\">&#8211;port 8002<\/span>, wait for the URL with that port, and run <span style=\"font-family: terminal, monaco, monospace;\">bash scripts\/ask-dispatch.sh http:\/\/127.0.0.1:8002<\/span> from the repository. The bundled copy accepts the same base URL argument. Without it the script uses 8001.<\/p>\n<p>The first request may take a while as the model loads. <span style=\"font-family: terminal, monaco, monospace;\">jq -e<\/span> prints <span style=\"font-family: terminal, monaco, monospace;\">true<\/span> for a passing check; an HTTP error or failed assertion stops the script. The sentence can vary, but the bay and reference must match:<\/p>\n<p><img decoding=\"async\" width=\"990\" height=\"521\" class=\"wp-image-13097\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/git-bash-running-the-curl-block-the-same-question.png\" alt=\"Git Bash running the curl block: the same question first returns BAY-2 and dispatch-001, then BAY-7 and dispatch-007 after the update.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/git-bash-running-the-curl-block-the-same-question.png 990w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/git-bash-running-the-curl-block-the-same-question-300x158.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/git-bash-running-the-curl-block-the-same-question-768x404.png 768w\" sizes=\"(max-width: 990px) 100vw, 990px\" \/><\/p>\n<p>Press <strong>Ctrl+C<\/strong> in the server terminal and wait for cleanup. Restart the demo before repeating the script so it begins with the original seed.<\/p>\n<h2>Make sure the PR actually runs the new test<\/h2>\n<p>The component job picks up the <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/tests\/integration\/test_dispatch_feed.py\">feed integration tests<\/a>. The answer assertions belong in the live suite, in the same PR as the feature. Otherwise, CI could verify the write without noticing a stale generated answer.<\/p>\n<p>In the workflow&#8217;s <span style=\"font-family: terminal, monaco, monospace;\">live-model<\/span> job, <span style=\"font-family: terminal, monaco, monospace;\">ollama serve<\/span> starts the service, <span style=\"font-family: terminal, monaco, monospace;\">ollama pull<\/span> downloads the weights and <span style=\"font-family: terminal, monaco, monospace;\">ollama create<\/span> applies the model settings. The model loads on the first inference request. <strong>Verify actual LLM expected responses and persisted output CRUD<\/strong> runs <a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\/blob\/main\/scripts\/test_ollama.py\"><span style=\"font-family: terminal, monaco, monospace;\">scripts.test_ollama<\/span><\/a>, which starts a separate emulator for the live tests. Cleanup uses the recorded Ollama process ID so it stops only the job&#8217;s own service.<\/p>\n<p>Those live tests make 20 real inference calls. Besides the dispatch update, they check that adding a vehicle changes a count from three to four, and that raising battery telemetry from 58% to 90% turns an 11-minute charging recommendation into <span style=\"font-family: terminal, monaco, monospace;\">noAction<\/span>. SDK checks verify the saved recommendation and its replacement and deletion. Application rules calculate the charging duration; the model invokes the tools and returns the acknowledged result.<\/p>\n<p>Before pushing, run both suites locally with <span style=\"font-family: terminal, monaco, monospace;\">scripts.ci<\/span> without <span style=\"font-family: terminal, monaco, monospace;\">&#8211;components-only<\/span>:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">uv run --locked --extra test python -m scripts.ci --review-timeout 900\r\nuv build<\/code><\/pre>\n<p>Locally the suites run one after the other; Actions runs them independently. The 900-second deadline gives each charging review more time on CPUs.<\/p>\n<p><img decoding=\"async\" width=\"1600\" height=\"900\" class=\"wp-image-13098\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model.png\" alt=\"The workflow runs independent component and model jobs, each against its own emulator.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model.png 1600w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model-300x169.png 300w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model-1024x576.png 1024w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model-768x432.png 768w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-workflow-runs-independent-component-and-model-1536x864.png 1536w\" sizes=\"(max-width: 1600px) 100vw, 1600px\" \/><\/p>\n<p>For your own feature, create a branch before editing:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">git switch -c feature\/your-change<\/code><\/pre>\n<p>Make the application change and add its tests, then rerun the complete local gate. The dispatch example is already in the repository, so reading it and running it won&#8217;t create anything to commit. Once you have an actual diff, stage only the files you intend to include and open a PR:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">git diff --stat\r\ngit add app tests .github\/workflows\/emulator-ci.yml\r\ngit diff --cached\r\ngit commit -m \"Add feature and regression coverage\"\r\ngit push -u origin feature\/your-change\r\ngh pr create --repo \"$repo\" --base main --head feature\/your-change \\\r\n  --title \"Add feature and regression coverage\" \\\r\n  --body \"Verify the database change and expected application behavior before merge.\"\r\ngh pr checks feature\/your-change --repo \"$repo\" --watch<\/code><\/pre>\n<p>If CI doesn&#8217;t start, check for merge conflicts or an <strong>Awaiting approval<\/strong> notice on a fork contribution. Keep <span style=\"font-family: terminal, monaco, monospace;\">pull_request<\/span>; <span style=\"font-family: terminal, monaco, monospace;\">pull_request_target<\/span> has a different trust model.<\/p>\n<p>GitHub tests the PR merged with its target branch. Wait for both <strong>Emulator component checks<\/strong> and <strong>Real agent, grounded answers and CRUD<\/strong> to pass for the latest update, not just an earlier commit.<\/p>\n<p><img decoding=\"async\" width=\"510\" height=\"231\" class=\"wp-image-13099\" src=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-completed-historical-feature-pr-shows-both-emu.png\" alt=\"The completed historical feature PR shows both emulator component checks and the real-model job succeeded.\" srcset=\"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-completed-historical-feature-pr-shows-both-emu.png 510w, https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-content\/uploads\/sites\/52\/2026\/10\/the-completed-historical-feature-pr-shows-both-emu-300x136.png 300w\" sizes=\"(max-width: 510px) 100vw, 510px\" \/><\/p>\n<p>If a job fails, we open its summary and artifacts. The model job preserves actual inputs and completions, expected results, SDK checks and service logs, and <span style=\"font-family: terminal, monaco, monospace;\">gh run view RUN_ID &#8211;repo &#8220;$repo&#8221; &#8211;log-failed<\/span> shows the failing logs in the terminal. We fix the problem locally, push to the same branch and keep the assertion rather than swapping in a canned answer.<\/p>\n<h2>Merge the checked change<\/h2>\n<p>Once the latest PR checks pass and the code is reviewed, we merge it:<\/p>\n<pre class=\"prettyprint language-default\"><code class=\"language-default\">gh pr merge feature\/your-change --repo \"$repo\" --squash --delete-branch\r\ngit switch main\r\ngit pull --ff-only origin main<\/code><\/pre>\n<p>Configure repository rules or branch protection to require both jobs if you want GitHub to enforce the gate. The workflow alone doesn&#8217;t prevent a merge.<\/p>\n<h2>What to take into your next change<\/h2>\n<p>Try another change: update PDX-02 and check that SEA-01 stays untouched. In your own application, pick a write and test its observable effect, including the data it should leave alone.<\/p>\n<p>Rerun the full gate when you update the emulator or model, too. <span style=\"font-family: terminal, monaco, monospace;\">vnext-latest<\/span> and <span style=\"font-family: terminal, monaco, monospace;\">phi3.5:latest<\/span> can move.<\/p>\n<p>Continuous deployment comes after this. Deploy the checked revision, then verify identity, access to the real Azure Cosmos DB account, networking and the model service in that environment. The emulator gives us an early regression test, not proof that the deployed environment works.<\/p>\n<h2>Documentation and demo<\/h2>\n<ul>\n<li><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/emulator-linux\">Azure Cosmos DB vNext emulator guidance<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/en\/actions\/get-started\/continuous-integration\">GitHub Actions: continuous integration (CI)<\/a><\/li>\n<li><a href=\"https:\/\/docs.github.com\/en\/actions\/reference\/workflows-and-actions\/events-that-trigger-workflows\">GitHub Actions: events that trigger workflows<\/a><\/li>\n<li>\n<div>\n<div><a href=\"https:\/\/learn.microsoft.com\/azure\/cosmos-db\/shell\/command-reference\">Explore Azure Cosmos DB Shell commands<\/a>.<\/div>\n<\/div>\n<\/li>\n<li><a href=\"https:\/\/docs.github.com\/en\/actions\/get-started\/continuous-deployment\">GitHub Actions: continuous deployment (CD)<\/a><\/li>\n<li><a href=\"https:\/\/learn.microsoft.com\/agent-framework\/integrations\/by-component\/model-providers\/ollama\">Microsoft Agent Framework: Ollama integration<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/AzureCosmosDB\/fleetcharge-agent-cosmos-ci\">FleetCharge demo repository: application, tests and workflow<\/a><\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">About Azure Cosmos DB<\/h2>\n<\/div>\n<p dir=\"auto\">Azure Cosmos DB is a fully managed NoSQL and vector database for modern applications, including AI. Ready to move beyond local testing? <a href=\"https:\/\/cosmos.azure.com\/try\/\" target=\"_blank\" rel=\"nofollow noopener\">Try Azure Cosmos DB for free<\/a>.<\/p>\n<p dir=\"auto\">Follow us on <a href=\"https:\/\/twitter.com\/AzureCosmosDB\" rel=\"nofollow\">X<\/a>, <a href=\"https:\/\/aka.ms\/AzureCosmosDBYouTube\" rel=\"nofollow\">YouTube<\/a> and <a href=\"https:\/\/www.linkedin.com\/company\/azure-cosmos-db\/\" rel=\"nofollow\">LinkedIn<\/a> for product updates and developer walkthroughs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you change a database-backed feature, a successful HTTP response isn&#8217;t enough. You need to know that the write reached storage, the application retrieved the updated record, and the next answer reflects it. The Azure Cosmos DB Emulator runs locally in Docker and lets us use the SDK we&#8217;ll use in production. We&#8217;ll develop against [&hellip;]<\/p>\n","protected":false},"author":39313,"featured_media":13112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-13086","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-core-sql-api"],"acf":[],"blog_post_summary":"<p>When you change a database-backed feature, a successful HTTP response isn&#8217;t enough. You need to know that the write reached storage, the application retrieved the updated record, and the next answer reflects it. The Azure Cosmos DB Emulator runs locally in Docker and lets us use the SDK we&#8217;ll use in production. We&#8217;ll develop against [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/13086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/users\/39313"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/comments?post=13086"}],"version-history":[{"count":3,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/13086\/revisions"}],"predecessor-version":[{"id":13129,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/posts\/13086\/revisions\/13129"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media\/13112"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/media?parent=13086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/categories?post=13086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cosmosdb\/wp-json\/wp\/v2\/tags?post=13086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}