Skip to content

Commit 2e6bace

Browse files
authored
fix: prevent stable labels from leaking across surfaces (#949)
* fix: scope stable maturity labels to primary surfaces * chore: keep changelog release-owned
1 parent 05d864b commit 2e6bace

7 files changed

Lines changed: 48 additions & 22 deletions

‎prompts/review-item.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,18 @@ Prefer `impact:ux-release-blocker` over `impact:ux-friction` when the same
218218
evidence supports both.
219219

220220
Set `maturityLabels` for issues only; use `[]` for PRs or unsupported matches.
221-
`maturity:stable`: Issue affects a taxonomy feature currently scored M4/M5.
221+
`maturity:stable`: The issue's primary taxonomy surface is currently scored M4/M5.
222222
First run `node "$CLAWSWEEPER_PROOF_SCRATCH_DIR/maturity-stable-shortlist.mjs"`
223-
from the target checkout and compare the issue against the M4+ shortlist. Read
223+
from the target checkout. Identify exactly one primary owner surface from the
224+
broken or missing product behavior and the source owner boundary. Shared
225+
Gateway/CLI transit, APIs, hosting, diagnostics, or implementation plumbing do
226+
not qualify an issue whose primary owner is below M4. A feature proposal does
227+
not qualify merely because implementing it would modify a stable surface.
228+
The helper lists both eligible M4+ surfaces and below-M4 exclusions. Read
224229
`taxonomy.yaml`, the full checked-out `qa/maturity-scores.yaml`, or
225-
`docs/maturity/` only if the shortlist is ambiguous. Select `maturity:stable`
226-
only for M4/M5 matches. Cite the feature id/name and score in `evidence` and
230+
`docs/maturity/` when the primary owner or category is ambiguous. Select
231+
`maturity:stable` only when that primary surface is M4/M5. Cite the primary
232+
surface id/name/code and the matching category in `evidence` and
227233
`labelJustifications`.
228234
Stable maturity supports priority, but does not automatically escalate it.
229235

‎schema/clawsweeper-decision.schema.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@
311311
"type": "string",
312312
"enum": ["maturity:stable"]
313313
},
314-
"description": "Issue-only labels for mature taxonomy matches. Use [] for PRs. Select maturity:stable only when an active matched feature is currently M4/M5 in qa/maturity-scores.yaml."
314+
"description": "Issue-only labels for mature taxonomy matches. Use [] for PRs. Select maturity:stable only when the issue's primary owner surface is currently M4/M5 in qa/maturity-scores.yaml; incidental Gateway/CLI transit or implementation plumbing does not qualify a lower-maturity surface."
315315
},
316316
"mergeRiskOptions": {
317317
"type": "array",

‎scripts/maturity-stable-shortlist.mjs‎

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,34 @@ console.log(stableShortlist(readFileSync(scorecardPath, "utf8")));
1414
function stableShortlist(text) {
1515
const scorecard = parse(text);
1616
const surfaces = Array.isArray(scorecard?.surfaces) ? scorecard.surfaces : [];
17-
const rows = surfaces
18-
.map(surfaceSummary)
19-
.filter((surface) => Number(surface.code.replace(/^M/, "")) >= 4);
17+
const rows = surfaces.map(surfaceSummary);
18+
const stableRows = rows.filter((surface) => maturityCode(surface) >= 4);
19+
const nonStableRows = rows.filter((surface) => maturityCode(surface) < 4);
2020

21-
if (rows.length === 0) return "No M4+ maturity scorecard surfaces found.";
22-
return rows
23-
.map((surface) => {
24-
const categories = surface.categories.length
25-
? ` | categories: ${surface.categories.join("; ")}`
26-
: "";
27-
return `${surface.id} | ${surface.name} | ${surface.code} ${surface.label} | q${surface.quality} c${surface.completeness}${categories}`;
28-
})
29-
.join("\n");
21+
return [
22+
"Primary-surface rule: classify the issue by the product surface that owns the broken or missing behavior. Shared Gateway/CLI transit, APIs, hosting, or diagnostics do not make a lower-maturity owner eligible.",
23+
"",
24+
"M4+ primary surfaces (eligible for maturity:stable):",
25+
...(stableRows.length > 0
26+
? stableRows.map((surface) => {
27+
const categories = surface.categories.length
28+
? ` | categories: ${surface.categories.join("; ")}`
29+
: "";
30+
return `${surface.id} | ${surface.name} | ${surface.code} ${surface.label} | q${surface.quality} c${surface.completeness}${categories}`;
31+
})
32+
: ["No M4+ maturity scorecard surfaces found."]),
33+
"",
34+
"Below-M4 primary surfaces (not eligible for maturity:stable):",
35+
...(nonStableRows.length > 0
36+
? nonStableRows.map(
37+
(surface) => `${surface.id} | ${surface.name} | ${surface.code} ${surface.label}`,
38+
)
39+
: ["No below-M4 maturity scorecard surfaces found."]),
40+
].join("\n");
41+
}
42+
43+
function maturityCode(surface) {
44+
return Number(surface.code.replace(/^M/, ""));
3045
}
3146

3247
function surfaceSummary(surface) {

‎src/clawsweeper.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1802,7 +1802,7 @@ const MATURITY_LABELS = [
18021802
{
18031803
name: "maturity:stable",
18041804
color: "1F883D",
1805-
description: "Issue affects a taxonomy feature currently scored M4/M5.",
1805+
description: "Issue's primary taxonomy surface is currently scored M4/M5.",
18061806
},
18071807
] as const satisfies readonly {
18081808
name: MaturityLabelName;

‎test/maturity-shortlist-script.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { tmpdir } from "node:os";
55
import { join } from "node:path";
66
import test from "node:test";
77

8-
test("maturity shortlist script emits only M4+ surfaces", () => {
8+
test("maturity shortlist script distinguishes eligible primary surfaces from exclusions", () => {
99
const dir = mkdtempSync(join(tmpdir(), "clawsweeper-maturity-"));
1010
try {
1111
const scorecard = join(dir, "maturity-scores.yaml");
@@ -38,9 +38,12 @@ test("maturity shortlist script emits only M4+ surfaces", () => {
3838
scorecard,
3939
]).toString();
4040

41+
assert.match(output, /Primary-surface rule:/);
42+
assert.match(output, /M4\+ primary surfaces \(eligible for maturity:stable\):/);
4143
assert.match(output, /gateway-runtime \| Gateway runtime \| M4 Stable \| q81 c89/);
4244
assert.match(output, /categories: HTTP APIs/);
43-
assert.doesNotMatch(output, /agent-runtime/);
45+
assert.match(output, /Below-M4 primary surfaces \(not eligible for maturity:stable\):/);
46+
assert.match(output, /agent-runtime \| Agent runtime \| M3 Beta/);
4447
} finally {
4548
rmSync(dir, { recursive: true, force: true });
4649
}

‎test/pr-label-policy.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ test("ClawSweeper maturity labels remove stale owned labels and preserve unrelat
733733
{
734734
name: "maturity:stable",
735735
color: "1F883D",
736-
description: "Issue affects a taxonomy feature currently scored M4/M5.",
736+
description: "Issue's primary taxonomy surface is currently scored M4/M5.",
737737
},
738738
]);
739739
assert.deepEqual(maturityLabelsForTest(["bug"], ["maturity:stable"]), ["bug", "maturity:stable"]);

‎test/review-prompt-policy.test.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,9 @@ test("review prompt uses token-light maturity shortlist helper", () => {
436436
);
437437

438438
assert.match(prompt, /maturity-stable-shortlist\.mjs/);
439-
assert.match(prompt, /compare the issue against the M4\+ shortlist/);
439+
assert.match(prompt, /Identify exactly one primary owner surface/);
440+
assert.match(prompt, /Shared\s+Gateway\/CLI transit/);
441+
assert.match(prompt, /feature proposal does\s+not qualify/);
440442
assert.match(
441443
runtimePrompt,
442444
/node "\$CLAWSWEEPER_PROOF_SCRATCH_DIR\/maturity-stable-shortlist\.mjs"/,

0 commit comments

Comments
 (0)