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
1 change: 1 addition & 0 deletions src/services/contributor-evidence-graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ export function buildContributorEvidenceGraph(args: ContributorEvidenceGraphInpu
...(reposCapped ? [`Evidence graph repo relationships capped at ${CONTRIBUTOR_EVIDENCE_GRAPH_MAX_REPOS}.`] : []),
...(labels.length < allLabels.length ? [`Evidence graph label relationships capped at ${CONTRIBUTOR_EVIDENCE_GRAPH_MAX_LABELS}.`] : []),
...(paths.length < allPaths.length ? [`Evidence graph path relationships capped at ${CONTRIBUTOR_EVIDENCE_GRAPH_MAX_PATHS}.`] : []),
...(outcomes.length < allOutcomes.length ? [`Evidence graph outcome relationships capped at ${CONTRIBUTOR_EVIDENCE_GRAPH_MAX_OUTCOMES}.`] : []),
];

const sources = buildSources(generatedAt, args.profile, args.gittensorSnapshot, repoNodes, labels, paths, outcomes);
Expand Down
25 changes: 25 additions & 0 deletions test/unit/contributor-evidence-graph.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import {
buildContributorEvidenceGraph,
CONTRIBUTOR_EVIDENCE_GRAPH_MAX_LABELS,
CONTRIBUTOR_EVIDENCE_GRAPH_MAX_OUTCOMES,
CONTRIBUTOR_EVIDENCE_GRAPH_MAX_PATHS,
CONTRIBUTOR_EVIDENCE_GRAPH_MAX_REPOS,
evidenceGraphTouchedRepoFullNames,
Expand Down Expand Up @@ -475,6 +476,30 @@ describe("contributor evidence graph", () => {
);
});

it("warns when outcome relationships exceed the max-outcomes cap (#8887)", () => {
const repoFullName = "owner/outcomes-cap";
// Multiple outcome rows for one included repo — buildOutcomeEdges does not dedupe by repo, so the
// outcomes slice can exceed MAX_OUTCOMES even when repos stay under MAX_REPOS.
const manyOutcomes = Array.from({ length: CONTRIBUTOR_EVIDENCE_GRAPH_MAX_OUTCOMES + 1 }, (_, index) =>
outcome(repoFullName, { pullRequests: index + 1, openPullRequests: 1, lane: index % 2 === 0 ? "direct_pr" : "issue_linked" }),
);
const graph = buildContributorEvidenceGraph({
login: "dev",
generatedAt: GENERATED_AT,
profile: profile({
registeredRepoActivity: { pullRequests: 1, mergedPullRequests: 0, issues: 0, reposTouched: [repoFullName], dominantLabels: [] },
}),
outcomeHistory: history(manyOutcomes),
roleContexts: [role(repoFullName)],
repositories: [repo(repoFullName)],
pullRequests: [pr(repoFullName, 1)],
pullRequestFiles: [],
});

expect(graph.outcomes).toHaveLength(CONTRIBUTOR_EVIDENCE_GRAPH_MAX_OUTCOMES);
expect(graph.warnings).toEqual(expect.arrayContaining([expect.stringContaining("outcome relationships capped")]));
});

it("selects only registered touched repos for bounded path-cache loading", () => {
expect(
evidenceGraphTouchedRepoFullNames({
Expand Down