fix(#2716): route non-user-facing conventional types to an Internal bucket, omit from release notes (#2838)
* test(#2716): failing-first regression for non-user-facing types → Internal bucket * fix(#2716): route non-user-facing conventional types to an Internal bucket, omit from release notes * fix(#2716): update SAMPLE_BODY/Discord/property tests for Internal bucket; fix stale CONTRIBUTING sentence (review) * test(#2716): relax Discord Enhancement assertion (enhance: prefix not stripped by cleanBullet) * docs(changeset): #2716 non-user-facing types omitted from release notes * docs(changeset): backfill #2716 PR number to 2838
This commit is contained in:
@@ -30,18 +30,36 @@ const HEADER_RE = /^([a-z]+)(\([^)]*\))?(!)?:/i;
|
||||
// An issue reference inside a scope: `(#123)`, `(#123, core)`, etc.
|
||||
const ISSUE_REF_IN_SCOPE_RE = /#\d+/;
|
||||
|
||||
// #2716: recognized non-user-facing conventional-commit types. A title whose
|
||||
// START-anchored type prefix is one of these is internal work (tests, chores,
|
||||
// CI, docs, refactors, perf, reverts) and must NOT render under the user-facing
|
||||
// "Enhancement" heading in release notes. Only a CLEAN prefix match qualifies —
|
||||
// untyped or anchor-defeated titles fall through to the visible Enhancement
|
||||
// fallback (a safety net so possibly-user-facing content is never hidden).
|
||||
const NON_USER_FACING_TYPES = new Set([
|
||||
'docs', 'refactor', 'test', 'ci', 'chore', 'perf', 'revert',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Classify a clean conventional title into a changelog bucket.
|
||||
* Callers that hold a full changelog bullet line (with a `* ` marker and a
|
||||
* ` by @author` suffix) must strip those first; this operates on the title.
|
||||
*
|
||||
* @param {string} title
|
||||
* @returns {'Feature'|'Fix'|'Enhancement'}
|
||||
* @returns {'Feature'|'Fix'|'Enhancement'|'Internal'}
|
||||
*/
|
||||
function classifyBucket(title) {
|
||||
const t = String(title == null ? '' : title).trim();
|
||||
if (FEATURE_RE.test(t)) return 'Feature';
|
||||
if (FIX_RE.test(t)) return 'Fix';
|
||||
// #2716: a clean non-user-facing type prefix → Internal (omitted from user-facing
|
||||
// release-note sections). The HEADER_RE anchor ensures a leading tag/prefix
|
||||
// (e.g. `[security] fix(...)`) does NOT match here — those keep falling through
|
||||
// to the visible Enhancement fallback.
|
||||
const headerMatch = HEADER_RE.exec(t);
|
||||
if (headerMatch && NON_USER_FACING_TYPES.has(headerMatch[1].toLowerCase())) {
|
||||
return 'Internal';
|
||||
}
|
||||
return 'Enhancement';
|
||||
}
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ const { runMain, ExitError } = require('../lib/cli-exit.cjs');
|
||||
const { classifyBucket } = require('./conventional-title.cjs');
|
||||
|
||||
/**
|
||||
* Classify a What's-Changed bullet line into 'Feature', 'Fix', or 'Enhancement'.
|
||||
* Classify a What's-Changed bullet line into 'Feature', 'Fix', 'Enhancement', or 'Internal'.
|
||||
* @param {string} bulletLine - Full bullet line including the leading `* ` or `- ` marker.
|
||||
* @returns {'Feature'|'Fix'|'Enhancement'}
|
||||
* @returns {'Feature'|'Fix'|'Enhancement'|'Internal'}
|
||||
*/
|
||||
function classifyTitle(bulletLine) {
|
||||
// Strip leading `* ` or `- ` marker
|
||||
@@ -83,7 +83,11 @@ function formatReleaseNotes({ generatedBody, version, prerelease, packageName })
|
||||
const category = classifyTitle(trimmed);
|
||||
if (category === 'Feature') featureBullets.push(trimmed);
|
||||
else if (category === 'Fix') fixBullets.push(trimmed);
|
||||
else enhancementBullets.push(trimmed);
|
||||
else if (category === 'Internal') {
|
||||
// #2716: non-user-facing work (test/chore/ci/docs/refactor/perf/revert)
|
||||
// is omitted from the user-facing "What's Changed" section entirely.
|
||||
continue;
|
||||
} else enhancementBullets.push(trimmed);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user