Python: enforce dependency-bounds validator in CI#6645
Conversation
Add a blocking "Dependency Bounds Validation" job to the Python code quality workflow so `validate-dependency-bounds-test` runs on pull requests and in the merge queue, not just on the weekly maintenance schedule (where it is non-blocking and only opens an issue on failure). The validator smoke-tests both ends of every package's allowed dependency range (lowest-direct and highest) and runs each package's pyright pass in an isolated environment, catching floor-too-low, missing-optional-dependency, and isolated-env typing regressions that the full-workspace test and typing jobs miss. Wiring it into required CI catches these at PR time instead of at release time. The job mirrors the dependency maintenance workflow's environment (Python 3.13, full git history for the workspace graph) so PR results line up with the nightly sweep, runs without continue-on-error so it can gate merges, and uploads the JSON report as an artifact for triage. Fixes microsoft#6582.
|
@vaibhav-patel please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
This PR adds a new required CI job to run the Python dependency-bounds validator on pull requests / merge queue events, so dependency floor/ceiling and isolated-environment typing regressions are caught before merging to main.
Changes:
- Add a blocking Dependency Bounds Validation job to the existing Python code-quality workflow.
- Run
uv run poe validate-dependency-bounds-test --package "*"with a 60-minute timeout and upload the JSON results artifact for triage.
| - name: Set up python and install the project | ||
| id: python-setup | ||
| uses: ./.github/actions/python-setup | ||
| with: | ||
| python-version: ${{ env.UV_PYTHON }} | ||
| os: ${{ runner.os }} | ||
| env: | ||
| UV_CACHE_DIR: /tmp/.uv-cache | ||
| # Smoke both ends of every package's allowed dependency range (lowest-direct and | ||
| # highest) and run each package's pyright pass in an isolated environment. This | ||
| # catches floor-too-low, missing-optional-dependency, and isolated-env typing | ||
| # regressions that the full-workspace test and typing jobs do not. | ||
| - name: Validate dependency bounds (lower + upper) | ||
| run: uv run poe validate-dependency-bounds-test --package "*" |
There was a problem hiding this comment.
Good catch — set UV_EXCLUDE_NEWER in the dependency-bounds job to match the maintenance workflow's 7-day cutoff in 6c45fdc.
Fixes #6582.
Motivation & Context
The dependency-bounds validator (
uv run poe validate-dependency-bounds-test) isonly run by the weekly
python-dependency-maintenance.ymlworkflow, where it iscontinue-on-error: trueand merely opens an issue on failure. It is not a requiredPR check, so dependency-floor, missing-optional-dependency, and isolated-env typing
regressions can land on
mainand ship in a release before anyone notices — ashappened at the
python-1.8.1tag, which was released while the validator was redfor
packages/coreatlowest-directresolution.Description & Review Guide
Adds a blocking Dependency Bounds Validation job to
python-code-quality.yml,which already runs on
pull_request→main,merge_group, andworkflow_dispatch.The job runs
validate-dependency-bounds-test --package "*", which smoke-tests bothends of every package's allowed dependency range (
lowest-directandhighest) andruns each package's pyright pass in an isolated environment.
continue-on-error, so it can gate PRs and the merge queue — the gap thisissue is about.
history for the internal workspace graph) so PR results line up with the nightly sweep.
timeout-minutes: 60guards against a hung resolver.The underlying floor/packaging issues this validator caught (the telemetry
find_specexceptclause, theagent-framework-toolsdev dependency on core, andthe shell-tool test
skipifguards) were already fixed in the 1.9.0 version bump, sothe validator is green on
mainand this job can be required immediately.Cost / scoping note
A full lower+upper sweep across all packages is somewhat slow. If per-PR cost becomes
a concern, follow-up options are to scope the run to changed packages on standard PRs,
or to run the full sweep nightly plus required-on-merge-queue. This PR wires up the
full required check first as the minimal correct fix; scoping can be layered on later.