From 88d7edf0d319452cb4f70f1cd24de3ea79a4e365 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Wed, 18 Nov 2026 21:01:49 -0600 Subject: [PATCH 1/3] ci(py): add daily newest-deps canary and per-major Dependabot PRs --- .github/dependabot.yml | 29 ++-- .../workflows/python-newest-deps-canary.yml | 157 ++++++++++++++++++ docs/dependencies.md | 8 +- 3 files changed, 183 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/python-newest-deps-canary.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 44c8a0d7..3abf5f8d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,12 +18,10 @@ version: 2 # Policy notes: # 1. Cooldowns satisfy zizmor (`dependabot-cooldown` >= 7d). -# 2. The `uv` group scopes weekly PRs to `minor` + `patch` and suppresses routine -# `version-update:semver-major` PRs via `ignore` (so breaking major jumps that -# require code migrations are handled intentionally rather than turning the -# weekly PR red). Security/CVE updates bypass both `cooldown` and `ignore`, -# opening standalone PRs (including major bumps when required) outside the -# weekly group. +# 2. The `uv` workspace batches `minor` + `patch` into one weekly PR. Majors aren't +# ignored and aren't grouped: each gets its own PR, because each needs its own +# review (cap diff, changelog, contract or not) and one red major shouldn't +# block the others. Security/CVE updates bypass `cooldown` and open standalone PRs. updates: # Maintain dependencies for GitHub Actions - package-ecosystem: "github-actions" @@ -38,6 +36,8 @@ updates: - "*" # Maintain dependencies for Python (uv workspace) + # Majors open one PR per dep instead of being ignored: a green one widens the + # cap, a red one is the migration ticket. See docs/dependencies.md. - package-ecosystem: "uv" directory: "/" schedule: @@ -45,13 +45,22 @@ updates: cooldown: default-days: 7 groups: - py-dependencies: + py-minor-and-patch: patterns: - "*" update-types: - "minor" - "patch" - ignore: - - dependency-name: "*" + # Majors open one PR per dep, except families that release in lockstep: + # splitting those would leave each PR unresolvable (sdk 2 needs api 2). + opentelemetry-major: + patterns: + - "opentelemetry-*" + update-types: + - "major" + aws-major: + patterns: + - "boto3" + - "botocore" update-types: - - "version-update:semver-major" + - "major" diff --git a/.github/workflows/python-newest-deps-canary.yml b/.github/workflows/python-newest-deps-canary.yml new file mode 100644 index 00000000..e2c87d37 --- /dev/null +++ b/.github/workflows/python-newest-deps-canary.yml @@ -0,0 +1,157 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +# Tests what a fresh `pip install genkit` resolves today: every dep at the +# newest version our bounds allow, not what uv.lock pins. Catches minor-version +# breaks (pydantic 2.14, google-genai 2.34) and uncapped majors before users +# report them. Floors are checked on every PR by the `tests-minimum-deps` job in +# python.yml. Scheduled and manual only, never a PR gate: failures come from +# upstream releases, not from the PR. See docs/dependencies.md. +# +# Scheduled runs on the default branch keep one open `dependency-canary-failure` issue: +# opened on the first failure, commented on while it stays red, closed on green. +name: Python Newest Dependencies Canary (Daily) + +on: + schedule: + - cron: "0 14 * * *" # Daily 14:00 UTC. + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }} + cancel-in-progress: true + +jobs: + canary: + name: Tests (newest PyPI versions in bounds, Python ${{ matrix.python-version }}) + runs-on: ubuntu-latest + permissions: + contents: read + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.14"] + steps: + - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 + with: + persist-credentials: false + + - name: Install uv and setup Python + uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 + with: + enable-cache: false + python-version: ${{ matrix.python-version }} + + - name: Re-resolve to the newest allowed versions + run: | + uv lock --upgrade + # List every package whose version moved past uv.lock. + git diff -U1 uv.lock | grep -E '^[ +-](name|version) = ' || echo 'uv.lock already at newest' + + - name: Install dependencies + env: + PY_VER: ${{ matrix.python-version }} + run: uv sync --frozen --python "$PY_VER" + + - name: Generate schema typing + run: ./bin/generate_schema_typing --ci + + - name: Run tests + env: + PY_VER: ${{ matrix.python-version }} + run: uv run --no-sync --python "$PY_VER" pytest + + - name: Print self-triage guide on failure + if: failure() + run: | + cat <<'EOF' | tee -a "$GITHUB_STEP_SUMMARY" + ### `python-newest-deps-canary` failed — how to fix + + Tests failed against the newest PyPI releases allowed by `packages/*/pyproject.toml` (what `pip install genkit-*` resolves today). + + 1. **Reproduce locally** (without committing a blanket lock bump): + ```bash + uv lock --upgrade && uv sync --frozen && uv run pytest + git checkout -- uv.lock + ``` + 2. **Identify the culprit** from the `Re-resolve to the newest allowed versions` step above and the pytest traceback. + 3. **Fix:** + - Update our code if the upstream change is intentional and backwards-compatible, **or** + - Exclude a buggy upstream release in `packages//pyproject.toml` with `!=x.y.z` (do **not** add `- + ${{ !cancelled() && github.event_name == 'schedule' && + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - name: Open, comment on, or close the dependency-canary-failure issue + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + RESULT: ${{ needs.canary.result }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + run: | + label=dependency-canary-failure + issue=$(gh issue list --label "$label" --state open --limit 1 --json number --jq '.[0].number // empty') + + if [[ "$RESULT" == "success" ]]; then + if [[ -n "$issue" ]]; then + gh issue close "$issue" --comment "Green again on the newest allowed deps: $RUN_URL" + fi + exit 0 + fi + if [[ "$RESULT" != "failure" ]]; then + exit 0 + fi + + if [[ -n "$issue" ]]; then + gh issue comment "$issue" --body "Still failing: $RUN_URL" + exit 0 + fi + + gh label create "$label" --force --color D93F0B \ + --description "Python tests fail on the newest deps our bounds allow" + gh issue create --label "$label" \ + --title "Python dependency canary: tests fail on newest allowed deps" \ + --body-file - </pyproject.toml\` with \`!=x.y.z\`. Do **not** add \` `<4`). Check `packages/*/pyproject.toml`, skim the changelog for behavior mocked tests miss (exceptions, transport, defaults), merge, and release so users get the wider range. + - **Contract dep (`pydantic`, `dotpromptz`):** widening affects user code. Merge deliberately with a release note. + - **Red capped PR:** leave it open as the migration ticket; the cap protects users meanwhile. +- **Daily newest-deps canary (`python-newest-deps-canary.yml`):** tests the newest PyPI versions our bounds allow—what `pip install` gets today (catching upstream regressions during Dependabot's 7-day cooldown). Not a PR gate since upstream releases trigger it. Opens/updates one `dependency-canary-failure` issue while red and closes it when green; fix our code or add `!=x.y.z`, and cut a patch release if users are hit. - **Security alerts:** Dependabot security PRs bypass cooldown and grouping. To clear a batch manually: ```bash From 1a564a92bdd2158242b6de3f67542fdeed587c7e Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Thu, 19 Nov 2026 12:51:50 -0600 Subject: [PATCH 2/3] ci(py): run the newest-deps canary weekly instead of daily --- .github/workflows/python-newest-deps-canary.yml | 6 +++--- docs/dependencies.md | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-newest-deps-canary.yml b/.github/workflows/python-newest-deps-canary.yml index e2c87d37..ede353c8 100644 --- a/.github/workflows/python-newest-deps-canary.yml +++ b/.github/workflows/python-newest-deps-canary.yml @@ -23,11 +23,11 @@ # # Scheduled runs on the default branch keep one open `dependency-canary-failure` issue: # opened on the first failure, commented on while it stays red, closed on green. -name: Python Newest Dependencies Canary (Daily) +name: Python Newest Dependencies Canary (Weekly) on: schedule: - - cron: "0 14 * * *" # Daily 14:00 UTC. + - cron: "0 14 * * 1" # Weekly, Monday 14:00 UTC. workflow_dispatch: permissions: @@ -153,5 +153,5 @@ jobs: 2. **Fix:** update our code for the upstream change, or exclude a broken upstream release in \`packages//pyproject.toml\` with \`!=x.y.z\`. Do **not** add \` `<4`). Check `packages/*/pyproject.toml`, skim the changelog for behavior mocked tests miss (exceptions, transport, defaults), merge, and release so users get the wider range. - **Contract dep (`pydantic`, `dotpromptz`):** widening affects user code. Merge deliberately with a release note. - **Red capped PR:** leave it open as the migration ticket; the cap protects users meanwhile. -- **Daily newest-deps canary (`python-newest-deps-canary.yml`):** tests the newest PyPI versions our bounds allow—what `pip install` gets today (catching upstream regressions during Dependabot's 7-day cooldown). Not a PR gate since upstream releases trigger it. Opens/updates one `dependency-canary-failure` issue while red and closes it when green; fix our code or add `!=x.y.z`, and cut a patch release if users are hit. +- **Weekly newest-deps canary (`python-newest-deps-canary.yml`):** tests the newest PyPI versions our bounds allow—what `pip install` gets today (catching upstream regressions during Dependabot's 7-day cooldown). Not a PR gate since upstream releases trigger it. Opens/updates one `dependency-canary-failure` issue while red and closes it when green; fix our code or add `!=x.y.z`, and cut a patch release if users are hit. - **Security alerts:** Dependabot security PRs bypass cooldown and grouping. To clear a batch manually: ```bash From 405ecedf0f2ba8d4bd2db316f739d5359b2fb418 Mon Sep 17 00:00:00 2001 From: Jeff Huang Date: Mon, 30 Nov 2026 22:12:03 +0000 Subject: [PATCH 3/3] ci(py): drop newest-deps canary workflow; keep per-major Dependabot PRs --- .../workflows/python-newest-deps-canary.yml | 157 ------------------ docs/dependencies.md | 3 +- 2 files changed, 1 insertion(+), 159 deletions(-) delete mode 100644 .github/workflows/python-newest-deps-canary.yml diff --git a/.github/workflows/python-newest-deps-canary.yml b/.github/workflows/python-newest-deps-canary.yml deleted file mode 100644 index ede353c8..00000000 --- a/.github/workflows/python-newest-deps-canary.yml +++ /dev/null @@ -1,157 +0,0 @@ -# Copyright 2026 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -# Tests what a fresh `pip install genkit` resolves today: every dep at the -# newest version our bounds allow, not what uv.lock pins. Catches minor-version -# breaks (pydantic 2.14, google-genai 2.34) and uncapped majors before users -# report them. Floors are checked on every PR by the `tests-minimum-deps` job in -# python.yml. Scheduled and manual only, never a PR gate: failures come from -# upstream releases, not from the PR. See docs/dependencies.md. -# -# Scheduled runs on the default branch keep one open `dependency-canary-failure` issue: -# opened on the first failure, commented on while it stays red, closed on green. -name: Python Newest Dependencies Canary (Weekly) - -on: - schedule: - - cron: "0 14 * * 1" # Weekly, Monday 14:00 UTC. - workflow_dispatch: - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: true - -jobs: - canary: - name: Tests (newest PyPI versions in bounds, Python ${{ matrix.python-version }}) - runs-on: ubuntu-latest - permissions: - contents: read - strategy: - fail-fast: false - matrix: - python-version: ["3.10", "3.14"] - steps: - - uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5 - with: - persist-credentials: false - - - name: Install uv and setup Python - uses: astral-sh/setup-uv@d4b2f3b6ecc6e67c4457f6d3e41ec42d3d0fcb86 # v5 - with: - enable-cache: false - python-version: ${{ matrix.python-version }} - - - name: Re-resolve to the newest allowed versions - run: | - uv lock --upgrade - # List every package whose version moved past uv.lock. - git diff -U1 uv.lock | grep -E '^[ +-](name|version) = ' || echo 'uv.lock already at newest' - - - name: Install dependencies - env: - PY_VER: ${{ matrix.python-version }} - run: uv sync --frozen --python "$PY_VER" - - - name: Generate schema typing - run: ./bin/generate_schema_typing --ci - - - name: Run tests - env: - PY_VER: ${{ matrix.python-version }} - run: uv run --no-sync --python "$PY_VER" pytest - - - name: Print self-triage guide on failure - if: failure() - run: | - cat <<'EOF' | tee -a "$GITHUB_STEP_SUMMARY" - ### `python-newest-deps-canary` failed — how to fix - - Tests failed against the newest PyPI releases allowed by `packages/*/pyproject.toml` (what `pip install genkit-*` resolves today). - - 1. **Reproduce locally** (without committing a blanket lock bump): - ```bash - uv lock --upgrade && uv sync --frozen && uv run pytest - git checkout -- uv.lock - ``` - 2. **Identify the culprit** from the `Re-resolve to the newest allowed versions` step above and the pytest traceback. - 3. **Fix:** - - Update our code if the upstream change is intentional and backwards-compatible, **or** - - Exclude a buggy upstream release in `packages//pyproject.toml` with `!=x.y.z` (do **not** add `- - ${{ !cancelled() && github.event_name == 'schedule' && - github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - name: Open, comment on, or close the dependency-canary-failure issue - env: - GH_TOKEN: ${{ github.token }} - GH_REPO: ${{ github.repository }} - RESULT: ${{ needs.canary.result }} - RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - run: | - label=dependency-canary-failure - issue=$(gh issue list --label "$label" --state open --limit 1 --json number --jq '.[0].number // empty') - - if [[ "$RESULT" == "success" ]]; then - if [[ -n "$issue" ]]; then - gh issue close "$issue" --comment "Green again on the newest allowed deps: $RUN_URL" - fi - exit 0 - fi - if [[ "$RESULT" != "failure" ]]; then - exit 0 - fi - - if [[ -n "$issue" ]]; then - gh issue comment "$issue" --body "Still failing: $RUN_URL" - exit 0 - fi - - gh label create "$label" --force --color D93F0B \ - --description "Python tests fail on the newest deps our bounds allow" - gh issue create --label "$label" \ - --title "Python dependency canary: tests fail on newest allowed deps" \ - --body-file - </pyproject.toml\` with \`!=x.y.z\`. Do **not** add \` `<4`). Check `packages/*/pyproject.toml`, skim the changelog for behavior mocked tests miss (exceptions, transport, defaults), merge, and release so users get the wider range. - **Contract dep (`pydantic`, `dotpromptz`):** widening affects user code. Merge deliberately with a release note. - **Red capped PR:** leave it open as the migration ticket; the cap protects users meanwhile. -- **Weekly newest-deps canary (`python-newest-deps-canary.yml`):** tests the newest PyPI versions our bounds allow—what `pip install` gets today (catching upstream regressions during Dependabot's 7-day cooldown). Not a PR gate since upstream releases trigger it. Opens/updates one `dependency-canary-failure` issue while red and closes it when green; fix our code or add `!=x.y.z`, and cut a patch release if users are hit. - **Security alerts:** Dependabot security PRs bypass cooldown and grouping. To clear a batch manually: ```bash