From 2c05d14b3102fd4cd8fea1949643bd45110bd3a3 Mon Sep 17 00:00:00 2001 From: TzuHsuan <96853116+TzuH-Hsu@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:16:55 +0800 Subject: [PATCH 1/2] fix: the labeler test no longer assumes area:ci exists in the repository's labels.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The last case ticked area:ci and asserted it was applied, which holds in the template and fails in every adopter that renamed the starter areas — which the template tells them to do. Reproduced against a downstream repository with nine contract areas: make check red on day one. The case now takes the first declared area, whatever its name, and passes trivially when none is declared. Closes #66 Co-Authored-By: Claude Opus 5 --- scripts/issue-labeler.test.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/issue-labeler.test.js b/scripts/issue-labeler.test.js index e863c17..998f429 100644 --- a/scripts/issue-labeler.test.js +++ b/scripts/issue-labeler.test.js @@ -152,9 +152,12 @@ test('run: an empty area set warns and applies nothing for Area', async () => { assert.equal(warnings.length, 1); }); -test("this repository's labels.yml: the shipped starter set behaves as before", () => { +test("this repository's labels.yml: a declared area is applied, an undeclared one is not", () => { + // Must hold in any adopted repo, whatever the area names are — the + // template tells adopters to rename the starter set, so no name is assumed. const areas = labeler.readAllowedAreas(path.join(__dirname, '..')); - assert.ok(areas.includes('area:ci')); - const r = changes('### Area\n\n- [x] area:ci — CI workflows and automation\n- [x] area:nope — n', [], areas); - assert.deepEqual(r.toAdd, ['area:ci']); + if (areas.length === 0) return; // an adopter may have dropped the family entirely + const first = areas[0]; + const r = changes(`### Area\n\n- [x] ${first} — declared\n- [x] area:not-declared-anywhere — n`, [], areas); + assert.deepEqual(r.toAdd, [first]); }); From 8e49b61701d8cef6a4ac3c682a43d52a3003fa15 Mon Sep 17 00:00:00 2001 From: TzuHsuan <96853116+TzuH-Hsu@users.noreply.github.com> Date: Wed, 16 Sep 2026 14:20:49 +0800 Subject: [PATCH 2/2] fix: derive the undeclared sentinel instead of naming one Co-Authored-By: Claude Opus 5 --- scripts/issue-labeler.test.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/issue-labeler.test.js b/scripts/issue-labeler.test.js index 998f429..1563b7f 100644 --- a/scripts/issue-labeler.test.js +++ b/scripts/issue-labeler.test.js @@ -158,6 +158,8 @@ test("this repository's labels.yml: a declared area is applied, an undeclared on const areas = labeler.readAllowedAreas(path.join(__dirname, '..')); if (areas.length === 0) return; // an adopter may have dropped the family entirely const first = areas[0]; - const r = changes(`### Area\n\n- [x] ${first} — declared\n- [x] area:not-declared-anywhere — n`, [], areas); + let undeclared = 'area:undeclared'; + while (areas.includes(undeclared)) undeclared += '-x'; + const r = changes(`### Area\n\n- [x] ${first} — declared\n- [x] ${undeclared} — n`, [], areas); assert.deepEqual(r.toAdd, [first]); });