mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Keep long version declarations from aborting issue triage
A valid long prerelease identifier can exceed GitHub's 50-character label-name limit. Retain that declaration without inventing a shortened affected version or marking supplied evidence missing, while still applying independent topic review and stale-version cleanup. Cover the exact boundary, one character beyond it and a much longer declaration through the production synchronizer and a strict API fixture. Contract-Neutral: Preserve silent issue metadata and Community review ownership; bound label representation without changing reporter evidence, contact or disposition. Change-source: pulse-maintainer
This commit is contained in:
25
.github/scripts/issue-version-triage.cjs
vendored
25
.github/scripts/issue-version-triage.cjs
vendored
@@ -612,14 +612,23 @@ async function syncLabels({ github, context, core }) {
|
||||
}
|
||||
|
||||
if (reportedVersion) {
|
||||
await ensureLabel(
|
||||
github,
|
||||
context,
|
||||
`${VERSION_LABEL_PREFIX}${reportedVersion}`,
|
||||
"0e8a16",
|
||||
`Bug reported against Pulse ${reportedVersion}`
|
||||
);
|
||||
nextLabels.add(`${VERSION_LABEL_PREFIX}${reportedVersion}`);
|
||||
const versionLabel = `${VERSION_LABEL_PREFIX}${reportedVersion}`;
|
||||
// GitHub label names stop at 50 characters. A longer declared version
|
||||
// still supplies evidence, but cannot be represented as an exact label.
|
||||
// Do not truncate it into a different version, or let that API validation
|
||||
// failure prevent independent topic review and stale-metadata removal.
|
||||
if (versionLabel.length <= 50) {
|
||||
await ensureLabel(
|
||||
github,
|
||||
context,
|
||||
versionLabel,
|
||||
"0e8a16",
|
||||
`Bug reported against Pulse ${reportedVersion}`
|
||||
);
|
||||
nextLabels.add(versionLabel);
|
||||
} else {
|
||||
core.info("Declared version exceeds the exact-version label limit; retaining its evidence without a version label.");
|
||||
}
|
||||
nextLabels.delete(NEEDS_VERSION_LABEL);
|
||||
} else {
|
||||
await ensureLabel(
|
||||
|
||||
39
.github/scripts/issue-version-triage.test.cjs
vendored
39
.github/scripts/issue-version-triage.test.cjs
vendored
@@ -3178,3 +3178,42 @@ test("further activity during recovery history stops without another reconciliat
|
||||
assert.deepEqual(calls.createComment, []);
|
||||
}
|
||||
});
|
||||
|
||||
for (const labelLength of [50, 51, 512]) {
|
||||
test(`a ${labelLength}-character version label cannot lose independent topic review`, async () => {
|
||||
const version = `6.6.0-${"x".repeat(labelLength - "affects-6.6.0-".length)}`;
|
||||
const versionLabel = `affects-${version}`;
|
||||
assert.equal(versionLabel.length, labelLength);
|
||||
const preserved = ["bug", "needs-human", "release-blocker", "needs-retest-on-latest", "operator-reviewed"];
|
||||
const issue = { number: 2930, title: "Current report", comments: 0,
|
||||
body: `### Pulse version\n${version}\n\n### Additional actionable topics\nThe saved connection also loses its label.`,
|
||||
labels: [...preserved, "affects-6.5.0", "needs-version-info"].map(name => ({ name })) };
|
||||
const { github, calls } = createGithub();
|
||||
const createLabel = github.rest.issues.createLabel;
|
||||
github.rest.issues.createLabel = async (payload) => {
|
||||
if (payload.name.length > 50) {
|
||||
throw Object.assign(new Error("Label name exceeds 50 characters"), {
|
||||
status: 422,
|
||||
response: { data: { errors: [{ resource: "Label", field: "name", code: "invalid" }] } },
|
||||
});
|
||||
}
|
||||
return createLabel(payload);
|
||||
};
|
||||
|
||||
await syncLabels({ github, context: createContext({ issue }), core: createCore() });
|
||||
|
||||
// A representation limit neither changes the declared version nor makes
|
||||
// it missing. No truncated label or reporter request can substitute for it.
|
||||
assert.equal(triage.internals.extractPulseVersion(issue.title, issue.body), version);
|
||||
const expected = labelLength <= 50 ? [versionLabel, "needs-decomposition"] : ["needs-decomposition"];
|
||||
assert.deepEqual(calls.addLabels.map(call => call.labels), [expected.sort()]);
|
||||
assert.deepEqual(calls.createLabel.map(call => call.name).sort(), expected.sort());
|
||||
assert.deepEqual(calls.getLabel.sort(), expected.sort(), "never send an oversized version label to GitHub");
|
||||
assert.deepEqual(calls.removeLabel.map(call => call.name), ["affects-6.5.0", "needs-version-info"]);
|
||||
assert.ok(!calls.removeLabel.some(call => preserved.includes(call.name)));
|
||||
assert.deepEqual(calls.createComment, []);
|
||||
assert.deepEqual(calls.getLatestRelease, []);
|
||||
assert.deepEqual(calls.paginate, []);
|
||||
assert.equal(calls.getIssue.length, 2, "keep the final live-read guard");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user