Skip to content

docs: run release commands in a worktree - #757

Merged
uniqueg merged 2 commits into
devfrom
docs/756-release-worktree
Nov 9, 2026
Merged

uniqueg merged 2 commits into
devfrom
docs/756-release-worktree

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

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 failed git switch --detach (e.g., because of uncommitted changes) let the following commands run, and citation.py check checked the wrong commit.
  • docs/helm-chart.md: the chart tag names the commit (git tag -s chart-vX.Y.Z <sha>) instead of tagging HEAD, chained the same way.

Closes #756

Verification

  • pytest tests/test_version_mentions.py tests/test_docs_hooks.py: 110 passed
  • mkdocs build --strict: passed

Light 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:

  • Update release documentation to perform source releases from a specified commit in a detached worktree, preserving the maintainer’s checkout and ensuring commands stop on errors with cleanup guidance.
  • Update Helm chart release instructions to fetch and sign the explicitly specified commit, with safer chained push commands and retry guidance.

Documentation:

  • Clarify recovery steps for failed tag pushes and verification of tag targets.

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]>
@sourcery-ai

sourcery-ai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Documentation

Update 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.

  • docs/contributing/index.md L264-285

Update Helm chart release instructions to create the signed tag for an explicitly specified commit and stop on errors.

  • docs/helm-chart.md L1191-1198

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@codecov

codecov Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (eb17893) to head (ecb26e9).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #757   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           74        74           
  Lines         9448      9448           
=========================================
  Hits          9448      9448           
Flag Coverage Δ
test_unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg marked this pull request as ready for review November 9, 2026 08:30

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread docs/contributing/index.md Resolved
Comment thread docs/contributing/index.md Resolved
Comment thread docs/helm-chart.md Resolved
Comment thread docs/helm-chart.md Resolved
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]>

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread docs/helm-chart.md Resolved
@uniqueg
uniqueg merged commit e362fbf into dev Nov 9, 2026
58 checks passed
@uniqueg
uniqueg deleted the docs/756-release-worktree branch November 9, 2026 09:50
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.

docs: run release commands in a worktree

1 participant