Skip to content
Merged
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
47 changes: 47 additions & 0 deletions .github/workflows/compatibility-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Compatibility infrastructure

on:
Comment thread
udsmicrosoft marked this conversation as resolved.
Resolved
workflow_dispatch:
push:
branches:
- main
paths:
- "compatibility/**"
- ".github/workflows/compatibility*"
- ".github/aw/actions-lock.json"
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- "compatibility/**"
- ".github/workflows/compatibility*"
- ".github/aw/actions-lock.json"

concurrency:
group: compatibility-infrastructure-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
compatibility-unit-tests:
name: Compatibility infrastructure
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Install compatibility development dependencies
run: python -m pip install -r compatibility/requirements-dev.txt
- name: Check scoped Python formatting and types
run: |
python -m black --check --config compatibility/pyproject.toml compatibility
python -m isort --check-only --settings-path compatibility/pyproject.toml compatibility
python -m flake8 --max-line-length=100 --extend-ignore=E203 compatibility
python -m mypy --config-file compatibility/pyproject.toml compatibility
- name: Run compatibility unit tests
run: python -m pytest -c compatibility/pyproject.toml compatibility/unit
- name: Check the README dashboard publisher
run: shellcheck compatibility/publish-readme.sh
100 changes: 100 additions & 0 deletions .github/workflows/compatibility-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Compatibility README dashboard

on:
workflow_run:
workflows: ["Ecosystem compatibility"]
types: [completed]
workflow_dispatch:
inputs:
run_id:
description: Completed compatibility workflow run ID, or blank to refresh stored evidence
type: string
required: false
push:
branches: [main]
paths:
- ".github/workflows/compatibility-readme.yml"
- "compatibility/**"
- "README.md"
schedule:
- cron: "17 * * * *"

permissions:
contents: read

concurrency:
# Distinct runs must not evict each other's pending publications.
group: compatibility-readme-${{ github.repository }}-${{ github.event.workflow_run.id || inputs.run_id || github.run_id }}-${{ github.event.workflow_run.run_attempt || github.run_attempt }}
cancel-in-progress: false

jobs:
publish:
name: Publish README status
if: >-
github.ref == format('refs/heads/{0}', github.event.repository.default_branch) &&
(github.event_name != 'workflow_run' ||
((github.event.workflow_run.event == 'workflow_dispatch' ||
github.event.workflow_run.event == 'schedule') &&
github.event.workflow_run.head_repository.full_name == github.repository &&
github.event.workflow_run.head_branch == github.event.repository.default_branch))
runs-on: ubuntu-24.04
timeout-minutes: 10
permissions:
actions: read
contents: write
steps:
- name: Check out trusted publisher code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: ${{ github.sha }}
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: "3.12"
- name: Install trusted publication dependencies
run: python -m pip install -r compatibility/requirements.txt
- name: Validate source workflow identity
id: source
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
SOURCE_RUN_ID: ${{ inputs.run_id }}
run: |
python -m compatibility.readme prepare \
--repository "$GITHUB_REPOSITORY" --branch "$DEFAULT_BRANCH" \
--event-name "$EVENT_NAME" --event-file "$GITHUB_EVENT_PATH" \
--run-id "$SOURCE_RUN_ID" --output "$RUNNER_TEMP/compatibility-source.json"
- name: Read reviewed source execution inputs
if: steps.source.outputs.action == 'publish'
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: ${{ steps.source.outputs.source_sha }}
path: .compatibility-source
persist-credentials: false
- name: Download this source attempt's combined evidence
if: steps.source.outputs.action == 'publish'
id: evidence
continue-on-error: true
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
with:
name: ${{ steps.source.outputs.artifact }}
run-id: ${{ steps.source.outputs.run_id }}
github-token: ${{ github.token }}
path: .compatibility-report
- name: Record unavailable artifacts
if: steps.source.outputs.action == 'publish' && steps.evidence.outcome != 'success'
run: |
echo "::warning::Source report unavailable; the dashboard will expose missing evidence, not a compatibility pass."
- name: Persist evidence and publish the status snapshot
if: steps.source.outputs.action != 'ignore'
run: |
bash compatibility/publish-readme.sh \
"$RUNNER_TEMP/compatibility-source.json" \
"$GITHUB_WORKSPACE/.compatibility-source" \
"$GITHUB_WORKSPACE/.compatibility-report"
{
echo "## README compatibility status"
echo
echo "Execution timestamps and outcomes are published on the compatibility-data branch."
echo "https://github.com/$GITHUB_REPOSITORY/blob/compatibility-data/site/README.md"
} >> "$GITHUB_STEP_SUMMARY"
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ that your driver of choice behaves the way you expect. Others may target
different environments (for example Kubernetes or a cloud deployment); each
playground's README states what it needs.

## Compatibility status

[![PyMongo compatibility](/../compatibility-data/site/badges/pymongo.svg)](/../compatibility-data/site/README.md#pymongo)

[Run details and accessible results](/../compatibility-data/site/README.md)
show tested versions, actual execution timestamps, and the latest attempt
separately from the last conclusive compatibility evidence.

## Playgrounds

| Playground | Language / Stack | What it shows |
Expand Down
8 changes: 8 additions & 0 deletions compatibility/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
!requirements*.txt
!integrations/*/requirements.txt
__pycache__/
.pytest_cache/
.mypy_cache/
.venv/
.test-results/
node_modules/
180 changes: 180 additions & 0 deletions compatibility/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# Ecosystem compatibility

This registry-driven runner tests ecosystem integration profiles against reviewed
DocumentDB releases. Execution, artifact verification, and result contracts are
shared; each integration adapter implements its own scenario suite.

## Profiles and reviewed artifacts

[`registry.yaml`](registry.yaml) defines profiles, enablement, default package
versions, version policies, required scenarios, and reviewed DocumentDB releases.
Adapter directories under [`integrations/`](integrations/) contain runtime recipes
and scenario suites. These definitions identify the package, runtime, and database
combination for a run, not the newest upstream releases. Database and client base
images are pinned by digest.

Runs target the newest reviewed DocumentDB release by default.
`--documentdb-version` selects another release listed in the registry.

Version overrides must match the integration's registry policy and have eligible
artifacts for its runtime. PyMongo versions use three numeric components, such as
`--version 4.9.0`; equivalent published versions such as `4.9` are matched using
package-version semantics. A version without an eligible Python 3.12 Linux x64
wheel is Not tested, not Working.

Before executing scenarios, the controller checks the actual extension and
PostgreSQL major versions. It verifies the selected wheel's filename and SHA-256
against non-yanked PyPI metadata. The client records installed package and
dependency versions and hashes, its runtime version, and its image identity.
An execution-input digest includes the suite, controller, schemas, and runtime
recipe, including uncommitted local changes.

## Coverage

The PyMongo profile exercises synchronous driver APIs. Its required scenarios are
declared in the registry's `expected_tests` list and cover the following behavior:

| Area | Behavior |
| --- | --- |
| Connection | Authenticated administrative ping over TLS |
| Inserts and reads | `insert_one`, `insert_many`, `find_one`, filters, projection, sorting, limits, and exact readback |
| Cursor and counts | Observed `getMore` with bounded batches and exact document counts |
| Updates and deletes | `update_one`, `find_one_and_update`, `delete_one`, `delete_many`, result objects, and persisted effects |
| Aggregation and indexes | Aggregation results, index creation/listing/removal, and duplicate-key rejection |
| BSON | ObjectId, integers, Decimal128, dates, binary values, arrays, booleans, and nested documents |

Each scenario has a fresh disposable database. Required cases cannot be silently
skipped or exempted. A result applies only to its exact version pair, runtime,
execution inputs, and declared scenarios. It does not establish compatibility
for async APIs, transactions, vector search, or other unlisted features.

## Run locally

Use a Python 3.12 virtual environment or a prepared Python 3.12 tooling container,
with access to a Linux Docker daemon capable of running Linux x64 images. Run
these commands from the repository root and install trusted controller dependencies
in that environment, not in the disposable integration client:

```bash
python -m pip install -r compatibility/requirements.txt
python -m compatibility.runner --integration pymongo \
--output compatibility/.test-results/pymongo-001/result.json
python -m compatibility.runner --integration pymongo --version 4.9.0 \
--output compatibility/.test-results/pymongo-4.9.0/result.json
```

Each invocation requires a fresh output path and creates fresh credentials,
containers, an internal Docker network, and disposable databases. Only the
controller has Docker access. The integration client receives no checkout mount,
Docker socket, publication credential, or external network access.

The runner builds the client without build-time network access after downloading
verified wheels. `--wheelhouse /path/to/wheels` reuses downloaded wheels, but PyPI
metadata verification still requires network access. Do not disable TLS
verification for package downloads.

The output includes `result.json`, a sanitized `result.log`, and `result.xml`
when tests execute. Setup failures still produce a validated JSON envelope and
diagnostics. Cleanup targets only the invocation's labeled Docker resources.
The runner refuses to overwrite existing results or diagnostic files.

To verify the nonpassing path:

```bash
python -m compatibility.runner --integration pymongo --demonstration \
--output compatibility/.test-results/pymongo-demo-001/result.json
```

This runs the normal scenarios plus one labeled intentional assertion failure
and must exit nonzero. Demonstration evidence cannot replace a compatibility
verdict. Use only synthetic data; do not supply production credentials.

## Interpret results

Working requires verified identities and every required scenario to pass.
A conclusive assertion or operation failure produces Failing. Missing, skipped,
incomplete, or infrastructure-failed execution cannot become Working and is
reported as Not tested unless a conclusive compatibility failure is present.

Inspect the scenario diagnostics and declared coverage before reporting a
compatibility problem. Distinguish an operation mismatch from a package-download,
readiness, or cleanup failure. Include a minimal synthetic reproduction, the
integration and database versions, the profile, and sanitized result/log details.
Never share credentials or customer data.

Runs emit runtime-neutral schema version 2. Schema-version-1 Python records remain
readable without rewriting their immutable provenance.

## README dashboard

The repository README embeds compact integration badges from the `compatibility-data`
branch. Each badge links to that integration's accessible results table, including
the source workflow runs and their detailed report artifacts. The publisher generates
`site/badges/<integration>.svg`, per-integration sections in `site/README.md`, and the
full status card in `site/status.svg` from the shared status snapshot.

Badges summarize the integration's published version and profile rows, using
Failing before Not tested, Stale, and Working. A missing latest result prevents a
green badge even when an earlier pass remains available in the details. A workflow
that fails before its profile selection is known also prevents a green badge.
Freshness and intentional-failure exclusion follow the same rules as the details.

The dashboard shows client and DocumentDB versions, the last conclusive evidence,
the latest attempt's outcome and execution timestamp, and verified scenario
counts. An incomplete attempt cannot acquire an earlier attempt's success.
Evidence is ordered by its workflow attempt rather than by test start time, so an
older run that starts its tests late cannot mask a newer attempt's outcome.
Workflow failures without usable profile artifacts remain visible separately
from older conclusive evidence. Synthetic demonstrations are excluded.

`Compatibility README dashboard` consumes completed dispatched or scheduled
`Ecosystem compatibility` runs from the same repository's default branch. Test
execution remains read-only; only the trusted publisher can write the data branch.
The publisher checks the source run, workflow path, repository, branch, artifact
attempt, and reviewed execution inputs. It reads source files to verify their
digests but never executes source-run code or downloaded artifact content.

Result JSON files remain immutable. Workflow-attempt identity and execution time
cannot be rewritten, while a later publication can recover previously unavailable
artifacts for that same attempt. Non-force updates preserve concurrent data
writers. The workflow refreshes the snapshot when default-branch inputs change
and hourly for freshness; it commits only when the published content changes.
It does not activate AI, create issues, or deploy a public website.

For manual recovery, dispatch `Compatibility README dashboard` on the default
branch with a completed compatibility `run_id`. Leave that input empty to render
stored evidence without launching tests. The source report artifact must still
be available. Before a completed run is published, the initialized dashboard
shows Not tested.

GitHub may cache embedded images. The accessible results and `site/status.json`
on the data branch expose the same snapshot. Execution timestamps always refer
to actual runs, never to rendering or refresh time.

## Extend and maintain

When adding an integration, include its badge in the root README. Use
`/../compatibility-data/site/badges/<integration>.svg` for the image and
`/../compatibility-data/site/README.md#<integration>` for the details link.

Add a reviewed adapter directory, pinned image and package requirements, normal
and deliberate-failure suites, and a registry entry naming every required
scenario. Keep package preparation, runtime validation, and provenance support
with any new runtime. Enable an integration only when its real adapter exists.
A registry entry alone does not implement runtime support.

Run infrastructure checks in a prepared Python 3.12 tooling container:

```bash
python -m pip install -r compatibility/requirements-dev.txt
python -m black --check --config compatibility/pyproject.toml compatibility
python -m isort --check-only --settings-path compatibility/pyproject.toml compatibility
python -m flake8 --max-line-length=100 --extend-ignore=E203 compatibility
python -m mypy --config-file compatibility/pyproject.toml compatibility
python -m pytest -c compatibility/pyproject.toml compatibility/unit
```

Also exercise normal and deliberate-failure runs against the selected released
database image. Assertions and fixtures should derive selected configuration
from the registry rather than duplicate version pins. No unchanged database or
gateway build is required for compatibility-only changes.
4 changes: 4 additions & 0 deletions compatibility/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: MIT

"""Version-pinned ecosystem compatibility automation."""
Loading