|
| 1 | +--- |
| 2 | +name: commit-helper |
| 3 | +description: Help create git commits and PRs with properly formatted messages and release notes following CockroachDB conventions. Use when committing changes or creating pull requests. |
| 4 | +--- |
| 5 | + |
| 6 | +# CockroachDB Commit Helper |
| 7 | + |
| 8 | +Help the user create properly formatted commit messages and release notes that follow CockroachDB conventions. |
| 9 | + |
| 10 | +## Workflow |
| 11 | + |
| 12 | +1. **Analyze the changes**: Run `git diff --staged` or `git diff` to understand what was modified |
| 13 | +2. **Determine the package prefix**: Identify the primary package affected |
| 14 | +3. **Ask the user** for: |
| 15 | + - Issue/epic number if not already known |
| 16 | + - Whether release notes are needed and what category fits best |
| 17 | +4. **Write the subject line**: Imperative mood, no period, under 72 characters |
| 18 | +5. **Write the body**: Explain the before/after, why the change was needed |
| 19 | +6. **Add issue references**: Include Resolves/Epic as appropriate |
| 20 | +7. **Write the release note**: Clear, user-focused description of the change |
| 21 | +8. **Create the commit** using the properly formatted message |
| 22 | + |
| 23 | +## Commit Message Structure |
| 24 | + |
| 25 | +**Basic Format:** |
| 26 | +``` |
| 27 | +package: imperative title without period |
| 28 | +
|
| 29 | +Detailed explanation of what changed, why it changed, and |
| 30 | +how it impacts users. Explain the problem that existed |
| 31 | +before and how this commit solves it. |
| 32 | +
|
| 33 | +Include context about alternate approaches considered and |
| 34 | +any side effects or consequences. |
| 35 | +
|
| 36 | +Resolves: #123 |
| 37 | +Epic: CRDB-357 |
| 38 | +
|
| 39 | +Release note (category): Description of user-facing change |
| 40 | +in past or present tense explaining what changed, how users |
| 41 | +can see the change, and why it's important. |
| 42 | +``` |
| 43 | + |
| 44 | +**Key Requirements:** |
| 45 | +- **Must** include release note annotation (even if "Release note: None") |
| 46 | +- **Must** include issue or epic reference |
| 47 | +- **Must** separate subject from body with blank line |
| 48 | +- **Recommended** prefix subject with affected package/area |
| 49 | +- **Recommended** use imperative mood in subject (e.g. "fix bug" not "fixes bug") |
| 50 | +- **Recommended** wrap body at 72-100 characters |
| 51 | + |
| 52 | +## Release Note Categories |
| 53 | + |
| 54 | +**When to include release notes:** |
| 55 | +- Changes to user interaction or experience |
| 56 | +- Changes to product behavior (performance, command responses, architecture) |
| 57 | +- Bug fixes affecting external users |
| 58 | + |
| 59 | +**When to exclude release notes:** |
| 60 | +- Internal refactors, testing, infrastructure work |
| 61 | +- Code that's too immature for docs (private preview features) |
| 62 | +- Internal settings beginning with `crdb_internal.` |
| 63 | +- Functionality not accessible to external users |
| 64 | + |
| 65 | +**Valid Categories:** |
| 66 | +- `backward-incompatible change` - Breaking changes to stable interfaces |
| 67 | +- `enterprise change` - Features requiring enterprise license |
| 68 | +- `ops change` - Commands/endpoints for operators (logging, metrics, CLI flags) |
| 69 | +- `cli change` - Commands for developers/contributors (SQL shells, debug tools) |
| 70 | +- `sql change` - SQL statements, functions, system catalogs |
| 71 | +- `ui change` - DB Console changes |
| 72 | +- `security update` - Security feature changes |
| 73 | +- `performance improvement` - Performance enhancements |
| 74 | +- `cluster virtualization` - Multi-tenancy infrastructure |
| 75 | +- `bug fix` - Problem fixes |
| 76 | +- `general change` - Changes that don't fit elsewhere |
| 77 | +- `build change` - Source build requirements |
| 78 | + |
| 79 | +## Release Note Best Practices |
| 80 | + |
| 81 | +**Description guidelines:** |
| 82 | +- Default to more information rather than less |
| 83 | +- Explain **what** changed, **how** it changed, and **why** it's relevant |
| 84 | +- Use past tense ("Added", "Fixed") or present tense ("CockroachDB now supports") |
| 85 | +- For bug fixes: describe cause, symptoms, and affected versions |
| 86 | +- Note if change is part of broader roadmap feature |
| 87 | + |
| 88 | +**Examples:** |
| 89 | + |
| 90 | +**Good bug fix:** |
| 91 | +``` |
| 92 | +Release note (bug fix): Fixed a bug introduced in v19.2.3 that |
| 93 | +caused duplicate rows in CREATE TABLE ... AS results when multiple |
| 94 | +nodes attempt to populate the results. |
| 95 | +``` |
| 96 | + |
| 97 | +**Good feature:** |
| 98 | +``` |
| 99 | +Release note (enterprise change): Shortened the default interval |
| 100 | +for the kv.closed_timestamp.target_duration cluster setting from |
| 101 | +30s to 3s. This allows follower reads at 4.8 seconds in the past, |
| 102 | +a much shorter window than the previous 48 seconds. |
| 103 | +``` |
| 104 | + |
| 105 | +## Issue References |
| 106 | +- `Resolves: #123` - Auto-closes issue on PR merge |
| 107 | +- `See also: #456, #789` - Cross-references issues |
| 108 | +- `Epic: CRDB-357` - Links to epic |
| 109 | + |
| 110 | +## How to Avoid Common Pitfalls |
| 111 | +- Always include a release note annotation (even "Release note: None") |
| 112 | +- Use only valid category names from the list above |
| 113 | +- Keep release notes focused on user-facing information |
| 114 | +- Write specific descriptions that explain the impact to users |
| 115 | +- Use `backward-incompatible change` category for any breaking changes |
| 116 | +- End subject lines without punctuation |
| 117 | +- Explain the "why" behind changes, not just the "what" |
| 118 | + |
| 119 | +## Pull Request Guidelines |
| 120 | +- **Create PRs from your personal fork**, not directly on cockroachdb/cockroach |
| 121 | +- **Single-commit PRs**: PR title should match commit title, PR body should match commit body |
0 commit comments