Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(vcs): resolve the default branch from the remote, not a stale origin/HEAD #7394

ClosedAntoineArt(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/7394/headopened View on GitHub

Showing 2 changed files with 187 additions and 13 deletions.

x
0 of 2 viewed, 2 left
100 additions and 0 deletionsapps/server/src/vcs/GitVcsDriverCore.test.tsModified
View file
@@ -635,6 +635,57 @@
).pipe(Effect.provide(ServerConfigLayer.pipe(Layer.provideMerge(NodeServices.layer)))),
​
+it.effect("cools down a failed remote default branch probe across mutations", () =>
+ Effect.scoped(
+ Effect.gen(function* () {
+ const delegate = yield* ChildProcessSpawner.ChildProcessSpawner;
+ const probeAttempts = yield* Ref.make(0);
+ const failingProbeSpawner = ChildProcessSpawner.make((command) =>
+ Effect.gen(function* () {
+ if (!ChildProcess.isStandardCommand(command)) {
+ return yield* Effect.die("expected a standard Git command");
+ }
+ if (!command.args.includes("ls-remote")) {
+ return yield* delegate.spawn(command);
+ }
+ yield* Ref.update(probeAttempts, (count) => count + 1);
+ // A probe that cannot spawn fails its cache entry instead of resolving to
+ // null, the same channel a timed-out probe fails through.
+ return yield* PlatformError.systemError({
+ _tag: "NotFound",
+ module: "ChildProcess",
+ method: "spawn",
+ });
+ }),
+ );
+ const driver = yield* makeGitVcsDriverCore().pipe(
+ Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, failingProbeSpawner),
+ );