Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): coalesce overlapping VCS status refreshes #19478

Closedluke2x(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/19478/headopened View on GitHub

Showing 2 changed files with 206 additions and 6 deletions (loading 1).

x
0 of 2 viewed, 2 left
206 additions and 6 deletionsapps/server/src/vcs/VcsStatusBroadcaster.test.tsModified
View file
@@ -70,7 +70,10 @@
...baseRemoteStatus,
};
​
-function layerTestFor(state: {
+// Keep fake cwd normalization synchronous so the concurrency tests control the only suspension.
+const layerTestFileSystem = FileSystem.layerNoop({ realPath: (path) => Effect.succeed(path) });
+​
+interface VcsStatusTestState {
currentLocalStatus: VcsStatusLocalResult;
currentRemoteStatus: VcsStatusRemoteResult | null;
localStatusCalls: number;
@@ -81,17 +84,26 @@
backgroundWorkEnabled?: boolean;
/** Runs before each remote status read, e.g. to hold a fetch open. */
beforeRemoteStatus?: Effect.Effect<void>;
-}) {
+ /** Runs before each local status read, e.g. to hold a refresh after its remote snapshot. */
+ beforeLocalStatus?: Effect.Effect<void>;
+}
+​
+function layerTestFor(state: VcsStatusTestState) {
return VcsStatusBroadcaster.layer.pipe(
+ Layer.provide(layerTestFileSystem),
Layer.provideMerge(NodeServices.layer),
Layer.provide(layerBackgroundPolicy(() => state.backgroundWorkEnabled !== false)),
Layer.provide(
Layer.mock(GitWorkflowService.GitWorkflowService)({
localStatus: () =>