Skip to content

Commit aee63a2

Browse files
saphidclaude
andcommitted
fix(server): review guides no longer fail on the repository's checkout hooks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 61c3794 commit aee63a2

2 files changed

Lines changed: 19 additions & 5 deletions

File tree

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
467467
),
468468
);
469469

470-
it.effect("keeps excerpts of source lines a configured diff driver would convert away", () =>
470+
it.effect("keeps excerpts despite the checkout's diff driver and a failing hook", () =>
471471
Effect.scoped(
472472
Effect.gen(function* () {
473473
const repositories = yield* makeRepositories;
@@ -477,6 +477,9 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
477477
"feature.txt diff=blank\n",
478478
);
479479
yield* git(repositories.workspace, ["config", "diff.blank.textconv", "true"]);
480+
const hook = `${repositories.workspace}/.git/hooks/post-checkout`;
481+
yield* fs.writeFileString(hook, "#!/bin/sh\nexit 1\n");
482+
yield* fs.chmod(hook, 0o755);
480483
const stored = yield* Deferred.make<void>();
481484
const context = yield* Layer.build(
482485
makeLayer({
@@ -502,9 +505,10 @@ it.layer(layerBase, { excludeTestServices: true })("PullRequestReviewGuideServic
502505
context,
503506
PullRequestReviewGuideService.PullRequestReviewGuideService,
504507
);
505-
yield* service.generate(reference);
506-
yield* Deferred.await(stored);
507-
const result = yield* service.get(reference);
508+
const runs = yield* watchRuns;
509+
yield* runs.generate(service, reference);
510+
const result = yield* runs.settled(service, reference);
511+
assert.notStrictEqual(result.run?._tag, "Failed", JSON.stringify(result.run));
508512
assert.deepStrictEqual(result.guide?.stops[0]?.excerpts, [
509513
{ path: "feature.txt", side: "new", start: 1, end: 3, caption: "" },
510514
]);

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,17 @@ const make = Effect.gen(function* () {
305305
yield* git.execute({
306306
operation: "PullRequestReviewGuideService.addWorktree",
307307
cwd: workspaceRoot,
308-
args: ["worktree", "add", "--detach", "--quiet", path, resolvedHead.commitSha],
308+
// Scratch checkout for reading the change: repository hooks (installs, LFS) only slow or fail it.
309+
args: [
310+
"-c",
311+
"core.hooksPath=/dev/null",
312+
"worktree",
313+
"add",
314+
"--detach",
315+
"--quiet",
316+
path,
317+
resolvedHead.commitSha,
318+
],
309319
timeoutMs: 5 * 60_000,
310320
});
311321
yield* Effect.addFinalizer(() =>

0 commit comments

Comments
 (0)