Repository navigation
ci(deps-update): list the updates in the commit message - #73
Merged
Merged
Conversation
The deps-update commit had only a subject, so projects that squash-merge with the PR's commit messages got an empty squash message. A new step compares uv.lock and the hook revs against HEAD (`uv sync --upgrade` does not print what it bumped) and the workflow puts the list in the commit body. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="project_name/.github/workflows/deps-update.yml" line_range="41-43" />
<code_context>
+ return subprocess.run(cmd, capture_output=True, text=True, check=True).stdout
+
+ def packages(text):
+ lock = tomllib.loads(text).get("package", [])
+ return {p["name"]: p["version"] for p in lock if "version" in p}
+
+ def hook_revs(text):
+ pairs = re.findall(r"- repo: https://github.com/(\S+)\n\s+rev: (\S+)", text)
</code_context>
<issue_to_address>
**issue (bug_risk):** `packages` collapses all `[[package]]` entries with the same name into one dictionary value. uv.lock can contain multiple versions of a package when different dependencies require incompatible versions, so the selected value depends on entry order and the generated commit message reports an arbitrary version change or omits a real bump.
**Triggers:** When the lock file contains more than one version of the same package before or after the upgrade.
**Suggested fix:** Track package entries by `(name, version)` or otherwise compare all versions for each package instead of reducing them to a single name-keyed value.
</issue_to_address>Sourcery assessment
Approval pending. 1 finding to address first.
Blocking findings: project_name/.github/workflows/deps-update.yml:43
…sions uv.lock holds one package at several versions when resolution forks by marker, and keying by name kept only one of them. Key by the fork's resolution-markers and list every changed pair: `- numpy a → a', b → b'`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845
When a fork split (numpy 2.2.1 for >=3.10 became 2.2.6 for 3.10 and 2.3.2 for >=3.11), zipping the leftovers dropped a bump, and a string sort put 2.10 before 2.9. Pair each new version with the newest old one below it, any old version left over with the oldest new one above it, and compare versions numerically. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same fix as #72, for the generated projects'
deps-update.yml. Its commit had only the subject⬆️ Update project dependencies, so a project that squash-merges with the PR's commit messages as the body (as this repo does) got an empty squash message.Change
A new step,
List the updates, for the commit message, compares the filesjust deps-updatechanged againstHEADand writes one line per bump to a step output. It covers package versions inuv.lockand hook revs in.pre-commit-config.yaml. The workflow puts that list in the commit body:It compares files because
uv sync --upgrade, unlikeuv lock --upgrade, prints nothing about what it bumped. The step is inline (shell: python) so generated projects don't get an extra script file. It usestomllib, which the runner's system Python 3.12 provides.Verification
pygments2.19.0 and ruff-pre-commit v0.15.0, ranuv sync --upgradeandprek auto-update, then ran the step's code. It wrote this toGITHUB_OUTPUT:rev: "0.26"line (the styleprek auto-updatewrites for validate-pyproject) parses to0.26. Tested on that line directly; the rendered project had no quoted revs.uv.lockholds a package at several versions when resolution forks by Python version or platform. The step keys each entry by itsresolution-markersand lists every changed pair on one line. If a fork's markers changed, each new version is paired with the newest old version below it, and any old version left over with the oldest new one above it. Tested on a real lock (requires-python >=3.9, numpy, old lock with--exclude-newer 2025-01-01, new with2025-09-01), where the ≥3.10 fork split in two:2.9 → 2.10ordering, and no change (no line).🤖 Generated with Claude Code
https://claude.ai/code/session_01GyMoD8tx4oz1bpJ1tEL845