Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 17 additions & 0 deletions .claude/REVIEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Code Review Criteria

When reviewing pull requests in this repository, check the following areas:

| Area | What to check |
| ---- | ------------- |
| Public API compatibility | Changes to exported identifiers, function signatures, the `Option` type or the `Error` struct fields. A breaking change needs a major version bump and a `/vN` module path. |
| Output formats | Changes to the `Error()` string, the `%v` / `%+v` JSON shape, JSON field names or the `slog` group keys. Consumers parse and match these, so treat them as API. `README.md` and `DESIGN.md` show the exact strings and must stay in sync. |
| Standard library semantics | `Is`, `As` and `Unwrap` keep working with the standard `errors` package. `Is` keeps its identifier-prefix matching. `CausedBy` chains stay reachable through `errors.Unwrap`. |
| Immutability of sentinels | Sentinel errors from `New` are shared package-level values. `Wrap` and every option must clone `Details`, `Identifier` and `Properties` and never mutate the template error. Watch for slice aliasing through `append`. |
| Concurrency | Sentinels are wrapped from many goroutines at once. No option may write to shared maps or slices. Tests run with `-race`. |
| Nil safety | Nil receivers, `Wrap(nil)`, `CausedBy(nil)`, empty property keys and nil maps must not panic. An error library must never crash the caller's error path. |
| Stack capture | `runtime.Caller` depth is hard-coded. A new entry point or an extra call layer shifts the captured frame. Tests should assert the reported function name. |
| Dependencies | The library has no runtime dependency. A new non-test import outside the standard library needs a strong reason. `go.mod` and `go.sum` stay consistent. |
| Tests | New behavior is covered by Ginkgo/Gomega specs in `errors_test.go`, in the existing `Describe` / `It` style. |
| CI and workflows | GitHub Actions are pinned to a commit SHA with a version comment, matching the existing workflows. |
| Security | No secrets or real hostnames in tests or examples. Flag changes that start logging `Properties` or `Details` in new places, since callers may put sensitive values there. |
28 changes: 28 additions & 0 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Code Review

on:
pull_request:
types: [opened, synchronize, labeled, unlabeled]
pull_request_target:
types: [opened, synchronize]

jobs:
review:
# May also trigger on bump branches when a human updates them (acceptable double-review).
if: github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' && github.actor != 'scality-renovate[bot]'
uses: scality/workflows/.github/workflows/claude-code-review.yml@91619d883650e6238f517757f7b978757c2cb086 # v2.12.1
Comment thread
TeddyAndrieux marked this conversation as resolved.
Resolved
secrets:
# The review prompt is a slash command shipped by the scality-skills
# plugin, which the shared workflow clones from the agent-hub marketplace
# with this app key. Without it the plugin is skipped and the review
# silently does nothing.
ACTIONS_APP_PRIVATE_KEY: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}

review-dependency-bump:
# pr.user.login catches bump PRs updated by a human, where github.actor is no longer the bot.
if: github.event_name == 'pull_request_target' && (github.actor == 'dependabot[bot]' || github.event.pull_request.user.login == 'dependabot[bot]' || github.actor == 'scality-renovate[bot]' || github.event.pull_request.user.login == 'scality-renovate[bot]')
uses: scality/workflows/.github/workflows/claude-code-dependency-review.yml@91619d883650e6238f517757f7b978757c2cb086 # v2.12.1
with:
ACTIONS_APP_ID: ${{ vars.ACTIONS_APP_ID }}
secrets:
ACTIONS_APP_PRIVATE_KEY: ${{ secrets.ACTIONS_APP_PRIVATE_KEY }}
10 changes: 10 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# go-errors

This is a **Go library for structured error handling** (`github.com/scality/go-errors`). It contains:

- A single package `errors` in `errors.go`: `New`, `Wrap` with functional options, stack capture, identifier chaining
- Standard library compatibility: `errors.Is`, `errors.As`, `errors.Unwrap`, `fmt` verbs (`%v` / `%+v` as JSON) and `slog.LogValuer`
- Ginkgo/Gomega tests in `errors_test.go`, run with `go test -race ./...`
- Linting with golangci-lint, via the devcontainer in `.devcontainer/`
- Design notes in `DESIGN.md`, usage and exact output formats in `README.md`
- No runtime dependencies: `go.mod` only pulls test dependencies
Loading