Repository navigation
docs: run release commands in a worktree - #757
Conversation
The release steps ran in the maintainer's checkout and kept going after a failed switch, so the citation check could run on the wrong commit. Run them in a new detached worktree, stop at the first error, and name the commit in the chart tag too. Closes #756 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideDocumentationUpdate the project release instructions to validate and publish the specified commit in a detached worktree, stop on errors, clean up the worktree, and explain how to retry a failed tag push.
Update Helm chart release instructions to create the signed tag for an explicitly specified commit and stop on errors.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #757 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 74 74
Lines 9448 9448
=========================================
Hits 9448 9448
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Hey - I've found 4 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="docs/contributing/index.md" line_range="277" />
<code_context>
+git tag -s vX.Y.Z <sha> -m "vX.Y.Z" &&
+git push origin vX.Y.Z &&
+cd - &&
+git worktree remove ../foca-release
```
</code_context>
<issue_to_address>
**Failed releases leave stale worktrees**
When a command after `git worktree add` fails, the `&&` chain skips `cd -` and `git worktree remove`, leaving `../foca-release` registered (and an interactive shell inside it); the next `git worktree add` fails because the path is occupied, blocking a retry.
Run cleanup regardless of earlier command failures, while preserving the release command's exit status.
</issue_to_address>
### Comment 2
<location path="docs/contributing/index.md" line_range="274" />
<code_context>
+cd ../foca-release &&
+python scripts/citation.py check X.Y.Z && # as the release workflow does
+git push origin <sha>:main && # fails unless it is a fast-forward
+git tag -s vX.Y.Z <sha> -m "vX.Y.Z" &&
+git push origin vX.Y.Z &&
+cd - &&
</code_context>
<issue_to_address>
**Failed tag pushes block retries**
When a push fails after the signed tag is created locally, `git tag -s` fails on rerun because the tag already exists, so the sequence never reaches another push and the maintainer must discover a separate command to push the existing tag.
Make the sequence push an already-created local tag on retry instead of failing at tag creation.
Also at `docs/helm-chart.md:1196-1197`.
</issue_to_address>
### Comment 3
<location path="docs/helm-chart.md" line_range="1194-1195" />
<code_context>
+depend on what is checked out, and stopping at the first error:
```bash
-git tag -s chart-v0.1.0 -m "foca-common 0.1.0"
+git fetch origin &&
+git tag -s chart-v0.1.0 <sha> -m "foca-common 0.1.0" &&
git push origin chart-v0.1.0
</code_context>
<issue_to_address>
**Use a chart worktree**
The issue asks both release procedures to run in a detached worktree at the release commit. The Helm chart instructions fetch and tag directly, without adding or entering a worktree.
</issue_to_address>
### Comment 4
<location path="docs/helm-chart.md" line_range="1197" />
<code_context>
-git tag -s chart-v0.1.0 -m "foca-common 0.1.0"
+git fetch origin &&
+git tag -s chart-v0.1.0 <sha> -m "foca-common 0.1.0" &&
git push origin chart-v0.1.0
```
</code_context>
<issue_to_address>
**Remove chart worktree**
The issue asks for the worktree to be removed at the end of both procedures. The Helm chart instructions end after pushing the tag and have no worktree cleanup step.
</issue_to_address>Linked issues
#756 docs: run release commands in a worktree · 2 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Run both release procedures in a new detached worktree at the release commit. | 🟡 Partly met | The contributing-guide procedure uses a detached worktree, but the Helm chart procedure still creates its tag from the current checkout. |
| 2 | Chain the commands with && so they stop at the first error. | ✅ Met | |
| 3 | Name the commit in every push and tag. | ✅ Met | The branch push names the SHA, and both tag-creation commands name the commit; the tag pushes push those named tags. |
| 4 | Remove the worktree at the end. | 🟡 Partly met | The contributing-guide procedure removes its worktree, but the Helm chart procedure does not create or remove one. |
Sourcery assessment
Approval pending. 4 findings to address first.
Blocking findings: docs/contributing/index.md:277, docs/contributing/index.md:274, docs/helm-chart.md:1195, docs/helm-chart.md:1197
Run the release steps in a subshell, so that the worktree is removed even if a step fails, and say how to retry a failed tag push. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Linked issues
#756 docs: run release commands in a worktree · 3 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Run both release procedures in a new detached worktree at the release commit. | 🟡 Partly met | The contributing-guide procedure uses a detached worktree, but the Helm chart instructions explicitly say that no worktree is needed. |
| 2 | Chain the commands with && so they stop at the first error. | ✅ Met | |
| 3 | Name the commit in every push and tag. | ✅ Met | The source release push and both tag commands target the specified commit; the chart push publishes that explicitly targeted tag. |
| 4 | Remove the worktree at the end. | ✅ Met | The contributing-guide procedure removes the worktree after the release subshell exits. |
Summary
docs/contributing/index.md: the release steps now run in a new detached worktree at the release commit (git worktree add --detach ../foca-release <sha>), so that the maintainer's checkout stays as it is. The commands are chained with&&, so they stop at the first error, and the worktree is removed at the end. Before, a failedgit switch --detach(e.g., because of uncommitted changes) let the following commands run, andcitation.py checkchecked the wrong commit.docs/helm-chart.md: the chart tag names the commit (git tag -s chart-vX.Y.Z <sha>) instead of taggingHEAD, chained the same way.Closes #756
Verification
pytest tests/test_version_mentions.py tests/test_docs_hooks.py: 110 passedmkdocs build --strict: passedLight lane: docs only, no reviewer subagents.
🤖 Generated with Claude Code
Summary by Sourcery
Make documented release procedures safer by targeting explicit commits and preserving local checkouts.
Enhancements:
Documentation: