11import { describe , expect , it } from "vitest" ;
22import { runIssueRagRetrieval , validateIssueRagInput } from "../../src/mcp/issue-rag" ;
33import { emptyIssueRagTelemetry } from "../../src/review/issue-rag-retrieval" ;
4+ import { PREFLIGHT_LIMITS } from "@loopover/contract" ;
45import { createTestEnv } from "../helpers/d1" ;
56
67describe ( "runIssueRagRetrieval (#4293)" , ( ) => {
@@ -21,33 +22,40 @@ describe("runIssueRagRetrieval (#4293)", () => {
2122 } ) ;
2223 } ) ;
2324
24- it ( "rejects oversized repos and invalid labels" , ( ) => {
25- expect ( validateIssueRagInput ( { owner : "acme" , repo : "r" . repeat ( 101 ) , title : "Add observability context for self-hosted review planning failures" } ) ) . toMatchObject ( {
26- ok : false ,
27- reason : "repo_too_long" ,
28- } ) ;
25+ it ( "rejects invalid labels and over-long bodies (length bounds for owner/repo/title live on the schema)" , ( ) => {
26+ // #10040: repo/title max-length are on RetrieveIssueContextInput; this helper only rejects after trim /
27+ // per-label length / body length / topK shape.
2928 expect (
3029 validateIssueRagInput ( {
3130 owner : "acme" ,
3231 repo : "demo" ,
3332 title : "Add observability context for self-hosted review planning failures" ,
34- labels : [ "x" . repeat ( 101 ) ] ,
33+ labels : [ "x" . repeat ( PREFLIGHT_LIMITS . labelChars + 1 ) ] ,
3534 } ) ,
3635 ) . toMatchObject ( { ok : false , reason : "invalid_labels" } ) ;
36+ expect (
37+ validateIssueRagInput ( {
38+ owner : "acme" ,
39+ repo : "demo" ,
40+ title : "Add observability context for self-hosted review planning failures" ,
41+ body : "x" . repeat ( PREFLIGHT_LIMITS . bodyChars + 1 ) ,
42+ } ) ,
43+ ) . toMatchObject ( { ok : false , reason : "body_too_long" } ) ;
3744 } ) ;
3845
3946 it ( "covers validation branches for owner/title/body/labels/topK normalization" , ( ) => {
4047 expect ( validateIssueRagInput ( { owner : "" , repo : "demo" , title : "Add observability context for self-hosted review planning failures" } ) ) . toMatchObject ( {
4148 ok : false ,
4249 reason : "owner_and_repo_required" ,
4350 } ) ;
51+ // #10040: over-long title is a schema concern; whitespace-only title is the helper's title_required.
4452 expect (
4553 validateIssueRagInput ( {
4654 owner : "acme" ,
4755 repo : "demo" ,
48- title : "x" . repeat ( 301 ) ,
56+ title : " " ,
4957 } ) ,
50- ) . toMatchObject ( { ok : false , reason : "title_too_long " } ) ;
58+ ) . toMatchObject ( { ok : false , reason : "title_required " } ) ;
5159 expect (
5260 validateIssueRagInput ( {
5361 owner : "acme" ,
0 commit comments