From b6f757ea6cc84a3121f24e05514f0e753fe27e6c Mon Sep 17 00:00:00 2001 From: reyanthony062001-ops Date: Wed, 15 Jul 2026 05:44:49 +0000 Subject: [PATCH] fix(signals): filter wantedPaths before interpolating focus-area PR guidance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit deriveContributionLanes gated the "Focus changes on maintainer-wanted areas" guidance line on the public-safety-filtered safeWanted list but then interpolated the raw manifest.wantedPaths. A single public-unsafe entry anywhere in wantedPaths made the whole joined sentence fail the all-or-nothing isFocusManifestPublicSafe filter, silently dropping the entire line — including the legitimate safe paths it was meant to surface. Interpolate the filtered safeWanted list instead, mirroring the buildPolicyEntryGuidance fix already in the loopover-engine sibling. Adds a regression test with a mixed safe/unsafe wantedPaths list asserting the safe path still surfaces in prEntryGuidance. Closes #5944 --- src/signals/focus-manifest.ts | 2 +- test/unit/policy-sanitizer.test.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/signals/focus-manifest.ts b/src/signals/focus-manifest.ts index 289324d35b..6ec249b747 100644 --- a/src/signals/focus-manifest.ts +++ b/src/signals/focus-manifest.ts @@ -872,7 +872,7 @@ export function deriveContributionLanes(manifest: FocusManifest): ContributionLa const prEntryGuidance: string[] = []; if (safeWanted.length > 0) { - prEntryGuidance.push(`Focus changes on maintainer-wanted areas: ${manifest.wantedPaths.slice(0, 5).join(", ")}.`); + prEntryGuidance.push(`Focus changes on maintainer-wanted areas: ${safeWanted.slice(0, 5).join(", ")}.`); } if (manifest.preferredLabels.length > 0) { const safeLabels = manifest.preferredLabels.filter(isFocusManifestPublicSafe); diff --git a/test/unit/policy-sanitizer.test.ts b/test/unit/policy-sanitizer.test.ts index 9e5defbb7d..d3f440bcc5 100644 --- a/test/unit/policy-sanitizer.test.ts +++ b/test/unit/policy-sanitizer.test.ts @@ -277,6 +277,19 @@ describe("contribution lane output — public-safe via deriveContributionLanes", expect(JSON.stringify(lanes)).not.toMatch(FORBIDDEN_POLICY_PATTERN); }); + it("still surfaces safe wanted paths in PR guidance when the manifest mixes in a public-unsafe path", () => { + // A single public-unsafe wantedPaths entry must not drop the whole "Focus changes on maintainer-wanted + // areas" line via the all-or-nothing public-safety filter: the interpolation is built from the filtered + // safe paths, so the safe path still surfaces and the unsafe one never appears. + const manifest = parseFocusManifest({ wantedPaths: ["src/", "reward-farming/"] }); + const lanes = deriveContributionLanes(manifest); + const focusLine = lanes.prEntryGuidance.find((entry) => entry.startsWith("Focus changes on maintainer-wanted areas:")); + expect(focusLine).toBeDefined(); + expect(focusLine).toContain("src/"); + expect(focusLine).not.toContain("reward-farming/"); + expect(JSON.stringify(lanes)).not.toMatch(FORBIDDEN_POLICY_PATTERN); + }); + it("emits a warning when contribution scope is unclear", () => { const manifest = parseFocusManifest({ wantedPaths: [], preferredLabels: [], issueDiscoveryPolicy: "encouraged" }); const lanes = deriveContributionLanes(manifest);