Skip to content

Commit b0700c7

Browse files
igerberclaude
andcommitted
Address CI review: thread single RELEASE_DATE through bump-version skill
CI review flagged P2 drift risk: step 3 can skip step 4 entirely when CHANGELOG already has a populated [NEW_VERSION] entry, which meant step 5 fell back to "today's date" for CITATION.cff even when CHANGELOG carried a different (earlier) header date. Bump-version runs on a different day than CHANGELOG pre-population would have produced inconsistent release metadata. Fix: resolve RELEASE_DATE once in step 3 — parse the existing CHANGELOG header date if the entry was pre-populated, otherwise use today's date — and thread that single value through step 4 (CHANGELOG generation) and step 5 (CITATION.cff date-released). Adds an abort path for malformed headers without a date. Updates the Notes section to reflect the new single-source-of-truth model. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 42cb28a commit b0700c7

1 file changed

Lines changed: 25 additions & 13 deletions

File tree

.claude/commands/bump-version.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,19 @@ Files that need updating:
3838
- Read `diff_diff/__init__.py` and extract the current `__version__` value
3939
- Store as `OLD_VERSION` for comparison link generation
4040

41-
3. **Check CHANGELOG entry**:
42-
- Search `CHANGELOG.md` for `## [NEW_VERSION]` section header
43-
- If found: Verify it has content (at least one `### Added/Changed/Fixed` subsection with bullet points)
44-
- If not found or empty: Generate entry from git commits (step 4)
45-
- If found with content: Skip to step 5
41+
3. **Check CHANGELOG entry and resolve `RELEASE_DATE`**:
42+
- Search `CHANGELOG.md` for `## [NEW_VERSION]` section header.
43+
- If found with content (at least one `### Added/Changed/Fixed` subsection with
44+
bullet points):
45+
- **Parse the existing header date** (e.g., `## [3.1.3] - 2026-04-19``2026-04-19`).
46+
Store as `RELEASE_DATE` and skip to step 5.
47+
- If the header has no date (malformed), abort with: `Error: CHANGELOG header for
48+
[NEW_VERSION] is missing a date. Fix the header before re-running.`
49+
- If not found or empty: Set `RELEASE_DATE` to today's date in `YYYY-MM-DD` format,
50+
then continue to step 4.
51+
52+
`RELEASE_DATE` is the single source of truth for the release date across every file
53+
touched in this bump. Do not recompute it downstream.
4654

4755
4. **Generate CHANGELOG from git** (only if needed):
4856
- Run: `git log v{OLD_VERSION}..HEAD --oneline`
@@ -51,7 +59,7 @@ Files that need updating:
5159
- **Added**: commits containing "add", "new", "implement", "introduce", "create"
5260
- **Changed**: commits containing "update", "change", "improve", "optimize", "refactor", "enhance"
5361
- **Fixed**: commits containing "fix", "bug", "correct", "repair", "resolve"
54-
- Get today's date in YYYY-MM-DD format
62+
- Use the `RELEASE_DATE` resolved in step 3 for the header.
5563
- Create CHANGELOG entry in this format:
5664
```markdown
5765
## [X.Y.Z] - YYYY-MM-DD
@@ -86,9 +94,10 @@ Files that need updating:
8694

8795
- `CITATION.cff`:
8896
Replace `version: "OLD_VERSION"` with `version: "NEW_VERSION"`.
89-
Also update `date-released: "OLD_DATE"` to `date-released: "YYYY-MM-DD"`
90-
using today's date (same value used for the CHANGELOG section header in
91-
step 4). Both fields are quoted strings; preserve the quoting style.
97+
Also update `date-released: "OLD_DATE"` to `date-released: "{RELEASE_DATE}"`
98+
using the `RELEASE_DATE` resolved in step 3. Both fields are quoted strings;
99+
preserve the quoting style. `RELEASE_DATE` must match the CHANGELOG header
100+
date; never substitute a freshly computed "today" value here.
92101

93102
6. **Update CHANGELOG comparison links**:
94103
- Run `git remote get-url origin` to determine the repository's GitHub URL
@@ -125,7 +134,10 @@ Files that need updating:
125134
- If CHANGELOG already has the target version entry with content, it will not be overwritten
126135
- Commit messages are cleaned up (prefixes like "feat:", "fix:" are removed) for CHANGELOG
127136
- The comparison link format uses `v` prefix for tags (e.g., `v2.2.0`)
128-
- `CITATION.cff` `date-released` is set to today's date (same value as the CHANGELOG
129-
section header). If the release is cut on a different day, update it manually at
130-
release time — drift here causes auto-citation tools (Zenodo, GitHub's "cite this
131-
repository", reference managers) to report stale metadata.
137+
- `CITATION.cff` `date-released` and the `CHANGELOG.md` section header share a single
138+
`RELEASE_DATE` resolved in step 3: if the CHANGELOG entry was pre-populated, its
139+
existing header date wins (so pre-written changelog drafts don't silently drift
140+
from the CITATION date); otherwise today's date is used for both. If the release
141+
is cut on a different day than the bump, update both surfaces manually — drift
142+
causes auto-citation tools (Zenodo, GitHub's "cite this repository", reference
143+
managers) to report stale metadata.

0 commit comments

Comments
 (0)