Python: stabilize dependency maintenance final checks#6662
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR narrows the Python dependency-maintenance automation so it only materializes/script-selects intended dependency changes, avoiding opportunistic lockfile churn and validator/tooling drift that can cause unrelated final-check failures.
Changes:
- Refresh
python/uv.lockwithuv lock(notuv lock --upgrade) after dev-pin and range updates to avoid broad lockfile upgrades. - Update the dev-pin refresh logic to:
- Skip internal
agent-framework*dev pins (left to package versioning). - Skip exact dev pins for validation tools (
ruff,mypy,pyright,pyrefly,ty,zuban).
- Skip internal
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
python/scripts/dependencies/_dependency_bounds_upper_impl.py |
Stops auto-refreshing internal AF dev pins and validator tool pins during dev dependency pin replacement collection. |
.github/workflows/python-dependency-maintenance.yml |
Uses uv lock instead of uv lock --upgrade to keep the workflow’s lockfile updates scoped. |
There was a problem hiding this comment.
Automated Code Review
Reviewers: 5 | Confidence: 91%
✓ Correctness
The changes are logically correct. Replacing
uv lock --upgradewithuv lockproperly scopes lockfile updates to only the changes made by the maintenance scripts. The removal of_load_workspace_package_versionsis clean (no remaining references tolru_cacheor the function). The new skip logic foragent-framework-*packages and validation tools with exact pins correctly prevents the two failure modes described in the PR rationale. The control flow after the changes is sound: validation tools are only skipped when they have an existing exact pin, and all other dev dependencies continue to be processed normally.
✓ Security Reliability
The PR narows the scope of automated dependency maintenance to avoid self-inflicted failures. Changes are straightforward and well-motivated: replacing
uv lock --upgradewithuv lockprevents unrelated lockfile churn, skipping internalagent-framework-*pins and validation tool pins avoids cascading failures. The removed_load_workspace_package_versionsfunction andlru_cacheimport are cleanly excised with no dangling references. No security or reliability concerns identified.
✓ Test Coverage
This PR introduces two new skip conditions in
_collect_dev_pin_replacements(skip internal agent-framework packages, skip validation tool dev pins) and removes the_load_workspace_package_versionshelper. None of these behavioral changes have corresponding unit tests. Thepython/scripts/dependencies/directory has no test infrastructure at all — no test files exist for this module. While the lack of tests is a pre-existing gap, the new logic branches are non-trivial filtering decisions that would benefit from targeted unit tests to prevent regressions.
✓ Failure Modes
The changes are well-scoped and don't introduce silent failure paths. The switch from
uv lock --upgradetouv lockstill materializes script-selected changes (exact pin bumps force lock updates), the_load_workspace_package_versionsremoval is clean (no remaining callers), thelru_cacheimport removal is safe (no remaining uses), and the new skip logic for validation tools and internal packages logs clear info messages before continuing. The control flow after the changes is sound: validation tool exact pins are preserved, non-pined validation tools still get processed, and the existing downgrade guard at line 328 remains correctly placed.
✗ Design Approach
I found two design issues. First, the final relock step now uses a plain
uv lock, but the upper-bound validator probes candidate runtime versions only through isolateduv run --with <dependency>==<version>executions and then persists only the widenedpyproject.tomlbounds, so final checks can silently run against the old locked version instead of the candidate that actually passed validation. Second, the new validation-tool skip was added in a shared helper that is also used by package-scoped bound validation, which conflicts with that helper’s documented purpose of refreshing dev pins so stale tooling does not masquerade as dependency-compatibility failures.
Flagged Issues
- .github/workflows/python-dependency-maintenance.yml:288 now runs
uv lock, but candidate runtime versions are only tested via isolateduv run --with <dependency>==<version>calls and the chosen result is persisted only as widenedpyproject.tomlbounds. If the previously locked version still satisfies the new range,uv lockwill keep it, so the later install/check/typing steps validate the old version rather than the selected candidate.
Automated review by eavanvalkenburg's agents
|
Flagged issue .github/workflows/python-dependency-maintenance.yml:288 now runs Source: automated DevFlow PR review |
Motivation & Context
The Python dependency maintenance workflow now gets past the release-cutoff bootstrap issue, but the manual run still failed during final validation. The generated update set was broadening beyond the script-selected dependency candidates:
uv lock --upgraderefreshed unrelated lockfile entries, and auto-updating validation tooling/internal Agent Framework pins introduced failures unrelated to the intended dependency maintenance PR.This keeps the workflow focused on dependencies selected by the maintenance scripts so final checks validate the generated PR instead of opportunistic toolchain or unrelated lockfile churn.
Description & Review Guide
uv lockinstead of broaduv lock --upgrade, skip exact dev pins for validation tools (ruff,mypy,pyright,pyrefly,ty,zuban), and skip internalagent-framework-*dev pins in the automated dev-pin refresh.Related Issue
No linked issue; this fixes a scheduled/manual Python dependency maintenance workflow failure observed after #6658.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.