Skip to content

fix(version): include test commits in changelogs instead of dropping them - #570

Merged
goosewobbler merged 2 commits into
mainfrom
fix/changelog-include-test-commits
Jul 19, 2026
Merged

goosewobbler merged 2 commits into
mainfrom
fix/changelog-include-test-commits

Conversation

@goosewobbler

@goosewobbler goosewobbler commented Jul 19, 2026 •

Copy link
Copy Markdown
Owner

Closes #569.

Problem

test: was the only conventional-commit type silently deleted from generated changelogs — mapCommitTypeToChangelogType (packages/version/src/changelog/commitParser.ts) returned null for it, while docs, style, refactor, perf, build, ci, and chore all already surface as "Changed". That single exclusion:

  • Violated ReleaseKit's own invariant — demoteScopes is documented as "Nothing is hidden or dropped" (noise is demoted, not removed).
  • Undercounted the standing-PR preview — the "N changes, de-duplicated" count dropped test commits before counting, so it didn't match the merged history. (Surfaced when test(harness): cover the npm-disabled cargo-only version path #567, a test: PR, never appeared in the v0.41.0 preview.)
  • Substituted a placeholder in sync/group releases — a package whose changes were only test: commits came back with entries: [] and got a synthetic "Update version to ${version}" line (groupStrategy.ts:358) instead of its real changes.

Fix

Map test to "Changed", alongside the other code-adjacent types. One-line behavioral change plus the spec that pinned the old behavior.

Why "Changed" and not a dedicated "Tests" section: Keep a Changelog categories describe the nature of a change (Added/Changed/Fixed/…), not the commit type; docs/ci/chore/etc. already fold into "Changed"; and test is low-signal, so it shouldn't be elevated to its own section (the future refinement, if wanted, is demotion like deps, not promotion).

Safety

Display-only. Releasability is decided by the semver bump-rank calc (feat→minor, fix→patch, breaking→major; test/docs/chore→no bump), which is independent of changelog-entry presence — so no test-only change becomes releasable. Verified pnpm turbo run lint typecheck test (32/32 tasks green).

🤖 Generated with Claude Code

Greptile Summary

This PR fixes a single omission in mapCommitTypeToChangelogType: test commits previously returned null and were silently dropped from changelogs, while every other conventional-commit type was already surfaced. The fix maps test to 'changed', removes the now-dead null-check guard, narrows the return type from … | null to ChangelogEntry['type'], and updates the spec to assert 11 entries instead of 10.

  • packages/version/src/changelog/commitParser.ts: removes the null short-circuit path and its guard, maps case 'test' to 'changed', and tightens the return type signature.
  • packages/version/test/unit/changelog/commitParser.spec.ts: updates the fixture assertion count and adds an explicit expectation that a test: commit surfaces as type: 'changed'.

Confidence Score: 5/5

Display-only change with no effect on semver bump logic; safe to merge.

The change touches only the changelog rendering path — mapCommitTypeToChangelogType — and explicitly leaves the bump-rank calculation (which governs releasability) untouched. The old null return and its guard are removed consistently: no call site relied on the null path for correctness, and the return-type narrowing matches the new reality. The spec update directly pins the new behaviour. No edge cases are left unaddressed.

No files require special attention.

Important Files Changed

Filename Overview
packages/version/src/changelog/commitParser.ts Maps test to 'changed' instead of null, removes the dead null-guard, and narrows the return type — all consistent and correct.
packages/version/test/unit/changelog/commitParser.spec.ts Count updated from 10 to 11 and a new assertion verifies test: is categorised as 'changed'; covers the behavioural change adequately.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["commit message"] --> B["parseCommitMessage()"]
    B --> C{"conventional\ncommit?"}
    C -- No --> D{"meaningful\nnon-conventional?"}
    D -- Yes --> E["type: 'changed'"]
    D -- No --> F["return null\n(filtered out)"]
    C -- Yes --> G["mapCommitTypeToChangelogType(type)"]
    G --> H{"type?"}
    H -- "feat" --> I["'added'"]
    H -- "fix" --> J["'fixed'"]
    H -- "revert" --> K["'removed'"]
    H -- "docs, style, refactor,\nperf, build, ci, chore,\ntest, (default)" --> L["'changed'"]
    I & J & K & L --> M["ChangelogEntry"]

    style L fill:#d4edda,stroke:#28a745
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A["commit message"] --> B["parseCommitMessage()"]
    B --> C{"conventional\ncommit?"}
    C -- No --> D{"meaningful\nnon-conventional?"}
    D -- Yes --> E["type: 'changed'"]
    D -- No --> F["return null\n(filtered out)"]
    C -- Yes --> G["mapCommitTypeToChangelogType(type)"]
    G --> H{"type?"}
    H -- "feat" --> I["'added'"]
    H -- "fix" --> J["'fixed'"]
    H -- "revert" --> K["'removed'"]
    H -- "docs, style, refactor,\nperf, build, ci, chore,\ntest, (default)" --> L["'changed'"]
    I & J & K & L --> M["ChangelogEntry"]

    style L fill:#d4edda,stroke:#28a745
Loading

Comments Outside Diff (1)

  1. packages/version/src/changelog/commitParser.ts, line 344 (link)

    P2 Now that test returns 'changed', every branch in the switch returns a non-null value — the | null in the return type is unreachable. Removing it makes the type accurately reflect the function's actual behaviour and avoids null-checks at call sites.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    Fix in Claude Code Fix in Cursor

Reviews (2): Last reviewed commit: "refactor(version): drop now-unreachable ..." | Re-trigger Greptile

…them

test was the only conventional-commit type mapped to null in
mapCommitTypeToChangelogType — every other non-feat/fix type (docs, style,
refactor, perf, build, ci, chore) already surfaces as "Changed". Dropping
test alone violated ReleaseKit's demote-don't-hide invariant, undercounted
the standing-PR preview's de-duplicated change count, and in sync/group
releases replaced a package's real (test-only) changes with a synthetic
"Update version to X" placeholder.

Map test to "Changed" like the other code-adjacent types. This is
display-only: releasability is decided by the semver bump-rank calc, which
is independent of changelog entries, so no test-only change becomes
releasable.

Closes #569

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011i1KvoyxATU3bz5V5Sf1Xu
@goosewobbler goosewobbler added this to the 0.41.0 milestone Jul 19, 2026
@github-actions

github-actions Bot commented Jul 19, 2026 •

Copy link
Copy Markdown
Contributor

Standing release PR: #555 · v0.41.0 queued (4 packages) · open 4h 56m · ✅ ready to merge

Release Preview — v0.40.0 → v0.40.1

Note: Labels on this PR are advisory in standing-pr mode. Bumps come from conventional commits in the standing PR; override by editing labels on the standing PR itself. Add release:immediate to bypass the standing PR and release this PR directly.

These changes will be added to the release PR (#555) when merged:

Changelog

monorepo 0.40.0 → 0.40.1

Changed

  • drop now-unreachable null from type mapping (version)

Fixed

  • include test commits in changelogs instead of dropping them (version) (#569)

All packages → 0.40.1 (sync versioning)

  • @releasekit/version
  • @releasekit/notes
  • @releasekit/publish
  • @releasekit/release

After merge — predicted release

No version escalation — this PR's changes will be included in the queued release without affecting the projected versions.

Package Standing PR This PR After merge
monorepo 0.41.0 0.40.1 0.41.0

Updated automatically by ReleaseKit

With test mapped to 'changed', every branch of mapCommitTypeToChangelogType
(including default) returns a concrete type, so its `| null` return and the
`if (!changelogType) return null` guard at the sole call site are dead.
Remove both. parseCommitMessage still returns null for non-conventional
bookkeeping commits — that `| null` is unaffected.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011i1KvoyxATU3bz5V5Sf1Xu
@goosewobbler
goosewobbler merged commit 5be1b67 into main Jul 19, 2026
24 checks passed
@goosewobbler
goosewobbler deleted the fix/changelog-include-test-commits branch July 19, 2026 19:09
@github-actions github-actions Bot mentioned this pull request Jul 19, 2026
@github-actions github-actions Bot mentioned this pull request Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changelog silently drops test: commits — inconsistent with demote-don't-hide, undercounts standing-PR preview

1 participant