Skip to content

ci: guard against stray uv.lock changes in PRs#351

Merged
ian-flores merged 2 commits into
mainfrom
ci-lockfile-guard
Jun 9, 2026
Merged

ci: guard against stray uv.lock changes in PRs#351
ian-flores merged 2 commits into
mainfrom
ci-lockfile-guard

Conversation

@ian-flores

Copy link
Copy Markdown
Collaborator

Bot-generated plan/docs PRs have repeatedly carried a stale uv.lock from an old base. It is invisible until it fails the Dependency Audit (vulnerable transitive pins on #309/#317/#346) or conflicts with main on merge (#309). A real dependency change always touches pyproject.toml, so a lone uv.lock change is the drift signal.

Adds a Lockfile Guard job: PRs that modify uv.lock without pyproject.toml fail with instructions to restore the lockfile. Legit dependency bumps (which touch both) and code/docs PRs are unaffected.

Note: the duplicate-module defect from #349 is already caught by ruff F811 in Lint & Format, so no separate check is added here.

Copilot AI review requested due to automatic review settings June 9, 2026 17:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a CI safeguard to detect and fail pull requests that change uv.lock without also changing pyproject.toml, preventing accidental lockfile drift from bot-generated docs/plan PRs.

Changes:

  • Introduces a new “Lockfile Guard” job in CI to reject PRs with a lone uv.lock change and provide remediation instructions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/ci.yml Outdated
&& ! printf '%s\n' "$changed" | grep -qx 'pyproject.toml'; then
echo "::error::uv.lock changed without a corresponding pyproject.toml change."
echo "Plan/docs PRs must not carry a uv.lock update. Restore it with:"
echo " git checkout origin/${GITHUB_BASE_REF} -- uv.lock && git commit uv.lock"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Applied in e74eabd — switched the hint to git checkout $BASE_SHA -- uv.lock && git commit -m 'restore uv.lock' uv.lock. The base SHA is unambiguous and the -m avoids the editor, so both points are addressed.

One note on the rationale: the fork-remote concern does not really apply here. This guard exists for the in-repo bot branches (bot-plan-* / bot-implement-*), where origin is correct — and a bare SHA is not actually more fork-safe anyway, since a fork contributor would need to fetch upstream to have that SHA locally either way. Took the change because the SHA + -m is simply a cleaner hint, not for fork safety.

@ian-flores ian-flores marked this pull request as ready for review June 9, 2026 17:22
@ian-flores ian-flores requested review from bdeitte and statik as code owners June 9, 2026 17:22
@ian-flores ian-flores enabled auto-merge (squash) June 9, 2026 18:21
@ian-flores ian-flores disabled auto-merge June 9, 2026 20:08
@ian-flores ian-flores merged commit 028a2d5 into main Jun 9, 2026
12 checks passed
@ian-flores ian-flores deleted the ci-lockfile-guard branch June 9, 2026 20:08
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