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
5 changes: 3 additions & 2 deletions packages/loopover-engine/src/idea-intake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ export function validateIdeaSubmission(raw: unknown): IdeaValidationResult {
else if (constraints.some((c) => c.length > IDEA_CONSTRAINT_MAX_CHARS)) errors.push("constraint_too_long");
}
const acceptanceHints = input.acceptanceHints;
if (acceptanceHints !== undefined && (!Array.isArray(acceptanceHints) || !acceptanceHints.every((h) => typeof h === "string"))) {
errors.push("acceptance_hints_invalid");
if (acceptanceHints !== undefined) {
if (!Array.isArray(acceptanceHints) || !acceptanceHints.every((h) => typeof h === "string")) errors.push("acceptance_hints_invalid");
else if (acceptanceHints.some((h) => h.length > IDEA_CONSTRAINT_MAX_CHARS)) errors.push("acceptance_hint_too_long");
}
const priority = input.priority;
if (priority !== undefined && priority !== "normal" && priority !== "high") errors.push("priority_invalid");
Expand Down
29 changes: 29 additions & 0 deletions test/unit/idea-intake-bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,35 @@ describe("validateIdeaSubmission", () => {
expect(validateIdeaSubmission(validIdea({ priority: "urgent" as unknown as IdeaSubmission["priority"] })).ok).toBe(false);
expect(validateIdeaSubmission(validIdea({ priority: "normal" })).ok).toBe(true);
});

it("caps acceptanceHints entry length at IDEA_CONSTRAINT_MAX_CHARS, same bound as constraints (#7243)", () => {
const atCap = validateIdeaSubmission(validIdea({ acceptanceHints: ["h".repeat(IDEA_CONSTRAINT_MAX_CHARS)] }));
expect(atCap.ok).toBe(true);

const overCap = validateIdeaSubmission(validIdea({ acceptanceHints: ["h".repeat(IDEA_CONSTRAINT_MAX_CHARS + 1)] }));
expect(overCap.ok).toBe(false);
if (!overCap.ok) expect(overCap.errors).toContain("acceptance_hint_too_long");
});

it("does not raise acceptance_hint_too_long for a malformed (non-array) acceptanceHints — shape error only", () => {
const r = validateIdeaSubmission(validIdea({ acceptanceHints: "x".repeat(IDEA_CONSTRAINT_MAX_CHARS + 1) as unknown as string[] }));
expect(r.ok).toBe(false);
if (!r.ok) {
expect(r.errors).toContain("acceptance_hints_invalid");
expect(r.errors).not.toContain("acceptance_hint_too_long");
}
});

it("collects an over-length acceptanceHints entry alongside other unrelated errors in one pass", () => {
const r = validateIdeaSubmission({
title: "t",
body: "b",
targetRepo: "o/n",
acceptanceHints: ["h".repeat(IDEA_CONSTRAINT_MAX_CHARS + 1)],
});
expect(r.ok).toBe(false);
if (!r.ok) expect(r.errors).toEqual(expect.arrayContaining(["id_required", "acceptance_hint_too_long"]));
});
});

describe("buildTaskGraph — spec §4 Example A (simple idea → one issue → go)", () => {
Expand Down