Skip to content

Commit 717a898

Browse files
committed
Merge remote-tracking branch 'origin/master' into merge-release-v0.40.1
# Conflicts: # version.go
2 parents 39f8a65 + 550d3b6 commit 717a898

File tree

8 files changed

+267
-20
lines changed

8 files changed

+267
-20
lines changed

.github/workflows/gateway-conformance.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
steps:
4242
# 1. Download the gateway-conformance fixtures
4343
- name: Download gateway-conformance fixtures
44-
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.10
44+
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.11
4545
with:
4646
output: fixtures
4747

@@ -93,7 +93,7 @@ jobs:
9393

9494
# 6. Run the gateway-conformance tests
9595
- name: Run gateway-conformance tests
96-
uses: ipfs/gateway-conformance/.github/actions/test@v0.10
96+
uses: ipfs/gateway-conformance/.github/actions/test@v0.11
9797
with:
9898
gateway-url: http://127.0.0.1:8080
9999
subdomain-url: http://localhost:8080
@@ -127,7 +127,7 @@ jobs:
127127
steps:
128128
# 1. Download the gateway-conformance fixtures
129129
- name: Download gateway-conformance fixtures
130-
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.10
130+
uses: ipfs/gateway-conformance/.github/actions/extract-fixtures@v0.11
131131
with:
132132
output: fixtures
133133

@@ -199,7 +199,7 @@ jobs:
199199

200200
# 9. Run the gateway-conformance tests over libp2p
201201
- name: Run gateway-conformance tests over libp2p
202-
uses: ipfs/gateway-conformance/.github/actions/test@v0.10
202+
uses: ipfs/gateway-conformance/.github/actions/test@v0.11
203203
with:
204204
gateway-url: http://127.0.0.1:8092
205205
args: --specs "trustless-gateway,-trustless-ipns-gateway" -skip 'TestGatewayCar/GET_response_for_application/vnd.ipld.car/Header_Content-Length'

AGENTS.md

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# AI Agent Instructions for Kubo
2+
3+
This file provides instructions for AI coding agents working on the [Kubo](https://github.com/ipfs/kubo) codebase (the Go implementation of IPFS). Follow the [Developer Guide](docs/developer-guide.md) for full details.
4+
5+
## Quick Reference
6+
7+
| Task | Command |
8+
|-------------------|----------------------------------------------------------|
9+
| Tidy deps | `make mod_tidy` (run first if `go.mod` changed) |
10+
| Build | `make build` |
11+
| Unit tests | `go test ./... -run TestName -v` |
12+
| Integration tests | `make build && go test ./test/cli/... -run TestName -v` |
13+
| Lint | `make -O test_go_lint` |
14+
| Format | `go fmt ./...` |
15+
16+
## Project Overview
17+
18+
Kubo is the reference implementation of IPFS in Go. Most IPFS protocol logic lives in [boxo](https://github.com/ipfs/boxo) (the IPFS SDK); kubo wires it together and exposes it via CLI and HTTP RPC API. If a change belongs in the protocol layer, it likely belongs in boxo, not here.
19+
20+
Key directories:
21+
22+
| Directory | Purpose |
23+
|--------------------|----------------------------------------------------------|
24+
| `cmd/ipfs/` | CLI entry point and binary |
25+
| `core/` | core IPFS node implementation |
26+
| `core/commands/` | CLI command definitions |
27+
| `core/coreapi/` | Go API implementation |
28+
| `client/rpc/` | HTTP RPC client |
29+
| `plugin/` | plugin system |
30+
| `repo/` | repository management |
31+
| `test/cli/` | Go-based CLI integration tests (preferred for new tests) |
32+
| `test/sharness/` | legacy shell-based integration tests |
33+
| `docs/` | documentation |
34+
35+
Other key external dependencies: [go-libp2p](https://github.com/libp2p/go-libp2p) (networking), [go-libp2p-kad-dht](https://github.com/libp2p/go-libp2p-kad-dht) (DHT).
36+
37+
## Go Style
38+
39+
Follow these Go style references:
40+
41+
- [Go Code Review Comments](https://go.dev/wiki/CodeReviewComments)
42+
- [Google Go Style Decisions](https://google.github.io/styleguide/go/decisions)
43+
44+
Specific conventions for this project:
45+
46+
- check the Go version in `go.mod` and use idiomatic features available at that version
47+
- readability over micro-optimization: clear code is more important than saving microseconds
48+
- prefer standard library functions and utilities over writing your own
49+
- use early returns and indent the error flow, not the happy path
50+
- use `slices.Contains`, `slices.DeleteFunc`, and the `maps` package instead of manual loops
51+
- preallocate slices and maps when the size is known: `make([]T, 0, n)`
52+
- use `map[K]struct{}` for sets, not `map[K]bool`
53+
- receiver names: single-letter abbreviations matching the type (e.g., `s *Server`, `c *Client`)
54+
- run `go fmt` after modifying Go source files, never indent manually
55+
56+
### Error Handling
57+
58+
- wrap errors with `fmt.Errorf("context: %w", err)`, never discard errors silently
59+
- use `errors.Is` / `errors.As` for error checking, not string comparison
60+
- never use `panic` in library code; only in `main` or test helpers
61+
- return `nil` explicitly for the error value on success paths
62+
63+
### Canonical Examples
64+
65+
When adding or modifying code, follow the patterns established in these files:
66+
67+
- CLI command structure: `core/commands/dag/dag.go`
68+
- CLI integration test: `test/cli/dag_test.go`
69+
- Test harness usage: `test/cli/harness/` package
70+
71+
## Building
72+
73+
Always run commands from the repository root.
74+
75+
```bash
76+
make mod_tidy # update go.mod/go.sum (use this instead of go mod tidy)
77+
make build # build the ipfs binary to cmd/ipfs/ipfs
78+
make install # install to $GOPATH/bin
79+
make -O test_go_lint # run linter (use this instead of golangci-lint directly)
80+
```
81+
82+
If you modify `go.mod` (add/remove/update dependencies), you must run `make mod_tidy` first, before building or testing. Use `make mod_tidy` instead of `go mod tidy` directly, as the project has multiple `go.mod` files.
83+
84+
If you modify any `.go` files outside of `test/`, you must run `make build` before running integration tests.
85+
86+
## Testing
87+
88+
The full test suite is composed of several targets:
89+
90+
| Make target | What it runs |
91+
|----------------------|-----------------------------------------------------------------------|
92+
| `make test` | all tests (`test_go_fmt` + `test_unit` + `test_cli` + `test_sharness`) |
93+
| `make test_short` | fast subset (`test_go_fmt` + `test_unit`) |
94+
| `make test_unit` | unit tests with coverage (excludes `test/cli`) |
95+
| `make test_cli` | CLI integration tests (requires `make build` first) |
96+
| `make test_sharness` | legacy shell-based integration tests |
97+
| `make test_go_fmt` | checks Go source formatting |
98+
| `make -O test_go_lint` | runs `golangci-lint` |
99+
100+
During development, prefer running a specific test rather than the full suite:
101+
102+
```bash
103+
# run a single unit test
104+
go test ./core/... -run TestSpecificUnit -v
105+
106+
# run a single CLI integration test (requires make build first)
107+
go test ./test/cli/... -run TestSpecificCLI -v
108+
```
109+
110+
### Environment Setup for Integration Tests
111+
112+
Before running `test_cli` or `test_sharness`, set these environment variables from the repo root:
113+
114+
```bash
115+
export PATH="$PWD/cmd/ipfs:$PATH"
116+
export IPFS_PATH="$(mktemp -d)"
117+
```
118+
119+
- `PATH`: integration tests use the `ipfs` binary from `PATH`, not Go source directly
120+
- `IPFS_PATH`: isolates test data from `~/.ipfs` or other running nodes
121+
122+
If you see "version (N) is lower than repos (M)", the `ipfs` binary in `PATH` is outdated. Rebuild with `make build` and verify `PATH`.
123+
124+
### Running Sharness Tests
125+
126+
Sharness tests are legacy shell-based tests. Run individual tests with a timeout:
127+
128+
```bash
129+
cd test/sharness && timeout 60s ./t0080-repo.sh
130+
```
131+
132+
To investigate a failing test, pass `-v` for verbose output. In this mode, daemons spawned by the test are not shut down automatically and must be killed manually afterwards.
133+
134+
### Cleaning Up Stale Daemons
135+
136+
Before running `test/cli` or `test/sharness`, stop any stale `ipfs daemon` processes owned by the current user. Leftover daemons hold locks and bind ports, causing test failures:
137+
138+
```bash
139+
pkill -f "ipfs daemon"
140+
```
141+
142+
### Writing Tests
143+
144+
- all new integration tests go in `test/cli/`, not `test/sharness/`
145+
- if a `test/sharness` test needs significant changes, remove it and add a replacement in `test/cli/`
146+
- use [testify](https://github.com/stretchr/testify) for assertions (already a dependency)
147+
- for Go 1.25+, use `testing/synctest` when testing concurrent code (goroutines, channels, timers)
148+
- reuse existing `.car` fixtures in `test/cli/fixtures/` when possible; only add new fixtures when the test requires data not covered by existing ones
149+
- always re-run modified tests locally before submitting to confirm they pass
150+
- avoid emojis in test names and test log output
151+
152+
## Before Submitting
153+
154+
Run these steps in order before considering work complete:
155+
156+
1. `make mod_tidy` (if `go.mod` changed)
157+
2. `go fmt ./...`
158+
3. `make build` (if non-test `.go` files changed)
159+
4. `make -O test_go_lint`
160+
5. `go test ./...` (or the relevant subset)
161+
162+
## Documentation and Commit Messages
163+
164+
- after editing CLI help text in `core/commands/`, verify width: `go test ./test/cli/... -run TestCommandDocsWidth`
165+
- config options are documented in `docs/config.md`
166+
- changelogs in `docs/changelogs/`: only edit the Table of Contents and the Highlights section; the Changelog and Contributors sections are auto-generated and must not be modified
167+
- follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/)
168+
- keep commit titles short and messages terse
169+
170+
## Writing Style
171+
172+
When writing docs, comments, and commit messages:
173+
174+
- avoid emojis in code, comments, and log output
175+
- keep an empty line before lists in markdown
176+
- use backticks around CLI commands, paths, environment variables, and config options
177+
178+
## PR Guidelines
179+
180+
- explain what changed and why in the PR description
181+
- include test coverage for new functionality and bug fixes
182+
- run `make -O test_go_lint` and fix any lint issues before submitting
183+
- verify that `go test ./...` passes locally
184+
- when modifying `test/sharness` tests significantly, migrate them to `test/cli` instead
185+
- end the PR description with a `## References` section listing related context, one link per line
186+
- if the PR closes an issue in `ipfs/kubo`, each closing reference should be a bullet starting with `Closes`:
187+
188+
```markdown
189+
## References
190+
191+
- Closes https://github.com/ipfs/kubo/issues/1234
192+
- Closes https://github.com/ipfs/kubo/issues/5678
193+
- https://discuss.ipfs.tech/t/related-topic/999
194+
```
195+
196+
## Scope and Safety
197+
198+
Do not modify or touch:
199+
200+
- files under `test/sharness/lib/` (third-party sharness test framework)
201+
- CI workflows in `.github/` unless explicitly asked
202+
- auto-generated sections in `docs/changelogs/` (Changelog and Contributors are generated; only TOC and Highlights are human-edited)
203+
204+
Do not run without being asked:
205+
206+
- `make test` or `make test_sharness` (full suite is slow; prefer targeted tests)
207+
- `ipfs daemon` without a timeout
208+
209+
## Running the Daemon
210+
211+
Always run the daemon with a timeout or shut it down promptly:
212+
213+
```bash
214+
timeout 60s ipfs daemon # auto-kill after 60s
215+
ipfs shutdown # graceful shutdown via API
216+
```
217+
218+
Kill dangling daemons before re-running tests: `pkill -f "ipfs daemon"`

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Kubo Changelogs
22

3+
- [v0.41](docs/changelogs/v0.41.md)
34
- [v0.40](docs/changelogs/v0.40.md)
45
- [v0.39](docs/changelogs/v0.39.md)
56
- [v0.38](docs/changelogs/v0.38.md)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ Kubo is available in community-maintained packages across many operating systems
186186

187187
## Development
188188

189-
See the [Developer Guide](docs/developer-guide.md) for build instructions, testing, and contribution workflow.
189+
See the [Developer Guide](docs/developer-guide.md) for build instructions, testing, and contribution workflow. AI coding agents should follow [AGENTS.md](AGENTS.md).
190190

191191
## Getting Help
192192

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ If you're experiencing an issue with IPFS, please [file an issue](https://github
2929
## Development
3030

3131
- **[Developer Guide](developer-guide.md)** - prerequisites, build, test, and contribute
32+
- **[AGENTS.md](../AGENTS.md)** - instructions for AI coding agents
3233
- Contributing Guidelines [for IPFS projects](https://github.com/ipfs/community/blob/master/CONTRIBUTING.md) and for [Go code specifically](https://github.com/ipfs/community/blob/master/CONTRIBUTING_GO.md)
3334
- [Building on Windows](windows.md)
3435
- [Customizing Kubo](customizing.md)

docs/RELEASE_CHECKLIST.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- Last updated during [v0.38.0 release](https://github.com/ipfs/kubo/issues/10884) -->
1+
<!-- Last updated during [v0.40.0 release](https://github.com/ipfs/kubo/issues/11008) -->
22

33
# ✅ Release Checklist (vX.Y.Z[-rcN])
44

@@ -21,32 +21,33 @@
2121
- [ ] Create `./docs/changelogs/vX.Y+1.md` and add link in [CHANGELOG.md](https://github.com/ipfs/kubo/blob/master/CHANGELOG.md)
2222
- [ ] Switch to `release-vX.Y.Z` branch and update [version.go](https://github.com/ipfs/kubo/blob/master/version.go) to `vX.Y.Z(-rcN)` (⚠️ double-check Y matches release) ([example](https://github.com/ipfs/kubo/pull/9394))
2323
- [ ] Create draft PR: `release-vX.Y.Z``release` ([example](https://github.com/ipfs/kubo/pull/9306))
24-
- [ ] In `release-vX.Y.Z` branch, cherry-pick commits from `master`: `git cherry-pick -x <commit>` ([example](https://github.com/ipfs/kubo/pull/10636/commits/033de22e3bc6191dbb024ad6472f5b96b34e3ccf))
25-
- ⚠️ **NOTE:** `-x` flag records original commit SHA for traceability and ensures cleaner merges with deduplicated commits in history
24+
- [ ] Cherry-pick commits from `master` into `release-vX.Y.Z`: `git cherry-pick -x <commit>` ([example](https://github.com/ipfs/kubo/pull/10636/commits/033de22e3bc6191dbb024ad6472f5b96b34e3ccf))
25+
- ⚠️ **NOTE:** `-x` flag records original commit SHA for traceability and cleaner merge history
2626
- [ ] Verify all CI checks on the PR are passing
27-
- [ ] **FINAL only:** In `release-vX.Y.Z` branch, replace `Changelog` and `Contributors` sections with `./bin/mkreleaselog` stdout (do **NOT** copy stderr)
27+
- [ ] **FINAL only:** Replace `Changelog` and `Contributors` sections in `release-vX.Y.Z` with `./bin/mkreleaselog` stdout (do **NOT** copy stderr)
2828
- [ ] **FINAL only:** Merge PR (`release-vX.Y.Z``release`) using `Create a merge commit`
29-
- ⚠️ do **NOT** use `Squash and merge` nor `Rebase and merge` because we need to be able to sign the merge commit
29+
- ⚠️ do **NOT** use `Squash and merge` nor `Rebase and merge` -- we want the releaser's GPG signature on the merge commit
3030
- ⚠️ do **NOT** delete the `release-vX.Y.Z` branch (needed for future patch releases and git history)
3131

3232
## 2. Tag & Publish
3333

3434
### Create Tag
35-
⚠️ **POINT OF NO RETURN:** Once pushed, tags trigger automatic Docker/NPM publishing that cannot be reversed!
35+
⚠️ **POINT OF NO RETURN:** Once pushed, tags trigger automatic Docker/NPM publishing and are irreversible!
3636
If you're making a release for the first time, do pair programming and have the release reviewer verify all commands.
3737

3838
- [ ] **RC:** From `release-vX.Y.Z` branch: `git tag -s vX.Y.Z-rcN -m 'Prerelease X.Y.Z-rcN'`
3939
- [ ] **FINAL:** After PR merge, from `release` branch: `git tag -s vX.Y.Z -m 'Release X.Y.Z'`
4040
- [ ] ⚠️ Verify tag is signed and correct: `git show vX.Y.Z(-rcN)`
4141
- [ ] Push tag: `git push origin vX.Y.Z(-rcN)`
42-
- ⚠️ do **NOT** use `git push --tags` because it pushes all your local tags
42+
- ⚠️ do **NOT** use `git push --tags` (pushes all local tags, polluting the repo with noise)
4343
- [ ] **STOP:** Wait for [Docker build](https://github.com/ipfs/kubo/actions/workflows/docker-image.yml) to complete before proceeding
4444

4545
### Publish Artifacts
4646

47-
- [ ] **Docker:** Publish to [DockerHub](https://hub.docker.com/r/ipfs/kubo/tags)
48-
- [ ] Wait for [Publish docker image](https://github.com/ipfs/kubo/actions/workflows/docker-image.yml) workflow triggered by tag push
49-
- [ ] Verify image is available on [Docker Hub → tags](https://hub.docker.com/r/ipfs/kubo/tags)
47+
> **Parallelism:** Docker and dist.ipfs.tech only depend on the pushed tag and can be started in parallel.
48+
> NPM and GitHub Release both depend on dist.ipfs.tech completing first.
49+
50+
- [ ] **Docker:** Verify [docker-image CI](https://github.com/ipfs/kubo/actions/workflows/docker-image.yml) passed and image is available on [Docker Hub → tags](https://hub.docker.com/r/ipfs/kubo/tags)
5051
- [ ] **dist.ipfs.tech:** Publish to [dist.ipfs.tech](https://dist.ipfs.tech)
5152
- [ ] Check out [ipfs/distributions](https://github.com/ipfs/distributions)
5253
- [ ] Create branch: `git checkout -b release-kubo-X.Y.Z(-rcN)`
@@ -64,7 +65,7 @@ If you're making a release for the first time, do pair programming and have the
6465
- [ ] Link to release issue
6566
- [ ] **RC:** Link to changelog, check `This is a pre-release`
6667
- [ ] **FINAL:** Copy changelog content (without header), do **NOT** check pre-release
67-
- [ ] Run [sync-release-assets](https://github.com/ipfs/kubo/actions/workflows/sync-release-assets.yml) workflow
68+
- [ ] Run [sync-release-assets](https://github.com/ipfs/kubo/actions/workflows/sync-release-assets.yml) workflow (requires dist.ipfs.tech)
6869
- [ ] Verify assets are attached to the GitHub release
6970

7071
## 3. Post-Release
@@ -74,18 +75,18 @@ If you're making a release for the first time, do pair programming and have the
7475
- [ ] **FINAL only:** Merge `release``master`
7576
- [ ] Create branch `merge-release-vX.Y.Z` from `release`
7677
- [ ] Merge `master` to `merge-release-vX.Y.Z` first, and resolve conflict in `version.go`
77-
- ⚠️ **NOTE:** make sure to ignore the changes to [version.go](https://github.com/ipfs/kubo/blob/master/version.go) (keep the `-dev` in `master`)
78+
- ⚠️ **NOTE:** keep the `-dev` version from `master` in [version.go](https://github.com/ipfs/kubo/blob/master/version.go), discard version from `release`
7879
- [ ] Create and merge PR from `merge-release-vX.Y.Z` to `master` using `Create a merge commit`
79-
- ⚠️ do **NOT** use `Squash and merge` nor `Rebase and merge` because we want to preserve original commit history
80+
- ⚠️ do **NOT** use `Squash and merge` nor `Rebase and merge` -- only `Create a merge commit` preserves commit history and audit trail of what was merged where
8081
- [ ] Update [ipshipyard/waterworks-infra](https://github.com/ipshipyard/waterworks-infra)
8182
- [ ] Update Kubo staging environment ([Running Kubo tests on staging](https://www.notion.so/Running-Kubo-tests-on-staging-488578bb46154f9bad982e4205621af8))
8283
- [ ] **RC:** Test last release against current RC
8384
- [ ] **FINAL:** Latest release on both boxes
8485
- [ ] **FINAL:** Update collab cluster boxes to the tagged release
8586
- [ ] **FINAL:** Update libp2p bootstrappers to the tagged release
86-
- [ ] Smoke test with [IPFS Companion Browser Extension](https://docs.ipfs.tech/install/ipfs-companion/)
8787
- [ ] Update [ipfs-desktop](https://github.com/ipfs/ipfs-desktop)
8888
- [ ] Create PR updating kubo version in `package.json` and `package-lock.json`
89+
- [ ] Smoke test with [IPFS Companion Browser Extension](https://docs.ipfs.tech/install/ipfs-companion/) against the PR build
8990
- [ ] **FINAL:** Merge PR and ship new ipfs-desktop release
9091
- [ ] **FINAL only:** Update [docs.ipfs.tech](https://docs.ipfs.tech/): run [update-on-new-ipfs-tag.yml](https://github.com/ipfs/ipfs-docs/actions/workflows/update-on-new-ipfs-tag.yml) workflow and merge the PR
9192

0 commit comments

Comments
 (0)