@@ -76,8 +76,8 @@ const REVIEW_DIFF_PATCH_MAX_OUTPUT_BYTES = 120_000;
7676const REVIEW_METADATA_MAX_OUTPUT_BYTES = 16 * 1024 * 1024 ;
7777// Temporary-index git add scales poorly (50k files took ~30 s); report incomplete totals above this cap.
7878const REVIEW_UNTRACKED_MAX_FILES = 5_000 ;
79- const REVIEW_UNTRACKED_MAX_FILE_BYTES = 10n * 1024n * 1024n ;
80- const REVIEW_UNTRACKED_MAX_TOTAL_BYTES = 64n * 1024n * 1024n ;
79+ // git diff --numstat reads ~5 ms/MB of untracked text; larger files are left out of the review index.
80+ const REVIEW_UNTRACKED_MAX_TOTAL_BYTES = 256n * 1024n * 1024n ;
8181const REVIEW_DIFF_FILE_MAX_OUTPUT_BYTES = 1024 * 1024 ;
8282const REVIEW_BRANCH_COMMIT_LIMIT = 100 ;
8383const REVIEW_BRANCH_SUBJECT_LIMIT = 300 ;
@@ -3171,34 +3171,22 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
31713171 ( candidate ) =>
31723172 onlyPath === undefined || candidate === onlyPath || candidate === `${ onlyPath } /` ,
31733173 ) ;
3174- if ( paths . length === 0 ) return { env : undefined , complete : true } ;
3174+ if ( paths . length === 0 ) return { env : undefined , omitted : false } ;
31753175 if ( paths . length > REVIEW_UNTRACKED_MAX_FILES ) return null ;
31763176 const boundedPaths : string [ ] = [ ] ;
31773177 let bytes = 0n ;
3178- let complete = true ;
31793178 for ( const relativePath of paths ) {
3180- // lstat bounds sparse files by logical size without reading symlink targets .
3179+ // lstat reads logical size without following symlinks .
31813180 const info = yield * fileSystem
31823181 . lstat ( path . resolve ( cwd , relativePath ) )
31833182 . pipe ( Effect . orElseSucceed ( ( ) => undefined ) ) ;
3184- if (
3185- info === undefined ||
3186- ( info . type !== "File" && info . type !== "Directory" && info . type !== "SymbolicLink" )
3187- ) {
3188- complete = false ;
3189- continue ;
3190- }
3191- const size = info . type === "Directory" ? 0n : info . size ;
3192- if (
3193- size > REVIEW_UNTRACKED_MAX_FILE_BYTES ||
3194- bytes + size > REVIEW_UNTRACKED_MAX_TOTAL_BYTES
3195- ) {
3196- complete = false ;
3197- continue ;
3198- }
3183+ const size = info ?. type === "File" || info ?. type === "SymbolicLink" ? info . size : 0n ;
3184+ if ( bytes + size > REVIEW_UNTRACKED_MAX_TOTAL_BYTES ) continue ;
31993185 bytes += size ;
32003186 boundedPaths . push ( relativePath ) ;
32013187 }
3188+ const omitted = boundedPaths . length < paths . length ;
3189+ if ( boundedPaths . length === 0 ) return { env : undefined , omitted } ;
32023190 const env = yield * prepareReviewIndex ( cwd , boundedPaths ) . pipe (
32033191 Effect . catchTags ( {
32043192 PlatformError : ( cause ) =>
@@ -3213,7 +3201,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
32133201 ) ,
32143202 } ) ,
32153203 ) ;
3216- return { env, complete } ;
3204+ return { env, omitted } ;
32173205 } ) ;
32183206
32193207 const resolveReviewMergeBase = Effect . fn ( "resolveReviewMergeBase" ) ( function * (
@@ -3290,12 +3278,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
32903278 : [ ] ;
32913279 // Empty status can mean untracked files are hidden; retain the full scan.
32923280 const untracked = yield * prepareUntrackedReviewIndex ( cwd , pathspecs ) ;
3293- if ( untracked === null || ! untracked . complete ) {
3281+ if ( untracked === null ) {
32943282 return yield * new GitCommandError ( {
32953283 operation : "GitVcsDriver.readBranchChangeTotals" ,
32963284 command : "git ls-files" ,
32973285 cwd,
3298- detail : "Untracked files exceed the review input limits ." ,
3286+ detail : "Too many untracked files to count ." ,
32993287 } ) ;
33003288 }
33013289 const readNumstat = ( ref : string ) =>
@@ -3624,10 +3612,9 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
36243612 } ) ;
36253613 const [ dirtyTrackedResult , baseResult ] = yield * Effect . gen ( function * ( ) {
36263614 const untracked = input . trackedOnly
3627- ? { env : undefined , complete : true }
3615+ ? { env : undefined , omitted : false }
36283616 : yield * prepareUntrackedReviewIndex ( cwd , pathArgs , input . file ?. path ) ;
3629- const metadataOnly =
3630- input . metadataOnly === true && ! input . file && untracked ?. complete === true ;
3617+ const metadataOnly = input . metadataOnly === true && ! input . file && untracked !== null ;
36313618 const [ dirty , base ] =
36323619 review . mergeBase === dirtyRef
36333620 ? yield * readTrackedDiff ( dirtyRef , untracked ?. env , metadataOnly ) . pipe (
@@ -3640,9 +3627,12 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function*
36403627 ] ,
36413628 { concurrency : 2 } ,
36423629 ) ;
3643- if ( untracked ?. complete ) return [ dirty , base ] as const ;
3630+ if ( untracked ?. omitted === false ) return [ dirty , base ] as const ;
3631+ // Too many untracked files drops per-file totals; omitted oversized files only mark it partial.
36443632 const incomplete = ( ref : string | null , result : typeof dirty ) =>
3645- ref === null ? result : { ...result , files : undefined , stdoutTruncated : true } ;
3633+ ref === null
3634+ ? result
3635+ : { ...result , stdoutTruncated : true , files : untracked ? result . files : undefined } ;
36463636 return [ incomplete ( dirtyRef , dirty ) , incomplete ( review . mergeBase , base ) ] as const ;
36473637 } ) . pipe ( Effect . scoped ) ;
36483638 const dirtyFiles = dirtyTrackedResult . files ;
0 commit comments