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
2 changes: 1 addition & 1 deletion src/mcp/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ const predictGateShape = {
linkedIssues: z.array(z.number().int().positive()).optional(),
// The PR's changed file PATHS (metadata only — paths, never source content). Supplying them lets the predictor
// also evaluate the focus-manifest path policy + path-gated pre-merge checks, matching the live gate (#11-13/#18).
changedPaths: z.array(z.string().min(1)).max(500).optional(),
changedPaths: z.array(z.string().min(1).max(PREFLIGHT_LIMITS.changedFileChars)).max(500).optional(),
};

// Pure local-metadata computation (no repo data, no secrets) — the agent supplies its own diff metadata
Expand Down
13 changes: 13 additions & 0 deletions test/unit/mcp-predict-gate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,19 @@ describe("MCP gittensory_predict_gate", () => {
expect((minimal.structuredContent as { pack: string }).pack).toBe("oss-anti-slop");
});

it("rejects changedPaths entries above the path metadata size cap", async () => {
const env = createTestEnv();
const client = await connect(env);

const result = await client.callTool({
name: "gittensory_predict_gate",
arguments: { login: "miner1", owner: "acme", repo: "widgets", title: "Huge path", changedPaths: [`src/${"a".repeat(301)}.ts`] },
});

expect(result.isError).toBe(true);
expect(JSON.stringify(result.content)).toContain("Too big");
});

it("predicts the focus-manifest path policy when changedPaths are supplied (#11-13/#18)", async () => {
const env = createTestEnv();
await upsertRepositoryFromGitHub(env, { name: "widgets", full_name: "acme/widgets" });
Expand Down
Loading