Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .claude/commands/update-seastar-sha.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
description: Update Seastar SHA to latest commit from v26.1.x branch
---

# Update Seastar SHA

Update the Seastar dependency in `bazel/repositories.bzl` to the latest commit from the `v26.1.x` branch of the Redpanda Seastar fork, then open a PR.

## Instructions

1. **Get the latest SHA from the v26.1.x branch**
```bash
gh api repos/redpanda-data/seastar/commits/v26.1.x --jq '.sha'
```
Store this as `NEW_SHA`.
Copy link
Member

Choose a reason for hiding this comment

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

When I first read this I thought things like NEW_SHA were files, and that this was too prescriptive. That is, Claude should perform better with declarative instructions.

But now I'm curious: is this like using a virtual storage location of sorts?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure (since claude also wrote this file), but I did test it and it worked. The way I did it was to work though a PR workflow without any skill, then when it worked, got claude to go back and record the steps it uses for next time as a skill.

I know you can actually do direct substitution in these files, like this though this isn't that.

I did find some references that specifically "store this as" will put the value into long term memory, depending on the context (e.g., into MCP's external memory).


2. **Read the current configuration**
- Use the Read tool to read `bazel/repositories.bzl`
- Find the current Seastar SHA in the `strip_prefix` line (format: `seastar-<SHA>`)
- Store this as `OLD_SHA`

3. **Check if update is needed**
- If `NEW_SHA` equals `OLD_SHA`, inform the user: "Seastar is already at the latest SHA: `<SHA>`"
- Exit without changes

4. **Compute the sha256 hash of the new archive**
```bash
curl -sL "https://github.com/redpanda-data/seastar/archive/<NEW_SHA>.tar.gz" | openssl dgst -sha256 | awk '{print $2}'
```
Store this as `NEW_HASH`.

5. **Update `bazel/repositories.bzl`**
Use the Edit tool to update the seastar `http_archive` block:
- Add or update the comment line immediately before `http_archive(` to read: `# branch: v26.1.x`
- Update `sha256 = "<NEW_HASH>"`
- Update `strip_prefix = "seastar-<NEW_SHA>"`
- Update `url = "https://github.com/redpanda-data/seastar/archive/<NEW_SHA>.tar.gz"`

6. **Run buildifier to format the file (this also updates MODULE.bazel.lock)**
```bash
bazel run //tools:buildifier.fix
```

7. **Build to verify the change**
```bash
bazel build //src/v/base
```
- If the build fails, revert the changes and report the error to the user
- Do not proceed with the PR if the build fails

8. **Get the list of changes since the old SHA**
```bash
gh api "repos/redpanda-data/seastar/compare/<OLD_SHA>...<NEW_SHA>" --jq '.commits[].commit.message' | head -1 | while read line; do echo "- $line"; done
```
Or use:
```bash
gh api "repos/redpanda-data/seastar/compare/<OLD_SHA>...<NEW_SHA>" --jq '.commits[] | "- " + (.commit.message | split("\n")[0])'
```
Store the list of oneline commit messages as `CHANGELOG`.

9. **Create a branch and commit**
- Create branch: `seastar-update-<first 8 chars of NEW_SHA>`
- Stage both `bazel/repositories.bzl` and `MODULE.bazel.lock`
- Commit message should be multi-line:
```
bazel: update seastar to <first 8 chars of NEW_SHA>
Changes:
<CHANGELOG>
```
10. **Open a PR**
Use `gh pr create` with:
- Title: `bazel: update seastar to <first 8 chars of NEW_SHA>`
- Body should include:
- Previous SHA (first 12 chars)
- New SHA (first 12 chars)
- Link to the commit comparison on GitHub
11. **Report success**
- Print the old and new SHA
- Print the PR URL
- Print the GitHub comparison link: `https://github.com/redpanda-data/seastar/compare/<OLD_SHA>...<NEW_SHA>`
## Example
Running `/update-seastar-sha` when there's a new commit:
```
Updating Seastar SHA...
Old SHA: 804949ce1b42
New SHA: abc123def456
Build succeeded.
PR created: https://github.com/redpanda-data/redpanda/pull/12345
Compare changes: https://github.com/redpanda-data/seastar/compare/804949ce1b42...abc123def456
```