Skip to content

ci(py): gate PRs on oldest supported deps and document dependency policy - #156

Merged
huangjeff5 merged 7 commits into
fix/py-dep-bounds-and-floorsfrom
ci/py-lowest-deps-and-docs
Nov 30, 2026
Merged

huangjeff5 merged 7 commits into
fix/py-dep-bounds-and-floorsfrom
ci/py-lowest-deps-and-docs

Conversation

@huangjeff5

@huangjeff5 huangjeff5 commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Part 3 of 4 in the dependency hygiene stack: #153 -> #154 -> #156 -> #157.

CI only tested uv.lock, which holds the newest versions. A PR could start calling an SDK API newer than the declared >= floor and pass every check, while users resolved inside that floor hit ImportError or AttributeError at runtime. This PR adds a required job that tests every direct dep at its declared floor, prints a self-contained copy-paste prompt on failure, and documents the policy.

Developer Experience (when a PR breaks an old floor)

Say a PR starts passing instructions= to openai (added in 1.68.0), while packages/genkit-openai/pyproject.toml still declares openai>=1.60.0:

  1. Regular Tests (Python 3.10–3.14) pass on uv.lock, and Tests (oldest supported deps, Python 3.10) fails.
  2. Clicking Details opens the expanded Run tests log. Right at the bottom (no scrolling, no doc-hopping — and also in a 1-click Copy block on the Actions Summary tab), CI prints a pre-filled prompt:
========================================================================
TESTS FAILED ON OLDEST SUPPORTED DEPENDENCIES
Copy-paste everything between the lines below into your coding agent:
------------------------------------------------------------------------
Fix the `tests-minimum-deps` CI failure on this branch.

Regular tests pass on uv.lock, but tests failed when direct dependencies
were resolved to their oldest declared `>=` versions in pyproject.toml.

Failing tests:
- FAILED packages/genkit-openai/tests/audio_model_test.py::test_generate_openai_stt_sends_temperature - TypeError: Transcriptions.create() got an unexpected keyword argument 'instructions'

Downgraded dependencies in the failing package(s):
- packages/genkit-openai/pyproject.toml: openai 1.60.0 (tested) vs 2.21.0 (uv.lock)

What to do:
1. Inspect the failing test(s) and traceback. First check whether a small
   backwards-compatible code change can keep the current minimum version
   working; prefer that over raising the minimum when it is clean.
2. If the newer API/behavior is genuinely required, find the lowest
   release that supports it:
   - Check the dependency's release notes/changelog for the missing API
     or fix (and probe candidate versions if the cutoff isn't clear).
   - Do NOT blindly jump to the uv.lock version for shared deps
     (pydantic, anyio, httpx, fastapi, opentelemetry-*). For leaf
     provider SDKs (openai, anthropic, google-genai, ollama), finding the
     exact cutoff is preferred, or bumping to uv.lock if unclear.
3. Update the `>=` minimum in the pyproject.toml above (keep any `<`
   upper bound intact; see docs/dependencies.md for bounds policy).
4. Verify locally and refresh the lockfile:
     just test-min-deps packages/genkit-openai/tests
     uv lock && just check
5. Confirm uv.lock is not downgraded, then summarize what changed and why.
------------------------------------------------------------------------
========================================================================
  1. Paste into a coding agent (or run the 2 commands by hand). just test-min-deps snapshots and restores uv.lock + .venv on exit via trap, so you can't accidentally commit a downgraded lockfile.

Main Changes

  • Tests (oldest supported deps, Python 3.10) is a required gate: Runs the full suite on Python 3.10 after uv lock --resolution lowest-direct, which drops every direct dep to its declared >= floor and leaves transitive deps free. On failure, prints the pre-filled, self-contained agent prompt above directly in the failed Run tests log and in $GITHUB_STEP_SUMMARY (no bespoke helper scripts to maintain).
  • just test-min-deps [pytest-args]: Local wrapper in justfile that runs uv lock --resolution lowest-direct && uv sync --frozen && uv run --no-sync pytest ... and restores the original uv.lock and .venv on exit.
  • Minor/patch Dependabot PRs can't move published bounds: Lint and Format fails if a py-minor-and-patch (or legacy py-dependencies) Dependabot PR edits any packages/*/pyproject.toml. Routine bumps should only touch uv.lock; raising a floor users resolve against is a deliberate change.
  • docs/dependencies.md: One page for the cap policy from fix(py): enforce dependency bounds policy and raise declared floors #154, floor rules (including how to triage tests-minimum-deps failures), workspace-only deps, and lockfile updates with the manual pip-audit workflow. Linked from README.md.

@huangjeff5
huangjeff5 added this pull request to stack #158 November 19, 2026 02:19
@huangjeff5
huangjeff5 force-pushed the ci/py-lowest-deps-and-docs branch 3 times, most recently from 752f35b to 28a98fb Compare November 19, 2026 02:39
@huangjeff5 huangjeff5 changed the title ci(py): gate PRs on lowest-deps, add bin/find_floor, and document policy ci(py): gate PRs on minimum dep versions, add find_min_dep_version, and document policy Nov 19, 2026
@huangjeff5
huangjeff5 force-pushed the ci/py-lowest-deps-and-docs branch from 28a98fb to d2d7a20 Compare November 19, 2026 02:49
@huangjeff5
huangjeff5 force-pushed the ci/py-lowest-deps-and-docs branch from d2d7a20 to b8121fe Compare November 19, 2026 03:01
The root comment said published packages keep floor-only bounds, but
check_consistency.py requires caps on REQUIRED_CAPS / SCOPED_CAPS deps.
…together

Two bugs surfaced re-deriving #154's floors with this script:

- Test envs skipped optional extras, so genkit-google-cloud's firestore
  tests failed even at uv.lock versions and the search aborted.
- opentelemetry-sdk pins opentelemetry-api with ==, so bisecting api alone
  paired it with the locked sdk and returned 1.45.0 instead of 1.39.0.
@huangjeff5 huangjeff5 changed the title ci(py): gate PRs on minimum dep versions, add find_min_dep_version, and document policy ci(py): gate PRs on oldest supported deps and document dependency policy Nov 30, 2026
@huangjeff5
huangjeff5 merged commit 5795f9e into main Nov 30, 2026
21 checks passed
@huangjeff5
huangjeff5 deleted the ci/py-lowest-deps-and-docs branch November 30, 2026 23:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants