fix: warn if build_command is missing git add uv.lock after template update#304
Conversation
…update Adds a post-update validation to poe update-template that checks pyproject.toml for the required git add uv.lock line in build_command. Warns users who may have missed the fix due to copier merge behavior. Resolves DOT-479
|
This change is part of the following stack: Change managed by git-spice. |
Greptile SummaryThis PR extends the Confidence Score: 5/5Safe to merge — the only finding is a P2 edge case (false negative if the target string appears outside build_command) that is very unlikely in practice. The TOML/shell quoting and escaping is correct, the Jinja guard is scoped properly to use_semantic_release, and the shell group-command syntax is POSIX-compliant. The single P2 concern (grep scope) does not block correctness for the intended use case. project/pyproject.toml.jinja line 259 — grep scope Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["poe update-template"] --> B["copier update --trust . --skip-answered --defaults"]
B --> C["uv sync --upgrade"]
C --> D["prek autoupdate"]
D --> E["echo ✓ Dependencies upgraded"]
E --> F{use_semantic_release?}
F -- No --> Z["Done"]
F -- Yes --> G["grep -q 'git add uv.lock CHANGELOG.md' pyproject.toml"]
G -- found --> Z
G -- not found --> H["echo ⚠ WARNING: build_command missing git add uv.lock CHANGELOG.md"]
H --> Z
Prompt To Fix All With AIThis is a comment left during a code review.
Path: project/pyproject.toml.jinja
Line: 259
Comment:
**grep searches entire file, not just `build_command`**
The check `grep -q 'git add uv.lock CHANGELOG.md' pyproject.toml` scans the whole file. If this exact string appears anywhere outside of `[tool.semantic_release]` (e.g. in a changelog entry, comment, or documentation string), the check silently passes and no warning is shown — even when `build_command` is still missing the line. A false negative here means releases silently produce stale lockfiles, which is the exact problem this check exists to prevent.
Scoping the grep to the semantic-release section would make it robust:
```suggestion
update-template = { shell = "copier update --trust . --skip-answered --defaults && uv sync --upgrade && prek autoupdate && echo ' ✓ Dependencies upgraded and hook versions updated'{% if use_semantic_release %} && { awk '/\\[tool\\.semantic_release\\]/,/^\\[/' pyproject.toml | grep -q 'git add uv.lock CHANGELOG.md' || echo ' ⚠ WARNING: build_command in pyproject.toml is missing \"git add uv.lock CHANGELOG.md\" — releases will produce stale lockfiles. Add \"git add uv.lock CHANGELOG.md\" to build_command.'; }{% endif %}" }
```
How can I resolve this? If you propose a fix, please make it concise.Reviews (2): Last reviewed commit: "Update project/pyproject.toml.jinja" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Adds a post-update validation to poe update-template that checks
pyproject.toml for the required git add uv.lock line in build_command.
Warns users who may have missed the fix due to copier merge behavior.
Resolves DOT-479
Closes #