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/api/routes.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Hono, type Context } from "hono";

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 6 meaningful terms.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 7 meaningful terms.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Open PR queue is busy

This repo has a busy open PR queue in the local Gittensory cache.

Check notice on line 1 in src/api/routes.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

PR author has maintainer association

This PR appears to come from a maintainer-associated account.
import { z } from "zod";
import { analyzePRQueue, type AuthorRole, type ChecksStatus } from "../queue-intelligence";
import { completeGitHubWebOAuth, createSessionFromGitHubToken, pollGitHubDeviceFlow, startGitHubDeviceFlow, startGitHubWebOAuth } from "../auth/github-oauth";
Expand Down Expand Up @@ -2142,6 +2142,7 @@
pullRequests,
bounties,
issueQuality: issueQuality?.report,
confirmedContributor: Boolean(context.gittensorSnapshot),
});
const response = { ...analysis, predictedGate, dataQuality: await loadRepoDataQuality(c.env, parsed.data.repoFullName) };
await persistSignal(c.env, "local-branch-analysis", `${parsed.data.login}:${parsed.data.repoFullName}:${parsed.data.branchName ?? parsed.data.headRef ?? "local"}`, parsed.data.repoFullName, response as unknown as Record<string, JsonValue>, analysis.generatedAt);
Expand Down
28 changes: 15 additions & 13 deletions src/rules/predicted-gate.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {

Check notice on line 1 in src/rules/predicted-gate.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 6 meaningful terms.

Check notice on line 1 in src/rules/predicted-gate.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 7 meaningful terms.

Check notice on line 1 in src/rules/predicted-gate.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.

Check notice on line 1 in src/rules/predicted-gate.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Open PR queue is busy

This repo has a busy open PR queue in the local Gittensory cache.

Check notice on line 1 in src/rules/predicted-gate.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

PR author has maintainer association

This PR appears to come from a maintainer-associated account.
buildCollisionReport,
buildPreflightResult,
buildPublicReadinessScore,
Expand Down Expand Up @@ -91,19 +91,6 @@
const { input, manifest, repo, issues, pullRequests } = args;
const gate = manifest.gate;

// A synthetic open PR from the local branch metadata — fed to the SAME advisory builder as a real PR.
const syntheticPr: PullRequestRecord = {
repoFullName: input.repoFullName,
number: 0,
title: input.title,
state: "open",
authorLogin: input.contributorLogin,
authorAssociation: input.authorAssociation ?? null,
body: input.body ?? null,
labels: input.labels ?? [],
linkedIssues: input.linkedIssues ?? [],
};

const preflight = buildPreflightResult(
{
repoFullName: input.repoFullName,
Expand All @@ -120,6 +107,21 @@
args.bounties ?? [],
args.issueQuality,
);

// A synthetic open PR from the local branch metadata — fed to the SAME advisory builder as a real PR.
// Use preflight's normalized linked issues so body references like "Closes #7" match real PR parity.
const syntheticPr: PullRequestRecord = {
repoFullName: input.repoFullName,
number: 0,
title: input.title,
state: "open",
authorLogin: input.contributorLogin,
authorAssociation: input.authorAssociation ?? null,
body: input.body ?? null,
labels: input.labels ?? [],
linkedIssues: preflight.linkedIssues,
};

const collisions = buildCollisionReport(input.repoFullName, issues, pullRequests);
const queueHealth = buildQueueHealth(repo, issues, pullRequests, collisions);
const readiness = buildPublicReadinessScore({
Expand Down
6 changes: 6 additions & 0 deletions test/unit/predicted-gate.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";

Check notice on line 1 in test/unit/predicted-gate.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 6 meaningful terms.

Check notice on line 1 in test/unit/predicted-gate.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Possible duplicate overlap

Titles/paths share 7 meaningful terms.

Check notice on line 1 in test/unit/predicted-gate.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Issue discovery is disabled for this repo

This repo is configured for direct contribution review rather than issue-discovery flow.

Check notice on line 1 in test/unit/predicted-gate.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

Open PR queue is busy

This repo has a busy open PR queue in the local Gittensory cache.

Check notice on line 1 in test/unit/predicted-gate.test.ts

View check run for this annotation

Deleted GitHub App / Gittensory Context

PR author has maintainer association

This PR appears to come from a maintainer-associated account.
import { buildPredictedGateVerdict, type PredictedGateInput } from "../../src/rules/predicted-gate";
import { parseFocusManifest } from "../../src/signals/focus-manifest";
import type { IssueRecord, PullRequestRecord, RepositoryRecord } from "../../src/types";
Expand Down Expand Up @@ -66,6 +66,12 @@
expect(advisory.blockers.some((b) => b.code === "missing_linked_issue")).toBe(false);
});

it("uses linked issues inferred from the body for gate advisory parity", () => {
const result = verdict({ gate: { linkedIssue: "block" }, input: { body: "Closes #7", linkedIssues: [] } });
expect(result.conclusion).toBe("success");
expect(result.blockers.some((b) => b.code === "missing_linked_issue")).toBe(false);
});

it("forces a neutral prediction for a self-declared non-confirmed contributor", () => {
const result = buildPredictedGateVerdict({
input: { ...BASE_INPUT, body: "no issue", linkedIssues: [] },
Expand Down