Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/loopover-miner/lib/opportunity-ranker.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ function rankedUsesDefaultGoalSpec(ranked, options = {}) {
const goalSpecsByRepo = buildGoalSpecsByRepo(options);
const specRepos = Object.keys(goalSpecsByRepo);
if (ranked.length === 0) return specRepos.length === 0;
return ranked.some((issue) => {
// The "ranked with the built-in default goal spec (no per-tenant .loopover-miner.yml supplied)" note is only
// truthful when the WHOLE batch fell back to the default -- so require EVERY ranked repo to lack a supplied spec,
// not just any one of them (#7226). With `.some`, a single spec-less repo made a mixed batch (where other repos
// genuinely had a spec supplied and applied) print the blanket note as if none did.
return ranked.every((issue) => {
const target = issue.repoFullName.trim().toLowerCase();
return !specRepos.some((repo) => repo.trim().toLowerCase() === target);
});
Expand Down
18 changes: 18 additions & 0 deletions test/unit/miner-opportunity-ranker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,24 @@ describe("rankCandidateIssues (#2302 follow-up)", () => {
expect(summary.usedDefaultGoalSpec).toBe(false);
});

it("does not report a blanket default-goal-spec note when only SOME ranked repos lack a spec (#7226)", () => {
const summary = rankCandidateIssuesWithSummary(
[
rawIssue({ repo: "widgets", repoFullName: "acme/widgets", issueNumber: 1 }),
rawIssue({ repo: "gadgets", repoFullName: "acme/gadgets", issueNumber: 2 }),
],
{
nowMs: NOW,
// Only acme/widgets has a per-tenant spec supplied+applied; acme/gadgets falls back to the default.
goalSpecContentByRepo: { "acme/widgets": "minerEnabled: true\npreferredLabels: [help wanted]\n" },
},
);
// Both repos are ranked and one genuinely used a supplied spec, so the batch is NOT "all default" —
// the blanket "no per-tenant .loopover-miner.yml supplied" note must NOT fire. Before #7226 this was `true`.
expect(summary.issues).toHaveLength(2);
expect(summary.usedDefaultGoalSpec).toBe(false);
});

it("raises dupRisk when repo-level contention inputs are provided", () => {
const calm = rankCandidateIssues([rawIssue()], { nowMs: NOW, highRiskDuplicateClusters: 0, openPullRequests: 4 });
const busy = rankCandidateIssues([rawIssue()], { nowMs: NOW, highRiskDuplicateClusters: 4, openPullRequests: 4 });
Expand Down