fix(checkpoint): pulls and rebases no longer flood a turn's changed files #17161
Mergedt3dotgg(GitHub profile, opens in a new tab)merged 10 commits into
main fromrefs/pull/17161/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:L
juliusmarminge added labelsmacroscope-review
- apps/server/src/vcs/GitVcsDriver.ts line 1216Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1202,3 +1211,6 @@12021211 ...(input.ignoreWhitespace ? ["--ignore-all-space"] : []),12031212 `${fromRevision}^{commit}`,12041213 `${input.toCheckpointRef}^{commit}`,1214+ // Paths are repository-relative, while cwd can be a subdirectory.1215+ ...(input.filePaths1216+ ? ["--", ...input.filePaths.map((file) => `:(top,literal)${file}`)]apps/mobile/src/features/review/ReviewSheet.tsx line 744OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -737,3 +740,5 @@737740738741 <MaterialScreenContent>739742 <View className="flex-1 bg-sheet android:bg-sheet-solid">743+ {gitFileCount > 0 && (744+ <View className="flex-row flex-wrap items-center gap-2 border-b border-border px-4 py-2">apps/server/src/checkpointing/CheckpointDiffQuery.ts line 224Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -182,3 +183,20 @@182183 });183184 }184185186+ const comparison = {187+ cwd: toScope.cwd,188+ fromCheckpointRef,189+ toCheckpointRef: toCheckpoint.ref,190+ fallbackFromToHead: false,191+ ignoreWhitespace,192+ };193+ // Older clients omit includeGitChanges and keep the complete diff.194+ const authoredPaths =195+ input.includeGitChanges === undefined196+ ? null197+ : yield* checkpointStore198+ .listAuthoredPaths(comparison)199+ .pipe(Effect.orElseSucceed(() => null));200+ const files =201+ authoredPaths === null202+ ? []
- apps/server/src/checkpointing/CheckpointDiffQuery.ts line 213OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -184,0 +193,21 @@193+ fallbackFromToHead: false,194+ ignoreWhitespace,195+ };196+ // Older clients omit includeGitChanges and keep the complete diff.197+ const authoredPaths =198+ input.includeGitChanges === undefined199+ ? null200+ : yield* checkpointStore201+ .listAuthoredPaths(comparison)202+ .pipe(Effect.orElseSucceed(() => null));203+ // Grouping is optional. When the summary fails, the complete diff still loads.204+ const files =205+ authoredPaths === null206+ ? []207+ : yield* checkpointStore.diffCheckpoints({ ...comparison, format: "numstat" }).pipe(208+ Effect.map(parseTurnDiffFilesFromNumstat),209+ Effect.orElseSucceed(() => []),210+ );211+ const retainedFiles = files.filter((file) => !isGitImport(file, authoredPaths));212+ const retainedPaths = retainedFiles.flatMap((file) =>213+ file.previousPath === undefined ? [file.path] : [file.previousPath, file.path],
- @@ -194,3 +226,21 @@226+ Effect.map(parseTurnDiffFilesFromNumstat),227+ Effect.orElseSucceed(() => []),228+ );229+ const retainedFiles = files.filter((file) => !isGitImport(file, authoredPaths));230+ // Select retained paths before generating a patch, so imported bulk cannot exhaust its output limit.231+ const diff =232+ retainedFiles.length === files.length233+ ? yield* checkpointStore234+ .diffCheckpoints(comparison)235+ .pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints"))236+ : (yield* Effect.forEach(237+ batchFilePaths(retainedFiles),238+ (filePaths) =>239+ checkpointStore240+ .diffCheckpoints({ ...comparison, filePaths })241+ .pipe(Effect.withSpan("checkpoint.turnDiff.diffCheckpoints")),242+ { concurrency: 4 },243+ )).join("");194244195245 const turnDiff = buildTurnDiffResult(input, diff);196246 if (!isTurnDiffResult(turnDiff)) {@@ -449,18 +454,10 @@449454 fallbackFromToHead: false,450455 ignoreWhitespace: false,451456 format: "numstat",452- })453- .pipe(454- Effect.map((diff) =>455- parseTurnDiffFilesFromNumstat(diff).map((file) => ({456- path: file.path,457- kind: "modified",458- additions: file.additions,459- deletions: file.deletions,460- })),461- ),457+ }),458+ checkpointStore.listAuthoredPaths(refs).pipe(462459 Effect.catch((cause) =>463- Effect.logWarning("orchestration V2 checkpoint diff summary failed", {460+ Effect.logWarning("orchestration V2 checkpoint authored paths failed", {464461 scopeId: input.scope.id,465462 checkpointRef,466463 cause: String(cause),
t3dotgg(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.


macroscopeapp[bot](GitHub profile, opens in a new tab) reviewed