Skip to content
Closed
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
3 changes: 2 additions & 1 deletion packages/loopover-engine/src/miner-goal-lane-fit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export function computeMinerGoalLaneFit(

let score: number;
if (preferred.length === 0) {
score = 1;
// Match computeLaneFit's documented neutral: no preference configured → fixed 0.5, never 0 or 1 (#8870).
score = 0.5;
} else {
const preferredMatch = preferred.some((want) => issueLabels.includes(want));
if (preferredMatch) {
Expand Down
7 changes: 4 additions & 3 deletions packages/loopover-engine/test/miner-goal-lane-fit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ test("isMinerRepoTargetable respects minerEnabled opt-out", () => {
assert.equal(isMinerRepoTargetable({ ...DEFAULT_MINER_GOAL_SPEC, minerEnabled: false }), false);
});

test("computeMinerGoalLaneFit returns 1 when no preferred labels are configured", () => {
assert.equal(computeMinerGoalLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC), 1);
test("computeMinerGoalLaneFit returns 0.5 when no preferred labels are configured (#8870)", () => {
// Aligns with computeLaneFit's documented neutral (goal-model.ts): no preference → 0.5, never 0 or 1.
assert.equal(computeMinerGoalLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC), 0.5);
});

test("computeMinerGoalLaneFit matches preferred labels case-insensitively", () => {
Expand Down Expand Up @@ -39,7 +40,7 @@ test("computeMinerGoalLaneFit applies issueDiscoveryPolicy modifiers", () => {
test("computeMinerGoalLaneFit returns 0 when a blocked label matches case-insensitively", () => {
const spec = { ...DEFAULT_MINER_GOAL_SPEC, blockedLabels: ["wontfix"] };
assert.equal(computeMinerGoalLaneFit({ labels: ["WontFix"] }, spec), 0);
assert.equal(computeMinerGoalLaneFit({ labels: ["bug"] }, spec), 1);
assert.equal(computeMinerGoalLaneFit({ labels: ["bug"] }, spec), 0.5);
});

test("computeMinerGoalLaneFit ignores malformed label entries safely", () => {
Expand Down
9 changes: 8 additions & 1 deletion test/unit/miner-goal-lane-fit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ describe("computeMinerGoalLaneFit", () => {
expect(computeMinerGoalLaneFit({ labels: ["feature"] }, spec)).toBe(0.25);
});

it("returns 0.5 when no preferred labels are configured (#8870)", () => {
// Aligns with computeLaneFit's documented neutral: no preference → 0.5, never 0 or 1.
expect(computeMinerGoalLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC)).toBe(0.5);
expect(computeMetadataLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC)).toBe(0.5);
});

it("scores normally when no blocked labels are configured", () => {
expect(computeMinerGoalLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC)).toBe(1);
// No preferredLabels → neutral 0.5, matching computeLaneFit (#8870).
expect(computeMinerGoalLaneFit({ labels: ["docs"] }, DEFAULT_MINER_GOAL_SPEC)).toBe(0.5);
});
});
Loading