Skip to content

Commit 915bb6d

Browse files
only21milclaude
andauthored
fix(server): disable text conversion when measuring review-guide hunks (#21988)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent a3cf3f0 commit 915bb6d

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

‎apps/server/src/pullRequest/PullRequestReviewGuideService.test.ts‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,51 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
466466
),
467467
);
468468

469+
it.effect("keeps excerpts of source lines a configured diff driver would convert away", () =>
470+
Effect.scoped(
471+
Effect.gen(function* () {
472+
const repositories = yield* makeRepositories;
473+
const fs = yield* FileSystem.FileSystem;
474+
yield* fs.writeFileString(
475+
`${repositories.workspace}/.git/info/attributes`,
476+
"feature.txt diff=blank\n",
477+
);
478+
yield* git(repositories.workspace, ["config", "diff.blank.textconv", "true"]);
479+
const stored = yield* Deferred.make<void>();
480+
const context = yield* Layer.build(
481+
makeLayer({
482+
...repositories,
483+
stored,
484+
generate: () =>
485+
Effect.succeed({
486+
stops: [
487+
{
488+
title: "The feature",
489+
summary: "The change.",
490+
attention: null,
491+
excerpts: [{ path: "feature.txt", side: "new", start: 1, end: 3, caption: "" }],
492+
files: [],
493+
notes: [],
494+
questions: [],
495+
},
496+
],
497+
}),
498+
}),
499+
);
500+
const service = Context.get(
501+
context,
502+
PullRequestReviewGuideService.PullRequestReviewGuideService,
503+
);
504+
yield* service.generate(reference);
505+
yield* Deferred.await(stored);
506+
const result = yield* service.get(reference);
507+
assert.deepStrictEqual(result.guide?.stops[0]?.excerpts, [
508+
{ path: "feature.txt", side: "new", start: 1, end: 3, caption: "" },
509+
]);
510+
}),
511+
),
512+
);
513+
469514
it.effect("refuses generation when the verified remote disappeared despite a usable origin", () =>
470515
Effect.scoped(
471516
Effect.gen(function* () {

‎apps/server/src/pullRequest/PullRequestReviewGuideService.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,10 @@ const make = Effect.gen(function* () {
344344
})
345345
.pipe(Effect.map((result) => result.stdout));
346346
const [nameOnly, patch] = yield* Effect.all(
347-
[diff(["--name-only", "-z"]), diff(["--unified=0", "--no-color", "--no-ext-diff"])],
347+
[
348+
diff(["--name-only", "-z"]),
349+
diff(["--unified=0", "--no-color", "--no-ext-diff", "--no-textconv"]),
350+
],
348351
{ concurrency: "unbounded" },
349352
);
350353
return parseReviewGuideChange(nameOnly, patch);

0 commit comments

Comments
 (0)